bayi il y a 9 mois
Parent
commit
e1b26999be
7 fichiers modifiés avec 41 ajouts et 21 suppressions
  1. 3 0
      api/user.js
  2. 1 1
      app.js
  3. 13 6
      custom-tab-bar/index.js
  4. 15 5
      pages/editUser/index.js
  5. 3 3
      pages/editUser/index.wxml
  6. 4 4
      pages/ranking/index.wxml
  7. 2 2
      project.miniapp.json

+ 3 - 0
api/user.js

@@ -47,4 +47,7 @@ module.exports = {
     bindDevice: data => request('/v3/user/deviceCode', 'post', data),
     // 获取公众号二维码(携带用户uid)
     getWxQrcode: data => request('/v3/user/showqrcode', 'get', data),
+    // 安卓更换性别时也更换头像
+    // /wx/user/updateGender
+    updateGender: data => request('/user/updateGender', 'post', data),
 }

+ 1 - 1
app.js

@@ -42,7 +42,7 @@ App({
             }
         } else {
             let userRes = await androidLogin({
-                extOpenId: '1111',
+                extOpenId: 'test1234567',
                 channel: '3016',
                 grade: 'PRIMARY_FIRST_GRADE'
             })

+ 13 - 6
custom-tab-bar/index.js

@@ -25,7 +25,7 @@ Component({
         color: "#999999",
         selectedColor: "#32CA69",
         mask: false,
-        show:true,
+        show: true,
         listTab: [{
             "pagePath": "/pages/activity/index",
             "text": "排行榜",
@@ -60,14 +60,21 @@ Component({
     methods: {
         switchTab(e) {
             if (e.currentTarget.dataset.index != this.data.selected) {
+                const data = e.currentTarget.dataset;
+                const url = data.path;
+                // 作品页面跳转时销毁
+                if (this.data.selected == '1') {
+                    wx.reLaunch({
+                        url
+                    });
+                } else {
+                    wx.switchTab({
+                        url
+                    });
+                }
                 this.setData({
                     selected: ''
                 })
-                const data = e.currentTarget.dataset;
-                const url = data.path;
-                wx.switchTab({
-                    url
-                });
             }
         },
         toAndroidLogin() {

+ 15 - 5
pages/editUser/index.js

@@ -8,7 +8,8 @@ import {
     setUserInfo,
     exchangePhone,
     getMyInfo,
-    bindPhone
+    bindPhone,
+    updateGender
 } from '~/api/user'
 import event from '~/mixins/event'
 let storeBindings
@@ -72,7 +73,7 @@ Page({
         this.setData({
             gradeIndex
         })
-    
+
     },
     // 调用清理函数
     onUnload() {
@@ -114,10 +115,19 @@ Page({
             nickName
         })
     },
-    selectGender(e) {
-        this.setUserInfo({
-            gender:e.detail.value
+    async selectGender(e) {
+        wx.showLoading({
+            title: '提交中',
         })
+        await setUserInfo({
+            gender: e.detail.value
+        }, 'put').finally(() => {
+            wx.hideLoading()
+        })
+        let res = await updateGender({
+            gender: e.detail.value
+        })
+        this.setUser(res)
     },
     bindDateChange(e) {
         this.setUserInfo({

+ 3 - 3
pages/editUser/index.wxml

@@ -9,8 +9,8 @@
     <view class="editRow">
         <view class="name">昵称</view>
         <view class="right">
-            <input name='nickName' type="nickname" placeholder="请输入昵称" class='nickName' maxlength="9"
-                value='{{userInfo.nickName}}' bindblur='saveNickName'></input>
+            <input placeholder="请输入昵称" class='nickName' maxlength="9" value='{{userInfo.nickName}}'
+                bindblur='saveNickName'></input>
             <image class='black' src='/static/black.png'></image>
         </view>
     </view>
@@ -28,7 +28,7 @@
     <view class="editRow">
         <view class="name">生日</view>
         <view class="right">
-            <picker mode="date" value="{{filters.formatDate( userInfo.birthday, 2)  }}" bindchange="bindDateChange"
+            <picker mode="date" value="{{filters.formatDate( userInfo.birthday, 5)  }}" bindchange="bindDateChange"
                 end="2022-01-01">
                 <view class="name">{{userInfo.birthday?filters.formatDate(userInfo.birthday,2):'请选择生日' }}</view>
             </picker>

+ 4 - 4
pages/ranking/index.wxml

@@ -23,7 +23,7 @@
             <view class="ilk {{rankingType=='4'?'current tips2':''}}" data-type='4'>
                 挑战PK榜
             </view>
-          <!--   <view class="ilk {{rankingType=='2'?'current tips2':''}}" data-type='2'>
+            <!--   <view class="ilk {{rankingType=='2'?'current tips2':''}}" data-type='2'>
                 邀新榜
             </view> -->
         </view>
@@ -65,11 +65,11 @@
     </view>
     <view class="podiumList">
         <scroll-view scroll-y="true" enhanced="true" show-scrollbar="{{false}}" class="scrollBox">
-            <view class="row" wx:for="{{userList.length-3}}" wx:key="index">
+            <view class="row" wx:for="{{userList.length-3}}" wx:key="index" data-uid='{{userList[index+3].uid}}'
+                bindtap="jumpUserInfo">
                 <view class="left">
                     <view class="num">{{index+4}}</view>
-                    <image src="{{userList[index+3].avatar}}" class="avatar" bindtap="jumpUserInfo"
-                        data-uid='{{userList[index+3].uid}}' lazy-load />
+                    <image src="{{userList[index+3].avatar}}" class="avatar" lazy-load />
                     <view class="nickName textOver">
                         {{userList[index+3].nickName||userList[index+3].eid}}
                     </view>

+ 2 - 2
project.miniapp.json

@@ -1,7 +1,7 @@
 {
   "miniVersion": "v2",
   "name": "朗读小咖秀",
-  "version": "0.0.1",
+  "version": "1.0.0",
   "mini-android": {
     "channel": {
       "name": "APP_CHANNEL",
@@ -74,7 +74,7 @@
       "NSPhotoLibraryAddUsageDescription": "用于保存图片"
     }
   },
-  "versionCode": 1,
+  "versionCode": 100,
   "mini-plugin": {
     "android": [
       {