hank 1 năm trước cách đây
mục cha
commit
394605c0e5
3 tập tin đã thay đổi với 30 bổ sung21 xóa
  1. 2 0
      app.js
  2. 9 2
      pages/mine/mine.js
  3. 19 19
      pages/mine/mine.wxml

+ 2 - 0
app.js

@@ -63,6 +63,8 @@ App({
             console.log(res);
             wx.setStorageSync('accessToken', res.accessToken);
             this.globalData.isLogin = true;
+            this.globalData.userCode = res.userCode;
+            console.log('登录成功', this.globalData)
             resolve(res);
           }).catch(err => {
             this.globalData.isLogin = false;

+ 9 - 2
pages/mine/mine.js

@@ -1,13 +1,20 @@
 // pages/mine/mine.js
 let interstitialAd = null
 
+const app = getApp()
+
 Page({
   data: {
-
+      userInfo: {},
+      userCode: '', // 用户id
   },
 
   onLoad: function (options) {
-    this.interstitalLoad()
+    this.interstitalLoad();
+    // console.log('userCode:', app.globalData)
+    this.setData({
+      userCode:app.globalData.userCode
+    })
   },
 
   onShow() {

+ 19 - 19
pages/mine/mine.wxml

@@ -1,27 +1,27 @@
 <!--pages/mine/mine.wxml-->
 <view class="container">
-  <view class="user-section">
-    <image class="user-avatar" src="/assets/images/avatar-placeholder.jpg"></image>
-    <view class="user-info">
-      <text class="nickname">游客</text>
-      <text class="user-id">用户ID:243518916</text>
+    <view class="user-section">
+        <image class="user-avatar" src="/assets/images/avatar-placeholder.jpg"></image>
+        <view class="user-info">
+            <text class="nickname">游客</text>
+            <text class="user-id">用户ID:{{userCode}}</text>
+        </view>
     </view>
-  </view>
 
-  <view class="menu-list">
-    <view class="menu-item" bindtap="goToReadingHistory">
-      <image class="menu-icon" src="/assets/images/tabs/tab-bookshelf_active.png"></image>
-      <text class="menu-text">阅读记录</text>
-      <view class="arrow"></view>
+    <view class="menu-list">
+        <view class="menu-item" bindtap="goToReadingHistory">
+            <image class="menu-icon" src="/assets/images/tabs/tab-bookshelf_active.png"></image>
+            <text class="menu-text">阅读记录</text>
+            <view class="arrow"></view>
+        </view>
     </view>
-  </view>
 
-  <view class="bottom-info">
-    <view class="terms">
-      <text class="terms-text">用户协议</text>
-      <text class="divider">|</text>
-      <text class="terms-text">隐私政策</text>
+    <view class="bottom-info">
+        <view class="terms">
+            <text class="terms-text">用户协议</text>
+            <text class="divider">|</text>
+            <text class="terms-text">隐私政策</text>
+        </view>
+        <text class="version-text">V 3.7.25</text>
     </view>
-    <text class="version-text">V 3.7.25</text>
-  </view>
 </view>