66 lines
1.9 KiB
Vue
66 lines
1.9 KiB
Vue
|
<script>
|
||
|
import toolAll from '@/jsFile/tools.js';
|
||
|
export default {
|
||
|
onLaunch: function() {
|
||
|
toolAll.tools.clearClog()//去除体验版和正式版的所有输出日志
|
||
|
},
|
||
|
onShow: function() {
|
||
|
uni.setStorageSync('publicColor', '#3875F6') //#3875F6
|
||
|
// uni.clearStorageSync()
|
||
|
if(uni.getStorageSync('token')!='') {
|
||
|
toolAll.tools.daoTime()
|
||
|
toolAll.tools.networkStatus()//检查当前网络状态
|
||
|
toolAll.tools.updaX()//检测版本更新
|
||
|
}
|
||
|
let ya = this
|
||
|
uni.login({
|
||
|
provider: 'weixin',
|
||
|
success: function(res) {
|
||
|
if (res.code) {
|
||
|
let obj = uni.getStorageSync('comeOn')//昵称、头像
|
||
|
var params = {
|
||
|
code:res.code,
|
||
|
nickname: '',
|
||
|
headimgurl: '',
|
||
|
country: '',
|
||
|
province: '',
|
||
|
city: '',
|
||
|
gender: '',
|
||
|
language:'',
|
||
|
invite_code:'',//用户邀请码
|
||
|
channel:''//来源渠道,二维码或分享链接中携带的来源渠道参数
|
||
|
}
|
||
|
ya.$requst.post('user/login',params).then(res => {
|
||
|
if(res.data.token!=''){
|
||
|
uni.setStorageSync('token',res.data.token)//缓存token
|
||
|
uni.setStorageSync('headImg',res.data.headimgurl)//缓存用户头像
|
||
|
}
|
||
|
},error => {})
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
// wx.checkSession({ //检测当前用户的session_key是否过期
|
||
|
// success: function() { //session_key 未过期,并且在本生命周期一直有效
|
||
|
// return;
|
||
|
// },
|
||
|
// fail: function() { //session_key 已经失效,需要重新执行登录流程
|
||
|
// setTimeout(()=>{
|
||
|
// uni.reLaunch({url:'/pages/login/login'})
|
||
|
// },2000)
|
||
|
// }
|
||
|
// })
|
||
|
},
|
||
|
onHide: function() {
|
||
|
// console.log('hide');
|
||
|
toolAll.tools.closeTimer()//清空埋点倒计时
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
/*每个页面公共css */
|
||
|
@import url("./commons/hengmei.css");
|
||
|
@import url("./commons/animate.min.css");
|
||
|
page {background-color: rgba(244, 244, 244, 1);}
|
||
|
</style>
|