From 719343707ecba18d6359a727813ae2c63ec57f0a Mon Sep 17 00:00:00 2001 From: chenxuhui Date: Fri, 22 Feb 2019 17:48:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8F=AF=E4=BB=A5=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/login.js | 27 +++++++++++++++++++++++---- utils/net.js | 6 +++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/pages/login/login.js b/pages/login/login.js index 77cebac..eda2480 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -18,6 +18,7 @@ function GetBindCustomer(that) { app.globalData.phoneNum = res.result.WeixinUser_Phone; // 获取cookie值 WeixinLogin(function (res) { + setCurrentCustomerID(); wx.switchTab({ url: '/pages/homePage/homePage', }) @@ -37,7 +38,7 @@ function setCurrentCustomerID (){ // 获取cookie值 参数1、appID 2、openID function WeixinLogin(successtion) { - let method = getCookie; + let method = '/MainSystem/B3MiniProgramRpc/Rpcs/CommonRpc/WeixinLogin'; let params = [app.globalData.appID, app.globalData.openID]; network.transfer_request(method, params, function (res) { app.globalData.cookie = res.result; @@ -62,9 +63,10 @@ function XuBindByPhone(that) { "HeadImgUrl": userInfos.avatarUrl, "UnionId": "", }]; - network.newRequestLoading(method2, params2, function (res) { + network.transfer_request(method2, params2, function (res) { if (res.result != null) { WeixinLogin(function () { + setCurrentCustomerID(); wx.switchTab({ url: '/pages/homePage/homePage', }) @@ -78,7 +80,6 @@ Page({ code: "", userName: "", psw: "", - index: 0, phoneNum: "", }, @@ -123,6 +124,24 @@ Page({ var that = this; if (e.detail.userInfo != null) { app.globalData.userInfo = e.detail.userInfo + if (this.data.code == "") { + wx.showToast({ + title: '请输入企业编码', + }) + return false; + } + if (this.data.userName == "") { + wx.showToast({ + title: '请输入用户名', + }) + return false; + } + // if (this.data.psw == "") { + // wx.showToast({ + // title: '请输入密码', + // }) + // return false; + // } if (this.data.phoneNum == "") { wx.showToast({ title: '请输入手机号码', @@ -149,7 +168,7 @@ Page({ "HeadImgUrl": userInfos.avatarUrl, "UnionId": "" }]; - network.transfer_request(method, params, function (res) { + network.requestLoading(method, params, function (res) { if (res.result != null) { app.globalData.globalCustomerID = res.result; XuBindByPhone(that); diff --git a/utils/net.js b/utils/net.js index d7616e9..e00e101 100644 --- a/utils/net.js +++ b/utils/net.js @@ -19,7 +19,7 @@ function requestLoading(method, params, successaction) { 'method': method, 'params': params }; - + console.log(data); wx.request({ url: app.globalData.baseUrl, data: data, @@ -88,7 +88,7 @@ function transfer_request(method, params, successaction) { "Method": method, "Data": params, }; - + console.log(newData); var baseUrl = app.globalData.tranferBaseUrl; wx.request({ url: baseUrl, @@ -99,7 +99,7 @@ function transfer_request(method, params, successaction) { }, method: 'POST', success: function (res) { - // console.log(res) + if (res.data.error != null) { if (res.data.error.code == 401) { wx.request({