liyongli 3 年之前
父節點
當前提交
63d7ffb911

+ 12 - 0
miniprogram/app.json

@@ -9,5 +9,17 @@
     "navigationBarTitleText": "陕西广电融媒体集团创新中心",
     "navigationBarTextStyle": "black"
   },
+  "tabBar": {
+    "custom": true,
+    "position": "top",
+    "list": [
+      {
+        "pagePath": "pages/channelAdvertising/index"
+      },
+      {
+        "pagePath": "pages/industryAdvertising/index"
+      }
+    ]
+  },
   "sitemapLocation": "sitemap.json"
 }

+ 1 - 1
miniprogram/app.ts

@@ -3,7 +3,7 @@ const baseConfig = require("./config_base")
 App<IAppOption>({
   globalData: {
     base: baseConfig,
-    tabActive: 0
+    tabActive: '/pages/channelAdvertising/index'
   },
   onLaunch() {
     // 登录

+ 14 - 19
miniprogram/custom-tab-bar/index.ts

@@ -1,40 +1,35 @@
 // custom-tab-bar/index.ts
+const app = getApp()
 Component({
   /**
    * 组件的属性列表
    */
   properties: {
-    type:{
-      type: Number
-    }
   },
-  ready(){
-    console.log(this.data.type)
+  ready() {
+    this.setData({
+      pageName: app.globalData.tabActive
+    })
   },
   /**
    * 组件的初始数据
    */
   data: {
-
+    pageName: ""
   },
 
   /**
    * 组件的方法列表
    */
   methods: {
-    changepage(e:any){
-      let i = e.target.dataset.index;
-      if(i == this.data.type) return
-      if(getCurrentPages().length> 1){
-        wx.navigateBack()
-        return
-      }
-      let li = [
-        "/pages/channelAdvertising/index",
-        "/pages/industryAdvertising/index"
-      ]
-      wx.navigateTo({
-        url: li[i]
+    changepage(e: any) {
+      const url = e.target.dataset.index;
+      this.setData({
+        pageName: url
+      }, () => {
+        console.log(this.data.pageName)
+        app.globalData.tabActive = url;
+        wx.switchTab({ url })
       })
     }
   }

+ 6 - 6
miniprogram/custom-tab-bar/index.wxml

@@ -1,15 +1,15 @@
 <!--custom-tab-bar/index.wxml-->
 <cover-view class="head">
-  <cover-view data-index="0" bindtap="changepage" class="item">
-    <cover-view data-index="0" class="{{'text ' + (type === 0? 'act' : '')}}">
+  <cover-view data-index="/pages/channelAdvertising/index" bindtap="changepage" class="item">
+    <cover-view data-index="/pages/channelAdvertising/index" class="{{'text ' + (pageName === '/pages/channelAdvertising/index'? 'act': '')}}">
       频道广告
     </cover-view>
-    <cover-view wx:if="{{type == 0}}" class="line">1</cover-view>
+    <cover-view wx:if="{{pageName === '/pages/channelAdvertising/index'}}" class="line">1</cover-view>
   </cover-view>
-  <cover-view data-index="1" bindtap="changepage" class="item">
-    <cover-view data-index="1" class="{{'text ' + (type === 1? 'act' : '')}}">
+  <cover-view data-index="/pages/industryAdvertising/index" bindtap="changepage" class="item">
+    <cover-view data-index="/pages/industryAdvertising/index" class="{{'text ' + (pageName === '/pages/industryAdvertising/index'? 'act': '')}}">
       行业广告
     </cover-view>
-    <cover-view wx:if="{{type == 1}}" class="line">1</cover-view>
+    <cover-view wx:if="{{pageName === '/pages/industryAdvertising/index'}}" class="line">1</cover-view>
   </cover-view>
 </cover-view>

+ 0 - 1
miniprogram/pages/channelAdvertising/index.json

@@ -7,7 +7,6 @@
     "local-kehuyoushi": "./components/kehuyoushi/index",
     "local-qianzaikehu": "./components/qianzaikehu/index",
     "local-baohedu": "./components/baohedu/index",
-    "local-tab": "../../custom-tab-bar/index",
     "van-row": "@vant/weapp/row/index",
     "van-col": "@vant/weapp/col/index",
     "van-icon": "@vant/weapp/icon/index"

+ 1 - 2
miniprogram/pages/channelAdvertising/index.ts

@@ -55,8 +55,7 @@ Page({
     return timeSelect;
   },
   bindPickerChange(event: wxPicker) {
-    const item = this.data.array[Number(event.detail.value)];
-    console.log(item)
+    // const item = this.data.array[Number(event.detail.value)];
     this.setData({
       array_act: Number(event.detail.value)
     })

+ 1 - 2
miniprogram/pages/channelAdvertising/index.wxml

@@ -1,6 +1,5 @@
 <!--index.wxml-->
-<local-tab type="0"></local-tab>
-<view class="channel">
+<view class="channel page">
   <van-row>
     <van-col span="12">
       <picker mode="selector" bindchange="bindPickerChange" range-key="text" value="{{array_act}}" range="{{array}}">

+ 0 - 1
miniprogram/pages/industryAdvertising/components/hangyejiegou/index.ts

@@ -25,7 +25,6 @@ namespace hangyejiegou {
       },
     },
     ready() {
-      console.log(this.data.array.index)
       this.init();
       first = false;
     },

+ 0 - 1
miniprogram/pages/industryAdvertising/components/quanpanqushi/F2.ts

@@ -136,7 +136,6 @@ namespace quanpanqushi {
           }
         }
       });
-      console.log(data, key)
       chartCatch.toufangfenxiChart.line().position('index*' + key).shape('smooth').color("dataKeyTypt", ["#1b9ade", "#fd5555"]);
       chartCatch.toufangfenxiChart.render();
       return chartCatch.toufangfenxiChart;

+ 0 - 1
miniprogram/pages/industryAdvertising/index.json

@@ -10,7 +10,6 @@
     "local-fenzhongdiankehu": "./components/fenzhongdiankehu/index",
     "local-jiemufenbu": "./components/jiemufenbu/index",
     "local-zhouzoushi": "./components/zhouzoushi/index",
-    "local-tab": "../../custom-tab-bar/index",
     "van-row": "@vant/weapp/row/index",
     "van-col": "@vant/weapp/col/index",
     "van-icon": "@vant/weapp/icon/index"

+ 30 - 30
miniprogram/pages/industryAdvertising/index.wxml

@@ -1,33 +1,33 @@
 <!--index.wxml-->
 <!-- <button wx:if="{{userInfo.signature === undefined}}" bindtap="getUserProfile"> 获取头像昵称 </button> -->
+<view class="page">
+  <van-row>
+    <van-col span="12">
+      <picker mode="selector" bindchange="bindPickerChange" range-key="text" value="{{array_act}}" range="{{array}}">
+        <view class="select">
+          {{array[array_act].text || "请选择"}}
+          <van-icon name="arrow-down" />
+        </view>
+      </picker>
+    </van-col>
+    <van-col span="12">
+      <picker mode="selector" bindchange="channelChange" range-key="channelName" value="{{channelList_act}}" range="{{channelList}}">
+        <view class="select">
+          {{channelList[channelList_act].channelName || "请选择"}}
+          <van-icon name="arrow-down" />
+        </view>
+      </picker>
+    </van-col>
+  </van-row>
+  <local-quanpanqushi wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-quanpanqushi>
+  <local-hangyejiegou wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-hangyejiegou>
+  <local-ruanzhifenbu wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-ruanzhifenbu>
+  <local-zhongdiankehu wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-zhongdiankehu>
 
-<local-tab type="1"></local-tab>
-<van-row>
-  <van-col span="12">
-    <picker mode="selector" bindchange="bindPickerChange" range-key="text" value="{{array_act}}" range="{{array}}">
-      <view class="select">
-        {{array[array_act].text || "请选择"}}
-        <van-icon name="arrow-down" />
-      </view>
-    </picker>
-  </van-col>
-  <van-col span="12">
-    <picker mode="selector" bindchange="channelChange" range-key="channelName" value="{{channelList_act}}" range="{{channelList}}">
-      <view class="select">
-        {{channelList[channelList_act].channelName || "请选择"}}
-        <van-icon name="arrow-down" />
-      </view>
-    </picker>
-  </van-col>
-</van-row>
-<local-quanpanqushi wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-quanpanqushi>
-<local-hangyejiegou wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-hangyejiegou>
-<local-ruanzhifenbu wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-ruanzhifenbu>
-<local-zhongdiankehu wx:if="{{channelList_act === 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-zhongdiankehu>
-
-<local-hangyetoufang wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-hangyetoufang>
-<local-hangyezhanbi wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-hangyezhanbi>
-<local-pindaofenbu wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-pindaofenbu>
-<local-fenzhongdiankehu wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-fenzhongdiankehu>
-<local-jiemufenbu wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-jiemufenbu>
-<local-zhouzoushi wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-zhouzoushi>
+  <local-hangyetoufang wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-hangyetoufang>
+  <local-hangyezhanbi wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-hangyezhanbi>
+  <local-pindaofenbu wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-pindaofenbu>
+  <local-fenzhongdiankehu wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-fenzhongdiankehu>
+  <local-jiemufenbu wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-jiemufenbu>
+  <local-zhouzoushi wx:if="{{channelList_act !== 0 && channelList.length && array[array_act].text}}" array="{{array[array_act]}}" channel="{{channelList[channelList_act]}}"></local-zhouzoushi>
+</view>

+ 1 - 1
typings/index.d.ts

@@ -6,7 +6,7 @@ interface IAppOption {
     base: {
       string: string|number|number[]|string[]
     },
-    tabActive: number
+    tabActive: string
   }
   userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback,
 }