diff --git a/api/tort.js b/api/tort.js index 9c5c6ce..beb1f02 100644 --- a/api/tort.js +++ b/api/tort.js @@ -5,6 +5,7 @@ const URL_REPEAT = BASE_URL + '/webserver/reportInfos/websiteUrlRepeat.do' const UPLOAD_PICTURE = BASE_URL + 'webserver/fileUploadController/uploadToLocal' const WEB_REPORT = BASE_URL + '/webserver/reportInfos/submitReportInfos.do' +const GET_CODE_URL = BASE_URL + '/webserver/captchaController/generateVerifyCodeOfReport.do' /** * 生成网址、网址转换 * @param {*} // url: '' @@ -23,4 +24,12 @@ return fetch.get(WEB_REPORT, data).then(res => res); } +// 获取验证码 +export function getCodeURl() { + const data = { + timeStr: new Date().getTime() + } + return fetch.get(GET_CODE_URL, data).then(res => res); +} + diff --git a/api/tort.js b/api/tort.js index 9c5c6ce..beb1f02 100644 --- a/api/tort.js +++ b/api/tort.js @@ -5,6 +5,7 @@ const URL_REPEAT = BASE_URL + '/webserver/reportInfos/websiteUrlRepeat.do' const UPLOAD_PICTURE = BASE_URL + 'webserver/fileUploadController/uploadToLocal' const WEB_REPORT = BASE_URL + '/webserver/reportInfos/submitReportInfos.do' +const GET_CODE_URL = BASE_URL + '/webserver/captchaController/generateVerifyCodeOfReport.do' /** * 生成网址、网址转换 * @param {*} // url: '' @@ -23,4 +24,12 @@ return fetch.get(WEB_REPORT, data).then(res => res); } +// 获取验证码 +export function getCodeURl() { + const data = { + timeStr: new Date().getTime() + } + return fetch.get(GET_CODE_URL, data).then(res => res); +} + diff --git a/common/fetch.js b/common/fetch.js index 1ed1345..9add31a 100644 --- a/common/fetch.js +++ b/common/fetch.js @@ -1,6 +1,20 @@ import { useStore } from "vuex"; // import { getLogin } from "@/utils/auth.js"; - +const dict = { + '1':'成功', + '2':'账户已存在', + '3': '验证码错误', + '4': '手机号码重复', + '5':'邮箱重复', + '6': '用户账户被锁', + '7': '密码错误', + '8':'账号不存在', + '9': '监督员状态未审核', + '10': '监督员状态未通过', + '101':'登陆注册成功', + '102':'监督员删除', + '103':'验证码超时', +} function fetch(method) { return function (url, data, otherParams = {}) { // if (method === 'POST' || method === 'PUT') { @@ -25,7 +39,23 @@ wx.setStorageSync('isRepeat', 'false') } resolve(data.data.data); - } else { + } else if( + data.data.status === 103 || data.data.status === 3 || + data.data.status === 2 ||data.data.status === 4 || + data.data.status === 5 ||data.data.status === 6 || + data.data.status === 7 || data.data.status === 8 || + data.data.status === 9 ||data.data.status === 10 || + data.data.status === 102 ) { + const status = data.data.status + ''; + const message = dict[status] + uni.showToast({ + // title: "系统异常,请稍后再试!", + title: `${message}`, + icon: "none", + duration: 3000, + }); + reject(data.data.status); + } else { if(data.data.message === '网址重复') { uni.showToast({ // title: "系统异常,请稍后再试!", @@ -49,6 +79,7 @@ } }, fail(err) { + console.log('fail', err) reject(err); }, ...otherParams, diff --git a/api/tort.js b/api/tort.js index 9c5c6ce..beb1f02 100644 --- a/api/tort.js +++ b/api/tort.js @@ -5,6 +5,7 @@ const URL_REPEAT = BASE_URL + '/webserver/reportInfos/websiteUrlRepeat.do' const UPLOAD_PICTURE = BASE_URL + 'webserver/fileUploadController/uploadToLocal' const WEB_REPORT = BASE_URL + '/webserver/reportInfos/submitReportInfos.do' +const GET_CODE_URL = BASE_URL + '/webserver/captchaController/generateVerifyCodeOfReport.do' /** * 生成网址、网址转换 * @param {*} // url: '' @@ -23,4 +24,12 @@ return fetch.get(WEB_REPORT, data).then(res => res); } +// 获取验证码 +export function getCodeURl() { + const data = { + timeStr: new Date().getTime() + } + return fetch.get(GET_CODE_URL, data).then(res => res); +} + diff --git a/common/fetch.js b/common/fetch.js index 1ed1345..9add31a 100644 --- a/common/fetch.js +++ b/common/fetch.js @@ -1,6 +1,20 @@ import { useStore } from "vuex"; // import { getLogin } from "@/utils/auth.js"; - +const dict = { + '1':'成功', + '2':'账户已存在', + '3': '验证码错误', + '4': '手机号码重复', + '5':'邮箱重复', + '6': '用户账户被锁', + '7': '密码错误', + '8':'账号不存在', + '9': '监督员状态未审核', + '10': '监督员状态未通过', + '101':'登陆注册成功', + '102':'监督员删除', + '103':'验证码超时', +} function fetch(method) { return function (url, data, otherParams = {}) { // if (method === 'POST' || method === 'PUT') { @@ -25,7 +39,23 @@ wx.setStorageSync('isRepeat', 'false') } resolve(data.data.data); - } else { + } else if( + data.data.status === 103 || data.data.status === 3 || + data.data.status === 2 ||data.data.status === 4 || + data.data.status === 5 ||data.data.status === 6 || + data.data.status === 7 || data.data.status === 8 || + data.data.status === 9 ||data.data.status === 10 || + data.data.status === 102 ) { + const status = data.data.status + ''; + const message = dict[status] + uni.showToast({ + // title: "系统异常,请稍后再试!", + title: `${message}`, + icon: "none", + duration: 3000, + }); + reject(data.data.status); + } else { if(data.data.message === '网址重复') { uni.showToast({ // title: "系统异常,请稍后再试!", @@ -49,6 +79,7 @@ } }, fail(err) { + console.log('fail', err) reject(err); }, ...otherParams, diff --git a/packageA/accountInfo/accountInfo.vue b/packageA/accountInfo/accountInfo.vue index bfda7ba..6a7048c 100644 --- a/packageA/accountInfo/accountInfo.vue +++ b/packageA/accountInfo/accountInfo.vue @@ -1,7 +1,7 @@