stanley-king vor 4 Jahren
Ursprung
Commit
27b9d2f680
44 geänderte Dateien mit 541 neuen und 273 gelöschten Zeilen
  1. 1 0
      README.md
  2. 24 2
      app.js
  3. 5 4
      app.json
  4. BIN
      image/contact.png
  5. BIN
      image/feedback.jpg
  6. BIN
      image/myhome/avtor.jpg
  7. 3 13
      pages/components/blockItem/blockItem.js
  8. 1 1
      pages/components/blockItem/blockItem.wxml
  9. 4 1
      pages/components/blockList/blockList.js
  10. 1 2
      pages/components/blockList/blockList.json
  11. 21 13
      pages/components/blockList/blockList.wxml
  12. 4 1
      pages/components/blocks/home1/homeOne.js
  13. 2 1
      pages/components/blocks/home1/homeOne.wxml
  14. 0 26
      pages/components/blocks/swiper_message/swiper_message.js
  15. 0 10
      pages/components/blocks/swiper_message/swiper_message.wxml
  16. 4 2
      pages/components/kefu/kefu.wxss
  17. 78 29
      pages/components/shareDialog/shareDialog.js
  18. 3 1
      pages/components/shareDialog/shareDialog.json
  19. 5 4
      pages/components/shareDialog/shareDialog.wxml
  20. 82 0
      pages/components/swiper_message/swiper_message.js
  21. 0 0
      pages/components/swiper_message/swiper_message.json
  22. 8 0
      pages/components/swiper_message/swiper_message.wxml
  23. 11 3
      pages/components/blocks/swiper_message/swiper_message.wxss
  24. 69 57
      pages/components/wxbutton/wxbutton.js
  25. 8 8
      pages/components/wxbutton/wxbutton.wxml
  26. 31 32
      pages/home/home.js
  27. 2 1
      pages/home/home.json
  28. 6 1
      pages/home/home.wxml
  29. 24 1
      pages/index/index.js
  30. 2 1
      pages/index/index.json
  31. 4 1
      pages/index/index.wxml
  32. 1 1
      pages/myhome/myhome.js
  33. 14 14
      pages/myhome/myhome.wxml
  34. 2 1
      pages/phoneCharges/phoneCharges.json
  35. 2 23
      pages/phoneCharges/phoneCharges.wxml
  36. 1 2
      pages/postage/postage.js
  37. 2 1
      pages/postage/postage.json
  38. 3 2
      pages/postage/postage.wxml
  39. 8 0
      pages/postage/postage.wxss
  40. 74 0
      pages/sample/sample.js
  41. 3 0
      pages/sample/sample.json
  42. 10 0
      pages/sample/sample.wxml
  43. 1 0
      pages/sample/sample.wxss
  44. 17 14
      utils/WxAuthor.js

+ 1 - 0
README.md

@@ -0,0 +1 @@
+

+ 24 - 2
app.js

@@ -16,7 +16,7 @@ App({
         //     content: '配置失败,请核查',
         //   })
         // }
-
+        
         // 用户版本更新
         if (wx.canIUse("getUpdateManager")) {
             let updateManager = wx.getUpdateManager();
@@ -174,5 +174,27 @@ App({
     },
     isNullObject(obj) {
         return (Object.keys(obj).length === 0);
-    }
+    },
+    writePhotosAlbum(callback) {
+        wx.showLoading({
+            title: '加载中'
+        });
+        wx.getSetting({
+            success(res) {
+                if (!res.authSetting['scope.writePhotosAlbum']) {
+                    wx.authorize({
+                        scope: 'scope.writePhotosAlbum',
+                        success() {
+                            wx.hideLoading();
+                            if (callback) callback();
+                        }
+                    })
+                }
+                else {
+                    wx.hideLoading();
+                    if (callback) callback();
+                }
+            }
+        })
+    },
 })

+ 5 - 4
app.json

@@ -1,8 +1,9 @@
 {
- "pages": [
-   "pages/postage/postage",
-   "pages/home/home",
-  "pages/index/index",    
+ "pages": [ 
+  "pages/home/home",
+  "pages/sample/sample",    
+  "pages/postage/postage",
+  "pages/index/index",   
   "pages/ence_push/ence_push",
   "pages/postageManage/postageManage",
   "pages/address/address",

BIN
image/contact.png


BIN
image/feedback.jpg


BIN
image/myhome/avtor.jpg


+ 3 - 13
pages/components/blockItem/blockItem.js

@@ -175,19 +175,9 @@ Component({
         imgShow: true
       });
     },
-    getAuth(e) {
-      let { userInfo } = e.detail
-      if (userInfo) {
-        this.setData({
-          userInfo
-        })
-        wx.reLaunch({
-          url: '/pages/index/index'
-        });
-      }
-    },
-    handleAuth(e){
-      console.log(123)
+    onWxButtonEvent(e) {
+      console.log('blockItem onWxButtonEvent',e);
+      this.triggerEvent('wxButtonEvent', e.detail);
     }
   }
 })

+ 1 - 1
pages/components/blockItem/blockItem.wxml

@@ -44,5 +44,5 @@
 </block>
 
 <block wx:elif="{{item_data.show_type == 'wxbutton'}}">
-  <wxbutton item_data="{{item_data}}"></wxbutton>
+  <wxbutton item_data="{{item_data}}" bind:wxButtonEvent="onWxButtonEvent"></wxbutton>
 </block>

+ 4 - 1
pages/components/blockList/blockList.js

@@ -28,6 +28,9 @@ Component({
    * 组件的方法列表
    */
   methods: {
-
+    onWxButtonEvent(e) {
+      console.log('blocklist onWxButtonEvent',e);
+      this.triggerEvent('wxButtonEvent', e.detail);
+    }
   }
 })

+ 1 - 2
pages/components/blockList/blockList.json

@@ -9,7 +9,6 @@
     "home_goods": "../blocks/home_goods/home_goods",
     "homeGrid": "../blocks/homeGrid/homeGrid",
     "homeWords":"../blocks/home_words/homeWords",
-    "homeTwo":"../blocks/home2/homeTwo",
-    "swiper_message":"../blocks/swiper_message/swiper_message"
+    "homeTwo":"../blocks/home2/homeTwo"
   }
 }

