Commit a0c60b15e844200f212eba5ed2bc40c77eadd55d

Authored by WXD-SEASON\season
2 parents 387befd3 5191dfd9

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

components/diy_advertising/diy_advertising.js
... ... @@ -18,6 +18,23 @@ Component({
18 18 someData: {},
19 19 max_sw_height:260,
20 20 },
  21 +
  22 + ready: function () {
  23 + var data_arr=this.properties.object.data;
  24 + var is_show=0;
  25 + for(var i in data_arr){
  26 + var item=data_arr[i];
  27 + var now=new Date();
  28 + if((!item.beg_date || now>new Date(item.beg_date))
  29 + && (!item.end_date || now<new Date(item.end_date)))
  30 + {
  31 + this.setData({is_show:1});
  32 + break;
  33 + }
  34 + }
  35 +
  36 +
  37 + },
21 38 methods: {
22 39  
23 40 customMethod: function () { },
... ...
components/diy_advertising/diy_advertising.wxml
... ... @@ -398,7 +398,7 @@
398 398 </view>
399 399  
400 400 <!--幻灯片-->
401   -<block wx:if='{{object.style==4}}'>
  401 +<block wx:if='{{object.style==4 && is_show}}'>
402 402  
403 403  
404 404 <swiper class="swiper" circular="true" autoplay="{{autoplay}}" current="{{object.sw_index}}"
... ... @@ -409,19 +409,21 @@
409 409 style="height:{{max_sw_height}}rpx" >
410 410 <block wx:for="{{object.data}}" wx:for-index="index" >
411 411  
  412 + <block wx:if="{{(!item.begin_date || g_filter.beg_time(item.begin_date) ) && (!item.end_date || g_filter.end_time(item.end_date) )}}">
412 413 <navigator url="{{item.wxapp_imgurl}}" class="s1_gk_a1" style="height:{{max_sw_height}}rpx" wx:if="{{g_filter.has_char(item.wxapp_imgurl,'plugin')>=0}}">
413 414 <swiper-item>
414 415 <image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
415   - <view class="title" wx:if="{{title}}">{{item.title}}</view>
  416 + <view class="title" wx:if="{{item.title}}">{{item.title}}</view>
416 417 </swiper-item>
417 418 </navigator>
418 419  
419 420 <view data-url="{{item.wxapp_imgurl}}" class="s1_gk_a1" style="height:{{max_sw_height}}rpx" bindtap="go_url" wx:else>
420 421 <swiper-item>
421 422 <image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
422   - <view class="title" wx:if="{{title}}">{{item.title}}</view>
  423 + <view class="title" wx:if="{{item.title}}">{{item.title}}</view>
423 424 </swiper-item>
424 425 </view>
  426 + </block>
425 427  
426 428 </block>
427 429 </swiper>
... ...
components/diy_notice/g_filter.wxs
... ... @@ -2,8 +2,28 @@ var g_filters = {
2 2 has_char:function(url,key){
3 3 if(!url) return -1;
4 4 return url.indexOf(key);
  5 + },
  6 + beg_time:function(beg_date){
  7 + var fmt1 = beg_date.substring(0, 19);
  8 + var reg = getRegExp("-", "g");
  9 + var fmt2 = fmt1.replace(reg, '/');
  10 + var t1 = getDate(fmt2);
  11 + var tnow=getDate();
  12 + if(t1<=tnow) return 1;
  13 + return 0;
  14 + },
  15 + end_time:function(end_date){
  16 + var fmt1 = end_date.substring(0, 19);
  17 + var reg = getRegExp("-", "g");
  18 + var fmt2 = fmt1.replace(reg, '/');
  19 + var t1 = getDate(fmt2);
  20 + var tnow=getDate();
  21 + if(t1>=tnow) return 1;
  22 + return 0;
5 23 }
6 24 }
7 25 module.exports = {
8   - has_char: g_filters.has_char
  26 + has_char: g_filters.has_char,
  27 + beg_time: g_filters.beg_time,
  28 + end_time: g_filters.end_time,
9 29 }
10 30 \ No newline at end of file
... ...
components/diy_scan/diy_scan.wxml
1   -<view class="scan_view" disable-scroll="true" bindtap='getScancode' style="top:{{top}}px;left:{{left}}px;" bindtouchmove="setTouchMove">
  1 +<block wx:if="{{object.bg_color}}">
  2 +<view class="scan_view" disable-scroll="true" bindtap='getScancode'
  3 + style="top:{{top}}px;left:{{left}}px; background-color:{{object.bg_color}}; opacity: 0.5 " bindtouchmove="setTouchMove">
2 4 <view style="text-align: center;">
3 5 <image class="cs-img" src="{{object.img}}"></image>
4   - <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view>
  6 + <view class="s_title" wx:if="{{object.title!=''}}">
  7 + <text wx:if="{{object.word_color}}" style="color:{{object.word_color}}">{{object.title}}</text>
  8 + <text wx:else >{{object.title}}</text>
  9 + </view>
5 10 </view>
6 11 </view>
7   -
  12 +</block>
  13 +
  14 +<block wx:else>
  15 +<view class="scan_view" disable-scroll="true" bindtap='getScancode' style="top:{{top}}px;left:{{left}}px;" bindtouchmove="setTouchMove">
  16 + <view style="text-align: center;">
  17 + <image class="cs-img" src="{{object.img}}"></image>
  18 + <view class="s_title" wx:if="{{object.title!=''}}">
  19 + <text wx:if="{{object.word_color}}" style="color:{{object.word_color}}">{{object.title}}</text>
  20 + <text wx:else>{{object.title}}</text>
  21 + </view>
  22 + </view>
  23 +</view>
  24 +</block>
... ...
pages/activity/pind_list/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + has_char:function(url,key){
  3 + if(!url) return -1;
  4 + return url.indexOf(key);
  5 + },
  6 + beg_time:function(beg_date){
  7 + var fmt1 = beg_date.substring(0, 19);
  8 + var reg = getRegExp("-", "g");
  9 + var fmt2 = fmt1.replace(reg, '/');
  10 + var t1 = getDate(fmt2);
  11 + var tnow=getDate();
  12 + if(t1<=tnow) return 1;
  13 + return 0;
  14 + },
  15 + end_time:function(end_date){
  16 + var fmt1 = end_date.substring(0, 19);
  17 + var reg = getRegExp("-", "g");
  18 + var fmt2 = fmt1.replace(reg, '/');
  19 + var t1 = getDate(fmt2);
  20 + var tnow=getDate();
  21 + if(t1>=tnow) return 1;
  22 + return 0;
  23 + }
  24 +}
  25 +module.exports = {
  26 + has_char: g_filters.has_char,
  27 + beg_time: g_filters.beg_time,
  28 + end_time: g_filters.end_time,
  29 +}
0 30 \ No newline at end of file
... ...
pages/activity/pind_list/pind_list.js
... ... @@ -44,12 +44,17 @@ Page({
44 44 }).then(res => {
45 45 if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
46 46 var a = res.data.data.pageData;
47   - var tt = {
48   - 'ad_code': os.imghost + a[0].ad_code,
49   - 'media_link': '',
50   - 'ad_weapplink':a[0].ad_weapplink
51   - };
52   - th.setData({ad_data:tt});
  47 + var narr=[];
  48 + for(var i in a){
  49 + var tt = {
  50 + 'ad_code': os.imghost + a[0].ad_code,
  51 + 'media_link': '',
  52 + 'ad_weapplink':a[0].ad_weapplink
  53 + };
  54 + narr.push(tt);
  55 + }
  56 +
  57 + th.setData({ad_data:narr});
53 58 }
54 59 })
55 60 },
... ...
pages/activity/pind_list/pind_list.wxml
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
1 2 <view class=" body_frame">
2 3  
3 4 <block wx:if="{{ad_data}}">
4   - <image mode="widthFix" src="{{ad_data.ad_code}}" style="width: 100%;"></image>
  5 + <swiper class="swiper" circular="true"
  6 + indicator-dots="true"
  7 + style="height:{{max_sw_height}}rpx" >
  8 + <block wx:for="{{ad_data}}">
  9 +
  10 + <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}">
  11 + <swiper-item>
  12 + <image src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
  13 + </swiper-item>
  14 + </navigator>
  15 +
  16 + <view data-url="{{item.ad_weapplink}}" class="s1_gk_a1" bindtap="go_url" wx:else>
  17 + <swiper-item>
  18 + <image src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
  19 + </swiper-item>
  20 + </view>
  21 +
  22 + </block>
  23 + </swiper>
