oil-station/gasStation-uni/App.vue

106 lines
3.0 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<script>
export default {
2024-01-22 16:14:28 +08:00
onLaunch: function(e) {
2023-11-27 09:24:16 +08:00
console.log('App Launch')
// #ifdef MP-WEIXIN
2024-03-27 10:12:45 +08:00
uni.setStorageSync("appltType", "WECHAT")
2023-12-28 17:31:50 +08:00
console.log("微信")
2023-11-27 09:24:16 +08:00
//检查是否存在新版本
uni.getUpdateManager().onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
console.log("是否有新版本:" + res.hasUpdate);
if (res.hasUpdate) { //如果有新版本
// 小程序有新版本,会主动触发下载操作(无需开发者触发)
uni.getUpdateManager().onUpdateReady(function() { //当新版本下载完成,会进行回调
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,单击确定重启应用',
showCancel: false,
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
uni.getUpdateManager().applyUpdate();
}
}
})
})
// 小程序有新版本,会主动触发下载操作(无需开发者触发)
uni.getUpdateManager().onUpdateFailed(function() { //当新版本下载失败,会进行回调
uni.showModal({
title: '提示',
content: '检查到有新版本,但下载失败,请检查网络设置',
showCancel: false,
})
})
}
});
// #endif
2023-12-28 17:31:50 +08:00
// #ifdef MP-ALIPAY
2024-03-27 10:12:45 +08:00
uni.setStorageSync("appltType", "ALIPAY")
2023-12-28 17:31:50 +08:00
console.log("支付宝")
2023-12-29 15:27:06 +08:00
my.canIUse('button.open-type.getAuthorize')
2024-01-22 14:25:45 +08:00
//获取关联普通二维码的码值放到全局变量qrCode中
if (e.query && e.query.qrCode) {
2024-03-27 10:12:45 +08:00
console.log(JSON.stringify(e) + "1.0")
let q = e.query.qrCode;
2024-01-22 14:25:45 +08:00
if (e.query.qrCode) {
let str = q.split("?")[1];
let storeId = "";
2024-03-27 10:12:45 +08:00
2024-01-22 14:25:45 +08:00
let staffId = "";
2024-03-12 15:52:45 +08:00
let userId = "";
let type = "";
2024-03-27 10:12:45 +08:00
let sn = "";
if (str.includes("&")) {
2024-01-22 14:25:45 +08:00
let arr = str.split("&");
arr.forEach(item => {
if (item.includes("storeId")) {
storeId = item.split("=")[1]
2024-03-12 15:52:45 +08:00
} else if (item.includes("staffId")) {
2024-01-22 14:25:45 +08:00
staffId = item.split("=")[1]
2024-03-12 15:52:45 +08:00
} else if (item.includes("userId")) {
userId = item.split("=")[1]
} else if (item.includes("type")) {
type = item.split("=")[1]
2024-03-27 10:12:45 +08:00
} else {
sn = item.split("=")[1]
2024-01-22 14:25:45 +08:00
}
})
2024-03-27 10:12:45 +08:00
} else {
2024-01-22 14:25:45 +08:00
if (str.includes("storeId")) {
storeId = str.split("=")[1]
}
}
uni.setStorageSync("storeId", storeId)
2024-03-27 11:23:26 +08:00
uni.setStorageSync("sn", sn)
2024-03-12 15:52:45 +08:00
uni.setStorageSync("y_type", type)
uni.setStorageSync("y_userId", userId)
2024-01-22 14:25:45 +08:00
uni.setStorageSync("inviteStaffId", staffId)
2024-03-12 15:52:45 +08:00
// uni.showLoading({
// title:uni.getStorageSync("storeId") + "staffId" + uni.getStorageSync("inviteStaffId")
// })
2024-01-22 14:25:45 +08:00
}
2024-03-27 10:12:45 +08:00
}
2023-12-28 17:31:50 +08:00
// #endif
2023-11-27 09:24:16 +08:00
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
2023-11-27 15:53:06 +08:00
// /*每个页面公共css */
@import "@/node_modules/uview-ui/index.scss";
2023-11-27 09:24:16 +08:00
.dis {
display: flex;
}
2024-03-27 11:23:26 +08:00
</style>