From 5355011b9d5e4f32a8751d1c2e600b2601fd8967 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期四, 16 三月 2023 17:50:42 +0800 Subject: [PATCH] 注册页面修改 --- api/publicInterface.js | 147 ++++++++++++++++++++++++++----------------------- 1 files changed, 78 insertions(+), 69 deletions(-) diff --git a/api/publicInterface.js b/api/publicInterface.js index 54e06bf..4e5801f 100644 --- a/api/publicInterface.js +++ b/api/publicInterface.js @@ -3,77 +3,46 @@ // const BaseUrl = "http://192.168.3.159:9999/"; import {BaseUrl as wrBaseUrl} from '@/api/request.js' -// const BaseUrl = "http://192.168.0.120:9999" const BaseUrl = "http://192.168.0.120:9999" // 鐧诲綍 -function apiLogin({ - code -}) { - uni.showLoading({ - title: '鐧诲綍涓�...', - }) - return new Promise((resolve, reject) => { - uni.request({ - url: BaseUrl + "/wrzs/wx/login", - method: "POST", - data: { - code - }, - header: { - // "TENANT-ID": "5", - // "Authorization": "Basic cGlnOnBpZw==", - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: (res) => { - uni.hideLoading(); - // console.log(res) - resolve(res.data); - }, - fail: (err) => { - console.log('閿欒', err); - uni.hideLoading(); - uni.showToast({ - icon: 'none', - title: '鏈嶅姟鍣ㄩ敊璇�' - }) - } - }) - }) -} +// function apiLogin({ +// code +// }) { +// uni.showLoading({ +// title: '鐧诲綍涓�...', +// }) +// return new Promise((resolve, reject) => { +// uni.request({ +// url: BaseUrl + "/wrzs/wx/login", +// method: "POST", +// data: { +// code +// }, +// header: { +// // "TENANT-ID": "5", +// // "Authorization": "Basic cGlnOnBpZw==", +// 'Content-Type': 'application/x-www-form-urlencoded' +// }, +// success: (res) => { +// uni.hideLoading(); +// // console.log(res) +// resolve(res.data); +// }, +// fail: (err) => { +// console.log('閿欒', err); +// uni.hideLoading(); +// uni.showToast({ +// icon: 'none', +// title: '鏈嶅姟鍣ㄩ敊璇�' +// }) +// } +// }) +// }) +// } -function apiLogin2({ - code -}) { - uni.showLoading({ - title: '鍔犺浇涓�...' - }) - return new Promise((resolve, reject) => { - uni.request({ - url: BaseUrl + "/wrzs/wx/login2", - method: "POST", - data: { - code - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: (res) => { - uni.hideLoading(); - resolve(res.data) - }, - fail: (err) => { - console.log('閿欒', err); - uni.hideLoading(); - uni.showToast({ - icon: 'none', - title: '鏈嶅姟鍣ㄩ敊璇�' - }) - } - }) - }) -} + // 娉ㄥ唽 @@ -130,6 +99,7 @@ }) } + // 鑾峰彇token function apiLoginPassword({ username, @@ -170,6 +140,45 @@ } +// 寰俊灏忕▼搴忎竴閿櫥褰� +function apiLoginWx({ + code +}) { + uni.showLoading({ + title: '鍔犺浇涓�...' + }) + return new Promise((resolve, reject) => { + uni.request({ + url: BaseUrl + '/admin/oauth2/token', + method: "POST", + data: { + grant_type:'mobile', + mobile:`MINI@${code}`, + code + }, + header: { + "Authorization": 'Basic c29jaWFsOnNvY2lhbA==', //app:app + 'content-type': 'application/x-www-form-urlencoded', + "CLIENT_TOC": "Y", + "isToken": "false" + }, + success: (res) => { + uni.hideLoading(); + resolve(res.data) + }, + fail: (err) => { + console.log('閿欒', err); + uni.hideLoading(); + uni.showToast({ + icon: 'none', + title: '鏈嶅姟鍣ㄩ敊璇�' + }) + } + }) + }) +} + + // 鑾峰彇娴佺▼鏁版嵁 // export const getProcessDataList = (params) => { @@ -178,8 +187,8 @@ export { - apiLogin, - apiLogin2, + apiLoginWx, apiRegister, - apiLoginPassword + apiLoginPassword, + BaseUrl } -- Gitblit v1.9.1