zhaoxiaohai hace 2 años
padre
commit
9c9405c034
Se han modificado 2 ficheros con 28 adiciones y 14 borrados
  1. 27 11
      pages/tabbar/home/index.js
  2. 1 3
      pages/tabbar/home/index.wxml

+ 27 - 11
pages/tabbar/home/index.js

@@ -33,7 +33,7 @@ Page({
         })
         /* 首页宫格授权查询 */
         if (wx.getStorageSync('userauth').length != 0) {
-            let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['通告', '推广素材', '商学院', '提报', '销售线索']),
+            let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['通告', '推广素材', '商学院', '提报', '销售线索', '营销物料']),
                 gridList = [],
                 subassembly = [];
             auth.forEach(v => {
@@ -74,6 +74,14 @@ Page({
                             apps: v.apps
                         })
                         break;
+                    case "营销物料":
+                        gridList.push({
+                            name: "营销物料",
+                            path: "/pages/tabbar/smartStore/index",
+                            icon: "icon-a-shouyejingangquyingxiaowuliao",
+                            apps: v.apps
+                        })
+                        break;
                     case "销售线索":
                         gridList.push({
                             name: "销售线索",
@@ -196,9 +204,16 @@ Page({
         const {
             item
         } = e.currentTarget.dataset;
-        wx.navigateTo({
-            url: `${item.path}?auth=${JSON.stringify(item.apps)}`,
-        });
+        const url = `${item.path}?auth=${JSON.stringify(item.apps)}`
+        if (item.name == "营销物料") {
+            wx.switchTab({
+                url
+            });
+        } else {
+            wx.navigateTo({
+                url
+            });
+        }
     },
     /* 去消息详情 */
     toMsg(e) {
@@ -221,12 +236,13 @@ Page({
     },
     /* banner */
     bannerClick(e) {
-        const hyperlink = e.currentTarget.dataset.hyperlink.split(":");
-        if (hyperlink[0] == 'path') {
-            wx.navigateTo({
-                url: hyperlink[1]
-            })
-        }
+        const {
+            item
+        } = e.currentTarget.dataset,
+            hyperlink = item.hyperlink.split(":");
+        if (hyperlink[0] == 'path') wx.navigateTo({
+            url: hyperlink[1]
+        })
     },
     onShow() {
         this.getTabBar().init();
@@ -238,5 +254,5 @@ Page({
     onHide() {
         clearInterval(DataCarousel);
     },
-    onShareAppMessage() { }
+    onShareAppMessage() {}
 })

+ 1 - 3
pages/tabbar/home/index.wxml

@@ -15,7 +15,7 @@
     <view class="banner_oval" />
     <swiper class='banner_content' autoplay circular>
         <swiper-item wx:for="{{bannerList}}" wx:key="index">
-            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-hyperlink="{{item.hyperlink}}" catchtap="bannerClick" />
+            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-item="{{item}}" catchtap="bannerClick" />
         </swiper-item>
     </swiper>
 </view>
@@ -68,7 +68,5 @@
         <view wx:if="{{index!=annunciateList.length-1}}" style="width: 100%; border-top: 1rpx solid #EEEEEE; margin-left: 30rpx;" />
     </block>
 </My_card>
-
 <view style="height: 140rpx;" />
-
 <wxs src='../../../utils/wxmlQueryPer.wxs' module="per" />