+ 21 - 13
pages/components/blockList/blockList.wxml

@@ -1,15 +1,23 @@
 <view wx:key="item"  wx:for="{{prop_special}}">
-    <swiper_message wx:if="{{item.item_type == 'adv_list'}}" 
-                image_list="{{item.items}}" 
-                scale="{{item.scale}}">
-    </swiper_message>
-    <divider wx:if="{{item.item_type == 'divider'}}" items="{{item}}"></divider>
-    <homeThree wx:if="{{item.item_type == 'home3'}}" specialData="{{item}}" items="{{item.items}}"></homeThree> 
-    <homeOne wx:if="{{item.item_type == 'home1'}}" special_datas="{{special_datas}}"  items="{{item.items}}" summery="{{summery}}"></homeOne>
-    <homeOne wx:if="{{item.item_type == 'home5'}}" items="{{item.items}}"></homeOne>
-    <homeTwo wx:if="{{item.item_type == 'home2'}}" items="{{item.items}}"></homeTwo>
-    <horizon wx:if="{{item.item_type == 'horizon' || item.item_type == 'horizon_goods'}}" specialData="{{item}}" items="{{item.items}}"></horizon>
-    <home_goods wx:if="{{item.item_type == 'home_goods'}}" specialData="{{item.item_title}}" summery="{{summery}}" goods_items="{{item.items}}"></home_goods>
-    <homeGrid wx:if="{{item.item_type == 'home_grid'}}" items="{{item.items}}"></homeGrid>
-    <homeWords wx:if="{{item.item_type == 'homewords'}}" specialData="{{item.item_title}}" items="{{item.items}}"></homeWords>  
+    <carousel   wx:if="{{item.item_type == 'adv_list'}}" 
+                image_list="{{item.items}}" scale="{{item.scale}}"></carousel>
+    <divider    wx:if="{{item.item_type == 'divider'}}" 
+                items="{{item}}"></divider>
+    <homeThree  wx:if="{{item.item_type == 'home3'}}" 
+                specialData="{{item}}" items="{{item.items}}"></homeThree> 
+    <homeOne    wx:if="{{item.item_type == 'home1'}}" 
+                special_datas="{{special_datas}}" items="{{item.items}}" summery="{{summery}}" 
+                bind:wxButtonEvent='onWxButtonEvent'></homeOne>
+    <homeOne    wx:if="{{item.item_type == 'home5'}}" 
+                items="{{item.items}}"></homeOne>
+    <homeTwo    wx:if="{{item.item_type == 'home2'}}" 
+                items="{{item.items}}"></homeTwo>
+    <horizon    wx:if="{{item.item_type == 'horizon' || item.item_type == 'horizon_goods'}}" 
+                specialData="{{item}}" items="{{item.items}}"></horizon>
+    <home_goods wx:if="{{item.item_type == 'home_goods'}}" 
+                specialData="{{item.item_title}}" summery="{{summery}}" goods_items="{{item.items}}"></home_goods>
+    <homeGrid   wx:if="{{item.item_type == 'home_grid'}}" 
+                items="{{item.items}}"></homeGrid>
+    <homeWords  wx:if="{{item.item_type == 'homewords'}}" 
+                specialData="{{item.item_title}}" items="{{item.items}}"></homeWords>  
 </view>

+ 4 - 1
pages/components/blocks/home1/homeOne.js

@@ -26,6 +26,9 @@ Component({
    * 组件的方法列表
    */
   methods: {
-
+    onWxButtonEvent(e) {
+      console.log('homeOne onWxButtonEvent', e);
+      this.triggerEvent('wxButtonEvent', e.detail);
+    }
   }
 })

+ 2 - 1
pages/components/blocks/home1/homeOne.wxml

@@ -1,6 +1,7 @@
 <!--components/blocks/home1/home_one.wxml-->
 <view>
   <block wx:key="index" wx:for="{{items}}">
-      <blockItem special_datas="{{special_datas}}" summery="{{summery}}" item_data="{{item}}"></blockItem>  
+      <blockItem  special_datas="{{special_datas}}" summery="{{summery}}" item_data="{{item}}"
+                  bind:wxButtonEvent='onWxButtonEvent'></blockItem>  
   </block>
 </view>

+ 0 - 26
pages/components/blocks/swiper_message/swiper_message.js

@@ -1,26 +0,0 @@
-// pages/components/blocks/swiper_message/swiper_message.js
-Component({
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-    msgList: [
-      { url: "url", title: "公告:多地首套房贷利率上浮 热点城市渐迎零折扣时代" },
-      { url: "url", title: "公告:悦如公寓三周年生日趴邀你免费吃喝欢唱" },
-      { url: "url", title: "公告:你想和一群有志青年一起过生日嘛?" }]
-  },
-
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-
-  }
-})

+ 0 - 10
pages/components/blocks/swiper_message/swiper_message.wxml

@@ -1,10 +0,0 @@
-<!--pages/components/blocks/swiper_message/swiper_message.wxml-->
-<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000">
-  <block wx:for="{{msgList}}">
-    <navigator url="/pages/index/index?title={{item.url}}" open-type="navigate">
-      <swiper-item>
-        <view class="swiper_item">{{item.title}}</view>
-      </swiper-item>
-    </navigator>
-  </block>
-</swiper>

