ソースを参照

1.排行榜跳转用户页面2.修改身份

bayi 2 年 前
コミット
9bb34c2259

+ 10 - 0
components/activityList/index.js

@@ -36,6 +36,16 @@ Component({
          this.activityTimeOut(item.closing, index)
        }) */
     },
+    jumpUserInfo({
+      currentTarget
+    }) {
+      if (!currentTarget.dataset.uid) {
+        return
+      }
+      wx.navigateTo({
+        url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
+      })
+    },
     activityTimeOut(oTime, index) {
       let inputTime = new Date(oTime)
       let dsq = setInterval(() => {

+ 12 - 7
components/activityList/index.wxml

@@ -39,26 +39,30 @@
         <view class="top">
           <view class="userBox">
             <view class="secondUser">
-              <image src="{{item.userList[1].avatar||'/static/nullAvatar.png'}}" class="avatar" />
+              <image src="{{item.userList[1].avatar||'/static/nullAvatar.png'}}" class="avatar" bindtap="jumpUserInfo"
+                data-uid='{{item.userList[1].uid}}' />
             </view>
             <view class="nickName textOver">{{item.userList[1].nickName||item.userList[1].eid}}</view>
           </view>
           <view class="userBox">
             <view class="firstUser">
-              <image src="{{item.userList[0].avatar||'/static/nullAvatar.png'}}" class="avatar" />
+              <image src="{{item.userList[0].avatar||'/static/nullAvatar.png'}}" class="avatar" bindtap="jumpUserInfo"
+                data-uid='{{item.userList[0].uid}}' />
             </view>
             <view class="nickName textOver">{{item.userList[0].nickName||item.userList[0].eid}}</view>
           </view>
           <view class="userBox">
             <view class="thirdUser">
-              <image src="{{item.userList[2].avatar||'/static/nullAvatar.png'}}" class="avatar" />
+              <image src="{{item.userList[2].avatar||'/static/nullAvatar.png'}}" class="avatar" bindtap="jumpUserInfo"
+                data-uid='{{item.userList[2].uid}}' />
             </view>
             <view class="nickName textOver">{{item.userList[2].nickName||item.userList[2].eid}}</view>
           </view>
         </view>
         <view class="btm">
           <view class="userBox" wx:for="{{5}}" wx:key="index" wx:for-item="items">
-            <image src="{{item.userList[index+3].avatar||'/static/nullAvatar.png'}}" class="avatar" />
+            <image src="{{item.userList[index+3].avatar||'/static/nullAvatar.png'}}" class="avatar"
+              bindtap="jumpUserInfo" data-uid='{{item.userList[index+3].uid}}' />
             <view class="nickName textOver">
               {{item.userList[index+3].nickName||item.userList[index+3].eid||'请你来挑战'}}
             </view>
@@ -81,7 +85,8 @@
         <view class="row" wx:for="{{3}}" wx:key="index" wx:for-item='items'>
           <view class="left">
             <image src="/static/{{index+1}}-1.png" class="stand" />
-            <image src="{{item.userList[index].avatar||'/static/nullAvatar.png'}}" class="avatar" />
+            <image src="{{item.userList[index].avatar||'/static/nullAvatar.png'}}" class="avatar" bindtap="jumpUserInfo"
+              data-uid='{{item.userList[index].uid}}' />
             <view class="nickName textOver">{{item.userList[index].nickName||item.userList[index].eid}}
             </view>
           </view>
@@ -94,7 +99,7 @@
         <!--  <view class="row">
           <view class="left">
             <image src="/static/2-1.png" class="stand" />
-            <image src="/static/play-big.png" class="avatar" />
+            <image src="/static/play-big.png" class="avatar" bindtap="jumpUserInfo" data-uid='{{userList[1].uid}}' />
             <view class="nickName textOver">樱桃小丸子</view>
           </view>
           <view class="right">
@@ -106,7 +111,7 @@
         <view class="row">
           <view class="left">
             <image src="/static/3-1.png" class="stand" />
-            <image src="/static/play-big.png" class="avatar" />
+            <image src="/static/play-big.png" class="avatar" bindtap="jumpUserInfo" data-uid='{{userList[1].uid}}' />
             <view class="nickName textOver">樱桃小丸子</view>
           </view>
           <view class="right">

+ 7 - 6
pages/editUser/index.js

@@ -101,12 +101,13 @@ Page({
     wx.showActionSheet({
       itemList: ['学生', '家长', '老师'],
       success: (res) => {
-        /*   if (res.tapIndex == this.data.userInfo.gender) {
-              return
-          }
-          this.setUserInfo({
-              gender: res.tapIndex
-          }) */
+        console.log(res);
+        if (res.tapIndex == this.data.userInfo.gender) {
+          return
+        }
+        this.setUserInfo({
+          profession: ['学生', '家长', '老师'][res.tapIndex]
+        })
       },
     })
   },

+ 1 - 1
pages/personal/index.wxml

@@ -3,7 +3,7 @@
   <view class="userBox">
     <view class="identity">
       <image class='avatar' src='{{ userInfo.user.avatar}}'></image>
-      <view class="identityText">{{ userInfo.user.profession}}</view>
+      <view class="identityText">{{userInfo.user.profession}}</view>
     </view>
     <view class="userRight">
       <view class="uRtop">

+ 3 - 0
pages/ranking/index.js

@@ -61,6 +61,9 @@ Page({
   jumpUserInfo({
     currentTarget
   }) {
+    if (!currentTarget.dataset.uid) {
+      return
+    }
     wx.navigateTo({
       url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=${this.data.rankingType==4?'pk':'user'}`,
     })