hldy_app/unpackage/dist/dev/mp-weixin/pages/login/login.js

284 lines
9.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const pages_login_api = require("./api.js");
if (!Math) {
(twoseven + oneseven + ZyUpdate + huakuai)();
}
const ZyUpdate = () => "../../component/zy-upgrade/zy-upgrade.js";
const oneseven = () => "./oneseven.js";
const twoseven = () => "./twoseven.js";
const huakuai = () => "../../component/public/huakuai.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "login",
setup(__props) {
const zyupgrade = common_vendor.ref(null);
const isTarget = common_vendor.ref(false);
const huakuaiOpen = common_vendor.ref(false);
const form = common_vendor.reactive({
username: "",
password: "",
captcha: "",
checkKey: 0
});
const changeform = common_vendor.reactive({
oldpassword: "",
newpassword: ""
});
const fullName = common_vendor.computed(() => {
return form.password && isLength11(form.username);
});
const showPopup = common_vendor.ref(false);
function closebottom() {
openbottom.value = false;
isTarget.value = true;
login();
}
function closePopup() {
showPopup.value = false;
common_vendor.index.setStorageSync("appWgtVersion", common_vendor.index.getSystemInfoSync().appWgtVersion);
}
function closeapp() {
plus.runtime.quit();
}
function isLength11(str) {
return typeof str === "string" && str.length === 11;
}
const jumpTo = (url) => {
common_vendor.index.navigateTo({
url
});
};
const canclick = common_vendor.ref(false);
const time = common_vendor.ref(0);
const getImg = () => {
if (/^\d{11}$/.test(form.username)) {
pages_login_api.isRel(form.username).then((res) => {
common_vendor.index.__f__("log", "at pages/login/login.vue:193", "^^^^^^^^^^6", res);
if (res.result !== null && res.result.serverUrl) {
common_vendor.index.setStorageSync("serverUrl", res.result.serverUrl);
common_vendor.index.__f__("log", "at pages/login/login.vue:196", "url", res.result.serverUrl);
time.value = Date.now();
pages_login_api.getLoginCode(time.value).then((res2) => {
form.captcha = res2.message;
canclick.value = true;
});
} else {
common_vendor.index.setStorageSync("serverUrl", "");
common_vendor.index.showToast({
title: "该手机号未绑定机构",
icon: "none",
// 可选值:'success'、'loading'、'none'
duration: 2e3
// 持续时间单位ms
});
canclick.value = false;
}
});
} else {
if (form.username) {
common_vendor.index.showToast({
title: "手机号不足11位",
icon: "none",
// 可选值:'success'、'loading'、'none'
duration: 2e3
// 持续时间单位ms
});
}
}
};
const openbottom = common_vendor.ref(false);
const openchange = common_vendor.ref(false);
const openany = common_vendor.ref(false);
const opentype = common_vendor.ref(false);
const login = () => {
if (isTarget.value) {
huakuaiOpen.value = true;
} else {
openbottom.value = true;
}
};
const jumpFirst = common_vendor.ref(false);
const canJump = () => {
if (!jumpFirst.value) {
if (loading.value === 2) {
setTimeout(() => {
jumpTo(`/pages/watch/index`);
}, 500);
} else {
loading.value++;
}
jumpFirst.value = true;
}
};
const loading = common_vendor.ref(0);
const huakuaisuccess = () => {
form.checkKey = time.value;
huakuaiOpen.value = false;
pages_login_api.loginApp(form).then((res) => {
if (res.success) {
common_vendor.index.showToast({
title: res.message,
icon: "none",
// 可选值:'success'、'loading'、'none'
duration: 500
// 持续时间单位ms
});
common_vendor.index.setStorageSync("token", res.result.token);
common_vendor.index.setStorageSync("username", form.username);
common_vendor.index.setStorageSync("realname", res.result.userInfo.realname);
if (loading.value === 2) {
setTimeout(() => {
jumpTo(`/pages/watch/index`);
}, 500);
} else {
loading.value++;
}
} else {
common_vendor.index.showToast({
title: res.message,
icon: "none",
// 可选值:'success'、'loading'、'none'
duration: 2e3
// 持续时间单位ms
});
}
});
};
common_vendor.onLoad(() => {
if (common_vendor.index.getStorageSync("appWgtVersion") != common_vendor.index.getSystemInfoSync().appWgtVersion) {
showPopup.value = true;
}
if (common_vendor.index.getStorageSync("token") && common_vendor.index.getStorageSync("token") !== 1) {
if (loading.value === 2) {
setTimeout(() => {
jumpTo(`/pages/watch/index`);
}, 500);
} else {
loading.value++;
}
}
init();
});
common_vendor.onShow(() => {
var _a;
(_a = zyupgrade.value) == null ? void 0 : _a.check_update();
});
function init() {
var monitorModule = common_vendor.index.requireNativePlugin("MonitorModule");
monitorModule.initSMBCloudSDK();
logincamera();
}
function logincamera() {
var monitorModule = common_vendor.index.requireNativePlugin("MonitorModule");
var loginfo = {
userName: "admin",
password: "Bl20230518",
serverAddress: "121.36.88.64",
port: 8888
};
monitorModule.cloudLoginIn(loginfo, (r) => {
if (loading.value === 2) {
setTimeout(() => {
jumpTo(`/pages/watch/index`);
}, 500);
} else {
loading.value++;
}
});
}
return (_ctx, _cache) => {
return common_vendor.e({
a: common_assets._imports_0$1,
b: common_vendor.o(getImg),
c: form.username,
d: common_vendor.o(($event) => form.username = $event.detail.value),
e: form.password,
f: common_vendor.o(($event) => form.password = $event.detail.value),
g: !fullName.value || !canclick.value,
h: fullName.value && canclick.value,
i: common_vendor.o(($event) => login()),
j: common_vendor.n(isTarget.value ? "radio-circle-target" : "radio-circle"),
k: common_vendor.o(($event) => isTarget.value = !isTarget.value),
l: common_vendor.o(($event) => isTarget.value = !isTarget.value),
m: common_vendor.o(($event) => {
openany.value = true;
opentype.value = true;
}),
n: common_vendor.o(($event) => {
openany.value = true;
opentype.value = false;
}),
o: showPopup.value
}, showPopup.value ? {
p: common_vendor.o(($event) => {
openany.value = true;
opentype.value = true;
}),
q: common_vendor.o(($event) => {
openany.value = true;
opentype.value = false;
}),
r: common_vendor.o(closePopup),
s: common_vendor.o(closeapp)
} : {}, {
t: openany.value
}, openany.value ? common_vendor.e({
v: common_vendor.o(($event) => openany.value = false),
w: common_assets._imports_0,
x: common_vendor.o(($event) => openany.value = false),
y: !opentype.value
}, !opentype.value ? {} : {}, {
z: opentype.value
}, opentype.value ? {} : {}, {
A: !opentype.value
}, !opentype.value ? {} : {}, {
B: opentype.value
}, opentype.value ? {} : {}) : {}, {
C: openbottom.value
}, openbottom.value ? {
D: common_vendor.o(($event) => openbottom.value = false),
E: common_vendor.o(($event) => {
openany.value = true;
opentype.value = true;
}),
F: common_vendor.o(($event) => {
openany.value = true;
opentype.value = false;
}),
G: common_vendor.o(closebottom)
} : {}, {
H: openchange.value
}, openchange.value ? {
I: changeform.oldpassword,
J: common_vendor.o(($event) => changeform.oldpassword = $event.detail.value),
K: changeform.newpassword,
L: common_vendor.o(($event) => changeform.newpassword = $event.detail.value),
M: common_vendor.o(($event) => openchange.value = false)
} : {}, {
N: common_vendor.sr(zyupgrade, "e4e4508d-2", {
"k": "zyupgrade"
}),
O: common_vendor.o(canJump),
P: common_vendor.p({
noticeflag: true,
theme: "blue",
h5preview: false,
oldversion: "1.0.0",
appstoreflag: true,
autocheckupdate: true
}),
Q: huakuaiOpen.value
}, huakuaiOpen.value ? {
R: common_vendor.o(() => {
}),
S: common_vendor.o(huakuaisuccess),
T: common_vendor.o(($event) => huakuaiOpen.value = false)
} : {});
};
}
});
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