+ 4 - 2
pages/components/kefu/kefu.wxss

@@ -7,11 +7,13 @@
   height: 145rpx;
   padding: 0;
   margin: 0;
-  border: 0;
-  outline: 0;
+  border: none;
+  outline: none;
 }
 
 .btn-kefu image{
   width: inherit;
   height: inherit;
+  mode:aspectFit;
+  background-color: none;
 }

+ 78 - 29
pages/components/shareDialog/shareDialog.js

@@ -7,23 +7,23 @@ Component({
    * 组件的属性列表
    */
   properties: {
-    showDialog:{
-      type:Boolean,
-      value:false,
-      observer:function(newVal,oldVal){
+    showDialog: {
+      type: Boolean,
+      value: false,
+      observer: function (newVal, oldVal) {
         console.log(newVal);
         const _self = this;
         const parmas = this.properties;
-        if(newVal == true) {
-          _self.getDataTimer = setInterval(function(){
+        if (newVal == true) {
+          _self.getDataTimer = setInterval(function () {
             let goods_id = parmas.goods_id
-            if(goods_id > 0) {
+            if (goods_id > 0) {
               _self.requestData(goods_id);
             }
-          },5000)
+          }, 5000)
         }
         else {
-          if(_self.getDataTimer) {
+          if (_self.getDataTimer) {
             clearInterval(this.getDataTimer)
           }
         }
@@ -34,14 +34,14 @@ Component({
       observer() {
         console.log('observer goods_id = ', this.properties.goods_id)
         let goods_id = this.properties.goods_id
-        if(goods_id > 0) {
+        if (goods_id > 0) {
           this.requestData(goods_id);
-          this.setData({shareModel: app.cardShareInfo()})
+          this.setData({ shareModel: app.cardShareInfo() })
         }
         else {
 
         }
-      } 
+      }
     }
   },
 
@@ -49,22 +49,25 @@ Component({
    * 组件的初始数据
    */
   data: {
-    current_goodsid:0,
+    current_goodsid: 0,
     fGoodsRequesting: false,
-    tip:'', 
-    invitess:[],
-    policy:[],
-    tip_title:'',
-    tip_num:0,
-    shareModel:{}
+    tip: '',
+    invitess: [],
+    policy: [],
+    tip_title: '',
+    tip_num: 0,
+    shareModel: {},
+    mini_code:'',
+    share_code:'',
+    showRCode:false
   },
 
   pageLifetimes: {
     // 组件所在页面的生命周期函数
     show: function () {
       console.log('pageLifetimes show goods_id = ', this.properties.goods_id)
-     },
-    hide: function () { 
+    },
+    hide: function () {
       console.log('pageLifetimes hide goods_id = ', this.properties.goods_id)
     },
     resize: function () { },
@@ -104,13 +107,49 @@ Component({
       console.log('onCloseDialog');
       this.triggerEvent('closeDialog', {})
     },
-    onShareInfo(){
+    onShareInfo() {
       console.log('onShareInfo');
       this.triggerEvent('onShareInfo', {})
     },
-    requestData(goods_id)
-    {
-      console.log('requestData goods_id=',goods_id)
+    onShareFriends() {
+      console.log('onShareFriends');
+      let self = this;
+      app.writePhotosAlbum(function () {
+        console.log('starting image ...');
+        var imgSrc = self.data.share_code
+        if (imgSrc == '') {
+          return;
+        }
+        wx.showLoading();
+        wx.downloadFile({
+          url: imgSrc,
+          success: function (res) {
+            console.log(res);
+            wx.saveImageToPhotosAlbum({
+              filePath: res.tempFilePath,
+              success: function (data) {
+                wx.hideLoading();
+                wx.showModal({
+                  title: '分享到朋友圈图片已经保存到相册',
+                  confirmText: "知道了",
+                  showCancel: false,
+                  success: function (res) {
+                    console.log();
+                  }
+                })
+              },
+              fail: function (err) {
+                wx.hideLoading();
+                console.log(err);
+              }
+            });
+          }
+        });
+      });
+    },
+
+    requestData(goods_id) {
+      console.log('requestData goods_id=', goods_id)
       if (this.fGoodsRequesting) return;
 
       this.fGoodsRequesting = true
@@ -123,14 +162,24 @@ Component({
         if (res.code == 200) {
           if (res.datas) {
             let invitess = res.datas.invitess
-            let policy = res.datas.policy 
+            let policy = res.datas.policy
             let tip_title = res.datas.tip_title
             let tip_num = res.datas.tip_num
-            this.setData({ tip_title,tip_num,invitess, policy })            
+            let mini_code = res.datas.mini_code;
+            let share_code = res.datas.share_code;
+
+            this.setData({ tip_title, tip_num, invitess, policy, mini_code, share_code})
           }
         }
-        this.fGoodsRequesting = false
+        this.fGoodsRequesting = false;
       })
+    },
+    onShareFace() {
+      this.setData({ showRCode: true })
+    },
+    onCloseMiniDialog() {
+      console.log('share dialog,onCloseMiniDialog')
+      this.setData({ showRCode: false })
     }
-  }
+  }  
 })

+ 3 - 1
pages/components/shareDialog/shareDialog.json

@@ -1,4 +1,6 @@
 {
   "component": true,
-  "usingComponents": {}
+  "usingComponents": {
+    "showImage": "../components/showImage/showImage"
+  }
 }

+ 5 - 4
pages/components/shareDialog/shareDialog.wxml

@@ -1,7 +1,7 @@
 <view class="sharePopup" wx:if="{{showDialog}}">
 	<view class="shareDialog">
-    <image src="../../../image/share_bg.png" class="share_bg"></image>
-    <image src="../../../image/close_icon.png" class="close_icon" bindtap="onCloseDialog"></image>
+    	<image src="../../../image/share_bg.png" class="share_bg"></image>
+    	<image src="../../../image/close_icon.png" class="close_icon" bindtap="onCloseDialog"></image>
 		<view class="shareInfo">
 			<view class="shareInfo___top">{{tip_title}}</view>
 			<view class="shareInfo___bottom">还有<text class="num">{{tip_num}}</text>位好友待邀请</view>
@@ -21,15 +21,16 @@
 				<image src="/image/icons/wx.png"></image>
 				<text>微信好友邀请</text>
 			</button>
-			<button open-type="share" class="btn-rechargeNow" data-shareInfo="{{shareModel}}">
+			<button class="btn-rechargeNow"  catchtap="onShareFriends">
 				<image src="/image/icons/circle.png" style="height:28rpx"></image>
 				<text>分享朋友圈</text>
 			</button>
 		</view>
-		<view class="faceToFace">
+		<view class="faceToFace" catchtap="onShareFace">
 			<image src="/image/icons/Group18@2x.png" style="width:26rpx; height:25rpx"></image>
 			<text>面对面扫码邀请</text>
 			<image src="/image/icons/Path@2x.png" style="width:12rpx; height:22rpx"></image>
 		</view>
 	</view>
+	<showImage wx:if="{{showRCode}}" imageUrl="{{mini_code}}" bind:closeDialog="onCloseMiniDialog" />
 </view>

+ 82 - 0
pages/components/swiper_message/swiper_message.js

@@ -0,0 +1,82 @@
+// pages/components/blocks/swiper_message/swiper_message.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    msgList: null
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    randint(low,high) {
+      let result = low + Math.round(Math.random() * (high - low));
+      return result;
+    }
+  },
+  lifetimes: {
+    attached: function () {
+      console.log('lifetimes attached')
+      let length = 200;
+      let numset = new Set();
+      for (let index = 0; index < length; index++) {
+        let num = this.randint(0,9999);
+        numset.add(num);
+      }
+
+      let dis_phone = [5,10,15,20,25];
+      let dis_oil = [5, 10, 25, 30, 45, 50];
+      let msgs = new Array();
+
+      let nums = Array.from(numset)
+      for(let index in nums)
+      {
+        let num = nums[index];
+        let str = '' + num;
+        if(str.length == 3) {
+          str = '0' + str;
+        }
+        else if(str.length == 2) {
+          str = '00' + str;
+        }
+        else if (str.length == 1) {
+          str = '000' + str;
+        }
+        else if(str.length == 4) {
+          str = str;
+        }
+        else {
+          continue;
+        }
+
+        let stype = '';
+        let discount = 0;
+        let type = this.randint(0, 1);
+        if (type==0) {
+          stype = "油卡充值";
+          let dis = this.randint(0, dis_oil.length - 1);
+          discount = dis_oil[dis];
+        }
+        else {
+          stype = "话费充值";
+          let dis = this.randint(0, dis_phone.length - 1);
+          discount = dis_phone[dis];
+        }
+        msgs.push({phone:str,type:stype,discount:discount});
+      }
+      this.setData({ msgList: msgs});
+    },
+    detached: function () {
+      console.log('lifetimes detached')
+    },
+  },
+})

pages/components/blocks/swiper_message/swiper_message.json → pages/components/swiper_message/swiper_message.json


+ 8 - 0
pages/components/swiper_message/swiper_message.wxml

@@ -0,0 +1,8 @@
+<!--pages/components/swiper_message/swiper_message.wxml-->
+<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000">
+  <block wx:key='item' wx:for="{{msgList}}">
+    <swiper-item>
+      <text class='swiper_item'>尾号为<text class="important">{{item.phone}}</text>的用户,<text class="important">{{item.type}}</text>节省<text class="important">{{item.discount}}</text>元</text>
+    </swiper-item>
+  </block>
+</swiper>

+ 11 - 3
pages/components/blocks/swiper_message/swiper_message.wxss

@@ -1,13 +1,21 @@
 /* pages/components/blocks/swiper_message/swiper_message.wxss */
 .swiper_container {
-  height: 55rpx;
-  width: 80vw;
+  height: 50rpx;
+  width: 100%;
+  left:20px;
+  top:0px;
+  position:absolute;
+  z-index: 999;
 }
 
 .swiper_item {
-  font-size: 25rpx;
+  font-size: 30rpx;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
   letter-spacing: 2px;
+}
+
+.important{
+color: blue;
 }

+ 69 - 57
pages/components/wxbutton/wxbutton.js

@@ -5,65 +5,77 @@ const ald = require('../../../utils/ald-stat.js')
 
 let app = getApp();
 Component({
- /**
-  * 组件的属性列表
-  */
- properties: {
-    item_data: {
-        type: Object
-    }
-},
- /**
-  * 组件的初始数据
-  */
- data: {
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        item_data: {
+            type: Object
+        }
+    },
+    /**
+     * 组件的初始数据
+     */
+    data: {
 
- },
+    },
 
- created(){
-     console.log(this.properties.item_data);
- },
+    created() {
+        console.log(this.properties.item_data);
+    },
+    
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        onGetUserInfo(e) {
+            console.log('onGetUserInfo');
+            if (e.detail.errMsg == "getUserInfo:ok") {
+                wx.showLoading({title: '加载中'});
+                app.globalData.userInfo = e.detail.userInfo;
+                app.globalData.userInfo.nickname = e.detail.userInfo.nickName;
+                this.wxauthen(e)
+            }
+        },
+        wxauthen: function (eInfo) {
+            let userInfo;
+            if (app.globalData.userId.unionid) {
+                userInfo = Object.assign({}, app.globalData.userId, app.globalData.userInfo);
+            } else {
+                userInfo = eInfo.detail.userInfo;
+                let {
+                    encryptedData,
+                    iv,
+                    signature
+                } = eInfo.detail
+                userInfo = Object.assign({}, {
+                    encryptedData
+                }, {
+                    signature
+                }, {
+                    iv
+                }, userInfo)
+            }
 
- /**
-  * 组件的方法列表
-  */
- methods: {
-     onGetUserInfo(e) {
-         console.log('onGetUserInfo');
-         if (e.detail.errMsg == "getUserInfo:ok") {
-             app.globalData.userInfo = e.detail.userInfo;
-             app.globalData.userInfo.nickname = e.detail.userInfo.nickName;
-             this.wxauthen(e)
-         }
-     },
-     wxauthen: function (eInfo) {
-         let userInfo;
-         if (app.globalData.userId.unionid) {
-             userInfo = Object.assign({}, app.globalData.userId, app.globalData.userInfo);
-         }
-         else {
-             userInfo = eInfo.detail.userInfo;
-             let { encryptedData, iv, signature } = eInfo.detail
-             userInfo = Object.assign({}, { encryptedData }, { signature }, { iv }, userInfo)
-         }
+            let params = {
+                user_info: userInfo,
+                act: "login",
+                op: "wxauthen",
+                relay_id: app.globalData.relay_id,
+                channel: app.globalData.channel_num
+            }
 
-         let params = {
-             user_info: userInfo,
-             act: "login",
-             op: "wxauthen",
-             relay_id: app.globalData.relay_id,
-             channel: app.globalData.channel_num
-         }
+            let self = this;
+            getReq(app, params, function (res) {
+                if (res.code == 200) {
+                    let datas = res.datas;
+                    app.globalData.member_id = datas.member_id
+                    app.globalData.hasmobile = datas.hasmobile
+                }
 
-         let self = this;
-         getReq(app, params, function (res) {
-             if (res.code == 200) {
-                 let datas = res.datas;
-                 app.globalData.member_id = datas.member_id
-                 app.globalData.hasmobile = datas.hasmobile
-             }
-             app.switchtab('/pages/home/home') 
-         })
-     }
-   }
-})
+                self.triggerEvent('wxButtonEvent', { event_type: 'getUserInfo', authen: 'success' });
+                wx.hideLoading()
+            })
+        }
+    }
+})

+ 8 - 8
pages/components/wxbutton/wxbutton.wxml

@@ -1,37 +1,37 @@
 <!--pages/components/wxbutton/wxbutton.wxml-->
-<view wx:if="{{item_data.show_data==='getUserInfo'}}">
-	<button class="btn" bindtap="navigator" open-type="getUserInfo" bindgetuserinfo="onGetUserInfo">
+<view wx:if="{{item_data.show_data==='getUserInfo'}}"  bind:getuserinfon="onGetUserInfoParent">
+	<button class="btn" open-type="getUserInfo" bindgetuserinfo="onGetUserInfo">
 		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';">
 		</image>
 	</button>
 </view>
 <view wx:elif="{{item_data.show_data==='getPhoneNumber'}}">
 	<button class="btn" open-type="getPhoneNumber" bindgetuserinfo="onGetPhoneNumber">
-		<image bindtap="navigator" mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
+		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
 	</button>
 </view>
 <view wx:elif="{{item_data.show_data==='contact'}}">
 	<button class="btn" open-type="contact" bindgetuserinfo="onContact">
-		<image bindtap="navigator" mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
+		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
 	</button>
 </view>
 <view wx:elif="{{item_data.show_data==='share'}}">
 	<button class="btn" open-type="share" bindgetuserinfo="onShare">
-		<image bindtap="navigator" mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
+		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
 	</button>
 </view>
 <view wx:elif="{{item_data.show_data==='launchApp'}}">
 	<button class="btn" open-type="launchApp" bindgetuserinfo="onLaunchApp">
-		<image bindtap="navigator" mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
+		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
 	</button>
 </view>
 <view wx:elif="{{item_data.show_data==='openSetting'}}">
 	<button class="btn" open-type="openSetting" bindgetuserinfo="onOpenSetting">
-		<image bindtap="navigator" mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
+		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
 	</button>
 </view>
 <view wx:elif="{{item_data.show_data==='feedback'}}">
 	<button class="btn" open-type="feedback" bindgetuserinfo="onFeedback">
-		<image bindtap="navigator" mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
+		<image mode="widthFix" src="{{item_data.image}}" style="width:'100%'; height:'100%';"></image>
 	</button>
 </view>

+ 31 - 32
pages/home/home.js

@@ -21,8 +21,7 @@ Page({
     daliy_bonus: ''
   },
 
-  onShow: function () 
-  {
+  onShow: function () {
     this.closeTips()
     if (!this.data.firstLoad) {
       app.setFromSource(this.data.fromSource)
@@ -41,7 +40,7 @@ Page({
   },
 
   onLoad: function (options) {
-    console.log('onLoad options:',options)
+    console.log('onLoad options:', options)
     if (options && options.relay_id) {
       app.globalData.relay_id = options.relay_id
       console.log('options.relay_id:', options.relay_id)
@@ -68,41 +67,41 @@ Page({
     });
     let self = this;
     console.log('fromSource =' + fromSource)
-    getReq(app,{
+    getReq(app, {
       act: 'index',
       op: 'mini_index',
       page: 10,
       curpage: 1,
       from: fromSource
-    }, 
-    // getReq(app,{
-    //   act: 'special',
-    //   op: 'index',
-    //   special_id:special_id
-    // }, 
-    function (res) {
-      wx.stopPullDownRefresh()
-      if (res.code == 200) {
-        console.log(res)
-        let prop_special = res.datas.special_list;
-        let sent_down_special = prop_special.splice(0, 8);
-        self.setData({
-          surplus_special: prop_special,
-          prop_special: sent_down_special,
-          special_datas: res.datas,
-          summery: res.datas.summary,
-          firstLoad: false,
-          fromSource: app.globalData.fromSource
-        });
-      }
-      setTimeout(function () {
-        wx.hideLoading()
-      }, 1000)
-    })
+    },
+      // getReq(app,{
+      //   act: 'special',
+      //   op: 'index',
+      //   special_id:special_id
+      // }, 
+      function (res) {
+        wx.stopPullDownRefresh()
+        if (res.code == 200) {
+          console.log(res)
+          let prop_special = res.datas.special_list;
+          let sent_down_special = prop_special.splice(0, 8);
+          self.setData({
+            surplus_special: prop_special,
+            prop_special: sent_down_special,
+            special_datas: res.datas,
+            summery: res.datas.summary,
+            firstLoad: false,
+            fromSource: app.globalData.fromSource
+          });
+        }
+        setTimeout(function () {
+          wx.hideLoading()
+        }, 1000)
+      })
   },
   req_tabs() {
     let self = this
-    getReq(app,{
+    getReq(app, {
       act: 'index',
       op: 'tabs'
     }, function (res) {
@@ -159,7 +158,7 @@ Page({
     if (this.data.isSendProp) {
       return;
     }
-    
+
     let surplus_special_num = this.data.surplus_special.length;
     if (surplus_special_num > 0) {
       wx.showLoading({
@@ -186,7 +185,7 @@ Page({
       return;
     }
   },
-  onPullDownRefresh(){
+  onPullDownRefresh() {
     this.getDatas()
   }
 })

+ 2 - 1
pages/home/home.json

@@ -4,6 +4,7 @@
     "tabs" : "../components/blocks/tabs/tabs",
     "blockList" : "../components/blockList/blockList",
     "searchBox": "../components/blocks/search/search" ,
-    "bonusTips": "../components/bonusTips/bonusTips"   
+    "bonusTips": "../components/bonusTips/bonusTips",
+    "swiper_message": "../components/swiper_message/swiper_message"
   }
 }

+ 6 - 1
pages/home/home.wxml

@@ -1,6 +1,8 @@
 <!--index.wxml-->
+<swiper_message> </swiper_message>
 <view style="max-width: 750rpx;margin: auto;overflow-x: hidden;">
-  <bonusTips wx:if="{{tipsFlag}}" tipsDatas="{{tipsDatas}}" bind:closeTips="closeTips"></bonusTips>
+  
+  <!-- <bonusTips wx:if="{{tipsFlag}}" tipsDatas="{{tipsDatas}}" bind:closeTips="closeTips"></bonusTips> -->
   <!-- <view style="height: 140rpx;overflow: hidden;background:#2b2b2b;">
       <searchBox></searchBox>
       <block wx:if="{{tabs.length}}">
@@ -22,4 +24,7 @@
          class='back_top_btn' 
          src='../../image/back_top.png'>
   </image>
+  <view class="adContainer">
+    <ad unit-id="adunit-41d3f9e8918eefe8" ad-intervals="30"></ad>
+  </view>
 </view>

+ 24 - 1
pages/index/index.js

@@ -27,7 +27,7 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        console.log('onLoad options:', options)
+        console.log('index page onLoad options:', options)
         if (options && options.relay_id) {
             app.globalData.relay_id = options.relay_id
             console.log('options.relay_id:', options.relay_id)
@@ -38,6 +38,29 @@ Page({
         }
         this.getDatas(1040)
     },
+    onWxButtonEvent:function (e) {
+        console.log('index: onWxButtonEvent',e); 
+        if(e.detail.event_type == 'getUserInfo') {
+            if (e.detail.authen == 'success') {
+                wx.showModal({
+                    title: '成功领取新人券',
+                    content: '马上去使用优惠券?',
+                    cancelText: '去首页',
+                    confirmText: '加个油',
+                    success: function (res) {
+                        if (res.confirm) {
+                            app.switchtab("/pages/postage/postage");
+                        } else {
+                            app.switchtab("/pages/home/home");
+                        }
+                    }
+                })
+            }
+            else {
+                app.switchtab("/pages/home/home");
+            }
+        }
+    },
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 2 - 1
pages/index/index.json

@@ -3,6 +3,7 @@
         "tabs": "../components/blocks/tabs/tabs",
         "blockList": "../components/blockList/blockList",
         "searchBox": "../components/blocks/search/search",
-        "bonusTips": "../components/bonusTips/bonusTips"
+        "bonusTips": "../components/bonusTips/bonusTips",
+        "swiper_message": "../components/swiper_message/swiper_message"
   }
 }

+ 4 - 1
pages/index/index.wxml

@@ -1,6 +1,9 @@
 <!-- pages/index/index.wxml -->
+<swiper_message></swiper_message>
 <view style="max-width: 750rpx;margin: auto;overflow-x: hidden;">
-    <blockList prop_special="{{prop_special}}" summery="{{summery}}" special_datas="{{special_datas}}"></blockList>
+    <blockList  prop_special="{{prop_special}}" summery="{{summery}}" special_datas="{{special_datas}}"
+                bind:wxButtonEvent='onWxButtonEvent'>
+    </blockList>
     <image  bindtap='backTop' 
             style="display:{{isScroll?'block':'none'}}" 
             mode='widthFix' class='back_top_btn' src='../../image/back_top.png'></image>

+ 1 - 1
pages/myhome/myhome.js

@@ -29,7 +29,7 @@ Page({
     if(cardtype === 'invitees') {
       app.navigateto('/pages/invitees/invitees')
     }
-    else if (cardtype === 'contact') {
+    else if (cardtype === 'contact' || cardtype === 'feedback') {
 
     } 
     else {

+ 14 - 14
pages/myhome/myhome.wxml

@@ -57,22 +57,12 @@
 	</view>
 	
 	<view class="cardList">
-	<view class="card">
-		<view class="card-title" bindtap="handleMore" data-cardtype="contact">
-			<image src="/image/contactb.png" class="icon icon-phone"></image>
-			<button class="button" open-type="contact">联系客服</button>
-			<image src="/image/myhome/arrow-right.png" class="more"></image>
-		</view>
-	</view>
  	<view class="card">
 			<view class="card-title" bindtap="handleMore" data-cardtype="phone">
 				<image src="/image/phone.png" class="icon icon-phone"></image>
 				<text class="text">我的手机号</text>
 				<image src="/image/myhome/arrow-right.png" class="more"></image>
 			</view>
-			<!-- <view class="card-body">
-				<view wx:if="{{phone.card_type==='phone'}}" class="card-item bg-blue">{{phone.card_no}}</view>
-			</view> -->
 		</view>
 		<view class="card">
 			<view class="card-title" bindtap="handleMore" data-cardtype="petrochina">
@@ -90,9 +80,6 @@
 				<text class="text">我的中石化油卡</text>
 				<image src="/image/myhome/arrow-right.png" class="more"></image>
 			</view>
-			<!-- <view class="card-body">
-				<view wx:if="{{sinopec.card_type==='sinopec'}}" class="card-item bg-orange">{{sinopec.card_no}}</view>
-			</view> -->
 		</view>
 		<view class="card">
 			<view class="card-title" bindtap="handleMore" data-cardtype="invitees">
@@ -101,7 +88,20 @@
 				<image src="/image/myhome/arrow-right.png" class="more"></image>
 			</view>
 		</view>
-		
+		<view class="card">
+			<view class="card-title" bindtap="handleMore" data-cardtype="contact">
+				<image src="/image/contactb.png" class="icon icon-phone"></image>
+				<button class="button" open-type="contact">联系客服</button>
+				<image src="/image/myhome/arrow-right.png" class="more"></image>
+			</view>
+		</view>
+		<view class="card">
+			<view class="card-title" bindtap="handleMore" data-cardtype="feedback">
+				<image src="/image/feedback.jpg" class="icon icon-phone"></image>
+				<button class="button" open-type="feedback">问题反馈</button>
+				<image src="/image/myhome/arrow-right.png" class="more"></image>
+			</view>
+		</view>		
 	</view>
 </view>
 

+ 2 - 1
pages/phoneCharges/phoneCharges.json

@@ -5,6 +5,7 @@
   "navigationBarTextStyle": "black",
   "usingComponents":{
     "shareDialog":"../components/shareDialog/shareDialog",
-    "termsOfService":"../components/termsOfService/termsOfService"
+    "termsOfService":"../components/termsOfService/termsOfService",
+    "swiper_message": "../components/swiper_message/swiper_message"
   }
 }

+ 2 - 23
pages/phoneCharges/phoneCharges.wxml

@@ -55,29 +55,8 @@
 		<view class="clause">2.充值后1-10分钟左右到账,运营商将发充值成功短信至充值手机</view>
 		<view class="clause">3.如需开发票请至相应的手机运营商官方APP开取电子发票;</view>
 	</view>
-
-  <!-- <view class="rechargeGear">
-    <view class="rechargeGear-title">说明</view>
-    <view class="rechargeGear-footer">
-      <view class="rechargeNow-tips">
-        <view>1.充值后1-10分钟左右到账,运营商将发充值成功短信至充值手机</view>
-        <view>2.如需开发票请至相应的手机运营商官方APP开取电子发票</view>
-      </view>
-    </view>
-  </view> -->
-
-  
-  <!-- <view class="rechargeGear">
-    <view class="rechargeGear-title">分享福利</view>
-    <view class="rechargeGear-footer">
-      <view class="rechargeNow-tips">
-        <view>1.分享10人可享95折优惠</view>
-        <view>2.分享5人可享96折优惠</view>
-        <view>3.分享3人可享97折优惠</view>
-      </view>
-    </view>
-  </view> -->
 </view>
 
 <shareDialog showDialog="{{showShareDialog}}"  goods_id="{{goods_id}}" bind:closeDialog="onCloseShareDialog"/>
-<termsOfService show="{{showtermsOfServiceDialog}}" bind:close="onShowtermsOfServiceDialog" />
+<termsOfService show="{{showtermsOfServiceDialog}}" bind:close="onShowtermsOfServiceDialog" />
+<kefu />

+ 1 - 2
pages/postage/postage.js

@@ -202,7 +202,6 @@ Page({
       let title = '支付成功'
       app.navigateto(`/pages/special/special?special_id=${special_id}&title=${title}`)
     }, (err) => {
-
         wx.showToast({
           icon: 'none',
           title: '支付未完成,订单将在10分钟后取消...',
@@ -288,7 +287,7 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    
   },
   onShareAppMessage: function (e) {
     if(e.from == 'button') {

+ 2 - 1
pages/postage/postage.json

@@ -5,6 +5,7 @@
   "usingComponents":{
     "shareDialog":"../components/shareDialog/shareDialog",
     "termsOfService":"../components/termsOfService/termsOfService",
-    "kefu":"../components/kefu/kefu"
+    "kefu":"../components/kefu/kefu",
+    "swiper_message": "../components/swiper_message/swiper_message"
   }
 }

+ 3 - 2
pages/postage/postage.wxml

@@ -1,5 +1,6 @@
 <view class="postage">
-	<view class="tips" wx:if="{{tips}}">{{tips}}</view>
+	<swiper_message class = 'swiper'> </swiper_message>
+	<!-- <view class="tips" wx:if="{{tips}}">{{tips}}</view> -->
 	<!-- 选择油卡 -->
 	<view class="tabs" wx:if="{{tabsData.length}}">
 		<view class="tabs-title">
@@ -62,7 +63,7 @@
 
 	<view class="rechargeGear-footer">
 		<view class="btn-rechargeNow" bindtap="onShowShareDialog">
-			<text>好友助力</text>
+			<text>邀请好友助力</text>
 		</view>
 		<view class="btn-rechargeNow  btn-rechargeNow___share" bindtap="handlerRecharge">
 			<text>充值</text>

+ 8 - 0
pages/postage/postage.wxss

@@ -382,4 +382,12 @@
 
 .footerInfo text {
   color: #EE7530;
+}
+
+.swiper {
+  height: 50rpx;
+  width: 100%;
+  left:20px;
+  top:0px;
+  position:absolute;
 }

+ 74 - 0
pages/sample/sample.js

@@ -0,0 +1,74 @@
+// pages/sample/sample.js
+Page({
+
+ /**
+  * 页面的初始数据
+  */
+ data: {
+
+ },
+ handleTap1: function (event) { //点击输出outer view bindtap
+  console.log("outer view bindtap")
+ },
+ handleTap2: function (event) { //点击输出middle view
+  console.log("middle view catchtap")
+ },
+ handleTap3: function (event) { //点击输出inner view bindtap  middle view catchtap
+  console.log("inner view bindtap")
+ },
+ /**
+  * 生命周期函数--监听页面加载
+  */
+ onLoad: function (options) {
+
+ },
+
+ /**
+  * 生命周期函数--监听页面初次渲染完成
+  */
+ onReady: function () {
+
+ },
+
+ /**
+  * 生命周期函数--监听页面显示
+  */
+ onShow: function () {
+
+ },
+
+ /**
+  * 生命周期函数--监听页面隐藏
+  */
+ onHide: function () {
+
+ },
+
+ /**
+  * 生命周期函数--监听页面卸载
+  */
+ onUnload: function () {
+
+ },
+
+ /**
+  * 页面相关事件处理函数--监听用户下拉动作
+  */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+  * 页面上拉触底事件的处理函数
+  */
+ onReachBottom: function () {
+
+ },
+
+ /**
+  * 用户点击右上角分享
+  */
+ onShareAppMessage: function () {
+
+ }
+})

+ 3 - 0
pages/sample/sample.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 10 - 0
pages/sample/sample.wxml

@@ -0,0 +1,10 @@
+<!--pages/sample/sample.wxml-->
+<view id="outer" bindtap="handleTap1">
+    outer view
+    <view id="middle"  bindtap="handleTap2">
+    middle view
+    </view>
+    <view id="inner" bindtap="handleTap3">
+      inner view
+    </view>
+</view>

+ 1 - 0
pages/sample/sample.wxss

@@ -0,0 +1 @@
+/* pages/sample/sample.wxss */

+ 17 - 14
utils/WxAuthor.js

@@ -1,5 +1,5 @@
 const getReq = require('../config.js').getReq
-const api    = require('../config.js').host
+const api = require('../config.js').host
 var ald = require('./ald-stat.js')
 
 export default class WxAuthor {
@@ -15,7 +15,7 @@ export default class WxAuthor {
     this.fGetSetting = getsetting
     wx.login({
       success: res => {
-        console.log('wx.login code:',res)
+        console.log('wx.login code:', res)
         this.ministart(res.code)
       }
     })
@@ -27,7 +27,7 @@ export default class WxAuthor {
       op: "ministart",
       code
     }
-    getReq(this.target,params, res => {
+    getReq(this.target, params, res => {
       this.target.globalData.fMinistart = true
       if (res.code == 200) {
         let { openid, unionid } = res.datas
@@ -35,13 +35,13 @@ export default class WxAuthor {
           this.setId(openid, unionid)
           wx.aldstat.sendOpenid(openid)
           wx.aldPushSendOpenid(openid)
-          if(this.fGetSetting) {
+          if (this.fGetSetting) {
             this.getSetting(false)
           }
         } else {
-          if(this.fGetSetting) {
+          if (this.fGetSetting) {
             this.getSetting(true)
-          }          
+          }
         }
       }
     })
@@ -51,7 +51,7 @@ export default class WxAuthor {
     wx.getSetting({
       success: res => {
         if (res.authSetting['scope.userInfo']) {
-          console.log('wx getSetting:',res)
+          console.log('wx getSetting:', res)
           this.getUserInfo(flag)
         }
       }
@@ -87,15 +87,18 @@ export default class WxAuthor {
       relay_id: relay_id,
       channel: channel_num
     }
-    getReq(this.target,params, res => {
+    getReq(this.target, params, res => {
       if (res.code == 200) {
         this.target.globalData.member_id = res.datas.member_id
         this.target.globalData.hasmobile = res.datas.hasmobile
-                
+
         let url = this.getUrl()
-        wx.reLaunch({
-          url
-        })
+        console.log('url:',url)
+        if (url != '/pages/index/index' && url != "pages/home/home") {
+          wx.reLaunch({
+            url
+          })
+        }
       }
       else {
         wx.showToast({
@@ -109,8 +112,8 @@ export default class WxAuthor {
 
   getUrl() {
     let len = getCurrentPages().length
-    if(len < 1) return ''
-     
+    if (len < 1) return ''
+
     let currentPage = getCurrentPages()[len - 1]
     let params = ''
     if (currentPage.options) {