ソースを参照

修改部分问题

空白格 3 年 前
コミット
ddf1c117b0
2 ファイル変更8 行追加9 行削除
  1. 8 3
      common/http.interceptor.js
  2. 0 6
      pages/index/index.vue

+ 8 - 3
common/http.interceptor.js

@@ -3,7 +3,12 @@ import store  from '../store/index.js'
 // vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
 // vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
 const install = (Vue, vm) => {
 const install = (Vue, vm) => {
 	Vue.prototype.$u.http.setConfig({
 	Vue.prototype.$u.http.setConfig({
-		baseUrl: config.baseUrl
+		baseUrl: config.baseUrl,
+		showLoading: true, // 是否显示请求中的loading
+		loadingText: '请求中...', // 请求loading中的文字提示
+		loadingTime: 500, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
+		originalData: false, // 是否在拦截器中返回服务端的原始数据
+		loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
 	});
 	});
 	// 请求拦截,配置Token等参数
 	// 请求拦截,配置Token等参数
 	Vue.prototype.$u.http.interceptor.request = (config) => {
 	Vue.prototype.$u.http.interceptor.request = (config) => {
@@ -12,7 +17,7 @@ const install = (Vue, vm) => {
 		}
 		}
 		// 请求地址加时间戳
 		// 请求地址加时间戳
 		config.url = config.url + '?t=' + Date.now()
 		config.url = config.url + '?t=' + Date.now()
-		let noTokenList = ['/wechat/h5/user','/client/auth/verifyCode'];
+		let noTokenList = ['/client/wechat/h5/code/', '/client/auth/sendSmsCodeV2', '/client/auth/verifyCodeV2'];
 		if(noTokenList.includes(config.url)) config.header.noToken = true;
 		if(noTokenList.includes(config.url)) config.header.noToken = true;
 		return config; 
 		return config; 
 	}
 	}
@@ -20,7 +25,7 @@ const install = (Vue, vm) => {
 	Vue.prototype.$u.http.interceptor.response = (res) => {
 	Vue.prototype.$u.http.interceptor.response = (res) => {
 		if(res.code == 200) {
 		if(res.code == 200) {
 			return res;  
 			return res;  
-		} else if(res.code == 401 || res.code == 400){
+		} else if(res.code == 401 || res.code == 400) {
 			const backUrl = location.href
 			const backUrl = location.href
 			// 判断浏览器
 			// 判断浏览器
 			const ua = window.navigator.userAgent.toLowerCase();
 			const ua = window.navigator.userAgent.toLowerCase();

+ 0 - 6
pages/index/index.vue

@@ -351,7 +351,6 @@
 			}
 			}
 		},
 		},
 		onLoad(page) {
 		onLoad(page) {
-			console.log(page)
 			const locationLocaturl = window.location.href
 			const locationLocaturl = window.location.href
 			// 微信聚合支付完成跳转过来重定向到详情页
 			// 微信聚合支付完成跳转过来重定向到详情页
 			const type = getUrlParams(locationLocaturl, 'type')
 			const type = getUrlParams(locationLocaturl, 'type')
@@ -611,9 +610,6 @@
 			},
 			},
 			// 获取首页数据
 			// 获取首页数据
 			handleGetIndexData() {
 			handleGetIndexData() {
-				uni.showLoading({
-					title: '加载中'
-				})
 				this.$u.api.getIndexData()
 				this.$u.api.getIndexData()
 					.then(res => {
 					.then(res => {
 						if (res.code === 200) {
 						if (res.code === 200) {
@@ -668,13 +664,11 @@
 								newsList.push(item.content)
 								newsList.push(item.content)
 							})
 							})
 							this.noticeList = newsList
 							this.noticeList = newsList
-							uni.hideLoading()
 						} else {
 						} else {
 							this.$refs.uToast.show({
 							this.$refs.uToast.show({
 								title: res.msg,
 								title: res.msg,
 								type: 'error'
 								type: 'error'
 							})
 							})
-							uni.hideLoading()
 						}
 						}
 					})
 					})
 			},
 			},