bayi před 2 roky
rodič
revize
f55a6d0f43

+ 2 - 0
components/activityList/index.js

@@ -1,3 +1,4 @@
+const app = getApp()
 import {
   getActivities
 } from '~/api/global'
@@ -15,6 +16,7 @@ Component({
     //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,7年包红包8,次数红包
     type: '4',
     activityList: [],
+    isIos: app.globalData.isIOS,
     dsqList: []
   },
   lifetimes: {

+ 1 - 1
components/activityList/index.wxml

@@ -75,7 +75,7 @@
         </view>
       </view>
     </view>
-    <view class="activityBox" wx:if="{{item.bannerType==4}}">
+    <view class="activityBox" wx:if="{{item.bannerType==4}}" wx:if="{{!isIos}}">
       <image src="{{item.icon}}" class="cover-small " />
       <view class="footer">
         <view class="info">

+ 22 - 2
pages/editUser/index.js

@@ -5,7 +5,10 @@ import {
   store
 } from '~/store/index'
 import {
-  setUserInfo
+  setUserInfo,
+  exchangePhone,
+  getMyInfo,
+  bindPhone
 } from '~/api/user'
 let storeBindings
 Page({
@@ -51,6 +54,7 @@ Page({
     })
     // 立刻更新
     this.storeBindings.updateStoreBindings()
+    console.log(this.data.userInfo);
     let {
       grade
     } = this.data.userInfo
@@ -152,5 +156,21 @@ Page({
     })
     this.setUser(res)
   },
-
+  async getPhoneNumber({
+    detail
+  }) {
+    let mobile = await exchangePhone({
+      code: detail.code
+    })
+    await bindPhone({
+      mobile
+    })
+    let userInfo = await getMyInfo()
+    this.setUser(userInfo)
+    wx.showToast({
+      title: '绑定成功!已获得7天VIP',
+      icon: "none",
+      duration: 2000
+    })
+  },
 })

+ 11 - 0
pages/editUser/index.wxml

@@ -62,6 +62,17 @@
       <image class='black' src='/static/black.png'></image>
     </view>
   </view>
+  <view class="editRow">
+    <view class="name">手机号</view>
+    <view class="right" wx:if="{{!userInfo.mobile}}">
+      <button class="resetBtn" style="font-size: 30rpx;" open-type="getPhoneNumber"
+        bindgetphonenumber="getPhoneNumber">立即绑定</button>
+      <image class='black' src='/static/black.png'></image>
+    </view>
+    <view class="right" wx:if="{{userInfo.mobile}}">
+      {{userInfo.mobile}}
+    </view>
+  </view>
   <!--    <view class="switchAccount mt40">
         切换账号
     </view> -->

+ 28 - 13
pages/my/index.js

@@ -11,6 +11,12 @@ import {
   exchangePhone,
   bindPhone
 } from '~/api/user'
+import {
+  createStoreBindings
+} from 'mobx-miniprogram-bindings'
+import {
+  store
+} from '~/store/index'
 const app = getApp()
 Page({
   data: {
@@ -23,6 +29,13 @@ Page({
   },
   onLoad() {
     this.getProducts()
+    // 手工绑定 
+    this.storeBindings = createStoreBindings(this, {
+      store,
+      actions: {
+        setUser: 'setUser'
+      }
+    })
   },
   async onShow() {
     if (typeof this.getTabBar === 'function') {
@@ -43,6 +56,7 @@ Page({
   async setUserInfo() {
     let userInfo = await getMyInfo()
     let vipTime = await getVipInfo()
+    this.setUser(userInfo.user)
     this.getTasks()
     this.setData({
       userInfo,
@@ -119,7 +133,6 @@ Page({
         setTimeout(() => {
           this.setUserInfo()
         }, 1500)
-
       },
       fail(res) {
         wx.showToast({
@@ -148,18 +161,20 @@ Page({
   async getPhoneNumber({
     detail
   }) {
-    let mobile = await exchangePhone({
-      code: detail.code
-    })
-    await bindPhone({
-      mobile
-    })
-    this.setUserInfo()
-    wx.showToast({
-      title: '绑定成功!已获得7天VIP',
-      icon: "none",
-      duration: 2000
-    })
+    if (detail.code) {
+      let mobile = await exchangePhone({
+        code: detail.code
+      })
+      await bindPhone({
+        mobile
+      })
+      this.setUserInfo()
+      wx.showToast({
+        title: '绑定成功!已获得7天VIP',
+        icon: "none",
+        duration: 2000
+      })
+    }
   },
   jump({
     currentTarget

+ 3 - 4
pages/my/index.wxml

@@ -3,7 +3,7 @@
 <view class="container seat">
   <!-- 用户信息 -->
   <view class="userBox">
-    <view class="above">
+    <view class="above" bindtap="jump" data-url="/pages/editUser/index">
       <view class="identity">
         <image class='avatar' src='{{ userInfo.user.avatar}}'></image>
         <view class="identityText">{{ userInfo.user.profession}}</view>
@@ -12,15 +12,14 @@
         <view class="uRtop">
           <view class="uRtopleft">
             <view class="nickName textOver">{{userInfo.user.nickName||'请输入昵称' }}</view>
-            <view class="gradeText textOver" bindtap="clipboar">学号:{{userInfo.user.eid}}</view>
+            <view class="gradeText textOver" catchtap="clipboar">学号:{{userInfo.user.eid}}</view>
           </view>
-          <view class="uRtopRight" bindtap="jump" data-url="/pages/editUser/index">
+          <view class="uRtopRight">
             <image class="edit" src="/static/edit_new.png" mode="" />
             <text>编辑</text>
           </view>
         </view>
       </view>
-
     </view>
     <view class="below sectionBoxs">
       <view class="sBox" bindtap='jump' data-url="/pages/follow/index">

binární
static/activity.png


binární
static/activity2.png


+ 6 - 1
utils/request.js

@@ -34,11 +34,16 @@ function request(url, method, data, oldBaseUrl = false) {
         } = result
         if (code == '200') {
           reslove(data)
-        } else if (code == '1102' || code == '1204' || code == '506') {
+        } else if (code == '1102' || code == '1204') {
           console.log(code, '<=====code1', message);
           wx.clearStorage()
         } else {
           console.log(code, '<=====code2', message);
+          wx.showToast({
+            title: message,
+            icon: "none",
+            duration: 3000
+          })
           // reject(message)
         }
       },