diff --git a/src/api/auth.js b/src/api/auth.js index aea54d5..236f548 100644 --- a/src/api/auth.js +++ b/src/api/auth.js @@ -11,6 +11,8 @@ function authRequest(path, data) { success(response) { const body = response.data || {} console.info('[Overseas PDA auth] response', { url, statusCode: response.statusCode, code: body.code, + message: typeof body === 'object' ? body.message : String(body).slice(0, 160), + contentType: response.header?.['Content-Type'] || response.header?.['content-type'], requestId: body.requestId || response.header?.['X-Request-Id'] || response.header?.['x-request-id'], traceId: body.traceId || response.header?.['X-Trace-Id'] || response.header?.['x-trace-id'] }) if (String(body.code ?? response.statusCode) !== '200') { diff --git a/src/manifest.json b/src/manifest.json index 5828a87..e882d8a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,91 +1,87 @@ { - "name" : "柏悦物流 PDA 海外版", - "appid" : "__UNI__936D079", - "description" : "柏悦物流海外仓 PDA 作业端", - "versionName" : "0.0.1", - "versionCode" : 1, - "transformPx" : false, - "app-plus" : { - "usingComponents" : true, - "nvueCompiler" : "uni-app", - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - "modules" : { - "Barcode" : {}, - "Bluetooth" : {}, - "Camera" : {}, - "Contacts" : {}, - "UIWebview" : {} - }, - "distribute" : { - "android" : { - "packagename" : "com.baiyuelogistics.pda.overseas", - "permissions" : [], - "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ] - }, - "ios" : { - "dSYMs" : false - }, - "sdkConfigs" : {}, - "icons" : { - "android" : { - "hdpi" : "static/app-icons/72x72.png", - "xhdpi" : "static/app-icons/96x96.png", - "xxhdpi" : "static/app-icons/144x144.png", - "xxxhdpi" : "static/app-icons/192x192.png" - }, - "ios" : { - "appstore" : "static/app-icons/1024x1024.png", - "ipad" : { - "app" : "static/app-icons/76x76.png", - "app@2x" : "static/app-icons/152x152.png", - "notification" : "static/app-icons/20x20.png", - "notification@2x" : "static/app-icons/40x40.png", - "proapp@2x" : "static/app-icons/167x167.png", - "settings" : "static/app-icons/29x29.png", - "settings@2x" : "static/app-icons/58x58.png", - "spotlight" : "static/app-icons/40x40.png", - "spotlight@2x" : "static/app-icons/80x80.png" - }, - "iphone" : { - "app@2x" : "static/app-icons/120x120.png", - "app@3x" : "static/app-icons/180x180.png", - "notification@2x" : "static/app-icons/40x40.png", - "notification@3x" : "static/app-icons/60x60.png", - "settings@2x" : "static/app-icons/58x58.png", - "settings@3x" : "static/app-icons/87x87.png", - "spotlight@2x" : "static/app-icons/80x80.png", - "spotlight@3x" : "static/app-icons/120x120.png" - } - } - } - } - }, - "quickapp" : {}, - "mp-weixin" : { - "appid" : "", - "setting" : { - "urlCheck" : false - }, - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false - }, - "vueVersion" : "3", - "h5" : { - "devServer" : { - "proxy": { - + "name": "柏悦物流 PDA 海外版", + "appid": "__UNI__936D079", + "description": "柏悦物流海外仓 PDA 作业端", + "versionName": "0.0.1", + "versionCode": 1, + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueCompiler": "uni-app", + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": { + "Barcode": {}, + "Bluetooth": {}, + "Camera": {}, + "Contacts": {}, + "UIWebview": {} + }, + "distribute": { + "android": { + "packagename": "com.baiyuelogistics.pda.overseas", + "permissions": [], + "abiFilters": ["armeabi-v7a", "arm64-v8a"] }, - "port" : 5176, - "https": false - } - } + "ios": { + "dSYMs": false + }, + "sdkConfigs": {}, + "icons": { + "android": { + "hdpi": "static/app-icons/72x72.png", + "xhdpi": "static/app-icons/96x96.png", + "xxhdpi": "static/app-icons/144x144.png", + "xxxhdpi": "static/app-icons/192x192.png" + }, + "ios": { + "appstore": "static/app-icons/1024x1024.png", + "ipad": { + "app": "static/app-icons/76x76.png", + "app@2x": "static/app-icons/152x152.png", + "notification": "static/app-icons/20x20.png", + "notification@2x": "static/app-icons/40x40.png", + "proapp@2x": "static/app-icons/167x167.png", + "settings": "static/app-icons/29x29.png", + "settings@2x": "static/app-icons/58x58.png", + "spotlight": "static/app-icons/40x40.png", + "spotlight@2x": "static/app-icons/80x80.png" + }, + "iphone": { + "app@2x": "static/app-icons/120x120.png", + "app@3x": "static/app-icons/180x180.png", + "notification@2x": "static/app-icons/40x40.png", + "notification@3x": "static/app-icons/60x60.png", + "settings@2x": "static/app-icons/58x58.png", + "settings@3x": "static/app-icons/87x87.png", + "spotlight@2x": "static/app-icons/80x80.png", + "spotlight@3x": "static/app-icons/120x120.png" + } + } + } + } + }, + "quickapp": {}, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "uniStatistics": { + "enable": false + }, + "vueVersion": "3", + "h5": { + "devServer": { + "port": 5176 + } + } } diff --git a/vite.config.js b/vite.config.js index 1d195ef..0cd9c10 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,6 +1,23 @@ import { defineConfig, loadEnv } from 'vite' import uni from '@dcloudio/vite-plugin-uni' +function loggedProxy(name, options) { + return { + ...options, + configure(proxy) { + proxy.on('proxyReq', (proxyRequest, request) => { + console.info(`[Overseas PDA H5 proxy] ${name}`, `${request.method} ${request.url}`, '->', `${options.target}${proxyRequest.path}`) + }) + proxy.on('proxyRes', (response, request) => { + console.info(`[Overseas PDA H5 proxy] ${name} response`, `${request.method} ${request.url}`, response.statusCode) + }) + proxy.on('error', (error, request) => { + console.error(`[Overseas PDA H5 proxy] ${name} error`, `${request.method} ${request.url}`, error.message) + }) + } + } +} + export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), '') const domesticTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000' @@ -9,12 +26,12 @@ export default defineConfig(({ mode }) => { plugins: [uni()], server: { proxy: { - '/api': { target: domesticTarget, changeOrigin: true }, - '/overseas-api': { + '/api': loggedProxy('auth', { target: domesticTarget, changeOrigin: true }), + '/overseas-api': loggedProxy('overseas', { target: overseasTarget, changeOrigin: true, rewrite: (path) => path.replace(/^\/overseas-api/, '/api') - } + }) } }, css: {