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.
119 lines
2.7 KiB
119 lines
2.7 KiB
<script>
|
|
import APPUpdate from "plugins/APPUpdate/index.js";
|
|
import config from "common/config.js";
|
|
export default {
|
|
globalData: {
|
|
// wxSilentLoginURL: "https://supervise.yxtsoft.com/portal/v1/wxuser/wxSilentLogin",
|
|
// wxSilentLoginURL: "https://supervise.yxtsoft.com/api/portal/v1/wxuser/wxSilentLogin",// 静默登录
|
|
wxSilentLoginURL: config.baseUrl+"/v1/app/wxuser/wxSilentLogin",
|
|
wxAuthLoginURL: "https://supervise.yxtsoft.com/api/portal/v1/wxuser/wxAuthLogin",
|
|
SilentLoginURL: "https://supervise.yxtsoft.com/api/portal/v1/wxuser/SilentLogin", // 注册
|
|
token: "",
|
|
isLogin: false,
|
|
sid: "",
|
|
headImage: "",
|
|
username: "",
|
|
orgSidPath: "",
|
|
orgNamePath: "",
|
|
organizationSid: "",
|
|
}, //全局变量,
|
|
|
|
onLaunch: function() {
|
|
console.log("》》》》", 11111111);
|
|
/* #ifdef APP-PLUS */
|
|
APPUpdate();
|
|
/* #endif */
|
|
|
|
console.log("》》》》", 22222222222);
|
|
|
|
const updateManager = uni.getUpdateManager();
|
|
|
|
updateManager.onCheckForUpdate(function(res) {
|
|
// 请求完新版本信息的回调
|
|
console.log(res.hasUpdate);
|
|
});
|
|
|
|
updateManager.onUpdateReady(function(res) {
|
|
uni.showModal({
|
|
title: '更新提示',
|
|
content: '新版本已经准备好,是否重启应用?',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
updateManager.applyUpdate();
|
|
}
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
updateManager.onUpdateFailed(function(res) {
|
|
// 新的版本下载失败
|
|
});
|
|
|
|
|
|
// // 不要删除
|
|
// console.log('高德地图定位Web服务key', '59970402d1c3f7dc1efff17d4dfcff21')
|
|
},
|
|
onShow: function() {
|
|
|
|
},
|
|
onHide: function() {
|
|
console.log("onHide》》》》", "onHide");
|
|
wx.clearStorage()
|
|
},
|
|
|
|
methods: {
|
|
//登录的回调函数
|
|
handlerLogin() {
|
|
wx.login({
|
|
success: res => {
|
|
//获取code
|
|
const code = res.code
|
|
console.log(res);
|
|
//将code发给后端请求token
|
|
// wx.request({
|
|
// url: 'http://xxxxxxx/login',
|
|
// data: {
|
|
// code
|
|
// },
|
|
// method: 'post',
|
|
// success: (res) => {
|
|
// const token = res.data.token
|
|
// //将token保存本地
|
|
// wx.setStorageSync('token', token)
|
|
// console.log(res);
|
|
// }
|
|
// })
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
/*每个页面公共css */
|
|
@import '@/uni_modules/uni-scss/index.scss';
|
|
|
|
/* #ifndef APP-NVUE */
|
|
@import '@/static/customicons.css';
|
|
|
|
// 设置整个项目的背景色
|
|
page {
|
|
height: 100%;
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
/* #endif */
|
|
|
|
@import '@/uni_modules/uview-ui/index.scss';
|
|
@import '@/common/app.scss';
|
|
|
|
.example-info {
|
|
font-size: 14px;
|
|
color: #333;
|
|
padding: 10px;
|
|
}
|
|
</style>
|