huanggang 7 năm trước cách đây
mục cha
commit
c641a1f29a
2 tập tin đã thay đổi với 20 bổ sung9 xóa
  1. 17 8
      app.js
  2. 3 1
      config.js

+ 17 - 8
app.js

@@ -1,6 +1,9 @@
 //app.js
 App({
-  host:"https://passport.lrlz.com/mobile/index.php",
+  // host:"https://passport.lrlz.com/mobile/index.php",
+  host:"https://121.43.114.153/mobile/index.php",
+  // host: "http://192.168.0.131/mobile/index.php",
+
   onLaunch: function () {
     let self = this;
     // 登录
@@ -8,13 +11,14 @@ App({
       success: res => {
         let self = this;
         wx.request({
-          url: self.host,
-          data:{
-            act:"login",
-            op:"ministart",
-            code: res.code,
-            client_type:"ios"
-          },
+          // url: self.host,
+          // data:{
+          //   act:"login",
+          //   op:"ministart",
+          //   code: res.code,
+          //   client_type:"ios"
+          // },
+          url: `https://api.weixin.qq.com/sns/jscode2session?appid=wxfdaeb25e38c4c47e&secret=e5b5055cbc608d10c6de0d877c221270&js_code=${res.code}&grant_type=authorization_code`,
           success:function(res){
             console.log(res);
             self.globalData.userId.openid = res.data.openid;
@@ -37,6 +41,7 @@ App({
                 self.globalData.userInfo = res.userInfo;
                 self.globalData.userInfo.nickname = res.userInfo.nickName;
                 let userInfo = Object.assign({}, self.globalData.userId, self.globalData.userInfo);
+                console.log(userInfo);
                 wx.request({
                   url: self.host,
                   method: 'GET',
@@ -47,6 +52,7 @@ App({
                     client_type:"ios"
                   },
                   success: function (res) {
+                    console.log(res.data.datas.HPHPSESSID);
                     wx.setStorageSync('session_id', res.data.datas.HPHPSESSID);
                     if (res.statusCode == 200) {
                       let current_url = "/" + getCurrentPages()[0].route;
@@ -85,6 +91,7 @@ App({
                   self.globalData.userInfo = res.userInfo;
                   self.globalData.userInfo.nickname = res.userInfo.nickName;
                   let userInfo = Object.assign({}, self.globalData.userId, self.globalData.userInfo);
+                  console.log(userInfo);
                   wx.request({
                     url: self.host,
                     method:'GET',
@@ -95,6 +102,8 @@ App({
                       client_type:"ios"
                     },
                     success:function(res){
+                      console.log(res);
+                      // console.log(res.data.datas.HPHPSESSID)
                       wx.setStorageSync('session_id', res.data.datas.HPHPSESSID);
                       if (res.statusCode == 200) {
                         let current_url = "/" + getCurrentPages()[0].route;

+ 3 - 1
config.js

@@ -1,5 +1,7 @@
 
-let api = "https://passport.lrlz.com/mobile/index.php"
+// let api = "https://passport.lrlz.com/mobile/index.php";
+let api = "https://121.43.114.153/mobile/index.php"
+// let api = "http://192.168.0.131/mobile/index.php";
 
 
 function getReq(data, callback, fail) {