guhongwei 4 anos atrás
pai
commit
43d248573a
6 arquivos alterados com 21 adições e 32 exclusões
  1. 2 1
      app.js
  2. 2 1
      app.json
  3. 1 21
      custom-tab-bar/index.js
  4. 1 4
      pages/my/index.js
  5. 4 3
      pages/my/index.wxml
  6. 11 2
      pages/my/index.wxss

+ 2 - 1
app.js

@@ -52,7 +52,8 @@ App({
     // 手机页面高度
     windowHeight: 0,
     // 请求接口
-    publicUrl: 'http://192.168.1.19:9901',
+    // publicUrl: 'http://192.168.1.19:9901',
+    publicUrl: 'https://www.waityou24.cn',
     // 图片请求接口
     fileUrl: "http://broadcast.waityou24.cn",
     // 站点标识

+ 2 - 1
app.json

@@ -1,10 +1,11 @@
 {
   "pages": [
+    "pages/my/index",
     "pages/home/index",
     "pages/food/index",
     "pages/calorie/index",
     "pages/reserve/index",
-    "pages/my/index",
+
     "pages/history/index",
     "pages/history/detail",
     "pages/news/index",

+ 1 - 21
custom-tab-bar/index.js

@@ -34,27 +34,7 @@ Component({
   methods: {
     switchTab(e) {
       const { index, path } = e.currentTarget.dataset;
-      if (index == 3) {
-        wx.getStorage({
-          key: 'userInfo',
-          success: function (res) {
-            app.globalData.userInfo = res.data;
-            wx.switchTab({ url: path })
-          },
-          fail: function (res) {
-            wx.getUserProfile({
-              desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
-              success: (res) => {
-                wx.setStorage({ key: "userInfo", data: res.userInfo })
-                app.globalData.userInfo = res.userInfo;
-                wx.switchTab({ url: path })
-              }
-            })
-          }
-        })
-      } else {
-        wx.switchTab({ url: path })
-      }
+      wx.switchTab({ url: path })
       // wx.switchTab({ url })
       // wx.reLaunch({ url })
       // this.setData({

+ 1 - 4
pages/my/index.js

@@ -11,7 +11,6 @@ Page({
     navbarData: {
       name: '我的'
     },
-    userInfo: {}
   },
   // 跳转页面
   routeBtn: function (e) {
@@ -21,7 +20,6 @@ Page({
         url: `/pages/history/index?openid=${app.globalData.wxInfo.openid}`
       })
     } else if (type == '2') {
-      app.globalData.userInfo = {}
       wx.redirectTo({
         url: '/pages/login/index'
       })
@@ -31,8 +29,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    let data = app.globalData.userInfo;
-    if (data) this.setData({ userInfo: data })
+   
   },
 
   /**

+ 4 - 3
pages/my/index.wxml

@@ -2,16 +2,17 @@
 <view class="main" style="padding-top:{{height}}px;height:{{windowHeight-height}}px">
   <view class="one">
     <view class="left">
-      <image src="{{userInfo.avatarUrl}}"></image>
+      <open-data type="userAvatarUrl" class="image"></open-data>
     </view>
     <view class="right">
       <view class="name">
-        {{userInfo.nickName}}
+        <open-data class="other" type="userNickName" lang="zh_CN"></open-data>
+        <open-data class="other" type="userGender" lang="zh_CN"></open-data>
       </view>
     </view>
   </view>
   <view class="two">
     <van-cell title="历史记录" is-link bind:click="routeBtn" data-type="1" />
-    <van-cell title="退出登录" is-link bind:click="routeBtn" data-type="2" />
+    <!-- <van-cell title="退出登录" is-link bind:click="routeBtn" data-type="2" /> -->
   </view>
 </view>

+ 11 - 2
pages/my/index.wxss

@@ -16,10 +16,13 @@
   text-align: center;
 }
 
-.main .one .left image {
+.main .one .left .image {
+  display: block;
   width: 66px;
   height: 66px;
-  border-radius: 90px;
+  overflow: hidden;
+  border-radius: 50%;
+  margin: 0 12px;
 }
 
 .main .one .right {
@@ -30,6 +33,12 @@
 .main .one .right .name {
   float: left;
   width: 100%;
+}
+
+.main .one .right .name .other {
+  float: left;
+  width: 100%;
+  margin: 0 0 5px 0;
   font-size: 16px;
   font-weight: bold;
   margin: 0 0 5px 0;