You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
4.2 KiB
123 lines
4.2 KiB
"use strict"; |
|
const common_vendor = require("../../common/vendor.js"); |
|
const api_user = require("../../api/user.js"); |
|
require("../../utils/request.js"); |
|
require("../../store/index.js"); |
|
require("../../utils/functions.js"); |
|
require("../../utils/IDCardVerification.js"); |
|
require("../../utils/base64.js"); |
|
require("../../config/host.js"); |
|
require("../../utils/md5.js"); |
|
if (!Array) { |
|
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar"); |
|
const _component_tips = common_vendor.resolveComponent("tips"); |
|
(_easycom_u_navbar2 + _component_tips)(); |
|
} |
|
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js"; |
|
if (!Math) { |
|
_easycom_u_navbar(); |
|
} |
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ |
|
__name: "login", |
|
setup(__props) { |
|
let tip = common_vendor.ref(null); |
|
let details = common_vendor.reactive({ |
|
tenantId: "", |
|
password: "", |
|
username: "", |
|
isremember: true |
|
}); |
|
common_vendor.onLoad(() => { |
|
let users = common_vendor.index.getStorageSync("loginuser"); |
|
if (users) { |
|
details.password = users.password; |
|
details.tenantId = users.tenantId; |
|
details.username = users.username; |
|
} |
|
}); |
|
common_vendor.onShow(() => { |
|
setTimeout(() => { |
|
}, 2e3); |
|
}); |
|
function chancheck() { |
|
console.log("确认"); |
|
} |
|
async function submitlogin() { |
|
let data = { |
|
"grant_type": "password", |
|
"scope": "all", |
|
"username": details.username, |
|
"password": details.password, |
|
"tenantId": details.tenantId |
|
}; |
|
let response = await api_user.oauthtoken(data); |
|
console.log(response); |
|
if (response == null ? void 0 : response.refresh_token) { |
|
setloctuser(response); |
|
} else { |
|
tip.value.setdetails({ |
|
title: "提示", |
|
content: "请确认账号密码正确,多次错误后禁止登录", |
|
confirmTxt: "确认", |
|
isshow: true, |
|
isshowcancel: false, |
|
success: () => { |
|
tip.value.setisshow(false); |
|
}, |
|
cancel: () => { |
|
tip.value.setisshow(false); |
|
}, |
|
close: () => { |
|
tip.value.setisshow(false); |
|
} |
|
}); |
|
console.log("登录错误"); |
|
} |
|
} |
|
function setisremember() { |
|
details.isremember = !details.isremember; |
|
} |
|
function setloctuser(userinfo) { |
|
common_vendor.index.setStorageSync("access_token", userinfo.access_token); |
|
common_vendor.index.setStorageSync("refresh_token", userinfo.refresh_token); |
|
common_vendor.index.setStorageSync("userinfo", userinfo); |
|
if (details.isremember) { |
|
let user = { |
|
tenantId: details.tenantId, |
|
password: details.password, |
|
username: details.username |
|
}; |
|
common_vendor.index.setStorageSync("loginuser", user); |
|
} |
|
common_vendor.index.switchTab({ |
|
url: "/pages/index/index" |
|
}); |
|
} |
|
const { username, password, tenantId, isremember } = common_vendor.toRefs(details); |
|
return (_ctx, _cache) => { |
|
return { |
|
a: common_vendor.p({ |
|
title: "登录", |
|
placeholder: true, |
|
border: "true", |
|
leftIcon: "" |
|
}), |
|
b: common_vendor.unref(tenantId), |
|
c: common_vendor.o(($event) => common_vendor.isRef(tenantId) ? tenantId.value = $event.detail.value : null), |
|
d: common_vendor.unref(username), |
|
e: common_vendor.o(($event) => common_vendor.isRef(username) ? username.value = $event.detail.value : null), |
|
f: common_vendor.unref(password), |
|
g: common_vendor.o(($event) => common_vendor.isRef(password) ? password.value = $event.detail.value : null), |
|
h: common_vendor.unref(isremember) ? "/static/check.png" : "/static/nocheck.png", |
|
i: common_vendor.o(setisremember), |
|
j: common_vendor.o(submitlogin), |
|
k: common_vendor.sr(tip, "c4194660-1", { |
|
"k": "tip" |
|
}), |
|
l: common_vendor.o(chancheck) |
|
}; |
|
}; |
|
} |
|
}); |
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "F:/物流/logPm/pages/login/login.vue"]]); |
|
wx.createPage(MiniProgramPage);
|
|
|