diff --git a/pages/login/index.js b/pages/login/index.js index 7477f51..24e615d 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -89,7 +89,7 @@ Page({ noPermission() { Dialog.confirm({ title: '提示', - message: '当前手机号不是用电管理联系账号', + message: '当前手机号未录入系统,请联系管理员,或点击手动绑定', confirmButtonText: '手动绑定', cancelButtonText: '取消', }) diff --git a/pages/rechargeDetail/index.js b/pages/rechargeDetail/index.js index 3b0ff71..7e348c7 100644 --- a/pages/rechargeDetail/index.js +++ b/pages/rechargeDetail/index.js @@ -51,8 +51,8 @@ Page({ switch (envVersion) { // 开发版 case 'develop': - api = `http://localhost:9001`; - // api = `https://zgd.hbhcbn.com/recharge-print-api-test`; + // api = `http://localhost:9001`; + api = `https://zgd.hbhcbn.com/recharge-print-api-test`; // api = `https://zgd.hbhcbn.com/recharge-print-api-test`; break; // 体验版 @@ -77,18 +77,31 @@ Page({ alertInfo("下载文件失败") return; } - wx.openDocument({ - filePath: res.tempFilePath, - fileType: [ "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!! - success: function (res) { - resolve() + const fs = wx.getFileSystemManager() + const newPath = wx.env.USER_DATA_PATH + '/' + `收据-${detail.time}.pdf` + fs.rename({ + oldPath: res.tempFilePath, + newPath: newPath, + success() { + wx.openDocument({ + filePath: newPath, + fileType: [ "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!! + success: function (res) { + resolve() + }, + fail: function (e) { + alertError("打开失败") + console.log('打开失败错误为', e) + rej() + } + }); }, - fail: function (e) { - alertError("打开失败") - console.log('打开失败错误为', e) - rej() + fail(res) { + console.error(res) } }) + + } } }) diff --git a/utils/request.js b/utils/request.js index 1d6ed2c..921723b 100644 --- a/utils/request.js +++ b/utils/request.js @@ -82,13 +82,12 @@ const parseResponse = function (response, url) { alertError("服务异常") return } - // const { statusCode } = response; - const { code } = response?.data || {}; - console.log('url', url,'code', code, 'response.data', response.data) - if (!code) { + const { statusCode } = response; + if (!statusCode) { alertError("服务异常") return } + console.log('url', url,'statusCode', statusCode, 'response.data', response) if (code === 401) { const currentUrl = getPageUrl() @@ -113,6 +112,8 @@ const parseResponse = function (response, url) { if (500 <= code && code < 600) { return { code: 500, message: "服务错误" } } + const { code } = response?.data || {}; + return response.data; }