chenjj 3 days ago
parent
commit
a1356bb3cd
4 changed files with 8 additions and 8 deletions
  1. 1 1
      pages/chat.vue
  2. 1 1
      pages/classify.vue
  3. 5 5
      pages/index.vue
  4. 1 1
      pages/mallMenu.vue

+ 1 - 1
pages/chat.vue

@@ -90,7 +90,7 @@ import dayjs from 'dayjs/esm/index'
 import { getList, conversationRemove } from '@/api/conversation.js';
 import { getNavBarHeight } from '@/utils/index.js'
 
-const userType = uni.getStorageSync('userType') //读取本地存储
+const userType = uni.getStorageSync('userType') || 1;//读取本地存储
 const list = ref([])
 const globalData = ref({
     statusBarHeight: 47,

+ 1 - 1
pages/classify.vue

@@ -32,7 +32,7 @@ import { userMainOrderList } from '@/api/userList.js'
 import CustomTabBar from '@/components/CustomTabBar/index.vue'
 import { getToken } from '@/utils/auth'
 
-const userType = uni.getStorageSync('userType') //读取本地存储
+const userType = uni.getStorageSync('userType')|| 1; //读取本地存储
 const tab = ref('')
 const tabKey = ref(0)
 const data = ref([]) //志愿者

+ 5 - 5
pages/index.vue

@@ -69,7 +69,7 @@ const list3 = ref(['']) // Initialize with at least one empty item
 const ValueZone = ref(['']) // Initialize with at least one empty item
 const hotList = ref([])
 const ValueZoneSwiper = ref([''])
-const userType = uni.getStorageSync('userType'); //读取本地存储
+const userType = uni.getStorageSync('userType') || 1; //读取本地存储
 const text1 = ref('');
 
 
@@ -258,6 +258,7 @@ const settingAddress = async () => {
 }
 
 onShow(() => {
+
   getBanners()
 
   // 在 App.vue  中初始化
@@ -270,6 +271,8 @@ onShow(() => {
       globalData.value = { statusBarHeight, navBarHeight }
     },
   })
+  console.log('=========>!userType',!userType);
+  
 })
 
 const addresstree = ref([])
@@ -300,10 +303,7 @@ onMounted(async () => {
         getList()
       })
   } else {
-    if(!userType){
-      //设置默认角色
-      uni.setStorageSync('userType', 1);
-    }
+    
     
     getList();
   }

+ 1 - 1
pages/mallMenu.vue

@@ -52,7 +52,7 @@ export default {
             arr: [],
             scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
             timer: null, // 定时器
-            userType: uni.getStorageSync('userType')
+            userType: uni.getStorageSync('userType')|| 1;
 
         }
     },