houwei 4 years ago
parent
commit
74f9ef05dc

+ 2 - 1
pages/index/index.js

@@ -178,11 +178,12 @@ Page({
   },
   onShow() {
     this.getletterStauts();
+    this.getInfos()
     tool.isLogin().then(res => {
-      console.log(res.rawData)
       this.setData({
         userInfo: JSON.parse(res.rawData)
       })
+      console.log(this.data.userInfo)
     }).catch(err => {
       console.log(err)
     })

+ 55 - 6
pages/personInfo/personInfo.js

@@ -31,6 +31,11 @@ Page({
       birthday: '',
       constellation: '',
       photoUrl: ''
+    },
+    userInfo: '',
+    ysf: {
+      title: '注册页',
+      config: ''
     }
   },
   change(e) {
@@ -382,9 +387,47 @@ Page({
       success: (res) => {
         console.log(res, '我是获取的信息')
         if (res.data.code == 0) {
+          let config='ysf.config';
+          let sex1 = '';
+          if(res.data.info.sex==0){
+            sex1='女'
+          }else{
+            sex1='男'
+          }
+          console.log(sex1)
           this.setData({
-            myInfo: res.data.info
+            myInfo: res.data.info,
+            [config]:JSON.stringify({
+              "uid": res.data.id, // 用户唯一标识
+              "level": 1, // vip等级
+              "data": JSON.stringify([{
+                  "index": 0,
+                  "key": "name",
+                  "label": "姓名",
+                  "value": res.data.info.name
+                },
+                {
+                  "index": 1,
+                  "key": "createTime",
+                  "label": "创建时间",
+                  "value": res.data.info.createTime
+                },
+                {
+                  "index": 2,
+                  "key": "sex",
+                  "label": "性别",
+                  "value": sex1
+                },
+                {
+                  "index": 3,
+                  "key": "tel",
+                  "label": "电话",
+                  "value": res.data.info.tel
+                }
+              ])
+            })
           })
+          console.log(this.data.ysf)
         }
         let idFront = 'form.idFront'
         let photoUrl = 'form.photoUrl'
@@ -507,11 +550,6 @@ Page({
       url: '/pages/index/index',
     })
   },
-  // goxy() {
-  //   wx.navigateTo({
-  //     url: '/pages/infoAgreement/infoAgreement',
-  //   })
-  // },
   async onLoad(options) {
     this.initValidate()
     tool.openidStatus().then(result => {
@@ -521,5 +559,16 @@ Page({
       })
       this.getInfos();
     })
+  },
+  onShow() {
+    this.getInfos()
+    tool.isLogin().then(res => {
+      this.setData({
+        userInfo: JSON.parse(res.rawData)
+      })
+      console.log(this.data.userInfo)
+    }).catch(err => {
+      console.log(err)
+    })
   }
 })

+ 1 - 1
pages/personInfo/personInfo.wxml

@@ -1,4 +1,4 @@
-<view class="container" style="margin-bottom:150rpx">
+<view class="container" style="padding-bottom:150rpx">
 	<view class="card_bj">
 		<view class="p1">身份证上传</view>
 		<view class="p2">注:上传横向且清晰的</view>

+ 1 - 0
pages/personInfo/personInfo.wxss

@@ -1,3 +1,4 @@
+
 .block {
   height: 80rpx;
   line-height: 80rpx;

+ 59 - 1
pages/personal/personal.js

@@ -28,7 +28,12 @@ Page({
         img: '../../images/icon5.jpg',
         url: '/pages/share/share'
       }
-    ]
+    ],
+    userInfo: '',
+    ysf: {
+      title: '注册页',
+      config: ''
+    }
   },
   goTab(e) {
     console.log(e.currentTarget.dataset.index)
@@ -120,6 +125,7 @@ Page({
     tool.isLogin().then(res => {
       console.log(res)
       this.setData({
+        userInfo: JSON.parse(res.rawData),
         avatarUrl: res.userInfo.avatarUrl,
         nick: res.userInfo.nickName,
         loginStatus: true
@@ -130,6 +136,57 @@ Page({
       })
     })
   },
+  getInfos2() {
+    wx.request({
+      url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
+      method: "get",
+      success: (res) => {
+        if (res.data.code == 0) {
+          let config='ysf.config';
+          let sex1 = '';
+          if(res.data.info.sex==0){
+            sex1='女'
+          }else{
+            sex1='男'
+          }
+          console.log(sex1)
+          this.setData({
+            myInfo: res.data.info,
+            [config]:JSON.stringify({
+              "uid": res.data.id, // 用户唯一标识
+              "level": 1, // vip等级
+              "data": JSON.stringify([{
+                  "index": 0,
+                  "key": "name",
+                  "label": "姓名",
+                  "value": res.data.info.name
+                },
+                {
+                  "index": 1,
+                  "key": "createTime",
+                  "label": "创建时间",
+                  "value": res.data.info.createTime
+                },
+                {
+                  "index": 2,
+                  "key": "sex",
+                  "label": "性别",
+                  "value": sex1
+                },
+                {
+                  "index": 3,
+                  "key": "tel",
+                  "label": "电话",
+                  "value": res.data.info.tel
+                }
+              ])
+            })
+          })
+          console.log(this.data.ysf.config)
+        }
+      }
+    })
+  },
   async onShow() {
     tool.openidStatus().then(result => {
       this.setData({
@@ -137,6 +194,7 @@ Page({
         sessionkey: result[1]
       })
       this.getInfos();
+      this.getInfos2();
       this.getTimes();
     })
   }

+ 1 - 1
pages/personal/personal.json

@@ -1,4 +1,4 @@
 {
   "usingComponents": {},
   "navigationBarTitleText": "我的"
-}
+}