5 24 </block>
6 25 <block wx:else>
7 26 <image class="xc-top-img" src="{{url}}/miniapp/images/team.jpg"></image>
... ...
pages/activity/pind_list/pind_list.wxss
... ... @@ -3,7 +3,7 @@ page{
3 3 }
4 4 .kill-list{
5 5 width: 95%;
6   - margin-top: -50rpx;
  6 + margin-top: -10rpx;
7 7 position:absolute;
8 8 left: 2.5%;
9 9  
... ...
pages/activity/seckill_list/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + has_char:function(url,key){
  3 + if(!url) return -1;
  4 + return url.indexOf(key);
  5 + },
  6 + beg_time:function(beg_date){
  7 + var fmt1 = beg_date.substring(0, 19);
  8 + var reg = getRegExp("-", "g");
  9 + var fmt2 = fmt1.replace(reg, '/');
  10 + var t1 = getDate(fmt2);
  11 + var tnow=getDate();
  12 + if(t1<=tnow) return 1;
  13 + return 0;
  14 + },
  15 + end_time:function(end_date){
  16 + var fmt1 = end_date.substring(0, 19);
  17 + var reg = getRegExp("-", "g");
  18 + var fmt2 = fmt1.replace(reg, '/');
  19 + var t1 = getDate(fmt2);
  20 + var tnow=getDate();
  21 + if(t1>=tnow) return 1;
  22 + return 0;
  23 + }
  24 +}
  25 +module.exports = {
  26 + has_char: g_filters.has_char,
  27 + beg_time: g_filters.beg_time,
  28 + end_time: g_filters.end_time,
  29 +}
