From 513be798a677672644770e2b2f7025b6d4d20414 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期三, 07 九月 2022 14:44:04 +0800 Subject: [PATCH] 完善登录,登录授权 --- api/global.js | 42 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 38 insertions(+), 4 deletions(-) diff --git a/api/global.js b/api/global.js index fddc019..4b4916e 100644 --- a/api/global.js +++ b/api/global.js @@ -27,9 +27,9 @@ }); } -// const baseUrl = 'http://192.168.0.159:9999' +// const baseUrl = 'http://192.168.3.159:9999' // const baseUrl = 'https://mx.jzeg.cn:443/app'; -const baseUrl = "https://mx.jzeg.cn:9998"; +const baseUrl = "https://mx.jzeg.cn:9998"; // 姝e紡鏈嶅姟 // POST璇锋眰 function apiLogin({ @@ -59,7 +59,38 @@ resolve(res); }, fail: (err) => { - console.log('閿欒',err); + console.log('閿欒', err); + uni.hideLoading(); + uni.showToast({ + icon: 'none', + title: '鏈嶅姟鍣ㄩ敊璇�' + }) + } + }) + }) +} + +function wxSmallLogin(code) { + uni.showLoading({ + title: '鐧诲綍涓�...', + }) + + return new Promise((resolve, reject) => { + uni.request({ + url: baseUrl + `/auth/mobile/token/social?grant_type=mobile&mobile=MINI@${code}`, + method: "POST", + header: { + "TENANT-ID": "5", + "Authorization": "Basic cGlnOnBpZw==", + 'Content-Type': 'application/x-www-form-urlencoded' + }, + success: (res) => { + uni.hideLoading(); + // console.log(res) + resolve(res); + }, + fail: (err) => { + console.log('閿欒', err); uni.hideLoading(); uni.showToast({ icon: 'none', @@ -71,6 +102,8 @@ } + + // 鑾峰彇娴佺▼鏁版嵁 // export const getProcessDataList = (params) => { // return getRequest('/oa/actProcess/getByCondition', params) @@ -78,5 +111,6 @@ export default { - apiLogin + apiLogin, + wxSmallLogin } -- Gitblit v1.9.1