main
lion 4 months ago
parent 5a587a0b17
commit 35442cbb86

@ -231,18 +231,6 @@ import { API } from "@/config/index.js";
export default {
data() {
return {
batches: [
{
id: 1,
direction: "in",
name: "2025010101",
},
{
id: 2,
direction: "out",
name: "2025010102",
},
],
isWeixinBrowser: false,
userInfo: null,
showEditPopup: false,
@ -260,18 +248,7 @@ export default {
paid_count: 0,
billed_count: 0,
// - batches
batches: [
{
id: 1,
direction: "in",
name: "2025010101",
},
{
id: 2,
direction: "out",
name: "2025010102",
},
],
batches: [],
},
};
},
@ -296,6 +273,30 @@ export default {
uni.$off("loginSuccess", this.onLoginSuccess);
},
methods: {
// token
handleTokenInvalid() {
// token
uni.removeStorageSync("token");
//
this.userInfo = null;
// #ifdef H5
// H5
try {
const app = getApp();
if (app && typeof app.wxH5AuthLogin === "function") {
app.wxH5AuthLogin();
return;
}
} catch (e) {
console.warn("handleTokenInvalid 调用 wxH5AuthLogin 失败:", e);
}
// #endif
//
uni.showToast({
title: "登录已失效,请重新进入",
icon: "none",
});
},
// token
waitForTokenAndFetch() {
const token = uni.getStorageSync("token");
@ -347,15 +348,22 @@ export default {
fail: reject,
});
});
if (res.data && res.data.errcode === 0) {
const data = res.data.data;
// statistics
if (data) {
console.log("data", data);
this.statistics.taihu_to_xujiang = data.taihu_to_xujiang || null;
this.statistics.xujiang_to_taihu = data.xujiang_to_taihu || null;
if (res.data) {
if (res.data.errcode === 4000) {
// token
this.handleTokenInvalid();
return;
}
if (res.data.errcode === 0) {
const data = res.data.data;
// statistics
if (data) {
console.log("data", data);
this.statistics.taihu_to_xujiang = data.taihu_to_xujiang || null;
this.statistics.xujiang_to_taihu = data.xujiang_to_taihu || null;
}
console.log(this.statistics);
}
console.log(this.statistics);
}
},
async fetchStatistics() {
@ -371,16 +379,23 @@ export default {
fail: reject,
});
});
if (res.data && res.data.errcode === 0) {
//
const existingWaterData = {
taihu_to_xujiang: this.statistics.taihu_to_xujiang,
xujiang_to_taihu: this.statistics.xujiang_to_taihu,
};
this.statistics = {
...res.data.data,
...existingWaterData,
};
if (res.data) {
if (res.data.errcode === 4000) {
// token
this.handleTokenInvalid();
return;
}
if (res.data.errcode === 0) {
//
const existingWaterData = {
taihu_to_xujiang: this.statistics.taihu_to_xujiang,
xujiang_to_taihu: this.statistics.xujiang_to_taihu,
};
this.statistics = {
...res.data.data,
...existingWaterData,
};
}
}
},
async fetchUserInfo() {
@ -399,14 +414,31 @@ export default {
});
});
if (res.data) {
const data = res.data || {};
const payerType = Number(data.payer_type ?? data.payerType ?? 1);
this.userInfo = { ...data, payer_type: payerType };
// errcode
if (typeof res.data.errcode !== "undefined") {
if (res.data.errcode === 4000) {
// token
this.handleTokenInvalid();
return;
}
if (res.data.errcode !== 0) {
//
uni.showToast({
title: res.data.errmsg || "获取用户信息失败",
icon: "none",
});
this.userInfo = null;
return;
}
}
const raw = res.data.data || res.data;
const payerType = Number(raw.payer_type ?? raw.payerType ?? 1);
this.userInfo = { ...raw, payer_type: payerType };
this.editForm = {
name: data.name || "",
name: raw.name || "",
payer_type: payerType,
phone: data.phone || "",
id_card: data.id_card || "",
phone: raw.phone || "",
id_card: raw.id_card || "",
};
}
} catch (e) {

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>胥口闸站购票</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.f93c9f80.js></script><script src=/h5/static/js/index.8e5a8a07.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.f93c9f80.js></script><script src=/h5/static/js/index.5f04b5d5.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save