0 30 \ No newline at end of file
... ...
pages/activity/seckill_list/seckill_list.js
... ... @@ -41,12 +41,16 @@ Page({
41 41 }).then(res => {
42 42 if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
43 43 var a = res.data.data.pageData;
44   - var tt = {
45   - 'ad_code': os.imghost + a[0].ad_code,
46   - 'media_link': '',
47   - 'ad_weapplink':a[0].ad_weapplink
48   - };
49   - th.setData({ad_data:tt});
  44 + var narr=[];
  45 + for(var i in a){
  46 + var tt = {
  47 + 'ad_code': os.imghost + a[0].ad_code,
  48 + 'media_link': '',
  49 + 'ad_weapplink':a[0].ad_weapplink
  50 + };
  51 + narr.push(tt);
  52 + }
  53 + th.setData({ad_data:narr});
50 54 }
51 55 })
52 56  
... ...
pages/activity/seckill_list/seckill_list.wxml
1 1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
2   -
  2 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
3 3 <view class=" body_frame">
4 4  
5 5 <block wx:if="{{ad_data}}">
6   - <image mode="widthFix" src="{{ad_data.ad_code}}" style="width: 100%;"></image>
  6 +
  7 + <swiper class="swiper" circular="true"
  8 + indicator-dots="true"
  9 + style="height:{{max_sw_height}}rpx" >
  10 + <block wx:for="{{ad_data}}">
  11 +
  12 + <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}">
  13 + <swiper-item>
  14 + <image src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
  15 + </swiper-item>
  16 + </navigator>
  17 +
  18 + <view data-url="{{item.ad_weapplink}}" class="s1_gk_a1" bindtap="go_url" wx:else>
  19 + <swiper-item>
  20 + <image src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
  21 + </swiper-item>
  22 + </view>
  23 +
  24 + </block>
  25 + </swiper>
  26 +
  27 +
