100 lines
3.8 KiB
JavaScript
100 lines
3.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const api_api = require("../../api/api.js");
|
|
const store_index = require("../../store/index.js");
|
|
if (!Array) {
|
|
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
|
const _easycom_statusBar2 = common_vendor.resolveComponent("statusBar");
|
|
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
|
(_easycom_up_icon2 + _easycom_statusBar2 + _easycom_up_input2)();
|
|
}
|
|
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
|
const _easycom_statusBar = () => "../../components/statusBar/statusBar.js";
|
|
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
|
if (!Math) {
|
|
(_easycom_up_icon + _easycom_statusBar + _easycom_up_input)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "login",
|
|
setup(__props) {
|
|
const statusBarHeight = common_vendor.index.getSystemInfoSync().statusBarHeight + "px";
|
|
common_vendor.ref("");
|
|
let dataFrom = common_vendor.reactive({
|
|
userName: "",
|
|
passwd: "",
|
|
uuid: "",
|
|
captcha: ""
|
|
});
|
|
let back = () => {
|
|
common_vendor.index.navigateBack();
|
|
};
|
|
let toRegister = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/login/register"
|
|
});
|
|
};
|
|
let getBackAccout = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: "./getBackAccout"
|
|
});
|
|
};
|
|
let toGetBack = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/login/getBack"
|
|
});
|
|
};
|
|
let login = async () => {
|
|
try {
|
|
const { code } = await common_vendor.index.login();
|
|
let _res = await api_api.loginApi(dataFrom);
|
|
common_vendor.index.setStorageSync("token", _res.token);
|
|
common_vendor.index.setStorageSync("user", _res);
|
|
store_index.store.commit("setToken", _res.token);
|
|
let saveOpenId = await api_api.saveOpenIdByZfbCode({ loginCode: code });
|
|
common_vendor.index.showToast({ title: "登录成功", icon: "none" });
|
|
setTimeout(() => {
|
|
common_vendor.index.navigateBack();
|
|
}, 200);
|
|
} catch (err) {
|
|
}
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: statusBarHeight,
|
|
b: common_vendor.o(common_vendor.unref(back)),
|
|
c: common_vendor.p({
|
|
name: "arrow-left",
|
|
bold: true,
|
|
color: "#000"
|
|
}),
|
|
d: common_assets._imports_0$2,
|
|
e: common_assets._imports_1$1,
|
|
f: common_vendor.o(($event) => common_vendor.unref(dataFrom).userName = $event),
|
|
g: common_vendor.p({
|
|
fontSize: "30rpx",
|
|
placeholder: "请输入您的用户名",
|
|
border: "bottom",
|
|
clearable: true,
|
|
modelValue: common_vendor.unref(dataFrom).userName
|
|
}),
|
|
h: common_vendor.o(($event) => common_vendor.unref(dataFrom).passwd = $event),
|
|
i: common_vendor.p({
|
|
fontSize: "30rpx",
|
|
type: "password",
|
|
placeholder: "请输入您的密码",
|
|
border: "bottom",
|
|
clearable: true,
|
|
modelValue: common_vendor.unref(dataFrom).passwd
|
|
}),
|
|
j: common_vendor.o((...args) => common_vendor.unref(getBackAccout) && common_vendor.unref(getBackAccout)(...args)),
|
|
k: common_vendor.o((...args) => common_vendor.unref(toGetBack) && common_vendor.unref(toGetBack)(...args)),
|
|
l: common_vendor.o((...args) => common_vendor.unref(login) && common_vendor.unref(login)(...args)),
|
|
m: common_vendor.o((...args) => common_vendor.unref(toRegister) && common_vendor.unref(toRegister)(...args))
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e4e4508d"]]);
|
|
my.createPage(MiniProgramPage);
|