From fba777a91a070b801b12c755a3f56f526e0f6bde Mon Sep 17 00:00:00 2001 From: Lj <1095098147@qq.com> Date: Mon, 21 Jul 2025 11:25:56 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=98=E4=BF=AE=E5=A4=8D=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- npminstall-debug.log | 214 ++++++++++++++++++++++++++++++++++++ pages/manager/order-detail.vue | 2 +- pages/subcomponent/detail.vue | 2 +- pages/subcomponent/promo-qrcode.vue | 168 ++++++++++++---------------- 4 files changed, 288 insertions(+), 98 deletions(-) create mode 100644 npminstall-debug.log diff --git a/npminstall-debug.log b/npminstall-debug.log new file mode 100644 index 0000000..6af7dac --- /dev/null +++ b/npminstall-debug.log @@ -0,0 +1,214 @@ +{ + root: 'C:\\Users\\lj\\Desktop\\222\\recycle-front', + registry: 'https://registry.npmmirror.com', + pkgs: [ + { + name: 'qrcode', + version: 'latest', + type: 'tag', + alias: undefined, + arg: [Result] + } + ], + production: false, + cacheStrict: false, + cacheDir: 'C:\\Users\\lj\\.npminstall_tarball', + env: { + npm_config_registry: 'https://registry.npmmirror.com', + npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\lj\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","qrcode"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\lj\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","qrcode"]}', + npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v22.16.0 win32 x64', + npm_config_cache: 'C:\\Users\\lj\\.npminstall_tarball', + NODE: 'C:\\Program Files\\nodejs\\node.exe', + npm_node_execpath: 'C:\\Program Files\\nodejs\\node.exe', + npm_execpath: 'C:\\Users\\lj\\AppData\\Roaming\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js', + npm_config_userconfig: 'C:\\Users\\lj\\.cnpmrc', + npm_config_disturl: 'https://cdn.npmmirror.com/binaries/node', + npm_config_r: 'https://registry.npmmirror.com', + COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com', + EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver', + NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs', + CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver', + OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver', + CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip', + ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/', + ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/', + SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass', + SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc', + NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v', + PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright', + SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli', + SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl', + RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2', + RE2_DOWNLOAD_SKIP_PATH: 'true', + PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma', + npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3', + npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar', + npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp', + npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips', + npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs', + npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl', + npm_rootpath: 'C:\\Users\\lj\\Desktop\\222\\recycle-front', + INIT_CWD: 'C:\\Users\\lj\\Desktop\\222\\recycle-front' + }, + binaryMirrors: { + ENVS: { + COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com', + EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver', + NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node', + PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs', + CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver', + OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver', + CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip', + ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/', + ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/', + SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass', + SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc', + NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v', + PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing', + PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright', + SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli', + SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl', + RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2', + RE2_DOWNLOAD_SKIP_PATH: 'true', + PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma', + npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3', + npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar', + npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp', + npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips', + npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs', + npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl' + }, + '@ali/s2': { host: 'https://cdn.npmmirror.com/binaries/looksgood-s2' }, + sharp: { replaceHostFiles: [Array], replaceHostMap: [Object] }, + '@tensorflow/tfjs-node': { + replaceHostFiles: [Array], + replaceHostRegExpMap: [Object], + replaceHostMap: [Object] + }, + cypress: { + host: 'https://cdn.npmmirror.com/binaries/cypress', + newPlatforms: [Object] + }, + 'utf-8-validate': { + host: 'https://cdn.npmmirror.com/binaries/utf-8-validate/v{version}' + }, + xprofiler: { + remote_path: './xprofiler/v{version}/', + host: 'https://cdn.npmmirror.com/binaries' + }, + leveldown: { host: 'https://cdn.npmmirror.com/binaries/leveldown/v{version}' }, + couchbase: { host: 'https://cdn.npmmirror.com/binaries/couchbase/v{version}' }, + gl: { host: 'https://cdn.npmmirror.com/binaries/gl/v{version}' }, + sqlite3: { + host: 'https://cdn.npmmirror.com/binaries/sqlite3', + remote_path: 'v{version}' + }, + '@journeyapps/sqlcipher': { host: 'https://cdn.npmmirror.com/binaries' }, + grpc: { + host: 'https://cdn.npmmirror.com/binaries', + remote_path: '{name}/v{version}' + }, + 'grpc-tools': { host: 'https://cdn.npmmirror.com/binaries' }, + wrtc: { + host: 'https://cdn.npmmirror.com/binaries', + remote_path: '{name}/v{version}' + }, + fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' }, + nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' }, + canvas: { + host: 'https://cdn.npmmirror.com/binaries/canvas', + remote_path: 'v{version}' + }, + 'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' }, + 'flow-bin': { + replaceHost: 'https://github.com/facebook/flow/releases/download/v', + host: 'https://cdn.npmmirror.com/binaries/flow/v' + }, + 'jpegtran-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/jpegtran-bin' + }, + 'cwebp-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/cwebp-bin' + }, + 'zopflipng-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/zopflipng-bin' + }, + 'optipng-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/optipng-bin' + }, + mozjpeg: { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/mozjpeg-bin' + }, + gifsicle: { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/gifsicle-bin' + }, + 'pngquant-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/pngquant-bin', + replaceHostMap: [Object] + }, + 'pngcrush-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/pngcrush-bin' + }, + 'jpeg-recompress-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/jpeg-recompress-bin' + }, + 'advpng-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/advpng-bin' + }, + 'pngout-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/pngout-bin' + }, + 'jpegoptim-bin': { + replaceHost: [Array], + host: 'https://cdn.npmmirror.com/binaries/jpegoptim-bin' + }, + argon2: { host: 'https://cdn.npmmirror.com/binaries/argon2' }, + 'ali-zeromq': { host: 'https://cdn.npmmirror.com/binaries/ali-zeromq' }, + 'ali-usb_ctl': { host: 'https://cdn.npmmirror.com/binaries/ali-usb_ctl' }, + 'gdal-async': { host: 'https://cdn.npmmirror.com/binaries/node-gdal-async' }, + 'libpg-query': { host: 'https://cdn.npmmirror.com/binaries' } + }, + forbiddenLicenses: null, + flatten: false, + proxy: undefined, + prune: false, + disableFallbackStore: false, + workspacesMap: Map(0) {}, + enableWorkspace: false, + workspaceRoot: 'C:\\Users\\lj\\Desktop\\222\\recycle-front', + isWorkspaceRoot: true, + isWorkspacePackage: false, + offline: false, + strictSSL: true, + ignoreScripts: false, + foregroundScripts: false, + ignoreOptionalDependencies: false, + detail: false, + forceLinkLatest: false, + trace: false, + engineStrict: false, + registryOnly: false, + client: false, + autoFixVersion: [Function: autoFixVersion] +} \ No newline at end of file diff --git a/pages/manager/order-detail.vue b/pages/manager/order-detail.vue index f0d7092..7a42c85 100644 --- a/pages/manager/order-detail.vue +++ b/pages/manager/order-detail.vue @@ -41,7 +41,7 @@ {{ item.value }} 查看物流 - 复制 + 复制 diff --git a/pages/subcomponent/detail.vue b/pages/subcomponent/detail.vue index a1fe98d..7714e5d 100644 --- a/pages/subcomponent/detail.vue +++ b/pages/subcomponent/detail.vue @@ -56,7 +56,7 @@ {{ expressCompany }}{{ wuliuNo }} 查看物流 - 复制 + 复制 diff --git a/pages/subcomponent/promo-qrcode.vue b/pages/subcomponent/promo-qrcode.vue index d29e66e..f6a2663 100644 --- a/pages/subcomponent/promo-qrcode.vue +++ b/pages/subcomponent/promo-qrcode.vue @@ -24,18 +24,12 @@ - - - - 二维码加载失败 - 请检查网络连接后重试 - - - + 邀请码:{{inviteCode}} @@ -58,9 +52,9 @@ export default { data() { return { userInfo: {}, - qrcodeUrl: '/static/qrcode.png', + qrcodeUrl: '/static/qrcode.png', // 展示用的图片URL + qrcodeLocalPath: '', // 下载用的本地文件路径 inviteCode: '888888', - qrcodeLoadError: false, // 二维码加载错误标志 } }, onLoad() { @@ -111,77 +105,92 @@ export default { getQrcode() { // 获取全局二维码路径 - if (getApp().globalData.qr_path) { + if (getApp().globalData.qr_path && getApp().globalData.qr_path.startsWith('wxfile://')) { console.log('获取到二维码路径', getApp().globalData.qr_path) + this.qrcodeLocalPath = getApp().globalData.qr_path this.qrcodeUrl = getApp().globalData.qr_path } else { - console.log('全局二维码路径不存在') - + console.log('全局二维码路径不存在,调用后端API生成') uni.showLoading({ - title: '拼命绘画中...' - }) - - uni.getImageInfo({ - src: `${config.baseUrl}/recycle-admin/applet/promotion/getInviteCode?token=${uni.getStorageSync('token')}`, - success: res => { - console.log(res); - getApp().globalData.qr_path = res.path - console.log(getApp().globalData.qr_path, 'qr_path') - this.qrcodeUrl = res.path - }, - fail: err => { - console.log('QR code load failed:', err) - }, - complete() { - uni.hideLoading() - } + title: '生成二维码中...' }) + this.generateQrcode() } }, + // 只保留后端API生成二维码 + generateQrcode() { + const token = uni.getStorageSync('token') + const qrcodeUrl = `${config.baseUrl}/recycle-admin/applet/promotion/getInviteCode?token=${token}` + console.log('二维码URL:', qrcodeUrl) + + // 展示用网络图片 + this.qrcodeUrl = qrcodeUrl + + // 下载到本地用于保存 + uni.downloadFile({ + url: qrcodeUrl, + success: res => { + console.log('下载成功:', res) + if (res.statusCode === 200) { + // 使用微信小程序推荐的临时文件路径格式 + const tempFilePath = res.tempFilePath + getApp().globalData.qr_path = tempFilePath + this.qrcodeLocalPath = tempFilePath + console.log('本地二维码路径:', tempFilePath) + } else { + console.log('下载失败,状态码:', res.statusCode) + uni.showToast({ title: '二维码下载失败', icon: 'none' }) + } + }, + fail: err => { + console.log('下载失败:', err) + uni.showToast({ title: '二维码下载失败', icon: 'none' }) + }, + complete() { + uni.hideLoading() + } + }) + }, + // 保存到手机相册 saveToAlbum() { - if (!this.qrcodeUrl) { + if (!this.qrcodeLocalPath) { uni.showToast({ - title: '二维码还未加载完成', + title: '二维码还未下载完成,请稍后再试', icon: 'none' }) return } - // 先授权相册权限 + // 使用新的权限检查方式 uni.getSetting({ success: (res) => { - if (!res.authSetting['scope.writePhotosAlbum']) { - // 没有权限,申请权限 - uni.authorize({ - scope: 'scope.writePhotosAlbum', + if (res.authSetting['scope.writePhotosAlbum'] === false) { + // 权限被拒绝,引导用户手动开启 + uni.showModal({ + title: '提示', + content: '需要您授权保存相册权限,请在设置中开启', + showCancel: false, success: () => { - this.doSaveImage() - }, - fail: () => { - // 权限被拒绝,引导用户手动开启 - uni.showModal({ - title: '提示', - content: '需要您授权保存相册权限', - showCancel: false, - success: () => { - uni.openSetting() - } - }) + uni.openSetting() } }) } else { - // 已有权限,直接保存 + // 尝试保存,如果没有权限会自动弹出授权框 this.doSaveImage() } + }, + fail: () => { + // 直接尝试保存 + this.doSaveImage() } }) }, // 执行保存图片 doSaveImage() { uni.saveImageToPhotosAlbum({ - filePath: this.qrcodeUrl, + filePath: this.qrcodeLocalPath, success: () => { uni.showToast({ title: '保存成功', @@ -198,17 +207,16 @@ export default { }) }, - // 二维码加载错误处理 - onQrcodeError(e) { - console.error('二维码图片加载失败:', e); - this.qrcodeLoadError = true; - // 可以在这里添加上报逻辑 + // 图片加载成功 + onImageLoad() { + console.log('二维码图片加载成功') }, - // 二维码加载成功处理 - onQrcodeLoad(e) { - console.log('二维码图片加载成功'); - this.qrcodeLoadError = false; + // 图片加载失败 + onImageError() { + console.log('二维码图片加载失败,使用默认图片') + this.qrcodeUrl = '/static/qrcode.png' + this.qrcodeLocalPath = '' } } } @@ -307,39 +315,7 @@ export default { box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); } - .qrcode-fallback { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #fff; - border-radius: 24rpx; - box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); - display: flex; - justify-content: center; - align-items: center; - } - - .qrcode-placeholder { - display: flex; - flex-direction: column; - align-items: center; - padding: 40rpx; - - .placeholder-text { - font-size: 32rpx; - color: #666; - margin-bottom: 16rpx; - font-weight: bold; - } - - .placeholder-desc { - font-size: 28rpx; - color: #999; - text-align: center; - } - } + .invite-code { margin-top: 32rpx;