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.
215 lines
7.8 KiB
215 lines
7.8 KiB
"use strict"; |
|
const common_vendor = require("../../common/vendor.js"); |
|
const api_user = require("../../api/user.js"); |
|
const utils_utils = require("../../utils/utils.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 _component_tiplist = common_vendor.resolveComponent("tiplist"); |
|
const _component_tips = common_vendor.resolveComponent("tips"); |
|
(_component_tiplist + _component_tips)(); |
|
} |
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ |
|
__name: "user", |
|
setup(__props) { |
|
let users = common_vendor.ref(null); |
|
const tiplists = common_vendor.ref(null); |
|
const tip = common_vendor.ref(null); |
|
let warehouseName = common_vendor.ref(null); |
|
let butlist = common_vendor.ref([ |
|
{ icon: "/static/usericon1.png", name: "通讯录", type: 1 }, |
|
{ icon: "/static/usericon2.png", name: "计件工资", type: 2 }, |
|
{ icon: "/static/usericon3.png", name: "系统设置", type: 3 }, |
|
{ icon: "/static/usericon4.png", name: "安全设置", type: 4 }, |
|
{ icon: "/static/usericon5.png", name: "关于我们", type: 5 }, |
|
// { icon: '/static/usericon6.png', name: '检测更新', type: 6 }, |
|
{ icon: "/static/usericon7.png", name: "分享", type: 7 }, |
|
{ icon: "/static/usericon8.png", name: "切换账号", type: 8 } |
|
]); |
|
let details = common_vendor.reactive({ |
|
showck: false, |
|
warehouseList: [], |
|
checkitems: {} |
|
}); |
|
common_vendor.onShow(() => { |
|
users.value = common_vendor.index.getStorageSync("userinfo"); |
|
warehouseName.value = common_vendor.index.getStorageSync("checkname"); |
|
}); |
|
common_vendor.onPullDownRefresh(() => { |
|
const timer = setTimeout(() => { |
|
common_vendor.index.stopPullDownRefresh(); |
|
clearTimeout(timer); |
|
}, 500); |
|
}); |
|
function ckeckitemck(item) { |
|
details.checkitems = item; |
|
} |
|
async function sbckck() { |
|
if (!details.checkitems.id) { |
|
common_vendor.index.showToast({ |
|
title: "没有选择仓库,请先选择仓库", |
|
icon: "none" |
|
}); |
|
utils_utils.utils.ttsspke("没有选择仓库,请先选择仓库"); |
|
return; |
|
} |
|
await api_user.preserveCurrentWarehouse(details.checkitems); |
|
common_vendor.index.setStorageSync("checkname", details.checkitems); |
|
details.showck = false; |
|
common_vendor.index.showToast({ |
|
title: "切换成功", |
|
icon: "none" |
|
}); |
|
utils_utils.utils.ttsspke("切换成功"); |
|
} |
|
function gologin() { |
|
common_vendor.index.navigateTo({ |
|
url: "/pages/login/login" |
|
}); |
|
} |
|
async function showwhselist() { |
|
let res = await api_user.getMyWarehouseList({}); |
|
console.log(res.data); |
|
details.warehouseList = res.data; |
|
details.showck = true; |
|
} |
|
function checkitem(item) { |
|
if (item.type == 1) |
|
; |
|
else if (item.type == 3) { |
|
common_vendor.index.navigateTo({ |
|
url: "/pagesUser/pages/systemSettings/systemSettings" |
|
}); |
|
} else if (item.type == 4) { |
|
common_vendor.index.navigateTo({ |
|
url: "/pagesUser/pages/securitySettings/securitySettings" |
|
}); |
|
} else if (item.type == 5) |
|
; |
|
else if (item.type == 6) { |
|
updateApp(); |
|
} else if (item.type == 8) { |
|
gologin(); |
|
} |
|
} |
|
function removeall() { |
|
const res = common_vendor.index.getStorageInfoSync(); |
|
res.keys.map((item) => { |
|
if (item == "loginuser" || item == "HistoryDate" || item == "setip" || item == "checkname" || item.indexOf("IMAGE_CACHE_INFO") != -1) { |
|
return; |
|
} |
|
common_vendor.index.removeStorageSync(item); |
|
}); |
|
common_vendor.index.reLaunch({ |
|
url: "/pages/login/login" |
|
}); |
|
console.log(res.currentSize); |
|
console.log(String(res.limitSize)); |
|
} |
|
async function updateApp() { |
|
let version = await utils_utils.utils.getversion(); |
|
console.log("version 版本>>>>", version); |
|
let data = { |
|
betenantCode: common_vendor.index.getStorageSync("userinfo").tenant_id, |
|
versionCode: version.version.split(".").join(""), |
|
versionType: version.pkName.indexOf("test") != -1 ? "1" : version.pkName.indexOf("bate") != -1 ? "2" : "3" |
|
}; |
|
console.log("data>>>>", data); |
|
let response = await api_user.AppPdaversiondetail(data); |
|
console.log("123 :>> ", 123); |
|
console.log("response :>> ", response); |
|
if (response.code == 200 && response.data && Object.keys(response.data).length !== 0) { |
|
console.log("res.data", response.data); |
|
console.log("有可更新包"); |
|
if (response.data.noSensation == "2" && response.data.link.indexOf("wgt") != -1) { |
|
utils_utils.utils.updatefile1(response.data.link); |
|
} else { |
|
tip.value.setdetails({ |
|
title: "提示", |
|
content: "检测到有新版本,请问是否更新?", |
|
confirmTxt: "更新", |
|
isshow: true, |
|
isshowcancel: true, |
|
success: async () => { |
|
utils_utils.utils.updatefile(response.data.link); |
|
tip.value.setisshow(false); |
|
}, |
|
cancel: () => { |
|
tip.value.setisshow(false); |
|
if (response.data.isUpdates == "2") { |
|
plus.runtime.quit(); |
|
} |
|
}, |
|
close: () => { |
|
tip.value.setisshow(false); |
|
if (response.data.isUpdates == "2") { |
|
plus.runtime.quit(); |
|
} |
|
} |
|
}); |
|
} |
|
} else { |
|
common_vendor.index.showToast({ |
|
title: response.msg, |
|
icon: "none" |
|
}); |
|
} |
|
} |
|
const { |
|
showck, |
|
warehouseList, |
|
checkitems |
|
} = common_vendor.toRefs(details); |
|
return (_ctx, _cache) => { |
|
var _a, _b, _c, _d; |
|
return common_vendor.e({ |
|
a: !((_a = common_vendor.unref(users)) == null ? void 0 : _a.user_id) |
|
}, !((_b = common_vendor.unref(users)) == null ? void 0 : _b.user_id) ? { |
|
b: common_vendor.o(gologin) |
|
} : {}, { |
|
c: (_c = common_vendor.unref(users)) == null ? void 0 : _c.user_id |
|
}, ((_d = common_vendor.unref(users)) == null ? void 0 : _d.user_id) ? { |
|
d: common_vendor.t(common_vendor.unref(users).real_name), |
|
e: common_vendor.t(common_vendor.unref(users).role_name), |
|
f: common_vendor.t(common_vendor.unref(warehouseName).name), |
|
g: common_vendor.o(showwhselist) |
|
} : {}, { |
|
h: common_vendor.f(common_vendor.unref(butlist), (item, k0, i0) => { |
|
return { |
|
a: item.icon, |
|
b: common_vendor.t(item.name), |
|
c: common_vendor.o(($event) => checkitem(item)) |
|
}; |
|
}), |
|
i: common_vendor.o(removeall), |
|
j: common_vendor.unref(showck) |
|
}, common_vendor.unref(showck) ? { |
|
k: common_vendor.f(common_vendor.unref(warehouseList), (item, k0, i0) => { |
|
return { |
|
a: common_vendor.t(item.name), |
|
b: common_vendor.o(($event) => ckeckitemck(item)), |
|
c: common_vendor.n(item.name == common_vendor.unref(checkitems).name ? "items xzck" : "items") |
|
}; |
|
}), |
|
l: common_vendor.o(sbckck), |
|
m: common_vendor.o(() => { |
|
}), |
|
n: common_vendor.o(($event) => showck.value = false) |
|
} : {}, { |
|
o: common_vendor.sr(tiplists, "4ed4f5f0-0", { |
|
"k": "tiplists" |
|
}), |
|
p: common_vendor.sr(tip, "4ed4f5f0-1", { |
|
"k": "tip" |
|
}) |
|
}); |
|
}; |
|
} |
|
}); |
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/worksp/logpm/pages/user/user.vue"]]); |
|
wx.createPage(MiniProgramPage);
|
|
|