7 28 </block>
8 29 <block wx:else>
9 30 <image class="xc-top-img" src="{{url}}/miniapp/images/seckill_top_img.jpg"></image>
... ...
pages/activity/seckill_list/seckill_list.wxss
... ... @@ -17,7 +17,7 @@
17 17 /* overflow-y: scroll; */
18 18 }
19 19 .seckill_list{
20   -margin-top: -50rpx;
  20 +margin-top: -10rpx;
21 21 left: 2%;
22 22 }
23 23 .seckill{
... ...
pages/cart/cart/cart.js
... ... @@ -31,6 +31,7 @@ Page({
31 31 btn_click:1,
32 32  
33 33 service_data:null,
  34 + max_sw_height:200,
34 35 },
35 36 onLoad: function() {
36 37 var a = this,ee=a;
... ... @@ -100,12 +101,16 @@ Page({
100 101 }).then(res => {
101 102 if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
102 103 var a = res.data.data.pageData;
103   - var tt = {
104   - 'ad_code': os.imghost + a[0].ad_code,
105   - 'media_link': '',
106   - 'ad_weapplink':a[0].ad_weapplink
107   - };
108   - th.setData({ad_data:tt});
  104 + var narr=[];
  105 + for(var i in a){
  106 + var tt = {
  107 + 'ad_code': os.imghost + a[i].ad_code,
  108 + 'media_link': '',
  109 + 'ad_weapplink':a[i].ad_weapplink
  110 + };
  111 + narr.push(tt);
  112 + }
  113 + th.setData({ad_data:narr});
109 114 }else{
110 115 //--获取是否又秒杀活动--
111 116 getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
... ... @@ -2038,5 +2043,19 @@ Page({
2038 2043  
2039 2044 refresh_input:function(){
2040 2045 this.data.btn_click=0;
2041   - }
  2046 + },
  2047 +
  2048 + imageLoad:function(e){
  2049 + var imgwidth = e.detail.width;
  2050 + var imgheight = e.detail.height;
  2051 + //宽高比
  2052 + var ratio = imgwidth / imgheight;
  2053 + //计算的高度值
  2054 + var viewHeight = 715 / ratio;
  2055 + var hei=this.data.max_sw_height;
  2056 +
  2057 + if (hei< viewHeight) {
  2058 + this.setData({ max_sw_height: viewHeight });
  2059 + }
  2060 + }
2042 2061 });
2043 2062 \ No newline at end of file
... ...
pages/cart/cart/cart.wxml
  1 +<wxs module="g_filter" src="g_filter.wxs"></wxs>
1 2 <!-- <import src="../../tabbar/tabbar.wxml" />
2 3 <template is="tabBar" data="{{tabBar}}" />
3 4 -->
... ... @@ -7,9 +8,30 @@
7 8 <image mode="widthFix" class="picture" src="{{iurl}}miniapp/images/stores/Seckill.png"></image>
8 9 </navigator>
9 10  
10   -<navigator bindtap="nav_goto" class="picture" data-url="{{ad_data.ad_weapplink}}" wx:if="{{ad_data}}">
11   - <image mode="widthFix" class="picture" src="{{ad_data.ad_code}}"></image>
12   -</navigator>
  11 +<block wx:if="{{ad_data}}">
  12 + <swiper class="swiper" circular="true"
  13 + indicator-dots="true"
  14 + style="height:{{max_sw_height}}rpx" >
  15 + <block wx:for="{{ad_data}}">
  16 +
  17 + <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}">
  18 + <swiper-item>
  19 + <image src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
  20 + </swiper-item>
  21 + </navigator>
  22 +
  23 + <view data-url="{{item.ad_weapplink}}" class="s1_gk_a1" bindtap="go_url" wx:else>
  24 + <swiper-item>
  25 + <image src="{{item.ad_code}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true"/>
  26 + </swiper-item>
  27 + </view>
  28 +
  29 + </block>
  30 + </swiper>
  31 +</block>
  32 +
  33 +
  34 +
13 35  
14 36  
15 37  
... ...
pages/cart/cart/cart.wxss
... ... @@ -353,3 +353,12 @@ page {
353 353 .quan_color{ background-color: #ff5306; height: 40rpx;color: #fff; padding: 0 10rpx; border-radius: 10rpx; margin-left: 10rpx}
354 354 .red_c{color:#ff5306}
355 355 .title_show{ margin: 10rpx 0 10px 0;padding: 0 20rpx}
  356 +
  357 +
  358 +.swiper image {
  359 + height: auto;
  360 + width: 100%;
  361 + margin: 0;
  362 + padding: 0;
  363 + vertical-align: top;
  364 +}
... ...
pages/cart/cart/g_filter.wxs 0 → 100644
  1 +var g_filters = {
  2 + has_char:function(url,key){
  3 + if(!url) return -1;
  4 + return url.indexOf(key);
  5 + },
  6 + beg_time:function(beg_date){
  7 + var fmt1 = beg_date.substring(0, 19);
  8 + var reg = getRegExp("-", "g");
  9 + var fmt2 = fmt1.replace(reg, '/');
  10 + var t1 = getDate(fmt2);
  11 + var tnow=getDate();
  12 + if(t1<=tnow) return 1;
  13 + return 0;
  14 + },
  15 + end_time:function(end_date){
  16 + var fmt1 = end_date.substring(0, 19);
  17 + var reg = getRegExp("-", "g");
  18 + var fmt2 = fmt1.replace(reg, '/');
  19 + var t1 = getDate(fmt2);
  20 + var tnow=getDate();
  21 + if(t1>=tnow) return 1;
  22 + return 0;
  23 + }
  24 +}
  25 +module.exports = {
  26 + has_char: g_filters.has_char,
  27 + beg_time: g_filters.beg_time,
  28 + end_time: g_filters.end_time,
  29 +}
0 30 \ No newline at end of file
... ...
utils/util.js
... ... @@ -467,6 +467,21 @@ function convert_arr_key(list,key){
467 467 })
468 468 return keyObs;
469 469 }
  470 +
  471 +function ajax_ok(res){
  472 + if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
  473 + return 1;
  474 + }
  475 + return 0;
  476 +}
  477 +function ajax_ok2(res){
  478 + if(res.data.code==0 && res.data.data && res.data.data.length>0){
  479 + return 1;
  480 + }
  481 + return 0;
  482 +}
  483 +
  484 +
470 485 module.exports = {
471 486 formatTime: function(e, r) {
472 487 var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) {
... ... @@ -574,5 +589,7 @@ module.exports = {
574 589 base64_encode:base64_encode, //64位加密
575 590 ob_to_parm:ob_to_parm ,//对象变成参数
576 591 sha1:sha1, //sha1进行签名
577   - convert_arr_key:convert_arr_key //将JS数组对象按其某个键值重组成Map对象
  592 + convert_arr_key:convert_arr_key, //将JS数组对象按其某个键值重组成Map对象
  593 + ajax_ok:ajax_ok, //将JS数组对象按其某个键值重组成Map对象
  594 + ajax_ok2:ajax_ok2 //将JS数组对象按其某个键值重组成Map对象
578 595 };
... ...