Commit 2767e58717052718adde427ca5c80b397dd09c50

Authored by yvan.ni
1 parent 66e0f4bd

1. 底部导航的优化 跳转函数,navigator的优化

2.  自定义模块 广告模块的滑块的时间,圆点的颜色     俩边间距, 图片间距功能
... ... @@ -5,66 +5,112 @@ var api = require("./api/api.js")
5 5  
6 6 //公共方法和变量
7 7 App({
8   - editTabBar: function () {
  8 + editTabBar: function (taht,stoid,url) {
  9 + var that=this;
  10 + var th = taht
9 11 //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。
10   -
11   - var curPageArr = getCurrentPages(); //获取加载的页面
12   - var curPage = curPageArr[curPageArr.length - 1]; //获取当前页面的对象
  12 + var custum_data=this.globalData.custum_data;
  13 + var isIpx=this.globalData.isIpx;
  14 + //var curPageArr = getCurrentPages(); //获取加载的页面
  15 + //var curPage = curPageArr[curPageArr.length - 1]; //获取当前页面的对象
  16 + var curPage=th;
13 17 var pagePath = curPage.route; //当前页面url
14 18 if (pagePath.indexOf('/') != 0) {
15   - pagePath = '/' + pagePath;
  19 + pagePath = '/' + pagePath;
16 20 }
17   - console.log("获取加载的页面:="+curPageArr)
18   - console.log("获取当前页面的对象:="+curPage)
19   - console.log("当前页面url:="+pagePath)
20   - var tabBar = this.globalData.tabBar;
21   - for (var i = 0; i < tabBar.list.length; i++) {
22   - tabBar.list[i].active = false;
23   - if (tabBar.list[i].weappurl == pagePath) {
24   - tabBar.list[i].active = true; //根据页面地址设置当前页面状态
25   - }
  21 + if(isIpx){
  22 + if(custum_data){
  23 + that.set_custom_nav(custum_data,isIpx,pagePath,url,curPage);
  24 + }else{
  25 + var tabBar = {
  26 + 'iscustom':2,
  27 + 'url':url,
  28 + 'active':pagePath,
  29 + 'isIpx':isIpx,
  30 + cartGoodsNum:this.globalData.cartGoodsNum
  31 + }
  32 + curPage.setData({
  33 + tabBar:tabBar,
  34 + isIpx:isIpx,
  35 + cartGoodsNum:this.globalData.cartGoodsNum
  36 + })
  37 + }
  38 +
  39 + }else{
  40 + var isIpx = false;
  41 + wx.getSystemInfo({
  42 + success: (res) => {
  43 + // console.log(res)
  44 + let modelmes = res.model; //手机品牌
  45 + if (modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来
  46 + isIpx = true
  47 + }
  48 + //缓存住,下次就不调用接口了
  49 + that.globalData.isIpx=isIpx;
  50 + getApp().request.promiseGet("/api/weshop/storeFooter/get/"+stoid, {
  51 + }).then(res => {
  52 + var e = res;
  53 + if(e.data.code != -1){
  54 + that.globalData.custum_data=e.data.data;
  55 + that.set_custom_nav(e.data.data,isIpx,pagePath,url,curPage);
  56 + }else{
  57 + var tabBar = {
  58 + 'iscustom':2,
  59 + 'url':url,
  60 + 'active':pagePath,
  61 + 'isIpx':isIpx,
  62 + cartGoodsNum:this.globalData.cartGoodsNum
  63 + }
  64 + curPage.setData({
  65 + tabBar:tabBar,
  66 + isIpx:isIpx,
  67 + cartGoodsNum:this.globalData.cartGoodsNum
  68 + })
  69 + }
  70 +
  71 + })
  72 + },
  73 + })
26 74 }
27   - curPage.setData({
28   - tabBar: tabBar
29   - });
30 75 },
  76 + set_custom_nav(data,isIpx,pagePath,url,curPage){
  77 + //缓存住,下次就不调用接口了
  78 + var itemList = data.data;
  79 + itemList = JSON.parse(itemList)
  80 + //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组,数组最后一个就是当前页面。
  81 + for (var i = 0; i < itemList.length; i++) {
  82 + itemList[i].active = false;
  83 + if (itemList[i].weappurl == pagePath) {
  84 + itemList[i].active = true; //根据页面地址设置当前页面状态
  85 + }
  86 + }
  87 +
  88 + //如果当服务端返回的值有数据就渲染数据到页面
  89 + var tabBar = {
  90 + 'iscustom':1,
  91 + 'url':url,
  92 + 'active':pagePath,
  93 + 'list':itemList,
  94 + 'backgroundColor': data.bkcolor,
  95 + 'selectedColor' : data.fontcolor_sele,
  96 + 'color':data.fontcolor,
  97 + 'length':itemList.length,
  98 + 'isIpx':isIpx,
  99 + cartGoodsNum:this.globalData.cartGoodsNum
  100 + }
  101 + curPage.setData({
  102 + tabBar:tabBar,
  103 + isIpx:isIpx,
  104 + cartGoodsNum:this.globalData.cartGoodsNum
  105 + })
  106 + },
  107 +
31 108  
32 109 globalData: {
33   - tabBar: {
34   - "color": "#6e6d6b",//文字未选择color
35   - "selectedColor": "#f23030",//文字被选择后color
36   - "borderStyle": "white",//
37   - "backgroundColor": "#ffffff",//背景color
38   - "iscustom":'',
39   - "url":"",
40   - "list": [
41   - {
42   - "weappurl": "/pages/index/index/index",
43   - "nav_name": "首页",
44   - "src": "/miniapp/images/bar/index.png",
45   - "src_sele": "/miniapp/images/bar/index_on.png"
46   - },
47   - {
48   - "weappurl": "/pages/goods/categoryList/categoryList",
49   - "nav_name": "分类",
50   - "src": "/miniapp/images/bar/fl.png",
51   - "src_sele": "/miniapp/images/bar/fl_on.png"
52   - },
53   - {
54   - "weappurl": "/pages/cart/cart/cart",
55   - "nav_name": "购物车",
56   - "src": "/miniapp/images/bar/car.png",
57   - "src_sele": "/miniapp/images/bar/car_on.png"
58   - },
59   - {
60   - "weappurl": "/pages/user/index/index",
61   - "nav_name": "我的",
62   - "src": "/miniapp/images/bar/user.png",
63   - "src_sele": "/miniapp/images/bar/user_on.png"
64   - }
65   - ]
66   - },
67   - isTabBar:false,
  110 + cartGoodsNum:0, //购物车总数量
  111 + isTabBar :false,
  112 + isIpx: false, //适配IPhoneX
  113 + url:"",
68 114 setting: t,
69 115 wechatUser: null,
70 116 userInfo: null,
... ... @@ -86,12 +132,14 @@ App({
86 132 to_group:null, //参团传递的数据
87 133 wxapp_buy_obj:null, //微信小程序购买的Object
88 134 pk_store:null, //选择的门店
  135 +
89 136 },
90 137 auth: o,
91 138 request: a,
92 139 onLaunch: function() {
93 140 this.initExt();
94 141 var t = this.globalData.setting;
  142 + //console.log(t)
95 143 t.resourceUrl = t.url + "/template/mobile/rainbow";
96 144 var clientWidth = wx.getSystemInfoSync().windowWidth;
97 145 var rpxR = 750 / clientWidth;
... ... @@ -106,6 +154,44 @@ App({
106 154 app.globalData.user_id= app.globalData.userInfo.user_id;
107 155 }
108 156 }
  157 +
  158 + wx.getSystemInfo({
  159 + success: (res) => {
  160 + // console.log(res)
  161 + let modelmes = res.model; //手机品牌
  162 + console.log('手机品牌', modelmes)
  163 + if (modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来
  164 + this.globalData.isIpx = true
  165 + }
  166 + },
  167 + })
  168 + console.log(t.stoid,this.globalData.user_id)
  169 + var tha = this
  170 + wx.request({
  171 + url: t.url+'/api/weshop/cart/page',
  172 + data: {
  173 +         store_id:t.stoid,
  174 +         user_id:tha.globalData.user_id,
  175 +         state:0,
  176 +         is_gift:0
  177 +       },
  178 + methods:'GET',
  179 + header: {
  180 + 'content-type': 'json'
  181 + },
  182 + success: function(e){
  183 +
  184 + var num = 0;
  185 +         for (var i = 0; i < e.data.data.pageData.length; i++) {
  186 +           num += e.data.data.pageData[i].goods_num;
  187 +         }
  188 +         console.log("购物车数量:=",num)
  189 +        tha.globalData.cartGoodsNum=num
  190 + },
  191 + fail: function(){}
  192 + })
  193 +
  194 +
109 195 },
110 196  
111 197 //---初始化第三方----
... ... @@ -333,6 +419,7 @@ App({
333 419  
334 420 //----智能跳转,判断 非tabBar,tabBar页面的跳转----
335 421 goto:function (url) {
  422 +
336 423 var arr_tabbar=["/pages/index/index/index","/pages/goods/categoryList/categoryList",
337 424 "/pages/goods/categoryList/categoryList?type=2",
338 425 "/pages/goods/categoryList/categoryList?type=1",
... ... @@ -340,10 +427,12 @@ App({
340 427 if(arr_tabbar.indexOf(url)!=-1){
341 428 if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1;
342 429 if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2;
343   - wx.switchTab({ url: url, }) //跳到tabbar页
  430 + wx.navigateTo({ url: url, }) //跳到tabbar页
  431 +
344 432 }else{
345 433 wx.navigateTo({ url: url, }) //跳到非tabbar页
346 434 }
  435 + //wx.navigateTo({ url: url, }) //跳到非tabbar页
347 436 },
348 437  
349 438 //显示提示,word提示内容,type 0失败,提示 1成功
... ...
app.json
... ... @@ -117,38 +117,6 @@
117 117 "backgroundColor": "#ffffff",
118 118 "enablePullDownRefresh": true
119 119 },
120   - "tabBar": {
121   - "color": "#6e6d6b",
122   - "selectedColor": "#f23030",
123   - "borderStyle": "white",
124   - "backgroundColor": "#ffffff",
125   - "list": [
126   - {
127   - "pagePath": "pages/index/index/index",
128   - "text": "首页",
129   - "iconPath": "packageA/images/bar/index.png",
130   - "selectedIconPath": "packageA/images/bar/index_on.png"
131   - },
132   - {
133   - "pagePath": "pages/goods/categoryList/categoryList",
134   - "text": "分类",
135   - "iconPath": "packageA/images/bar/fl.png",
136   - "selectedIconPath": "packageA/images/bar/fl_on.png"
137   - },
138   - {
139   - "pagePath": "pages/cart/cart/cart",
140   - "text": "购物车",
141   - "iconPath": "packageA/images/bar/car.png",
142   - "selectedIconPath": "packageA/images/bar/car_on.png"
143   - },
144   - {
145   - "pagePath": "pages/user/index/index",
146   - "text": "我的",
147   - "iconPath": "packageA/images/bar/user.png",
148   - "selectedIconPath": "packageA/images/bar/user_on.png"
149   - }
150   - ]
151   - },
152 120 "debug": false,
153 121 "sitemapLocation": "sitemap.json"
154 122 }
155 123 \ No newline at end of file
... ...
components/diy_advertising/diy_advertising.js
... ... @@ -16,9 +16,10 @@ Component({
16 16 interval:3000,
17 17 duration:1000,
18 18 someData: {},
19   - max_sw_height:null,
  19 + max_sw_height:getApp().globalData.windowWidth,
20 20 },
21 21 methods: {
  22 +
22 23 customMethod: function () { },
23 24 //---智能跳转---
24 25 go_url:function(e){
... ...
components/diy_advertising/diy_advertising.wxml
1 1 <wxs module="g_filter" src="../diy_notice/g_filter.wxs"></wxs>
2 2 <!--上下两块-->
3 3 <block wx:if='{{object.style==0}}'>
4   -<view class="zwp_s1">
  4 +<view class="zwp_s1" style="background-color: {{object.bg_color?object.bg_color:'none'}}">
5 5 <block wx:for="{{object.data}}" wx:key="{{index}}">
6   - <view class='s1'>
  6 + <view class='s1' style="padding: 0 {{object.two_side}}px">
7 7 <view class='s1_gk'>
8 8 <block wx:if="{{item.src==''}}">
9 9 <text>建议宽度640</text>
... ... @@ -80,19 +80,31 @@
80 80 </view>
81 81 <view class="clear"></view>
82 82 <!--2行三列-->
83   -<view class='s4' wx:if='{{object.style==3}}'>
  83 +<view class='s4' wx:if='{{object.style==3}}'
  84 + style="padding:0 {{object.two_side}}px;display: flex; background-color:{{object.bg_color?object.bg_color:'none'}}">
84 85  
85 86 <block wx:for="{{object.data}}" wx:key="{{index}}">
86 87  
87   - <view class='s4_gk'>
  88 + <view class='s4_gk' wx:if="{{index==0}}" style="width:{{(max_sw_height-2*object.two_side-2*object.jian_ge)/3}}px">
88 89 <block wx:if="{{item.src==''}}">
89 90 <text>200*200</text>
90 91 </block>
91 92 <block wx:if="{{item.src!=''}}">
92   - <navigator url="{{item.wxapp_imgurl}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.wxapp_imgurl,'plugin')>=0}}"><image src="{{item.src}}" ></image></navigator>
93   - <view data-url="{{item.wxapp_imgurl}}" class="s1_gk_a1" bindtap="go_url" wx:else><image src="{{item.src}}" ></image></view>
  93 + <navigator url="{{item.wxapp_imgurl}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.wxapp_imgurl,'plugin')>=0}}"><image src="{{item.src}}" mode="widthFix" ></image></navigator>
  94 + <view data-url="{{item.wxapp_imgurl}}" class="s1_gk_a1" bindtap="go_url" wx:else><image src="{{item.src}}" mode="widthFix"></image></view>
94 95 </block>
95 96 </view>
  97 +
  98 + <view class='s4_gk' wx:else style="margin-left:{{object.jian_ge}}px; width:{{(max_sw_height-2*object.two_side-2*object.jian_ge)/3}}px">
  99 + <block wx:if="{{item.src==''}}">
  100 + <text>200*200</text>
  101 + </block>
  102 + <block wx:if="{{item.src!=''}}">
  103 + <navigator url="{{item.wxapp_imgurl}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.wxapp_imgurl,'plugin')>=0}}"><image src="{{item.src}}" mode="widthFix"></image></navigator>
  104 + <view data-url="{{item.wxapp_imgurl}}" class="s1_gk_a1" bindtap="go_url" wx:else><image src="{{item.src}}" mode="widthFix"></image></view>
  105 + </block>
  106 + </view>
  107 +
96 108 </block>
97 109 </view>
98 110 <view class="clear"></view>
... ... @@ -137,10 +149,10 @@
137 149 <text>300*150</text>
138 150 </block>
139 151 <block wx:if="{{object.data[2].src!=''}}">
140   - <navigator url="{{object.data[2].wxapp_imgurl}}" open-type="switchTab" class="s1_gk_a1" wx:if="{{g_filter.has_char(object.data[2].wxapp_imgurl,'plugin')>=0}}">
  152 + <navigator url="{{object.data[2].wxapp_imgurl}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(object.data[2].wxapp_imgurl,'plugin')>=0}}">
141 153 <image src="{{object.data[2].src}}"></image>
142 154 </navigator>
143   - <view data-url="{{object.data[2].wxapp_imgurl}}" open-type="switchTab" class="s1_gk_a1" bindtap="go_url" wx:else>
  155 + <view data-url="{{object.data[2].wxapp_imgurl}}" class="s1_gk_a1" bindtap="go_url" wx:else>
144 156 <image src="{{object.data[2].src}}"></image>
145 157 </view>
146 158  
... ... @@ -388,9 +400,14 @@
388 400 <!--幻灯片-->
389 401 <block wx:if='{{object.style==4}}'>
390 402  
391   - <swiper class="swiper" indicator-dots="true" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" style="height:{{max_sw_height}}rpx" >
  403 +
  404 + <swiper class="swiper" autoplay="{{autoplay}}" current="{{object.sw_index}}"
  405 + indicator-dots="true"
  406 + indicator-color="{{object.dot_color}}"
  407 + indicator-active-color="{{object.dot_color_act}}"
  408 + interval="{{object.swiper_time?object.swiper_time*1000:interval}}" duration="{{duration}}"
  409 + style="height:{{max_sw_height}}rpx" >
392 410 <block wx:for="{{object.data}}" wx:for-index="index" >
393   -
394 411  
395 412 <navigator url="{{item.wxapp_imgurl}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.wxapp_imgurl,'plugin')>=0}}">
396 413 <swiper-item><image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" /></swiper-item>
... ... @@ -400,10 +417,10 @@
400 417 <swiper-item><image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" /></swiper-item>
401 418 </view>
402 419  
403   -
404   -
405   -
406 420 </block>
407 421 </swiper>
408 422  
  423 +
  424 +
  425 +
409 426 </block>
... ...
components/diy_advertising/diy_advertising.wxss
... ... @@ -17,7 +17,6 @@
17 17 }
18 18  
19 19 .s1 {
20   - width: 100%;
21 20 display: flex;
22 21 }
23 22  
... ... @@ -152,14 +151,10 @@
152 151  
153 152 .s4_gk {
154 153 /* background-color: rgb(129, 213, 249); */
155   - width: 32%;
156 154 color: #fff;
157 155 font-size: 32rpx;
158   - height: 240rpx;
159 156 text-align: center;
160   - margin-left: 1%;
161 157 float: left;
162   - margin-bottom: 8rpx;
163 158 }
164 159  
165 160 .s4_gk1 {
... ... @@ -331,8 +326,8 @@
331 326 width: 100%;
332 327 margin: 0;
333 328 }
334   -
335   -
336   -.zwp_s1{
337   - margin-bottom: 8rpx;
338   -}
339 329 \ No newline at end of file
  330 +.sw_con{
  331 + position: relative;
  332 +}
  333 +.clicle{ width: 20rpx; height: 20rpx}
  334 +.dots{ position: absolute; bottom: 10rpx; width: 100%; display: flex; justify-content: center}
... ...
pages/cart/cart/cart.js
... ... @@ -55,11 +55,9 @@ Page({
55 55 },
56 56 onShow: function() {
57 57 var th = this;
58   - //th.setData({
59   - // isTabBar: getApp().globalData.isTabBar,
60   - //});
61   -
62   - t.editTabBar(); //显示自定义的底部导航
  58 + //调用底部导航
  59 + t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
  60 +
63 61 this.getCardList();
64 62 if(getApp().globalData.user_id) getApp().requestCardNum();
65 63 //--获取是否又秒杀活动--
... ... @@ -81,6 +79,12 @@ Page({
81 79  
82 80 },
83 81  
  82 + onHide(){
  83 + for(var i = 1; i < 100; i++) {
  84 + clearInterval(i);
  85 + }
  86 + },
  87 +
84 88 //-------------获取购物车列表,要安装门店进行分类订单-----------
85 89 getCardList: function() {
86 90 var th = this;
... ... @@ -1102,7 +1106,7 @@ Page({
1102 1106 },
1103 1107 //跳到首页
1104 1108 goto: function(e) {
1105   - wx.switchTab({
  1109 + navigateTo({
1106 1110 url: '/pages/index/index/index',
1107 1111 })
1108 1112 },
... ...
pages/cart/cart/cart.wxml
... ... @@ -180,10 +180,6 @@
180 180 </view>
181 181  
182 182  
183   -
184   -
185 183 <warn id="warn"></warn>
186   -<!-- <view wx:if="{{isTabBar == true}}">
187   - <import src="../../tabbar/tabbar.wxml" />
188   - <template is="tabBar" data="{{tabBar}}" />
189   -</view> -->
190 184 \ No newline at end of file
  185 +<import src="../../tabbar/tabbar.wxml" />
  186 +<template is="tabBar" data="{{tabBar}}" />
191 187 \ No newline at end of file
... ...
pages/cart/cart/cart.wxss
... ... @@ -31,7 +31,7 @@ page {
31 31 align-items: center;
32 32 justify-content: center;
33 33 background-color: rgb(255, 255, 255);
34   - margin-bottom: 99rpx;
  34 + margin-bottom: 160rpx;
35 35 }
36 36  
37 37 radio {
... ... @@ -143,7 +143,7 @@ radio {
143 143 height: 100rpx;
144 144 position: fixed;
145 145 left: 0;
146   - bottom: 0;
  146 + bottom: 45px;
147 147 font-size: 28rpx;
148 148 color: #666;
149 149 background-color: rgb(255, 255, 255);
... ...
pages/cart/cart2/cart2.js
... ... @@ -142,7 +142,7 @@ Page({
142 142 var th=this;
143 143 if (th.data.isclose==0){
144 144  
145   - wx.switchTab({
  145 + wx.navigateTo({
146 146 url: "/pages/index/index/index"
147 147 })
148 148  
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -217,7 +217,7 @@ Page({
217 217 onShow: function() {
218 218 var th=this;
219 219 if (th.data.isclose==0){
220   - wx.switchTab({
  220 + wx.navigateTo({
221 221 url: "/pages/index/index/index"
222 222 })
223 223 }else{
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -62,7 +62,7 @@ Page({
62 62 onShow: function() {
63 63 var th = this;
64 64 if (th.data.isclose == 0) {
65   - wx.switchTab({
  65 + wx.navigateTo({
66 66 url: "/pages/index/index/index"
67 67 })
68 68 }
... ...
pages/goods/categoryList/categoryList.js
... ... @@ -47,13 +47,14 @@ Page({
47 47 is_pl_time:0,
48 48 requestData:null, //风格三的商品数据列表 分页
49 49 stylePage:1, //商品列表分页标识
  50 +
50 51 //风格三使用
51 52 url: t.globalData.setting.imghost,
52 53 currentPage: 1,
53 54 requestData: null,
54 55 allData: null,
55 56 openFilterModal: !1,
56   - baseUrl: "api/weshop/goods/page?1=1&orderField=goods_id&orderType=desc&is_mainshow=1&isonsale=1&store_id="+oo.stoid+"&is_recommend=1",
  57 + baseUrl: "api/weshop/goods/page?1=1&cat_id=1&parent_id=0&orderField=goods_id&orderType=desc&page=1&is_mainshow=1&isonsale=1&store_id="+oo.stoid+"&is_recommend=1",
57 58 requestUrl: "",
58 59 tabname: "goods_id", //排序的字段
59 60 adname: "desc", //升降的字段
... ... @@ -152,10 +153,8 @@ Page({
152 153  
153 154 onShow:function(){
154 155 var that=this;
155   - that.setData({
156   - isTabBar: getApp().globalData.isTabBar,
157   - });
158   - t.editTabBar(); //显示自定义的底部导航
  156 + //调用底部导航
  157 + t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url);
159 158 //this.requestFirstCategoris();
160 159 if(getApp().globalData.user_id) getApp().requestCardNum();
161 160 getApp().getConfig2(function (e) {
... ... @@ -463,9 +462,12 @@ Page({
463 462 success: function (e) {
464 463 var arr=new Array();
465 464 var dda = e.data.data.pageData;
466   - s.setData({brand_list:dda});
  465 + s.setData({brand_list:dda});
467 466 for (var i = 0; i < dda.length; i++) {
468   - if(dda[i].logo && dda[i].logo.indexOf("http")<0) dda[i].logo = oo.imghost+dda[i].logo;
  467 + //console.log(dda[i].logo)
  468 + if(dda[i].logo && dda[i].logo.indexOf("http")<0){
  469 + dda[i].logo = oo.imghost+dda[i].logo;
  470 + }
469 471 if (arr.length>0){
470 472 var find = 0;
471 473 //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素
... ... @@ -487,8 +489,15 @@ Page({
487 489 }
488 490 //进行排序
489 491 arr.sort(compare("zm"));
  492 + for(var i=0;i< arr.length;i++){
  493 + for(var j=0;j<arr[i].array.length;j++){
  494 + if(arr[i].array[j].logo == ""){
  495 + arr[i].array[j].logo= s.data.iurl+"/miniapp/images/no_brand_def.jpg";
  496 + }
  497 + }
  498 + }
490 499 s.setData({ groups: arr });
491   -
  500 + //console.log(s.data.groups)
492 501 }
493 502 });
494 503 },
... ... @@ -507,10 +516,22 @@ Page({
507 516 },
508 517 //图片失败,默认图片
509 518 bind_bnerr_pp: function (e) {
  519 + var list = this.data.groups
510 520 var _errImg = e.target.dataset.errorimg;
511   - var _errObj = {};
512   - _errObj[_errImg] = this.data.iurl+"/miniapp/images/no_brand_def.jpg\n";
513   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  521 + var idx = e.target.dataset.idx;
  522 + var pix = e.target.dataset.pix;
  523 + // for(var i=0;i< list.length;i++){
  524 + // for(var j=0;j<list[i].array.length;j++){
  525 + // if(list[i].array[j].logo == ""){
  526 + // list[i].array[j].logo= this.data.iurl+"/miniapp/images/no_brand_def.jpg";
  527 + // }
  528 + // }
  529 + // }
  530 + // this.setData({groups:list})
  531 + // var _errObj = {};
  532 + // _errObj[_errImg] = this.data.iurl+"/miniapp/images/no_brand_def.jpg\n";
  533 + //console.log(this.data.groups)
  534 + //this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
514 535 },
515 536 //商品图片失败,默认图片
516 537 goods_bnerr: function (e) {
... ... @@ -534,15 +555,6 @@ Page({
534 555 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
535 556  
536 557 },
537   -
538   -
539   - //---图片失败,默认图片---
540   - bind_Goodsbnerr: function (e) {
541   - var _errImg = e.target.dataset.errorimg;
542   - var _errObj = {};
543   - _errObj[_errImg] ="/miniapp/images/default_g_img.gif";
544   - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
545   - },
546 558 // 新的版本分类点击一级分类
547 559 click_classify:function(e){
548 560 clearInterval(this.data.timer);
... ... @@ -619,7 +631,7 @@ Page({
619 631 })
620 632 },
621 633 onUnload: function () {
622   - this.destroyActivityTimer();
  634 + //this.destroyActivityTimer();
623 635 },
624 636  
625 637  
... ... @@ -688,7 +700,7 @@ Page({
688 700 // },
689 701 // 左侧更新
690 702 scrollLower: function (data) {
691   - console.log("上拉加载更多", JSON.stringify(data))
  703 + //console.log("上拉加载更多", JSON.stringify(data))
692 704 var that = this;
693 705 clearInterval(that.data.timer);
694 706 that.setData({
... ... @@ -714,7 +726,7 @@ Page({
714 726 s.setData({
715 727 msgStatus: false,
716 728 });
717   - //如果有数据 断分页为第一页的时候直接渲染数据
  729 + //如果有数据 断分页为第一页的时候直接渲染数据
718 730 if (page > 1) {
719 731 //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面
720 732 var arr = s.data.requestData
... ... @@ -765,46 +777,43 @@ Page({
765 777 countDownNum: countDownNum,
766 778 requestData: []
767 779 });
768   - s.setData({
769   - timer:setInterval(function () {
770   - if (countDownNum == 0) {
771   - clearInterval(s.data.timer);
772   - //关闭定时器之后,可作其他处理
773   - s.setData({
774   - msgStatus: false,
775   - })
776   -
777   - //如果没有数据就把分页初始化成第一页
778   - //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据
779   - var dataArray = s.data.one_level_classify
780   - var index = s.data.index
781   - console.log(dataArray[index + 1])
782   - if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){
783   - console.log("dataArray[index + 1] = undefined")
784   - s.setData({
785   - stylePage: 1,
786   - msgStatus: true,
787   - lastMsg: true
788   - });
789   - }else{
790   - s.setData({
791   - stylePage: 1,
792   - index: index + 1,
793   - select_classify_on: index + 1,
794   - cat_id: dataArray[index + 1]['items']['id'],
795   - classify_name: dataArray[index + 1]['items']['name']
796   - });
797   - s.style(s.data.stylePage, dataArray[index + 1]['items']['id']);
798   - }
799   -
800   - }
801   - countDownNum--;
  780 + s.data.timer=setInterval(function () {
  781 + if (countDownNum == 0) {
  782 + clearInterval(s.data.timer);
  783 + //关闭定时器之后,可作其他处理
802 784 s.setData({
803   - countDownNum: countDownNum
  785 + msgStatus: false,
804 786 })
805   - }, 1000)
806 787  
807   - })
  788 + //如果没有数据就把分页初始化成第一页
  789 + //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据
  790 + var dataArray = s.data.one_level_classify
  791 + var index = s.data.index
  792 + console.log(dataArray[index + 1])
  793 + if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){
  794 + console.log("dataArray[index + 1] = undefined")
  795 + s.setData({
  796 + stylePage: 1,
  797 + msgStatus: true,
  798 + lastMsg: true
  799 + });
  800 + }else{
  801 + s.setData({
  802 + stylePage: 1,
  803 + index: index + 1,
  804 + select_classify_on: index + 1,
  805 + cat_id: dataArray[index + 1]['items']['id'],
  806 + classify_name: dataArray[index + 1]['items']['name']
  807 + });
  808 + s.style(s.data.stylePage, dataArray[index + 1]['items']['id']);
  809 + }
  810 +
  811 + }
  812 + countDownNum--;
  813 + s.setData({
  814 + countDownNum: countDownNum
  815 + })
  816 + }, 1000)
808 817 }
809 818  
810 819  
... ...
pages/goods/categoryList/categoryList.wxml
... ... @@ -19,7 +19,7 @@
19 19 </view>
20 20 </view>
21 21 <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}">
22   - <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;">
  22 + <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;margin-bottom:120rpx">
23 23 <!--------分类---------->
24 24 <swiper-item >
25 25 <scroll-view scroll-y="true" class="fenlei-list"
... ... @@ -83,14 +83,14 @@
83 83 <view class="no-data" wx:if="{{!is_date}}">
84 84 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
85 85 <view class="no-data-title">暂无分类</view>
86   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  86 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
87 87 </view>
88 88 </block>
89 89 <block wx:elif="{{is_do}}">
90 90 <view class="no-data" >
91 91 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
92 92 <view class="no-data-title">商家暂未设置分类</view>
93   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  93 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
94 94 </view>
95 95 </block>
96 96 </block>
... ... @@ -112,11 +112,12 @@
112 112 <input bindfocus="goseach" class="search-cont" placeholder="搜索你想要的生活" type="text"></input>
113 113 </view>
114 114 </view>
  115 +
115 116 <!-- 分类项目内容 -->
116   - <view class="flex project_height" style="margin-left:-10rpx">
  117 + <view class="flex project_height" style="margin-left:-10rpx;margin-bottom:120rpx">
117 118 <!-- 分类项目的类型 -->
118   - <view class="project_type">
119   - <view class="project_type-frame">
  119 + <view class="project_type" style="background-color:#eee">
  120 + <view class="project_type-frame" style="margin-bottom:120rpx">
120 121 <view wx:if="{{is_show_gb}}">
121 122 <view bindtap="click_classify" class="share_type fs30 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}">
122 123 <text>国</text><text>家</text>
... ... @@ -184,11 +185,11 @@
184 185 <view class="classify_content-frame flex flex-wrap">
185 186  
186 187 <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx">
187   - <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" >
  188 + <view class="brand_img_frame" wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" >
188 189  
189 190 <view class="brand_img t-c">
190   - <image class=" brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image>
191   - <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view>
  191 + <image class="brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image>
  192 + <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view>
192 193 </view>
193 194 </view>
194 195  
... ... @@ -260,7 +261,7 @@
260 261 <view class="no-data" >
261 262 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
262 263 <view class="no-data-title">商家暂未设置分类</view>
263   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  264 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
264 265 </view>
265 266 </block>
266 267  
... ... @@ -287,8 +288,8 @@
287 288 <!-- 分类项目内容 -->
288 289 <view class="flex project_height" style="margin-left:-10rpx;">
289 290 <!-- 分类项目的类型 -->
290   - <view class="project_type" style="height:88%;overflow-y:auto;position:fixed;left:0;z-index:999999;top:120rpx;">
291   - <view class="project_type-frame" style="margin-bottom:50px;">
  291 + <view class="project_type" style="background-color:#eee;height:88%;overflow-y:auto;position:fixed;left:0;z-index:999999;top:120rpx;">
  292 + <view class="project_type-frame" style="margin-bottom:120rpx;">
292 293 <view wx:if="{{is_show_gb}}">
293 294 <view bindtap="click_classify" class="share_type fs30 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}">
294 295 <text>国</text><text>家</text>
... ... @@ -316,7 +317,7 @@
316 317 </view>
317 318 </view>
318 319 <!-- 分类项目的内容 -->
319   - <view class="classify_content" style="margin-left:26%;margin-top:60px">
  320 + <view class="classify_content" style="margin-left:27%;margin-top:130rpx">
320 321 <!-- 国家的样式 -->
321 322 <block wx:if="{{select_classify_on==223&&is_show_gb}}">
322 323 <view class="classify_name fs28 flex-space-between">
... ... @@ -349,10 +350,10 @@
349 350 <view class="classify_content-frame flex flex-wrap">
350 351  
351 352 <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx">
352   - <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" >
  353 + <view class="brand_img_frame "wx:for="{{brand_list.array}}" wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" >
353 354  
354 355 <view class="brand_img t-c">
355   - <image class=" brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image>
  356 + <image class=" brand_img" src="{{user.logo}}" data-pix="{{pidx}}" data-idx="{{idx}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image>
356 357 <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view>
357 358 </view>
358 359 </view>
... ... @@ -365,7 +366,7 @@
365 366 <block wx:if="{{is_show_pl}}">
366 367 <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}">
367 368 <view style="width:100%;height:100%;">
368   - <view class="classify_name fs28 flex-space-between" id="header" data-pid="0" data-cid="{{cat_id}}" bindtap='select_more' style="position:fixed;z-index:999999;top:65px;width:70%;background-color:#ffffff;left:26%;padding:0 10rpx;">
  369 + <view class="classify_name fs28 flex-space-between" id="header" data-pid="0" data-cid="{{cat_id}}" bindtap='select_more' style="position:fixed;z-index:999999;top:130rpx;width:70%;background-color:#ffffff;left:27%;padding:0 10rpx;">
369 370 <view class="classify_title ellipsis-1">{{classify_name}}</view>
370 371 <view class="flex select_more" >
371 372 <view class="red-co fs24" >更多</view>
... ... @@ -382,7 +383,7 @@
382 383 <view class="choice_list" style="height:{{msgStatus != true?'100%':''}}">
383 384 <navigator class="choice_item" style="margin-bottom:{{dataLength -1 == index?'100px':'0'}}" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" data-id="{{index}}" wx:key="{{index}}">
384 385 <view class="img-wrap">
385   - <image src="{{url+item.original_img}}" binderror="bind_Goodsbnerr" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image>
  386 + <image src="{{url+item.original_img}}" binderror="bind_bnerr2" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image>
386 387 </view>
387 388 <view class="item-cont">
388 389 <view class="title">{{item.goods_name}}</view>
... ... @@ -465,7 +466,7 @@
465 466 <view wx:if="{{msgStatus == true && lastMsg == false}}" class="no-data-title" style="text-align:center;margin-top:100px">
466 467 <view style="color:#444;line-height:30px;">该类别暂无推荐商品</view><view style="color:#444;line-height:30px;"> {{countDownNum}} 秒后自动跳到下一个类别</view> </view>
467 468 <view wx:elif="{{lastMsg == true && msgStatus == true}}" class="no-data-title" style="text-align:center;margin-top:100px">该类别暂无推荐商品</view>
468   - <!-- <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> -->
  469 + <!-- <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator> -->
469 470 </view>
470 471  
471 472 </scroll-view>
... ... @@ -482,12 +483,10 @@
482 483 <view class="no-data" >
483 484 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
484 485 <view class="no-data-title">商家暂未设置分类</view>
485   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  486 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
486 487 </view>
487 488 </block>
488 489  
489 490 </block>
490   -<!-- <view wx:if="{{isTabBar == true}}">
491 491 <import src="../../tabbar/tabbar.wxml" />
492   - <template is="tabBar" data="{{tabBar}}" />
493   -</view> -->
494 492 \ No newline at end of file
  493 + <template is="tabBar" data="{{tabBar}}" />
495 494 \ No newline at end of file
... ...
pages/goods/categoryList/categoryList.wxss
... ... @@ -244,15 +244,23 @@ margin: auto;
244 244 margin-top: 35rpx;
245 245 }
246 246 .select_classify{
247   - background: #d60021;
248   -border-radius: 30rpx;
249   -color: #fff;
  247 + /* 20200530 update */
  248 +/* background: #d60021; */
  249 +background:white;
  250 +/* border-radius: 30rpx; */
  251 +/* color: #fff; */
  252 +color:black;
250 253 height: 48rpx;
251 254 line-height: 45rpx;
  255 +font-weight:700;
252 256  
253 257 }
254 258 .select_classify.width80{
255   - width: 74.5%;
  259 + /* 20200530updata */
  260 + /* width: 74.5%; */
  261 + width: 100%;
  262 + height: 100rpx;
  263 + line-height: 100rpx;
256 264 }
257 265 .select_classify.width80.text-indent{
258 266 text-indent: 38rpx;
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -752,6 +752,9 @@ Page({
752 752 onUnload: function() {},
753 753 onHide: function() {
754 754 this.data.is_timer = 0;
  755 + for(var i = 1; i < 100; i++) {
  756 + clearInterval(i);
  757 + }
755 758 },
756 759 //----------三个选项按钮-----------
757 760 tabClick: function(t) {
... ... @@ -3137,7 +3140,7 @@ Page({
3137 3140 var vpath = res.path;
3138 3141 var context = wx.createCanvasContext('share');
3139 3142 //先画背景
3140   - var pg_path = "../../../images/share/share_bg.png";
  3143 + var pg_path = "/pacj/images/share/share_bg.png";
3141 3144 context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
3142 3145 //--昵称---
3143 3146 context.setFontSize(24 * unit)
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -824,7 +824,7 @@
824 824 <view>收藏</view>
825 825 </view>
826 826 <view class="shopping-cart cart-ico new_split">
827   - <navigator openType="switchTab" url="/pages/cart/cart/cart">
  827 + <navigator url="/pages/cart/cart/cart">
828 828 <image class="sc-img" src="{{iurl}}/miniapp/images/shopping-cart.png"></image>
829 829 <view class="cart-num ellipsis-1"> {{cartGoodsNum}} </view>
830 830 <view>购物车</view>
... ...
pages/goods/goodsList/goodsList.wxml
... ... @@ -127,7 +127,7 @@
127 127 <view class="no-data" wx:if="{{(!requestData||requestData.length==0) && is_go}}">
128 128 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
129 129 <view class="no-data-title">没有相关的数据</view>
130   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  130 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
131 131 </view>
132 132 </view>
133 133 <view hidden="{{!openFilterModal}}">
... ...
pages/goods/search/search.wxml
... ... @@ -110,7 +110,7 @@
110 110 <view class="no-data" wx:if="{{!requestData||requestData.length==0}}">
111 111 <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image>
112 112 <view class="no-data-title">没有相关的数据</view>
113   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  113 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
114 114 </view>
115 115 </view>
116 116 <view hidden="{{!openFilterModal}}">
... ...
pages/index/index/index.js
... ... @@ -15,6 +15,7 @@ var regeneratorRuntime = require(&#39;../../../utils/runtime.js&#39;);
15 15 var api = require('../../../api/api.js');
16 16 var d = getApp().globalData;
17 17  
  18 +
18 19 Page({
19 20 data: {
20 21 url: o.imghost,
... ... @@ -71,13 +72,12 @@ Page({
71 72 new_image: "", //新人有礼弹窗图片
72 73 new_nav: "", //新人页面跳转地址
73 74  
74   - w_holiday_pop:0
  75 + w_holiday_pop:0,
75 76  
76 77 },
77 78  
78 79 onLoad: function() {
79 80 var th = this;
80   -
81 81 //看一下商家是否开通了权益
82 82 //--初始化是否有打勾--
83 83 getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
... ... @@ -92,7 +92,7 @@ Page({
92 92 });
93 93 }
94 94 })
95   -
  95 +
96 96  
97 97 },
98 98 //关闭新用户领取广告
... ... @@ -104,42 +104,14 @@ Page({
104 104 },
105 105  
106 106 async onShow() {
107   - var th = this;
108   - //获取底部导航
109   - // await getApp().request.promiseGet("/api/weshop/storeFooter/get/"+o.stoid, {
110   -
111   - // }).then(res => {
112   - // var e = res;
113   - // console.log(e)
114   - // if(e.data.code != -1){
115   - // getApp().globalData.isTabBar = true
116   - // //console.log(JSON.parse(e))
117   - // var itemList = e.data.data.data;
118   -
119   - // itemList = JSON.parse(itemList)
120   - // for(var i=0; i<itemList.length; i++){
121   - // itemList[i]['active'] = false
122   - // }
123   - // console.log(itemList)
124   - // getApp().globalData.tabBar.backgroundColor = e.data.data.bkcolor
125   - // getApp().globalData.tabBar.selectedColor = e.data.data.fontcolor_sele
126   - // getApp().globalData.tabBar.color = e.data.data.fontcolor
127   - // getApp().globalData.tabBar.list = itemList
128   - // getApp().globalData.tabBar.iscustom = '1'
129   - // getApp().globalData.tabBar.url = "";
130   - // wx.hideTabBar({})
131   - // }else{
132   - // getApp().globalData.isTabBar = true
133   - // getApp().globalData.tabBar.iscustom = '2'
134   - // getApp().globalData.tabBar.url = th.data.url;
135   - // }
136   - // th.setData({
137   - // isTabBar: getApp().globalData.isTabBar,
138   - // });
139   - // })
140   - // console.log("isTabBar:="+getApp().globalData.isTabBar)
141   - // t.editTabBar(); //显示自定义的底部导航
142   -
  107 +
  108 + var th = this
  109 +
  110 + //调用底部导航
  111 + getApp().globalData.url=th.data.url
  112 + t.editTabBar(th,o.stoid,th.data.url);
  113 +
  114 +
143 115 if (getApp().globalData.user_id) getApp().requestCardNum();
144 116 await this.init_load();
145 117 //显示的时候要开启计时器
... ... @@ -201,13 +173,16 @@ Page({
201 173 }
202 174 })
203 175 },
204   -
205 176 //当隐藏的时候就关闭计时器
206 177 onHide: function() {
207 178 this.data.is_timer = 0;
208 179 clearInterval(this.data.pt_timer);
209 180 clearInterval(this.data.w_holiday_pop);
210 181 this.data.w_holiday_pop=0;
  182 + for(var i = 1; i < 100; i++) {
  183 + clearInterval(i);
  184 + }
  185 +
211 186 },
212 187  
213 188 //同步初始加载
... ...
pages/index/index/index.wxml
... ... @@ -69,7 +69,7 @@
69 69 </navigator>
70 70 </view>
71 71 <view class="venues_item">
72   - <navigator openType="switchTab" url="/pages/goods/categoryList/categoryList">
  72 + <navigator url="/pages/goods/categoryList/categoryList">
73 73 <image src="{{url}}/miniapp/images/index/fenlei.png"></image>
74 74 <view>全部分类</view>
75 75 </navigator>
... ... @@ -246,7 +246,7 @@
246 246 </view>
247 247  
248 248 <!-- 好物推荐 -->
249   - <view class="title" style="margin-bottom:{{isTabBar == true ? '50px' : '0'}}">
  249 + <view class="title" style="margin-bottom:{{isIpx ? '168rpx' : '100rpx'}};">
250 250 <!-- 标题 -->
251 251 <view>
252 252 <!-- 中文名标题 -->
... ... @@ -359,9 +359,9 @@
359 359 </view>
360 360 </view>
361 361 </block>
362   -<!-- <view wx:if="{{isTabBar == true}}"> -->
363   - <!-- <import src="../../tabbar/tabbar.wxml" />
364   - <template is="tabBar" data="{{tabBar}}" /> -->
365   -<!-- </view> -->
  362 +
  363 + <import src="../../tabbar/tabbar.wxml" />
  364 + <template is="tabBar" data="{{tabBar}}"/>
  365 +
366 366  
367 367  
... ...
pages/tabbar/tabbar.js
1   -// pages/tabbar.js
2   -var d = getApp().globalData;
3   -Page({
4   -
5   - /**
6   - * 页面的初始数据
7   - */
8   - data: {
9   - isTabBar:d.isTabBar
10   - },
11   -
12   - /**
13   - * 生命周期函数--监听页面加载
14   - */
15   - onLoad: function (options) {
16   -
17   - },
18   -
19   - /**
20   - * 生命周期函数--监听页面初次渲染完成
21   - */
22   - onReady: function () {
23   -
24   - },
25   -
26   - /**
27   - * 生命周期函数--监听页面显示
28   - */
29   - onShow: function () {
30   -
31   - },
32   -
33   - /**
34   - * 生命周期函数--监听页面隐藏
35   - */
36   - onHide: function () {
37   -
38   - },
39   -
40   - /**
41   - * 生命周期函数--监听页面卸载
42   - */
43   - onUnload: function () {
44   -
45   - },
46   -
47   - /**
48   - * 页面相关事件处理函数--监听用户下拉动作
49   - */
50   - onPullDownRefresh: function () {
51   -
52   - },
53   -
54   - /**
55   - * 页面上拉触底事件的处理函数
56   - */
57   - onReachBottom: function () {
58   -
59   - },
60   -
61   - /**
62   - * 用户点击右上角分享
63   - */
64   - onShareAppMessage: function () {
65   -
66   - }
67   -})
68 0 \ No newline at end of file
pages/tabbar/tabbar.wxml
1 1 <!--pages/tabbar.wxml-->
2   -
3 2 <template name="tabBar">
4   - <view class="tab-bar" style="position:fixed;color: {{tabBar.color}}; background: {{tabBar.backgroundColor}}; {{tabBar.position=='top'? 'top: 0' : 'bottom: 0'}};width:100%;height:50px;z-index:9999999">
  3 + <!-- 如果是自定义的话 -->
  4 + <view hidden="{{tabBar.iscustom=='2'}}" class="tab-bar" style="width:100%;height:{{tabBar.isIpx ? '168rpx' : '100rpx'}};position:fixed;color: {{tabBar.color}}; background: {{tabBar.backgroundColor}}; bottom: 0;z-index:9999999;padding:2px 0;">
5 5 <block wx:for="{{tabBar.list}}" wx:key="weappurl">
6   - <navigator url="{{item.weappurl}}" bindtap="goto({{item.weappurl}})" class="tabbar_item {{item.clas}}" style="{{item.active? 'color: '+(item.selectedColor? item.selectedColor : tabBar.selectedColor) : ''}};position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
7   - <view style="width:50%;height:50%;margin-left:25%;"><image src="{{tabBar.url}}{{item.src_sele}}" wx:if="{{item.active&&item.src_sele}}" class="img" style="width:100%;height:100%"></image>
8   - <image src="{{tabBar.url}}{{item.src}}" wx:if="{{!item.active&&item.src}}" class="img" style="width:100%;height:100%"></image></view>
9   - <view style="width:100%;height:100%;"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.8rem">{{item.nav_name}}</text></view>
10   - </navigator>
  6 +
  7 + <block wx:if="{{!item.active}}">
  8 + <navigator url="{{item.weappurl}}" open-type="redirect" class="tabbar_item {{item.clas}}" style="position:relative;width:{{100 / tabBar.length}}%;height:100%;float:left;text-align:center;padding:2px 0;">
  9 + <view wx:if="{{item.nav_name=='购物车'}}" style="background-color: red;color: #fff;font-size: 20rpx;border-radius: 40rpx;width: 50rpx;height: 30rpx;padding: 5rpx;position: absolute;z-index: 100;right: 0">
  10 + {{tabBar.cartGoodsNum}}
  11 + </view>
  12 + <view style="width:35%;height:30px;margin-left:33%;">
  13 + <image src="{{item.src}}" wx:if="{{!item.active}}" mode="widthFix" class="img" style="max-width:100%;max-height:100%"></image>
  14 + </view>
  15 + <view style="height:20px;line-height:15px; position: relative; top: -15rpx"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.6rem">{{item.nav_name}}</text></view>
  16 + </navigator>
  17 + </block>
  18 + <block wx:else>
  19 + <view class="tabbar_item {{item.clas}}" style="color: {{item.selectedColor? item.selectedColor :tabBar.selectedColor}};position:relative;width:{{100 / tabBar.length}}%;height:100%;float:left;text-align:center;padding:2px 0;">
  20 + <view wx:if="{{item.nav_name=='购物车'}}" style="background-color: red;color: #fff;font-size: 20rpx;border-radius: 40rpx;width: 50rpx;height: 30rpx;padding: 5rpx;position: absolute;z-index: 100;right:0">
  21 + {{tabBar.cartGoodsNum}}
  22 + </view>
  23 + <view style="width:35%;height:30px;margin-left:33%;">
  24 + <block wx:if="{{item.active}}">
  25 + <image src="{{item.src_sele}}" mode="widthFix" class="img" style="max-width:100%;max-height:100%"></image>
  26 + </block>
  27 + <block wx:else>
  28 + <navigator url="{{item.weappurl}}">
  29 + <image src="{{item.src}}" wx:if="{{!item.active}}" mode="widthFix" class="img" style="max-width:100%;max-height:100%"></image>
  30 + </navigator>
  31 + </block>
  32 + </view>
  33 + <view style="height:20px;line-height:15px; position: relative; top: -15rpx"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.6rem">{{item.nav_name}}</text></view>
  34 + </view>
  35 + </block>
  36 +
11 37 </block>
12 38 </view>
  39 +
  40 +
  41 + <!-- 如果是默认的话 -->
  42 + <view hidden="{{tabBar.iscustom=='1'}}" class="tab-bar" style="width:100%;height:{{tabBar.isIpx ? '168rpx' : '100rpx'}};position:fixed;color:#6e6d6b; background:#ffffff; bottom: 0;z-index:9999999;padding:2px 0;">
  43 + <!-- 1 -->
  44 + <block wx:if="{{tabBar.active!='/pages/index/index/index'}}">
  45 + <navigator url="/pages/index/index/index" class="tabbar_item {{item.clas}}" open-type="redirect" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  46 + <view style="width:30%;height:57rpx;margin-left:35%;">
  47 + <image src="{{tabBar.url}}/miniapp/images/bar/index.png" class="img" style="width:100%;height:100%"></image>
  48 + </view>
  49 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">首页</text></view>
  50 + </navigator>
  51 + </block>
  52 + <block wx:else>
  53 + <view class="tabbar_item {{item.clas}}" style="color:#f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  54 + <view style="width:30%;height:57rpx;margin-left:35%;">
  55 + <image src="{{tabBar.url}}/miniapp/images/bar/index_on.png" class="img" style="width:100%;height:100%"></image>
  56 + </view>
  57 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">首页</text></view>
  58 + </view>
  59 + </block>
  60 +
  61 +
  62 + <!-- 2 -->
  63 + <block wx:if="{{tabBar.active!='/pages/goods/categoryList/categoryList'}}">
  64 + <navigator url="/pages/goods/categoryList/categoryList" class="tabbar_item {{tabBar.clas}}" open-type="redirect" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  65 + <view style="width:30%;height:57rpx;margin-left:35%;">
  66 + <image src="{{tabBar.url}}/miniapp/images/bar/fl.png" class="img" style="width:100%;height:100%"></image>
  67 + </view>
  68 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" wx:if="分类" style="font-size:0.6rem">分类</text></view>
  69 + </navigator>
  70 + </block>
  71 + <block wx:else>
  72 + <view class="tabbar_item {{tabBar.clas}}" style="color:#f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  73 + <view style="width:30%;height:57rpx;margin-left:35%;">
  74 + <image src="{{tabBar.url}}/miniapp/images/bar/fl_on.png" class="img" style="width:100%;height:100%"></image>
  75 + </view>
  76 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" wx:if="分类" style="font-size:0.6rem">分类</text></view>
  77 + </view>
  78 + </block>
  79 +
  80 +
  81 + <!-- 3 -->
  82 + <block wx:if="{{tabBar.active!='/pages/cart/cart/cart'}}">
  83 + <navigator url="/pages/cart/cart/cart" open-type="redirect" class="tabbar_item {{tabBar.clas}}" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  84 + <view style="background-color: red;color: #fff;font-size: 20rpx;border-radius: 40rpx;width: 50rpx;height: 30rpx;padding: 5rpx;position: fixed;z-index: 100;left:63%">
  85 + {{tabBar.cartGoodsNum}}
  86 + </view><view style="width:30%;height:57rpx;margin-left:35%;">
  87 + <image src="{{tabBar.url}}/miniapp/images/bar/car.png" class="img" style="width:100%;height:100%"></image>
  88 + </view>
  89 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">购物车</text></view>
  90 + </navigator>
  91 + </block>
  92 + <block wx:else>
  93 + <view class="tabbar_item {{tabBar.clas}}" style="color: #f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  94 + <view style="background-color: red;color: #fff;font-size: 20rpx;border-radius: 40rpx;width: 50rpx;height: 30rpx;padding: 5rpx;position: fixed;z-index: 100;left:63%">
  95 + {{tabBar.cartGoodsNum}}
  96 + </view><view style="width:30%;height:57rpx;margin-left:35%;">
  97 + <image src="{{tabBar.url}}/miniapp/images/bar/car_on.png" class="img" style="width:100%;height:100%"></image>
  98 + </view>
  99 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">购物车</text></view>
  100 + </view>
  101 + </block>
  102 +
  103 + <!-- 4 -->
  104 + <block wx:if="{{tabBar.active!='/pages/user/index/index'}}">
  105 + <navigator url="/pages/user/index/index" open-type="redirect" class="tabbar_item {{tabBar.clas}}" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  106 + <view style="width:30%;height:57rpx;margin-left:35%;">
  107 + <image src="{{tabBar.url}}/miniapp/images/bar/user.png" class="img" style="width:100%;height:100%"></image>
  108 + </view>
  109 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">我的</text></view>
  110 + </navigator>
  111 + </block>
  112 + <block wx:else>
  113 + <view class="tabbar_item {{tabBar.clas}}" style="color: #f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;">
  114 + <view style="width:30%;height:57rpx;margin-left:35%;">
  115 + <image src="{{tabBar.url}}/miniapp/images/bar/user_on.png" class="img" style="width:100%;height:100%"></image>
  116 + </view>
  117 + <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">我的</text></view>
  118 + </view>
  119 + </block>
  120 +
  121 + </view>
13 122 </template>
... ...
pages/tabbar/tabbar.wxss
1   -/* pages/tabbar.wxss */
2 0 \ No newline at end of file
pages/team/team_show/team_show.js
... ... @@ -523,7 +523,7 @@ Page({
523 523 if(getCurrentPages()>1)
524 524 wx.navigateBack({delta: 1})
525 525 else
526   - wx.switchTab({
  526 + wx.navigateTo({
527 527 url: "/pages/index/index/index"
528 528 });
529 529 },
... ...
pages/user/binding_info/binding_info.js
... ... @@ -139,7 +139,7 @@ Page({
139 139 "function" == typeof cb && cb(e.globalData.userInfo, e.globalData.wechatUser);
140 140 e.showWarning("绑定成功");
141 141 setTimeout(function(){
142   - wx.switchTab({
  142 + wx.navigateTo({
143 143 url: '/pages/user/index/index',
144 144 })
145 145 },1000);
... ...
pages/user/collect_list/collect_list.js
... ... @@ -129,7 +129,7 @@ Page({
129 129  
130 130  
131 131 goto: function(ee) {
132   - wx.switchTab({
  132 + wx.navigateTo({
133 133 url: '/pages/index/index/index',
134 134 })
135 135 },
... ...
pages/user/comment/comment.js
... ... @@ -150,7 +150,7 @@ Page({
150 150 },
151 151 //跳到首页
152 152 goto: function(ee) {
153   - wx.switchTab({
  153 + wx.navigateTo({
154 154 url: '/pages/index/index/index',
155 155 })
156 156 },
... ...
pages/user/coupon/coupon.wxml
... ... @@ -16,7 +16,7 @@
16 16 </view>
17 17 <view class="coupon-body">
18 18 <view class="line">{{storeName}}</view>
19   - <navigator class="use-btn {{typeId!=0?'btn-disable':''}}" openType="switchTab" url="{{typeId==0?'/pages/index/index/index':''}}">{{typeId==1?'已使用':typeId==2?'已过期':'立即使用'}}</navigator>
  19 + <navigator class="use-btn {{typeId!=0?'btn-disable':''}}" url="{{typeId==0?'/pages/index/index/index':''}}">{{typeId==1?'已使用':typeId==2?'已过期':'立即使用'}}</navigator>
20 20 </view>
21 21 <view class="use-end">限{{item.deadTimeFommat}}前使用</view>
22 22 </view>
... ... @@ -24,6 +24,6 @@
24 24 <view class="no-data" wx:if="{{!coupons||coupons.length==0}}">
25 25 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
26 26 <view class="no-data-title">没有找到相关的数据</view>
27   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  27 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
28 28 </view>
29 29 </view>
... ...
pages/user/deposit/prepaid/msg/msg.js
... ... @@ -69,7 +69,7 @@ Page({
69 69 },
70 70 homepage:function(){
71 71  
72   - wx.switchTab({
  72 + wx.navigateTo({
73 73 url: "../../../../index/index/index",
74 74 })
75 75 },
... ...
pages/user/get_user_info/get_user_info.wxml
... ... @@ -2,5 +2,5 @@
2 2 <image class="cart-image"></image>
3 3 <view class="no-data-title">请先登录, 以便操作更多功能</view>
4 4 <button bindgetuserinfo="bindGetUserinfo" class="getuse_info" openType="getUserInfo">获取用户信息</button>
5   - <navigator class="similer" openType="switchTab" url="/pages/index/index/index">返回首页</navigator>
  5 + <navigator class="similer" url="/pages/index/index/index">返回首页</navigator>
6 6 </view>
... ...
pages/user/index/index.js
... ... @@ -41,7 +41,6 @@ Page({
41 41 actImg: "",
42 42 is_assistance: 0, //助力活动
43 43 ad_img:"",
44   - isshow_vip:0,
45 44 },
46 45 goto_nav: function(e) {
47 46 var th = this;
... ... @@ -79,19 +78,14 @@ Page({
79 78 onShow: function() {
80 79  
81 80 this.is_assistance();
82   - this.getPlusCardType();
83   -
84   -
85 81 var stoid = app_d.setting.stoid;
86 82 var s = this,
87 83 th = s,
88 84 need_money = 0,
89 85 cur_g_num = 0;
90   - th.setData({
91   - isTabBar: getApp().globalData.isTabBar,
92   - });
93 86  
94   - app.editTabBar(); //显示自定义的底部导航
  87 + //调用底部导航
  88 + getApp().editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
95 89 getApp().get_isbuy(th.setappdata);
96 90 if (getApp().globalData.user_id) getApp().requestCardNum();
97 91 /*------会员登录------*/
... ... @@ -329,7 +323,11 @@ Page({
329 323 /**
330 324 * 生命周期函数--监听页面隐藏
331 325 */
332   - onHide: function() {},
  326 + onHide: function() {
  327 + for(var i = 1; i < 100; i++) {
  328 + clearInterval(i);
  329 + }
  330 + },
333 331 setappdata: function(t) {
334 332 if (t.isout == 1)
335 333 wx.navigateTo({
... ... @@ -634,23 +632,9 @@ Page({
634 632  
635 633 }
636 634 })
637   - },
638   -
639   - //--- 获取卡类列表 ---
640   - getPlusCardType: function () {
641   - var storid = os.stoid;
642   - var th = this;
643   - var isshow_vip=0;
644   - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
645   - if(res.data.code==0){
646   - for(var i in res.data.data){
647   - var item=res.data.data[i];
648   - //IsStopBuy 如果是真的话,代表这个卡没有停用
649   - if(item.IsStopBuy!=true){ isshow_vip=1;break; }
650   - }
651   - th.setData({isshow_vip:isshow_vip})
652   - }
653   - })
654 635 }
655 636  
  637 +
  638 +
  639 +
656 640 })
... ...
pages/user/index/index.wxml
1   -<view class="xc-page" style="margin-bottom:{{isTabBar == true ? '50px' : '0'}}">
  1 +<view class="xc-page" style="margin-bottom:{{isIpx ? '168rpx' : '100rpx'}}">
2 2 <view class="xc-user">
3 3 <view class="xc-head rel">
4 4 <image class="xc-background" src="{{iurl}}{{ad_img?ad_img:'/miniapp/images/user_index_powder.jpg'}}">
... ... @@ -63,9 +63,6 @@
63 63 </image>
64 64  
65 65 </view>
66   -
67   - <block wx:if="{{isshow_vip}}">
68   -
69 66 <view class="xc-add-member-frame flex-level rel addplus" wx:if="{{is_dengji==2}}">
70 67 <view class="xc-add-member flex-center-around ">
71 68 <view class="flex jc-center ai-center">
... ... @@ -89,7 +86,6 @@
89 86 </view>
90 87 </view>
91 88 </view>
92   - </block>
93 89  
94 90 </view>
95 91 <view class="xc-after-sale rel">
... ... @@ -301,7 +297,5 @@
301 297 </view>
302 298  
303 299 <pop_txt id="pop_txt"></pop_txt>
304   -<!-- <view wx:if="{{isTabBar == true}}">
305 300 <import src="../../tabbar/tabbar.wxml" />
306   - <template is="tabBar" data="{{tabBar}}" />
307   -</view> -->
308 301 \ No newline at end of file
  302 + <template is="tabBar" data="{{tabBar}}" />
309 303 \ No newline at end of file
... ...
pages/user/integral/msg/msg.js
... ... @@ -68,7 +68,7 @@ Page({
68 68 },
69 69 homepage:function(){
70 70  
71   - wx.switchTab({
  71 + wx.navigateTo({
72 72 url: "../../index/index",
73 73 })
74 74 },
... ...
pages/user/member/bring/msg/msg.js
... ... @@ -63,7 +63,7 @@ Page({
63 63 },
64 64 homepage:function(){
65 65  
66   - wx.switchTab({
  66 + wx.navigateTo({
67 67 url: "../../../index/index",
68 68 })
69 69 },
... ...
pages/user/my_service/tment_details.js
... ... @@ -117,7 +117,7 @@ Page({
117 117 //跳到首页
118 118 goto: function(e) {
119 119 var th = this;
120   - wx.switchTab({
  120 + wx.navigateTo({
121 121 url: '/pages/index/index/index',
122 122 })
123 123 },
... ...
pages/user/order_list/order_list.js
... ... @@ -501,6 +501,7 @@ Page({
501 501 if (good.goods_price != gg.shop_price) isok = 0;
502 502  
503 503 }
  504 + var is_h=0;
504 505 if (!isok) {
505 506 wx.showModal({
506 507 title: '提示',
... ... @@ -728,7 +729,7 @@ Page({
728 729 },
729 730 //跳到首页
730 731 goto: function(e) {
731   - wx.switchTab({
  732 + wx.navigateTo({
732 733 url: '/pages/index/index/index',
733 734 })
734 735 },
... ...
pages/user/return_goods_list/return_goods_list.wxml
... ... @@ -24,6 +24,6 @@
24 24 <view class="no-data" wx:if="{{!list||list.length==0}}">
25 25 <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image>
26 26 <view class="no-data-title">没有找到相关的记录</view>
27   - <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator>
  27 + <navigator class="lookat" url="/pages/index/index/index"> 去逛逛 </navigator>
28 28 </view>
29 29 </view>
... ...
utils/auth.js
... ... @@ -282,7 +282,7 @@ module.exports = {
282 282 }, null, !0);
283 283 },
284 284 goHome: function() {
285   - wx.switchTab({
  285 + wx.navigateTo({
286 286 url: "/pages/index/index/index"
287 287 });
288 288 },
... ...
utils/request.js
... ... @@ -69,9 +69,9 @@ module.exports = {
69 69 var i = getApp();
70 70 return i.auth.clearAuth(), i.showWarning("正在重新登录", function() {
71 71 var t = getCurrentPages();
72   - "pages/user/index/index" != t[t.length - 1].route ? wx.switchTab({
  72 + "pages/user/index/index" != t[t.length - 1].route ? wx.navigateTo({
73 73 url: "/pages/user/index/index"
74   - }) : wx.switchTab({
  74 + }) : wx.navigateTo({
75 75 url: "/pages/index/index/index"
76 76 });
77 77 }, null, !0), !1;
... ...