From 4b48bacef8646cee8b66f5e10b0ed7124534e93e Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 12 五月 2023 17:10:47 +0800
Subject: [PATCH] 首页修改

---
 miniprogram/pages/user/loginInfo/index.ts |   58 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/miniprogram/pages/user/loginInfo/index.ts b/miniprogram/pages/user/loginInfo/index.ts
index edf9ae9..c0534c1 100644
--- a/miniprogram/pages/user/loginInfo/index.ts
+++ b/miniprogram/pages/user/loginInfo/index.ts
@@ -33,6 +33,10 @@
       }
     this.data.user.userIdcard=e.detail.value
   },
+  getPhoneNumber:function(e){
+      console.log(e);
+      
+  },
   submit(){
       if(!/^[\u4e00-\u9fa5]{2,4}$/.test(this.data.user.realName)){
         // Toast.fail('璇疯緭鍏ユ纭殑濮撳悕'); 
@@ -55,21 +59,39 @@
         })
         return
     }
-   
-   wx.request({
-       url:loginInfo.globalData.url+"/wx/user/add",
-       method:"POST",
-       data:this.data.user,
-       header:{
-           'token':wx.getStorageSync('token')
-       },
-       success:(res)=>{
-           wx.setStorageSync('info',true)
-           wx.reLaunch({
-               url:'../../user/index'
-           })
-       }
-   })
+    wx.request({
+        
+                    url: loginInfo.globalData.url+"/wx/login",
+                    data: {
+                        "phone": wx.getStorageSync('phone'),
+                    },
+                    method: "GET",
+                    success: (res) => {
+                        wx.setStorageSync('token', res.data.data.token)
+                        wx.setStorageSync('role', res.data.data.role)
+                        wx.setStorageSync('id', res.data.data.id)
+                        wx.setStorageSync('card',res.data.data.time)
+                        console.log(res.data.data.id)
+                        this.data.user.id= res.data.data.id
+                        wx.setStorageSync('id',res.data.data.id)
+                        wx.request({
+                            url:loginInfo.globalData.url+"/wx/user/add",
+                            method:"POST",
+                            data:this.data.user,
+                            header:{
+                                'token':wx.getStorageSync('token')
+                            },
+                            success:(res)=>{
+                                wx.setStorageSync('info',true)
+                                wx.reLaunch({
+                                    url:'../../user/index'
+                                })
+                            }
+                        })
+                    }
+
+                })
+ 
   },
 face(){
     wx.chooseMedia({
@@ -83,17 +105,17 @@
                 filePath: res.tempFiles[0].tempFilePath,
                 name: "file",
                 header: {
-                    'token': wx.getStorageSync('token'),
+                    // 'token': wx.getStorageSync('token'),
                     'content-type': 'application/json'
                 },
                 success:(res)=>{
-                    // 鎴愬姛閫氱煡
-                    Notify({ type: 'primary', message: '閲囬泦鎴愬姛' });
                     const result = JSON.parse(res.data)
                     this.setData({
                         pic:result.data,
                         isShow:true
                     })
+                      // 鎴愬姛閫氱煡
+                    Notify({ type: 'primary', message: '閲囬泦鎴愬姛' });
                 }
             })
         }

--
Gitblit v1.8.0