打包地址
This commit is contained in:
+304
@@ -0,0 +1,304 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_api = require("../../api/api.js");
|
||||
const utils_auth = require("../../utils/auth.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
const _easycom_up_form_item2 = common_vendor.resolveComponent("up-form-item");
|
||||
const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
|
||||
const _easycom_up_code2 = common_vendor.resolveComponent("up-code");
|
||||
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
|
||||
const _easycom_up_form2 = common_vendor.resolveComponent("up-form");
|
||||
(_easycom_up_input2 + _easycom_up_form_item2 + _easycom_up_toast2 + _easycom_up_code2 + _easycom_up_button2 + _easycom_up_form2)();
|
||||
}
|
||||
const _easycom_up_input = () => "../../node-modules/uview-plus/components/u-input/u-input.js";
|
||||
const _easycom_up_form_item = () => "../../node-modules/uview-plus/components/u-form-item/u-form-item.js";
|
||||
const _easycom_up_toast = () => "../../node-modules/uview-plus/components/u-toast/u-toast.js";
|
||||
const _easycom_up_code = () => "../../node-modules/uview-plus/components/u-code/u-code.js";
|
||||
const _easycom_up_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js";
|
||||
const _easycom_up_form = () => "../../node-modules/uview-plus/components/u-form/u-form.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_input + _easycom_up_form_item + _easycom_up_toast + _easycom_up_code + _easycom_up_button + _easycom_up_form)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "login",
|
||||
setup(__props) {
|
||||
const code = common_vendor.ref("");
|
||||
const phone = common_vendor.ref(null);
|
||||
common_vendor.ref(false);
|
||||
const isPhoneLogin = common_vendor.ref(true);
|
||||
const customStyle = common_vendor.reactive({
|
||||
height: "90rpx",
|
||||
fontSize: "36rpx"
|
||||
});
|
||||
const customCode = common_vendor.reactive({
|
||||
color: "#3ec7c0",
|
||||
height: "64rpx",
|
||||
fontSize: "28rpx",
|
||||
borderColor: "#e2e2e2",
|
||||
opcity: "1"
|
||||
});
|
||||
const tips = common_vendor.ref("");
|
||||
const seconds = common_vendor.ref(10);
|
||||
const uCodeRef = common_vendor.ref(null);
|
||||
const checked = common_vendor.ref(false);
|
||||
const hasRedirectUrl = common_vendor.ref(false);
|
||||
const radioChange = (e) => {
|
||||
checked.value = !checked.value;
|
||||
};
|
||||
const alertAgree = () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "请先同意用户协议",
|
||||
icon: "none"
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad((options) => {
|
||||
if (options.redirectUrl) {
|
||||
hasRedirectUrl.value = true;
|
||||
}
|
||||
});
|
||||
const goPage = () => {
|
||||
if (hasRedirectUrl.value) {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:201", "true");
|
||||
let url = "";
|
||||
let redirectUrl = common_vendor.index.getStorageSync("redirectUrl");
|
||||
if (redirectUrl && redirectUrl.indexOf("/login/login") == -1) {
|
||||
url = redirectUrl;
|
||||
} else {
|
||||
url = "pages/index/index";
|
||||
}
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:210", "url:" + url);
|
||||
common_vendor.index.redirectTo({
|
||||
url: "/" + url,
|
||||
success() {
|
||||
common_vendor.index.setStorageSync("redirectUrl", "");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:219", "false");
|
||||
common_vendor.index.redirectTo({
|
||||
url: "/pages/index/index"
|
||||
});
|
||||
}
|
||||
};
|
||||
const getPhoneNumber = (e) => {
|
||||
if (e.detail.errMsg === "getPhoneNumber:ok") {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:228", e.target.code);
|
||||
utils_auth.auth().then((res) => {
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:230", res);
|
||||
api_api.api.wxLogin({
|
||||
phone_code: e.target.code,
|
||||
wx_code: res,
|
||||
source: 1
|
||||
}).then((data) => {
|
||||
let result = data.data.data;
|
||||
{
|
||||
const { envVersion } = common_vendor.index.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
common_vendor.index.setStorageSync("AUTH_TOKEN_CASEDATA", result.token);
|
||||
} else {
|
||||
common_vendor.index.setStorageSync("DEV_AUTH_TOKEN_CASEDATA", result.token);
|
||||
}
|
||||
}
|
||||
common_vendor.index.setStorageSync("userInfo", {
|
||||
avatar: result.avatar,
|
||||
user_id: result.user_id,
|
||||
status: result.status,
|
||||
user_name: result.user_name,
|
||||
doctor_id: result.doctor_id
|
||||
});
|
||||
goPage();
|
||||
}).catch((err) => {
|
||||
common_vendor.index.showToast({
|
||||
title: err,
|
||||
icon: "none"
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
const phoneLogin = () => {
|
||||
if (!isPhoneNum(phone.value))
|
||||
return;
|
||||
if (!code.value) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请输入验证码",
|
||||
icon: "none"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!checked.value) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请先同意用户协议",
|
||||
icon: "none"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
utils_auth.auth().then((res) => {
|
||||
api_api.api.mobileLogin({
|
||||
code: code.value,
|
||||
phone: phone.value,
|
||||
wx_code: res
|
||||
}).then((data) => {
|
||||
let result = data.data.data;
|
||||
const { envVersion } = common_vendor.index.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
common_vendor.index.setStorageSync("AUTH_TOKEN_CASEDATA", result.token);
|
||||
} else {
|
||||
common_vendor.index.setStorageSync("DEV_AUTH_TOKEN_CASEDATA", result.token);
|
||||
}
|
||||
common_vendor.index.setStorageSync("userInfo", {
|
||||
avatar: result.avatar,
|
||||
user_id: result.user_id,
|
||||
status: result.status,
|
||||
user_name: result.user_name,
|
||||
doctor_id: result.doctor_id
|
||||
});
|
||||
goPage();
|
||||
});
|
||||
});
|
||||
};
|
||||
const isPhoneNum = (phonenum) => {
|
||||
let reg = /^1[3456789]\d{9}$/;
|
||||
if (!reg.test(phonenum)) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请输入有效的手机号码!",
|
||||
icon: "none"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const codeChange = (text) => {
|
||||
tips.value = text;
|
||||
};
|
||||
const switchType = () => {
|
||||
isPhoneLogin.value = !isPhoneLogin.value;
|
||||
};
|
||||
const goRegister = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/register/register"
|
||||
});
|
||||
};
|
||||
const getCode = () => {
|
||||
if (!isPhoneNum(phone.value))
|
||||
return;
|
||||
if (uCodeRef.value.canGetCode) {
|
||||
common_vendor.index.showLoading({
|
||||
title: "正在获取验证码"
|
||||
});
|
||||
getSms();
|
||||
} else {
|
||||
common_vendor.index.$u.toast("倒计时结束后再发送");
|
||||
}
|
||||
};
|
||||
const getSms = () => {
|
||||
api_api.api.getCode({
|
||||
phone: phone.value,
|
||||
scene: 1
|
||||
}).then((res) => {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.$u.toast("验证码已发送");
|
||||
uCodeRef.value.start();
|
||||
});
|
||||
};
|
||||
const end = () => {
|
||||
customCode.opacity = 1;
|
||||
};
|
||||
const start = () => {
|
||||
customCode.opacity = 0.5;
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: !isPhoneLogin.value
|
||||
}, !isPhoneLogin.value ? {
|
||||
b: common_vendor.o(($event) => phone.value = $event),
|
||||
c: common_vendor.p({
|
||||
placeholder: "请输入肝胆相照专家版手机号",
|
||||
modelValue: phone.value
|
||||
}),
|
||||
d: common_vendor.p({
|
||||
label: "手机号",
|
||||
prop: "userInfo.name",
|
||||
borderBottom: true
|
||||
})
|
||||
} : {}, {
|
||||
e: !isPhoneLogin.value
|
||||
}, !isPhoneLogin.value ? {
|
||||
f: common_vendor.o(($event) => code.value = $event),
|
||||
g: common_vendor.p({
|
||||
placeholder: "请输入验证码",
|
||||
modelValue: code.value
|
||||
}),
|
||||
h: common_vendor.sr("uToastRef", "e4e4508d-5,e4e4508d-3"),
|
||||
i: common_vendor.sr(uCodeRef, "e4e4508d-6,e4e4508d-3", {
|
||||
"k": "uCodeRef"
|
||||
}),
|
||||
j: common_vendor.o(end),
|
||||
k: common_vendor.o(start),
|
||||
l: common_vendor.o(codeChange),
|
||||
m: common_vendor.p({
|
||||
seconds: seconds.value
|
||||
}),
|
||||
n: common_vendor.t(tips.value),
|
||||
o: common_vendor.o(getCode),
|
||||
p: common_vendor.p({
|
||||
customStyle: customCode,
|
||||
color: "#e2e2e2"
|
||||
}),
|
||||
q: common_vendor.p({
|
||||
label: "验证码",
|
||||
prop: "userInfo.name",
|
||||
borderBottom: true
|
||||
})
|
||||
} : {}, {
|
||||
r: common_vendor.sr("form", "e4e4508d-0"),
|
||||
s: common_vendor.p({
|
||||
labelPosition: "left",
|
||||
labelWidth: "115rpx"
|
||||
}),
|
||||
t: !isPhoneLogin.value
|
||||
}, !isPhoneLogin.value ? {
|
||||
v: common_vendor.o(phoneLogin),
|
||||
w: common_vendor.p({
|
||||
customStyle,
|
||||
type: "success",
|
||||
text: "登录",
|
||||
color: "#3cc7c0",
|
||||
size: "large"
|
||||
})
|
||||
} : common_vendor.e({
|
||||
x: checked.value
|
||||
}, checked.value ? {
|
||||
y: common_vendor.o(getPhoneNumber),
|
||||
z: common_vendor.p({
|
||||
customStyle,
|
||||
type: "success",
|
||||
["open-type"]: "getPhoneNumber",
|
||||
text: "手机号快捷登录",
|
||||
color: "#3cc7c0",
|
||||
size: "large"
|
||||
})
|
||||
} : {
|
||||
A: common_vendor.o(alertAgree),
|
||||
B: common_vendor.p({
|
||||
customStyle,
|
||||
type: "success",
|
||||
text: "手机号快捷登录",
|
||||
color: "#3cc7c0",
|
||||
size: "large"
|
||||
})
|
||||
}), {
|
||||
C: common_vendor.t(isPhoneLogin.value ? "用短信验证码登录" : "快捷登录"),
|
||||
D: common_vendor.o(switchType),
|
||||
E: common_vendor.o(goRegister),
|
||||
F: checked.value,
|
||||
G: common_vendor.o(radioChange)
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e4e4508d"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/login.js.map
|
||||
Reference in New Issue
Block a user