bayi 2 年 前
コミット
38d044fa78

+ 8 - 3
components/activityList/index.js

@@ -31,10 +31,14 @@ Component({
       this.setData({
         activityList
       })
+      // console.log(activityList);
       // 下面这个处理限时活动的,第一版先不上
-      /*  res.forEach((item, index) => {
-         this.activityTimeOut(item.closing, index)
-       }) */
+      // activityList.forEach((item, index) => {
+      //   if (item.bannerType == 4 && item.voucherType) {
+      //     // this.activityTimeOut(1677109150000, index)
+      //     this.activityTimeOut(item.endTime, index)
+      //   }
+      // })
     },
     jumpUserInfo({
       currentTarget
@@ -49,6 +53,7 @@ Component({
     activityTimeOut(oTime, index) {
       let inputTime = new Date(oTime)
       let dsq = setInterval(() => {
+        console.log('1');
         var nowTime = new Date();
         //把剩余时间毫秒数转化为秒
         var times = (inputTime - nowTime) / 1000;

+ 7 - 4
components/activityList/index.wxml

@@ -80,9 +80,10 @@
       <view class="footer">
         <view class="info">
           <view class="title">{{item.title}}</view>
-          <view class="time">{{filters.formatDate(item.startTime,2)}}—{{filters.formatDate(item.endTime,2)}}
+          <view class="time" wx:if="{{!item.voucherType}}">
+            {{filters.formatDate(item.startTime,2)}}—{{filters.formatDate(item.endTime,2)}}
           </view>
-          <view class="timeOut {{item.second=='00'?'closing':''}}" wx:if="{{item.second}}">距活动结束:
+          <view class="timeOut {{item.second=='00'?'closing':''}}" wx:if="{{item.voucherType}}">距活动结束:
             <view class="outNum">{{item.hour}}</view>
             <view class="outSplit">:</view>
             <view class="outNum">{{item.minute}}</view>
@@ -90,10 +91,12 @@
             <view class="outNum">{{item.second}}</view>
           </view>
         </view>
-        <view class="btn {{item.second=='00'?'closingBtn':''}}" data-info='{{item}}' bindtap="drawVoucher">立即领取
+        <view class="btn {{item.second=='00'?'closingBtn':''}}" data-info='{{item}}' bindtap="drawVoucher">
+          {{item.second=='00'?
+          '已结束':item.voucherType?'立即使用':'立即领取'}}
         </view>
       </view>
     </view> -->
   </block>
 </view>
-<Voucher id="voucher" />
+<!-- <Voucher id="voucher" /> -->

+ 6 - 7
components/voucher/index.js

@@ -29,16 +29,13 @@ Component({
     id: '',
     voucherType: ''
   },
-  pageLifetimes: {
-    show() {
-      this.getProducts()
-    },
-  },
   /**
    * 组件的方法列表
    */
   methods: {
     open(data) {
+      this.getProducts()
+
       let {
         type,
         id,
@@ -73,16 +70,17 @@ Component({
       })
     },
     async getVoucher() {
-      console.log('zz');
+      console.log('zz', this.data.voucherType);
       if (!this.data.voucherType) {
         await getVoucher({
           id: this.data.id
         })
       }
-      this.toBuy()
+      this.toBuy(this.data.voucherType == 1 ? '1001' : '1010')
     },
     //购买vip和购买次数不是一个接口 type 1001是vip,1010是次数
     async toBuy(productId) {
+      console.log(productId);
       wx.showLoading({
         title: '提交中',
         mask: true
@@ -100,6 +98,7 @@ Component({
         }).finally(() => {
           wx.hideLoading()
         })
+        console.log(res);
       } else {
         wx.hideLoading()
         wx.showToast({

+ 34 - 4
pages/follow/index.js

@@ -1,12 +1,10 @@
 import {
-  getFansList
+  getFansList,
+  setFans
 } from '~/api/user'
 import reachBottom from '~/mixins/reachBottom'
 Page({
   behaviors: [reachBottom],
-  /**
-   * 页面的初始数据
-   */
   data: {
     // 1我的关注;2我的粉丝
     currentType: 1
@@ -38,4 +36,36 @@ Page({
       url: `/pages/personal/index?uid=${uid}`,
     })
   },
+  async setFans({
+    currentTarget
+  }) {
+    if (this.data.currentType == '1') {
+      this.jumpUserInfo({
+        currentTarget
+      })
+    } else {
+      if (currentTarget.dataset.iseachother) {
+        this.jumpUserInfo({
+          currentTarget
+        })
+      } else {
+        await setFans({
+          uid: currentTarget.dataset.uid
+        })
+        let listCopy = JSON.parse(JSON.stringify(this.data.list))
+        listCopy.forEach(item => {
+          if (item.user.uid == currentTarget.dataset.uid) {
+            item.isEachOther = true
+          }
+        })
+        this.setData({
+          list: listCopy
+        })
+        wx.showToast({
+          title: '已回关',
+          icon: 'none'
+        })
+      }
+    }
+  }
 })

+ 26 - 12
pages/follow/index.less

@@ -11,7 +11,7 @@
     .type {
       padding: 10rpx 20rpx;
       color: #666;
-      font-size: 26rpx;
+      font-size: 28rpx;
     }
 
     .currentType {
@@ -49,6 +49,9 @@
         }
 
         .user-profession {
+          position: absolute;
+          bottom: -4rpx;
+          left: 17rpx;
           width: 68rpx;
           height: 24rpx;
           background: rgba(97, 202, 84, 1);
@@ -58,30 +61,41 @@
           color: rgba(255, 255, 255, 1);
           line-height: 24rpx;
           text-align: center;
-          position: absolute;
-          bottom: -4rpx;
-          left: 17rpx;
+
         }
       }
 
-      .nickName {
+      .infoBox {
+        display: flex;
+        flex-direction: column;
+        justify-content: space-around;
         margin-left: 14rpx;
         margin-top: 2rpx;
+
+        .gmtCreated {
+          font-size: 24rpx;
+          color: #888;
+        }
       }
     }
 
     .state {
-      width: 100rpx;
       text-align: center;
 
-      .stateImg {
-        width: 46rpx;
-        height: 40rpx;
+      .stateText {
+        width: 160rpx;
+        padding: 16rpx 0rpx;
+        border-radius: 50rpx;
+        font-size: 24rpx;
+      }
+
+      .already {
+        background-color: #E4EDFB;
       }
 
-      .stateText {
-        color: #686868;
-        font-size: 20rpx;
+      .yet {
+        background-color: #1BC665;
+        color: white;
       }
     }
   }

+ 12 - 8
pages/follow/index.wxml

@@ -1,22 +1,26 @@
+<wxs src="../../utils/filter.wxs" module="filters" />
+
 <view class="followBox">
   <view class="screening">
     <view class="type {{currentType==1?'currentType':''}}" data-type="1" bindtap="setType">我的关注</view>
     <view class="type {{currentType==2?'currentType':''}}" data-type="2" bindtap="setType">我的粉丝</view>
   </view>
-  <view class="follow" wx:for="{{list}}" wx:key="*this" bindtap="jumpUserInfo" data-uid='{{item.user.uid}}'>
-    <view class="userInfo">
+  <view class="follow" wx:for="{{list}}" wx:key="*this">
+    <view class="userInfo" bindtap="jumpUserInfo" data-uid='{{item.user.uid}}'>
       <view class='avatar'>
         <image class='avatar-image' src="{{ item.user.avatar }}" />
         <view class="user-profession">{{item.user.profession}}</view>
       </view>
-      <view class="nickName">
-        {{item.user.nickName||item.user.eid}}
+      <view class="infoBox">
+        <view class="nickName">
+          {{item.user.nickName||item.user.eid}}
+        </view>
+        <view class="gmtCreated">{{filters.formatDate(item.fans.gmtCreated,4)}}</view>
       </view>
     </view>
-    <view class="state">
-      <image class='stateImg'
-        src="{{currentType==1?'/static/concernback.png':item.isEachOther?'/static/concerned.png':'/static/concernRespond.png'}}" />
-      <view class="stateText">{{ currentType==1?'已关注':item.isEachOther?'互相关注':'回关'}}</view>
+    <view class="state" data-uid='{{item.user.uid}}' data-isEachOther="{{item.isEachOther}}" bindtap="setFans">
+      <view class="stateText {{currentType==1||item.isEachOther?'already':'yet'}}">{{
+        currentType==1?'已关注':item.isEachOther?'互相关注':'回关'}}</view>
     </view>
   </view>
   <emptyBg wx:if="{{nullList}}" message='快去寻找小伙伴吧!' />

+ 23 - 12
pages/follow/index.wxss

@@ -11,7 +11,7 @@
 .followBox .screening .type {
   padding: 10rpx 20rpx;
   color: #666;
-  font-size: 26rpx;
+  font-size: 28rpx;
 }
 .followBox .screening .currentType {
   color: #333;
@@ -45,6 +45,9 @@
   border: 4rpx solid #61CA54;
 }
 .followBox .follow .userInfo .avatar .user-profession {
+  position: absolute;
+  bottom: -4rpx;
+  left: 17rpx;
   width: 68rpx;
   height: 24rpx;
   background: #61ca54;
@@ -54,25 +57,33 @@
   color: #ffffff;
   line-height: 24rpx;
   text-align: center;
-  position: absolute;
-  bottom: -4rpx;
-  left: 17rpx;
 }
-.followBox .follow .userInfo .nickName {
+.followBox .follow .userInfo .infoBox {
+  display: flex;
+  flex-direction: column;
+  justify-content: space-around;
   margin-left: 14rpx;
   margin-top: 2rpx;
 }
+.followBox .follow .userInfo .infoBox .gmtCreated {
+  font-size: 24rpx;
+  color: #888;
+}
 .followBox .follow .state {
-  width: 100rpx;
   text-align: center;
 }
-.followBox .follow .state .stateImg {
-  width: 46rpx;
-  height: 40rpx;
-}
 .followBox .follow .state .stateText {
-  color: #686868;
-  font-size: 20rpx;
+  width: 160rpx;
+  padding: 16rpx 0rpx;
+  border-radius: 50rpx;
+  font-size: 24rpx;
+}
+.followBox .follow .state .already {
+  background-color: #E4EDFB;
+}
+.followBox .follow .state .yet {
+  background-color: #1BC665;
+  color: white;
 }
 .followBox .empty {
   margin-top: 200rpx;

BIN
static/concernRespond.png


BIN
static/concernback.png


BIN
static/concerned.png