Browse Source

bug修复

xiaohaizhao 8 months ago
parent
commit
f2cfcf23f0
5 changed files with 40 additions and 25 deletions
  1. 0 1
      app.js
  2. 17 15
      pages/login/modules/login.js
  3. 3 2
      pages/tabbar/home/index.js
  4. 15 2
      pages/tabbar/home/index.wxml
  5. 5 5
      pages/tabbar/message/details.js

+ 0 - 1
app.js

@@ -31,7 +31,6 @@ App({
                 wx.setStorageSync('userauth', res.data);
             });
         };
-        wx.setStorageSync('appid', 'wxc1b6ae925ac1d06a');
     },
     initSocket() {
         let that = this;

+ 17 - 15
pages/login/modules/login.js

@@ -1,7 +1,13 @@
 function loginMsg(res) {
+	wx.removeStorageSync('auth')
+	wx.removeStorageSync('userauth');
+	wx.removeStorageSync('siteP');
+	wx.removeStorageSync('banner_list');
+	wx.removeStorageSync('templetList');
 	wx.setStorageSync('account_list', res.account_list);
 	if (res.account_list.length == 1) {
 		wx.setStorageSync('userrole', res.account_list[0].usertype == 1 ? '业务员' : '经销商');
+		wx.removeStorageSync('userMsg')
 		wx.setStorageSync('userMsg', res.account_list[0])
 		init();
 	} else {
@@ -31,6 +37,10 @@ function init() {
 		content: {
 			nocache: true
 		}
+	}, {
+		"classname": "sysmanage.develop.querytemplet.querytemplet",
+		"method": "query",
+		"content": {}
 	}].map(v => _Http.basic(v))).then(list => {
 		console.log("登录初始化", list)
 		if (list.some(res => res.msg != '成功')) return list.filter(res => {
@@ -47,24 +57,16 @@ function init() {
 		let pages = getCurrentPages();
 		let prevPage = pages[pages.length - 2];
 		if (prevPage && prevPage.__route__ == 'pages/tabbar/home/index') prevPage.refreshData();
-		wx.switchTab({
-			url: '/pages/tabbar/home/index'
-		})
-	})
 
-	_Http.basic({
-		"classname": "sysmanage.develop.querytemplet.querytemplet",
-		"method": "query",
-		"content": {}
-	}).then(res => {
-		console.log("获取列表查询条件", res)
-		if (res.msg != '成功') return;
-		let data = res.data.find(v => v.templetname == '站点全部');
+		let data = list[3].data.find(v => v.templetname == '站点全部');
 		if (data) {
-			res.data = res.data.filter(v => v.templetname != '站点全部')
-			res.data.unshift(data)
+			list[3].data = list[3].data.filter(v => v.templetname != '站点全部')
+			list[3].data.unshift(data)
 		}
-		wx.setStorageSync('templetList', res.data)
+		wx.setStorageSync('templetList', list[3].data)
+		wx.switchTab({
+			url: '/pages/tabbar/home/index'
+		})
 	})
 }
 

+ 3 - 2
pages/tabbar/home/index.js

@@ -9,7 +9,7 @@ import {
 
 Page({
   data: {
-    appid: wx.getStorageSync('appid'),
+    appid: 'wxc1b6ae925ac1d06a',
     bannerList: [], //banner列表
     gridList: [],
     notice: "",
@@ -18,7 +18,8 @@ Page({
   },
   onLoad(options) {
     this.setData({ //获取胶囊位置信息
-      capsule: wx.getMenuButtonBoundingClientRect()
+      capsule: wx.getMenuButtonBoundingClientRect(),
+      templetList: JSON.stringify(wx.getStorageSync('templetList'))
     })
     this.refreshData() //更新权限等信息
     this.getTabBar().unReadMessageCount(); //更新信息数量

+ 15 - 2
pages/tabbar/home/index.wxml

@@ -11,7 +11,7 @@
     </view>
 </view>
 <!-- 滚动通知 -->
-<van-notice-bar custom-class='notice-bar' mode="link" background="none" data-item="{{notice}}" background='#FCF6EF' color='#666' text="{{notice.message}}"  bindtap="toMsg">
+<van-notice-bar custom-class='notice-bar' mode="link" background="none" data-item="{{notice}}" background='#FCF6EF' color='#666' text="{{notice.message}}" bindtap="toMsg">
     <text slot="left-icon" data-item="{{notice}}" class="work work-xiaoxigundong" />
 </van-notice-bar>
 <!-- 轮播区域 -->
@@ -25,7 +25,20 @@
         <view class="group" wx:if="{{item.list.length}}">
             <view class="label"><text class="work {{item.icon}}" />{{item.label}}</view>
             <view class="main">
-                <navigator version='trial' class="item" wx:for="{{item.list}}" wx:for-item="it" wx:for-index="i" target='{{item.appid!=appid?"miniProgram":"self"}}' app-id='{{item.appid}}' path="{{it.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site}}" url="{{it.path}}" open-type="{{it.openType||'navigate'}}" wx:key="name" data-it="{{it}}" data-item="{{item}}" bindtap="openRecord">
+                <navigator version='trial'
+                class="item"
+                wx:for="{{item.list}}"
+                wx:for-item="it"
+                wx:for-index="i"
+                target='{{item.appid!=appid?"miniProgram":"self"}}'
+                app-id='{{item.appid}}'
+                path="{{it.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site+'&site='+site}}"
+                url="{{it.path}}"
+                open-type="{{it.openType||'navigate'}}"
+                wx:key="name"
+                data-it="{{it}}"
+                data-item="{{item}}"
+                bindtap="openRecord">
                     <view class="icon-box" style="background-color: {{it.bColor}};">
                         <text class="work {{it.icon}}" style="color: {{it.color}};" />
                     </view>

+ 5 - 5
pages/tabbar/message/details.js

@@ -1,7 +1,7 @@
 const _Http = getApp().globalData.http;
 Page({
 	data: {
-		appid: wx.getStorageSync('appid'),
+		appid: 'wxc1b6ae925ac1d06a',
 		detailsData: {}
 	},
 	onLoad(options) {
@@ -42,10 +42,10 @@ Page({
 					//工单
 					item.path = "/Eservice/workerLeader/editworkOrderDetail/index"
 					break;
-/* 				case "sa_serviceorder":
-					//申请单
-					item.path = "/Eservice/workerLeader/serviceBillDetail/index"
-					break; */
+					/* 				case "sa_serviceorder":
+										//申请单
+										item.path = "/Eservice/workerLeader/serviceBillDetail/index"
+										break; */
 				default:
 					let arr = item.path.split("/");
 					arr[arr.length - 1] = 'detail';