准备联调抄表记录
This commit is contained in:
@@ -8,3 +8,5 @@ export const payWays = ["现金", "银行卡", "支付宝", "微信", "云闪
|
||||
export const getRechargeOperateWay = (num) => {
|
||||
return payWays[num];
|
||||
}
|
||||
|
||||
export const feeType = ['华昌宝能收费', "物业代收1", "物业代收2", "物业代收线损"]
|
||||
@@ -45,10 +45,10 @@ export function getConfigByEnv() {
|
||||
switch (envVersion) {
|
||||
// 开发版
|
||||
case 'develop':
|
||||
// api = "http://localhost:8000"
|
||||
api = "http://localhost:8000"
|
||||
// api = "https://zgd.hbhcbn.com/api3"
|
||||
api = "https://zgd.hbhcbn.com/api3"
|
||||
// api = "https://zgd.hbhcbn.com/wxApi"
|
||||
// TODO: 发布正式时使用此路径
|
||||
// api = "https://zgd.hbhcbn.com/wxApi"
|
||||
// api = "http://127.0.0.1:4523/m1/4143821-0-default"
|
||||
break;
|
||||
// 体验版
|
||||
@@ -198,9 +198,11 @@ export const wxLogin = () => {
|
||||
resolve(res.code)
|
||||
return
|
||||
}
|
||||
alertInfo("未进行微信登录")
|
||||
reject()
|
||||
},
|
||||
fail: err => {
|
||||
alertError(err)
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
@@ -225,17 +227,8 @@ export const wxModal = (data) => {
|
||||
}
|
||||
|
||||
|
||||
export const getPixelRatio = () => {
|
||||
let pixelRatio = 0
|
||||
wx.getSystemInfo({
|
||||
success: function (res) {
|
||||
pixelRatio = res.pixelRatio
|
||||
},
|
||||
fail: function () {
|
||||
pixelRatio = 0
|
||||
}
|
||||
})
|
||||
return pixelRatio
|
||||
export const getPixelRatio = () => {
|
||||
return wx.getSystemInfoSync()?. pixelRatio
|
||||
}
|
||||
|
||||
|
||||
@@ -254,4 +247,12 @@ export function getPageUrl() {
|
||||
/** 根据文件路径获取文件名 */
|
||||
export function getFileName(path) {
|
||||
return path.slice(path.lastIndexOf("/") + 1, -1)
|
||||
}
|
||||
}
|
||||
|
||||
export function replaceSpecialIcon(str) {
|
||||
return str.replace(/#/g, escape("#"))
|
||||
}
|
||||
|
||||
export function getRoundNumber(number) {
|
||||
return (Math.round(number * 100) / 100).toFixed(2)
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ const request = async function (options, config = {}) {
|
||||
try {
|
||||
response = await requestWithoutCookie(options);
|
||||
// 服务器没有返回200直接报错
|
||||
// if (!response || response.statusCode !== 200) {
|
||||
// alertError(response?.data?.message || "发生错误,请稍后重试")
|
||||
// return;
|
||||
// }
|
||||
if (!response || response.statusCode !== 200) {
|
||||
alertError(response?.data?.message || "发生错误,请稍后重试")
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理cookie
|
||||
const setCookie = response.header['set-cookie'] || response.header['Set-Cookie'];
|
||||
@@ -78,16 +78,22 @@ const request = async function (options, config = {}) {
|
||||
|
||||
// 处理返回结果,默认直接返回数据
|
||||
const parseResponse = function (response, url) {
|
||||
console.log('response', response, url)
|
||||
if (!response) {
|
||||
alertError("服务异常")
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
wx.clearStorageSync()
|
||||
alertError("无响应,请重试")
|
||||
return
|
||||
|
||||
}
|
||||
const { statusCode } = response;
|
||||
if (!statusCode) {
|
||||
alertError("服务异常")
|
||||
alertError("服务错误")
|
||||
return
|
||||
}
|
||||
console.log('url', url,'statusCode', statusCode, 'response.data', response)
|
||||
console.log('url', url,'statusCode', statusCode, 'response.data', response?.data)
|
||||
if (code === 401) {
|
||||
const currentUrl = getPageUrl()
|
||||
|
||||
@@ -107,7 +113,7 @@ const parseResponse = function (response, url) {
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
wx.clearStorageSync()
|
||||
return { code: 404, message: "服务故障" }
|
||||
return { code: 404, message: "服务不存在" }
|
||||
}
|
||||
if (500 <= code && code < 600) {
|
||||
return { code: 500, message: "服务错误" }
|
||||
@@ -140,6 +146,7 @@ const CUD = async function (method, uri, data = null) {
|
||||
options.data = data;
|
||||
}
|
||||
const response = await request(options);
|
||||
console.log("response---------",response)
|
||||
return parseResponse(response);
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ export const getDot = async () => {
|
||||
return;
|
||||
}
|
||||
const { code, message, data } = await getUnReadApproveNumber();
|
||||
if (code !== OK) {
|
||||
return;
|
||||
}
|
||||
if (data > 0) {
|
||||
wx.showTabBarRedDot({
|
||||
index: 2,
|
||||
|
||||
Reference in New Issue
Block a user