liyongli 3 лет назад
Родитель
Сommit
86ce3f3192

+ 0 - 16
miniprogram/app.json

@@ -9,21 +9,5 @@
     "navigationBarTitleText": "陕西广电融媒体集团创新中心",
     "navigationBarTextStyle": "black"
   },
-  "tabBar": {
-    "custom": false,
-    "color": "#646566",
-    "selectedColor": "#1989fa",
-    "position": "top",
-    "list": [
-      {
-        "pagePath": "pages/channelAdvertising/index",
-        "text": "频道广告"
-      },
-      {
-        "pagePath": "pages/industryAdvertising/index",
-        "text": "行业广告"
-      }
-    ]
-  },
   "sitemapLocation": "sitemap.json"
 }

+ 1 - 0
miniprogram/app.less

@@ -4,4 +4,5 @@ page{
   font-size: 14px;
   height: 100vh;
   overflow-x: hidden;
+  padding-top: 30px;
 }

+ 4 - 0
miniprogram/custom-tab-bar/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 41 - 0
miniprogram/custom-tab-bar/index.ts

@@ -0,0 +1,41 @@
+// custom-tab-bar/index.ts
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    type:{
+      type: Number
+    }
+  },
+  ready(){
+    console.log(this.data.type)
+  },
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  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]
+      })
+    }
+  }
+})

+ 15 - 0
miniprogram/custom-tab-bar/index.wxml

@@ -0,0 +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>
+    <cover-view wx:if="{{type === 0}}" 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>
+    <cover-view wx:if="{{type === 1}}" class="line">1</cover-view>
+  </cover-view>
+</cover-view>

+ 37 - 0
miniprogram/custom-tab-bar/index.wxss

@@ -0,0 +1,37 @@
+/* custom-tab-bar/index.wxss */
+.head {
+  position: fixed;
+  z-index: 1;
+  width: 100%;
+  height: 33px;
+  line-height: 33px;
+  background-color: #fff;
+  top: 0;
+  display: flex;
+}
+
+.item {
+  flex: 1;
+  background-color: #fff;
+  text-align: center;
+  box-sizing: border-box;
+}
+
+.text {
+  color: #646566;
+  height: 2em;
+  line-height: 2em;
+  font-size: 14px;
+  display: inline-block;
+}
+
+.line {
+  width: 4em;
+  height: 5rpx;
+  margin: 0 auto;
+  background-color: #1989fa;
+}
+
+.act {
+  color: #1989fa;
+}

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

@@ -7,6 +7,7 @@
     "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 - 0
miniprogram/pages/channelAdvertising/index.wxml

@@ -1,5 +1,6 @@
 <!--index.wxml-->
 <!-- <button wx:if="{{userInfo.signature === undefined}}" bindtap="getUserProfile"> 获取头像昵称 </button> -->
+<local-tab type="0"></local-tab>
 <view class="channel">
   <van-row>
     <van-col span="12">

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

@@ -10,6 +10,7 @@
     "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"

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

@@ -1,6 +1,7 @@
 <!--index.wxml-->
 <!-- <button wx:if="{{userInfo.signature === undefined}}" bindtap="getUserProfile"> 获取头像昵称 </button> -->
 
+<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}}">
@@ -19,15 +20,14 @@
     </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-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>