2020-05-29 03:13:55 +00:00
|
|
|
|
<script>
|
2020-08-05 13:06:29 +00:00
|
|
|
|
import { mapMutations, mapState } from 'vuex';
|
2020-07-31 00:45:30 +00:00
|
|
|
|
export default {
|
2020-08-08 07:40:48 +00:00
|
|
|
|
globalData: {
|
|
|
|
|
im: {}
|
|
|
|
|
},
|
2020-08-15 11:14:12 +00:00
|
|
|
|
computed: {
|
|
|
|
|
...mapState(["hasLogin"])
|
|
|
|
|
},
|
2020-07-31 00:45:30 +00:00
|
|
|
|
onLaunch() {
|
2020-08-08 07:40:48 +00:00
|
|
|
|
getApp().globalData.im = this.imService
|
2020-07-31 00:45:30 +00:00
|
|
|
|
// 缓存token
|
|
|
|
|
uni.getStorage({
|
|
|
|
|
key: "token",
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.loginIn(res.data);
|
|
|
|
|
}
|
|
|
|
|
})
|
2020-08-15 11:14:12 +00:00
|
|
|
|
// 刷新token
|
|
|
|
|
if (this.hasLogin) {
|
2020-08-17 08:57:23 +00:00
|
|
|
|
this.refreshToken_function();
|
2020-08-15 11:14:12 +00:00
|
|
|
|
}
|
2020-08-17 08:57:23 +00:00
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
//app关闭默认的启动 方法关闭启动图。但是这个时间不能太晚,6s 超时后依旧会主动关闭。
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
plus.navigator.closeSplashscreen();
|
|
|
|
|
},3000)
|
|
|
|
|
// #endif
|
2020-08-18 07:08:42 +00:00
|
|
|
|
},
|
|
|
|
|
onShow(){
|
2020-08-25 06:21:15 +00:00
|
|
|
|
// this.getVersion();
|
2020-08-25 04:21:26 +00:00
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
|
2020-08-18 07:08:42 +00:00
|
|
|
|
},
|
|
|
|
|
onHide(){
|
|
|
|
|
|
2020-07-31 00:45:30 +00:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2020-08-05 13:06:29 +00:00
|
|
|
|
...mapMutations(['loginIn']),
|
2020-08-15 11:14:12 +00:00
|
|
|
|
// 刷新token
|
|
|
|
|
refreshToken_function(){
|
|
|
|
|
this.$u.api.refreshToken({}).then((res) => {
|
|
|
|
|
// console.log(res);
|
|
|
|
|
if (res.errCode == 0) {
|
|
|
|
|
let token = res.data.token;
|
|
|
|
|
uni.setStorageSync('token', token);//存储toke值
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-08-25 02:13:49 +00:00
|
|
|
|
getVersion() {
|
|
|
|
|
this.$u.post("Specialci/checkVersion",{ app_version: this.$app_version }).then(res => {
|
|
|
|
|
// console.log(res);
|
|
|
|
|
if(res.data.app_version != this.$app_version) {
|
|
|
|
|
this.$u.route('/pageE/setting/updateVersion', {
|
2020-08-25 04:21:26 +00:00
|
|
|
|
status: res.data.is_focus_upgrade
|
2020-08-25 02:13:49 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-07-31 00:45:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-29 03:13:55 +00:00
|
|
|
|
</script>
|
2020-06-02 00:47:57 +00:00
|
|
|
|
<style lang="scss">
|
2020-07-31 00:45:30 +00:00
|
|
|
|
/* #ifndef APP-PLUS-NVUE */
|
|
|
|
|
@import "/static/css/normalize";
|
2020-08-03 13:40:22 +00:00
|
|
|
|
/* 顶部自定义导航留白 */
|
|
|
|
|
.status_bar {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: var(--status-bar-height);
|
2020-08-09 11:08:12 +00:00
|
|
|
|
}
|
|
|
|
|
/* 自定义下拉 */
|
|
|
|
|
.load-size {
|
|
|
|
|
::v-deep.u-more-text {
|
|
|
|
|
font-size: 20rpx !important;
|
|
|
|
|
}
|
2020-08-03 13:40:22 +00:00
|
|
|
|
}
|
2020-07-31 00:45:30 +00:00
|
|
|
|
/* #endif */
|
2020-08-01 03:16:53 +00:00
|
|
|
|
</style>
|