he2802 4 лет назад
Родитель
Сommit
3cc43c39d4
4 измененных файлов с 13 добавлено и 6 удалено
  1. 6 4
      common/request.js
  2. 2 0
      components/my.vue
  3. 0 1
      pages/index/index.vue
  4. 5 1
      store/index.js

+ 6 - 4
common/request.js

@@ -8,10 +8,12 @@ export const BASE_URL = 'https://api.xyyxt.net'//接口api
 export const BASE_IMG_URL = 'https://file.xyyxt.net/'//图片上传api
 export const tenantId = '867735392558919680'
 export const myRequest = (options) => {
-	 uni.showLoading({
-		title:'拼命加载中...'
-	}) 
-	
+	if(store.state.allowLoading){
+		uni.showLoading({
+			title:'拼命加载中...'
+		}) 
+	}
+
 	return new Promise((resolve, reject) => {
 		uni.request({
 			url: BASE_URL + options.url,

+ 2 - 0
components/my.vue

@@ -202,9 +202,11 @@ export default {
 			return;
 		},
 		async init() {
+			this.$store.state.allowLoading= false
 			const firstFunc = await this.getInfoAttached();
 			const seciedFunc = await this.getLevel();
 			this.$api.refreshUserInfo();
+			this.$store.state.allowLoading = true
 		},
 		jumpPopup() {
 			uni.showModal({

+ 0 - 1
pages/index/index.vue

@@ -79,7 +79,6 @@ export default {
 						}
 					}
 					that.$store.state.dictObj = newList;
-					console.log(newList)
 				}
 			});
 		},

+ 5 - 1
store/index.js

@@ -9,7 +9,8 @@ const store = new Vuex.Store({
         avatarUrl: '',  
         userName: '',
 		userInfo:null,
-		dictObj:null
+		dictObj:null,
+		allowLoading:true
     },  
 	 getters: {
 		userInfo: state => {
@@ -23,6 +24,9 @@ const store = new Vuex.Store({
 		dictObj:state => {
 			return state.dictObj
 		},
+		allowLoading:state => {
+			return state.allowLoading
+		},
 	},
     mutations: { 
         updateUserInfo(state, provider) {