|
@@ -118,11 +118,45 @@
|
|
},
|
|
},
|
|
mounted() { // 页面创建后判断用户状态
|
|
mounted() { // 页面创建后判断用户状态
|
|
uni.$on('RELAUNCH', () => uni.reLaunch({ url: '../login-psw/login-psw' })) // 监听 token 失效事件,跳转到登录页
|
|
uni.$on('RELAUNCH', () => uni.reLaunch({ url: '../login-psw/login-psw' })) // 监听 token 失效事件,跳转到登录页
|
|
|
|
+ uni.$on('INIT', () => this.init())
|
|
if (this.$store.state.app.token) { // 当用户处于登陆状态
|
|
if (this.$store.state.app.token) { // 当用户处于登陆状态
|
|
if (window.location.pathname.split('/').length > 4) {
|
|
if (window.location.pathname.split('/').length > 4) {
|
|
window.history.replaceState({}, '', '/api/gzh')
|
|
window.history.replaceState({}, '', '/api/gzh')
|
|
}
|
|
}
|
|
uni.showLoading({ mask: true })
|
|
uni.showLoading({ mask: true })
|
|
|
|
+ this.init()
|
|
|
|
+ } else {
|
|
|
|
+ if (window.location.pathname.split('/').length > 4) {
|
|
|
|
+ uni.showLoading({ mask: true })
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uni.hideLoading()
|
|
|
|
+ const query = window.location.pathname.split('/')
|
|
|
|
+ window.history.replaceState({}, '', '/api/gzh')
|
|
|
|
+ uni.reLaunch({ url: `../invite-proxy/invite-proxy?nickname=${query[3]}&mobile=${query[4]}&invite_code=${query[5]}` })
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ uni.reLaunch({ url: '../login-psw/login-psw' })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onPullDownRefresh() {
|
|
|
|
+ this.init()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ rTap() { uni.navigateTo({ url: '../help-use/help-use' }) }, // 点击导航栏帮助
|
|
|
|
+ toSwiperDetail(index) { // 点击轮播图
|
|
|
|
+ if (this.swiper[index].is_jump == 1) {
|
|
|
|
+ uni.navigateTo({ url: `../app-webview/app-webview?url=${this.swiper[index].url}` })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ indexRequest() { // 请求首页数据
|
|
|
|
+ _API_IndexIndex().then(res => {
|
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
|
+ this.news = res.data.news
|
|
|
|
+ this.swiper = res.data.swiper
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ init() {
|
|
_API_GetUserStatus().then(res => { // 获取用户状态
|
|
_API_GetUserStatus().then(res => { // 获取用户状态
|
|
this.$store.commit('userinfo/UPDATA_USERINFO', res.data) // 获取用户状态后保存在 vuex 中
|
|
this.$store.commit('userinfo/UPDATA_USERINFO', res.data) // 获取用户状态后保存在 vuex 中
|
|
if (res.data.status == 1) { // 用户状态为 1 表示正常
|
|
if (res.data.status == 1) { // 用户状态为 1 表示正常
|
|
@@ -134,6 +168,7 @@
|
|
} else if (res.data.cert_status == 6) { // 用户认证完成
|
|
} else if (res.data.cert_status == 6) { // 用户认证完成
|
|
this.indexRequest() // 请求首页数据
|
|
this.indexRequest() // 请求首页数据
|
|
_API_GetUserInfo().then(res => { // 请求用户信息
|
|
_API_GetUserInfo().then(res => { // 请求用户信息
|
|
|
|
+ uni.stopPullDownRefresh()
|
|
this.$store.commit('userinfo/UPDATA_USERINFO', res.data) // 获取用户信息后保存在 vuex 中
|
|
this.$store.commit('userinfo/UPDATA_USERINFO', res.data) // 获取用户信息后保存在 vuex 中
|
|
if (this.$store.state.userinfo.pass_status) {
|
|
if (this.$store.state.userinfo.pass_status) {
|
|
uni.showModal({ title: '提示', content: '为了保障您的账户安全,请立即修改密码', showCancel: false, success: res => {
|
|
uni.showModal({ title: '提示', content: '为了保障您的账户安全,请立即修改密码', showCancel: false, success: res => {
|
|
@@ -152,33 +187,6 @@
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- } else {
|
|
|
|
- if (window.location.pathname.split('/').length > 4) {
|
|
|
|
- uni.showLoading({ mask: true })
|
|
|
|
- setTimeout(() => {
|
|
|
|
- uni.hideLoading()
|
|
|
|
- const query = window.location.pathname.split('/')
|
|
|
|
- window.history.replaceState({}, '', '/api/gzh')
|
|
|
|
- uni.reLaunch({ url: `../invite-proxy/invite-proxy?nickname=${query[3]}&mobile=${query[4]}&invite_code=${query[5]}` })
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- uni.reLaunch({ url: '../login-psw/login-psw' })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- rTap() { uni.navigateTo({ url: '../help-use/help-use' }) }, // 点击导航栏帮助
|
|
|
|
- toSwiperDetail(index) { // 点击轮播图
|
|
|
|
- if (this.swiper[index].is_jump == 1) {
|
|
|
|
- uni.navigateTo({ url: `../app-webview/app-webview?url=${this.swiper[index].url}` })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- indexRequest() { // 请求首页数据
|
|
|
|
- _API_IndexIndex().then(res => {
|
|
|
|
- uni.stopPullDownRefresh()
|
|
|
|
- this.news = res.data.news
|
|
|
|
- this.swiper = res.data.swiper
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|