From 3419e3866b16f4b4ace7e89ea50c74dc0983da9a Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期四, 06 四月 2023 17:28:20 +0800 Subject: [PATCH] 修改转发错误,修正日计划单 --- api/publicInterface.js | 158 ++++++++++++++++++++++++++++------------------------ 1 files changed, 86 insertions(+), 72 deletions(-) diff --git a/api/publicInterface.js b/api/publicInterface.js index 54e06bf..856e250 100644 --- a/api/publicInterface.js +++ b/api/publicInterface.js @@ -1,79 +1,53 @@ // import {resolve} from "../unpackage/dist/dev/mp-weixin/common/vendor"; // import login from "../pages/login/login"; -// 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" + +import { + BaseUrl as wrBaseUrl +} from '@/api/request.js' +const BaseUrl = "http://192.168.0.110:9999"; +// const BaseUrl = "http://hesuancj.cn:9999" +// const BaseUrl = "https://hesuancj.cn:9095" +// const BaseUrl = "http://192.168.3.119: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 +104,7 @@ }) } + // 鑾峰彇token function apiLoginPassword({ username, @@ -170,6 +145,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 +192,8 @@ export { - apiLogin, - apiLogin2, + apiLoginWx, apiRegister, - apiLoginPassword + apiLoginPassword, + BaseUrl } -- Gitblit v1.9.1