| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 | 
							- <!-- 初始化判断页面 -->
 
- <template>
 
- 	<view>
 
- 		<view class="loading-container-bg">
 
- 			<!-- <image mode="aspectFill" src="../../../static/loading.jpg"></image> -->
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	import config from '../../../common/config.js';
 
- 	import reqUtil from "@/util/util-js/requstUtil.js";
 
- 	import {
 
- 		mapState,
 
- 		mapMutations
 
- 	} from 'vuex'
 
- 	export default {
 
- 		data() {
 
- 			return {}
 
- 		},
 
- 		computed: mapState(['bNewUser']),
 
- 		onLoad() {},
 
- 		onShow() {
 
- 			let bCanLoading = false;
 
- 			//验证登录存储
 
- 			//如果登录过,直接跳转登录页面
 
- 			const value = uni.getStorageSync('token');
 
- 			var _self = this;
 
- 			if (value) {
 
- 				console.log("验证登录Token值:",value,config.URL.VERIFICATION);
 
- 				reqUtil.requestData(config.URL.VERIFICATION, {
 
- 					token: value
 
- 				}).then(res => {
 
- 						console.log('requestData VERIFICATION =====', res);
 
- 						if (res.code == 0) {
 
- 							// TODO token时效性问题
 
- 							_self.$store.state.token = value;
 
- 							_self.$store.state.bNewUser = res.data.newUser;
 
- 							_self.accountLogin(function() {
 
- 								// console.log("======");
 
- 								if (_self.bNewUser) {
 
- 									_self.onNavTo("userInfo");
 
- 								} else {
 
- 									_self.onNavTo("personal");
 
- 								}
 
- 							});
 
- 							
 
- 						} else {
 
- 							//清空保存的storage
 
- 							uni.clearStorageSync();
 
- 							//如果token 不合法,不存在,跳转登录页面
 
- 							_self.onNavTo("login");
 
- 						}
 
- 					},
 
- 					e => {
 
- 						console.log(e)
 
- 					});
 
- 			} else {
 
- 				//如果没有token,进入登录界面
 
- 				_self.onNavTo("login");
 
- 			}
 
- 			
 
- 			//预加载
 
- 			// uni.preloadPage({url: "../../platform/app-plus/subNVue/guide"});
 
- 		},
 
- 		methods: {
 
- 			...mapMutations(['accountLogin']),
 
- 			onNavTo(navType) {
 
- 				// uni.hideToast();
 
- 				console.log('当前loading 跳转的页面是 navType:',navType);
 
- 				if (navType == "userInfo") {
 
- 					uni.redirectTo({
 
- 						url: "../../my-page/userInfo/userInfo"
 
- 					})
 
- 				} else if (navType == "personal") {
 
- 					// uni.redirectTo({
 
- 					uni.switchTab({
 
- 						url: "../../personal-page/personal/personal"
 
- 					})
 
- 				} else {
 
- 					uni.redirectTo({
 
- 						url: "../../login-page/login/login"
 
- 					})
 
- 				}
 
- 			}
 
- 		}
 
- 	}
 
- </script>
 
- <style>
 
- 	.loading-container-bg {
 
- 		position: absolute;
 
- 		left: 0;
 
- 		top: 0;
 
- 		bottom: 0;
 
- 		right: 0;
 
- 		width: 750rpx;
 
- 		height: 100%;
 
- 	}
 
- 	.loading-container-bg image {
 
- 		width: 100%;
 
- 		height: 100%;
 
- 	}
 
- </style>
 
 
  |