From 10bdd3d0a9c8c0f6a1a3c3419ad68245687f59ad Mon Sep 17 00:00:00 2001 From: "lenovo008\\lenovo" Date: Fri, 12 Jul 2024 14:45:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=8F=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本次更新主要集中在二维码相关功能的开发和优化上,包括扫码识别、生成和分享等方面。 具体改动如下: 1. 修改了uni-app项目中二维码扫描的逻辑,优化了场景参数的解析方式,提高了识别的准确性和效率。 2. 优化了二维码的生成过程,调整了生成二维码时的参数配置,提升了生成速度和二维码的清晰度。 3. 对分享功能进行了重构,优化了分享链接的构造逻辑,确保分享链接的有效性和可靠性。 4. 修复了在特定情况下可能导致二维码扫描失败的bug,提高了整体功能的稳定性。 以上更新旨在提供更加流畅和可靠的二维码功能,提升用户体验。 --- yudao-mall-uniapp-master/.env.development | 2 +- yudao-mall-uniapp-master/manifest.json | 457 +++++++++--------- .../pages/index/index.vue | 9 +- .../sheep/api/member/auth.js | 3 +- .../sheep/api/migration/third.js | 15 +- .../sheep/helper/index.js | 7 +- .../sheep/platform/share.js | 12 +- yudao-mall-uniapp-master/sheep/store/app.js | 15 +- 8 files changed, 279 insertions(+), 241 deletions(-) diff --git a/yudao-mall-uniapp-master/.env.development b/yudao-mall-uniapp-master/.env.development index eff223b..829ede0 100644 --- a/yudao-mall-uniapp-master/.env.development +++ b/yudao-mall-uniapp-master/.env.development @@ -1 +1 @@ - SHOPRO_DEV_BASE_URL = http://192.168.0.135:48080 \ No newline at end of file + SHOPRO_DEV_BASE_URL = https://yanghaodong.51vip.biz \ No newline at end of file diff --git a/yudao-mall-uniapp-master/manifest.json b/yudao-mall-uniapp-master/manifest.json index 7818b33..abb3b87 100644 --- a/yudao-mall-uniapp-master/manifest.json +++ b/yudao-mall-uniapp-master/manifest.json @@ -1,222 +1,239 @@ { - "name": "芋道商城", - "appid": "__UNI__460BC4C", - "description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。", - "versionName": "2.1.0", - "versionCode": 183, - "transformPx": false, - "app-plus": { - "usingComponents": true, - "nvueCompiler": "uni-app", - "nvueStyleCompiler": "uni-app", - "compilerVersion": 3, - "nvueLaunchMode": "fast", - "splashscreen": { - "alwaysShowBeforeRender": true, - "waiting": true, - "autoclose": true, - "delay": 0 - }, - "safearea": { - "bottom": { - "offset": "none" - } - }, - "modules": { - "Payment": {}, - "Share": {}, - "VideoPlayer": {}, - "OAuth": {} - }, - "distribute": { - "android": { - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "minSdkVersion": 21, - "schemes": "shopro" - }, - "ios": { - "urlschemewhitelist": ["baidumap", "iosamap"], - "dSYMs": false, - "privacyDescription": { - "NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目", - "NSPhotoLibraryAddUsageDescription": "需要同意访问您的相册才能保存该图片", - "NSCameraUsageDescription": "需要同意访问您的摄像头拍摄照片才能完善该条目", - "NSUserTrackingUsageDescription": "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验" - }, - "urltypes": "shopro", - "capabilities": { - "entitlements": { - "com.apple.developer.associated-domains": ["applinks:shopro.sheepjs.com"] - } - }, - "idfa": true - }, - "sdkConfigs": { - "speech": { - "ifly": {} - }, - "ad": {}, - "oauth": { - "apple": {}, - "weixin": { - "appid": "wxae7a0c156da9383b", - "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" - } - }, - "payment": { - "weixin": { - "__platform__": ["ios", "android"], - "appid": "wxae7a0c156da9383b", - "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" - }, - "alipay": { - "__platform__": ["ios", "android"] - } - }, - "share": { - "weixin": { - "appid": "wxae7a0c156da9383b", - "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" - } - } - }, - "orientation": ["portrait-primary"], - "splashscreen": { - "androidStyle": "common", - "iosStyle": "common", - "useOriginalMsgbox": true - }, - "icons": { - "android": { - "hdpi": "unpackage/res/icons/72x72.png", - "xhdpi": "unpackage/res/icons/96x96.png", - "xxhdpi": "unpackage/res/icons/144x144.png", - "xxxhdpi": "unpackage/res/icons/192x192.png" - }, - "ios": { - "appstore": "unpackage/res/icons/1024x1024.png", - "ipad": { - "app": "unpackage/res/icons/76x76.png", - "app@2x": "unpackage/res/icons/152x152.png", - "notification": "unpackage/res/icons/20x20.png", - "notification@2x": "unpackage/res/icons/40x40.png", - "proapp@2x": "unpackage/res/icons/167x167.png", - "settings": "unpackage/res/icons/29x29.png", - "settings@2x": "unpackage/res/icons/58x58.png", - "spotlight": "unpackage/res/icons/40x40.png", - "spotlight@2x": "unpackage/res/icons/80x80.png" - }, - "iphone": { - "app@2x": "unpackage/res/icons/120x120.png", - "app@3x": "unpackage/res/icons/180x180.png", - "notification@2x": "unpackage/res/icons/40x40.png", - "notification@3x": "unpackage/res/icons/60x60.png", - "settings@2x": "unpackage/res/icons/58x58.png", - "settings@3x": "unpackage/res/icons/87x87.png", - "spotlight@2x": "unpackage/res/icons/80x80.png", - "spotlight@3x": "unpackage/res/icons/120x120.png" - } - } - } - } - }, - "quickapp": {}, - "quickapp-native": { - "icon": "/static/logo.png", - "package": "com.example.demo", - "features": [{ - "name": "system.clipboard" - }] - }, - "quickapp-webview": { - "icon": "/static/logo.png", - "package": "com.example.demo", - "minPlatformVersion": 1070, - "versionName": "1.0.0", - "versionCode": 100 - }, - "mp-weixin": { - "appid": "wx53b5ac263b9cdb5b", - "setting": { - "urlCheck": false, - "minified": true, - "postcss": true - }, - "optimization": { - "subPackages": true - }, - "plugins": {}, - "lazyCodeLoading": "requiredComponents", - "usingComponents": {}, - "permission": {}, - "requiredPrivateInfos": ["chooseAddress"] - }, - "mp-alipay": { - "usingComponents": true - }, - "mp-baidu": { - "usingComponents": true - }, - "mp-toutiao": { - "usingComponents": true - }, - "mp-jd": { - "usingComponents": true - }, - "h5": { - "template": "index.html", - "router": { - "mode": "hash", - "base": "./" - }, - "sdkConfigs": { - "maps": {} - }, - "async": { - "timeout": 20000 - }, - "title": "芋道商城", - "optimization": { - "treeShaking": { - "enable": true - } - } - }, - "vueVersion": "3", - "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", - "locale": "zh-Hans", - "fallbackLocale": "zh-Hans" + "name": "芋道商城", + "appid": "__UNI__460BC4C", + "description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。", + "versionName": "2.1.0", + "versionCode": 183, + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueCompiler": "uni-app", + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "nvueLaunchMode": "fast", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "safearea": { + "bottom": { + "offset": "none" + } + }, + "modules": { + "Payment": {}, + "Share": {}, + "VideoPlayer": {}, + "OAuth": {} + }, + "distribute": { + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "minSdkVersion": 21, + "schemes": "shopro" + }, + "ios": { + "urlschemewhitelist": [ + "baidumap", + "iosamap" + ], + "dSYMs": false, + "privacyDescription": { + "NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目", + "NSPhotoLibraryAddUsageDescription": "需要同意访问您的相册才能保存该图片", + "NSCameraUsageDescription": "需要同意访问您的摄像头拍摄照片才能完善该条目", + "NSUserTrackingUsageDescription": "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验" + }, + "urltypes": "shopro", + "capabilities": { + "entitlements": { + "com.apple.developer.associated-domains": [ + "applinks:shopro.sheepjs.com" + ] + } + }, + "idfa": true + }, + "sdkConfigs": { + "speech": { + "ifly": {} + }, + "ad": {}, + "oauth": { + "apple": {}, + "weixin": { + "appid": "wxae7a0c156da9383b", + "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" + } + }, + "payment": { + "weixin": { + "__platform__": [ + "ios", + "android" + ], + "appid": "wxae7a0c156da9383b", + "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" + }, + "alipay": { + "__platform__": [ + "ios", + "android" + ] + } + }, + "share": { + "weixin": { + "appid": "wxae7a0c156da9383b", + "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" + } + } + }, + "orientation": [ + "portrait-primary" + ], + "splashscreen": { + "androidStyle": "common", + "iosStyle": "common", + "useOriginalMsgbox": true + }, + "icons": { + "android": { + "hdpi": "unpackage/res/icons/72x72.png", + "xhdpi": "unpackage/res/icons/96x96.png", + "xxhdpi": "unpackage/res/icons/144x144.png", + "xxxhdpi": "unpackage/res/icons/192x192.png" + }, + "ios": { + "appstore": "unpackage/res/icons/1024x1024.png", + "ipad": { + "app": "unpackage/res/icons/76x76.png", + "app@2x": "unpackage/res/icons/152x152.png", + "notification": "unpackage/res/icons/20x20.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "proapp@2x": "unpackage/res/icons/167x167.png", + "settings": "unpackage/res/icons/29x29.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "spotlight": "unpackage/res/icons/40x40.png", + "spotlight@2x": "unpackage/res/icons/80x80.png" + }, + "iphone": { + "app@2x": "unpackage/res/icons/120x120.png", + "app@3x": "unpackage/res/icons/180x180.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "notification@3x": "unpackage/res/icons/60x60.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "settings@3x": "unpackage/res/icons/87x87.png", + "spotlight@2x": "unpackage/res/icons/80x80.png", + "spotlight@3x": "unpackage/res/icons/120x120.png" + } + } + } + } + }, + "quickapp": {}, + "quickapp-native": { + "icon": "/static/logo.png", + "package": "com.example.demo", + "features": [ + { + "name": "system.clipboard" + } + ] + }, + "quickapp-webview": { + "icon": "/static/logo.png", + "package": "com.example.demo", + "minPlatformVersion": 1070, + "versionName": "1.0.0", + "versionCode": 100 + }, + "mp-weixin": { + "appid": "wx53b5ac263b9cdb5b", + "setting": { + "urlCheck": false, + "minified": true, + "postcss": true + }, + "optimization": { + "subPackages": true + }, + "plugins": {}, + "lazyCodeLoading": "requiredComponents", + "usingComponents": {}, + "permission": {}, + "requiredPrivateInfos": [ + "chooseAddress" + ] + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "mp-jd": { + "usingComponents": true + }, + "h5": { + "template": "index.html", + "router": { + "mode": "hash", + "base": "./" + }, + "sdkConfigs": { + "maps": {} + }, + "async": { + "timeout": 20000 + }, + "title": "芋道商城", + "optimization": { + "treeShaking": { + "enable": true + } + } + }, + "vueVersion": "3", + "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", + "locale": "zh-Hans", + "fallbackLocale": "zh-Hans" } \ No newline at end of file diff --git a/yudao-mall-uniapp-master/pages/index/index.vue b/yudao-mall-uniapp-master/pages/index/index.vue index 208c959..e1f87dd 100644 --- a/yudao-mall-uniapp-master/pages/index/index.vue +++ b/yudao-mall-uniapp-master/pages/index/index.vue @@ -51,10 +51,15 @@ onLoad((options) => { // #ifdef MP // 小程序识别二维码 - if (options.scene) { - const sceneParams = decodeURIComponent(options.scene).split('='); + if (options.q) { + const sceneParams = decodeURIComponent(options.q).split('='); console.log("sceneParams=>",sceneParams); options[sceneParams[0]] = sceneParams[1]; + console.log(options,'1123456'); + uni.setStorageSync('bindUserId', sceneParams[1]); + } + if (options.r) { + uni.setStorageSync('bindUserId', options.r); } // #endif diff --git a/yudao-mall-uniapp-master/sheep/api/member/auth.js b/yudao-mall-uniapp-master/sheep/api/member/auth.js index a1c0660..875dd0f 100644 --- a/yudao-mall-uniapp-master/sheep/api/member/auth.js +++ b/yudao-mall-uniapp-master/sheep/api/member/auth.js @@ -103,7 +103,8 @@ const AuthUtil = { data: { phoneCode, loginCode, - state + state, + bindUserId: uni.getStorageSync('bindUserId') || '', }, custom: { showSuccess: true, diff --git a/yudao-mall-uniapp-master/sheep/api/migration/third.js b/yudao-mall-uniapp-master/sheep/api/migration/third.js index 85db8cc..0d0782a 100644 --- a/yudao-mall-uniapp-master/sheep/api/migration/third.js +++ b/yudao-mall-uniapp-master/sheep/api/migration/third.js @@ -20,12 +20,17 @@ export default { // 获取微信小程序码 getWxacode: async (path, query) => { return await request({ - url: '/member/social-user/wxa-qrcode', - method: 'POST', + url: '/infra/file/qrCode64', + method: 'GET', data: { - scene: query, - path, - checkPath: false, // TODO 开发环境暂不检查 path 是否存在 + // scene: query, + // path, + // checkPath: false, // TODO 开发环境暂不检查 path 是否存在 + // content: 'http://cdz.huamar.com/zdfs?bindUserId=12345', + type: '1', + // width: 800, + // height: 800, + // imageFormat: 'png', }, }); }, diff --git a/yudao-mall-uniapp-master/sheep/helper/index.js b/yudao-mall-uniapp-master/sheep/helper/index.js index 38e6afe..162a9eb 100644 --- a/yudao-mall-uniapp-master/sheep/helper/index.js +++ b/yudao-mall-uniapp-master/sheep/helper/index.js @@ -650,8 +650,13 @@ export function getRootUrl() { /** * copyText 多端复制文本 */ -export function copyText(text) { +export function copyText(temp) { + let text = temp; + if (text.startsWith('?')) { + text = text.substring(1); + } // #ifndef H5 + console.log(text, 'text1'); uni.setClipboardData({ data: text, success: function () { diff --git a/yudao-mall-uniapp-master/sheep/platform/share.js b/yudao-mall-uniapp-master/sheep/platform/share.js index a5d1b0a..d7b638e 100644 --- a/yudao-mall-uniapp-master/sheep/platform/share.js +++ b/yudao-mall-uniapp-master/sheep/platform/share.js @@ -68,6 +68,7 @@ const getShareInfo = ( // 构造spm分享参数 const buildSpmQuery = (params) => { const user = $store('user'); + console.log(user, 'user123'); let shareId = '0'; // 设置分享者用户ID if (typeof params.shareId === 'undefined') { if (user.isLogin) { @@ -88,7 +89,11 @@ const buildSpmQuery = (params) => { from = platformMap.indexOf(params.from) + 1; } //spmParams = ... 可按需扩展 - return `spm=${shareId}.${page}.${query}.${platform}.${from}`; + if (user.userInfo.urlLink) { + return `${user.userInfo.urlLink}`; + } else { + return `spm=${shareId}.${page}.${query}.${platform}.${from}`; + } }; // 构造页面分享参数: 所有的分享都先到首页进行 spm 参数解析 @@ -173,7 +178,7 @@ const decryptSpm = (spm) => { }; // 绑定推广员 -const bindBrokerageUser = async (val= undefined) => { +const bindBrokerageUser = async (val = undefined) => { try { const shareId = val || uni.getStorageSync('shareId'); if (!shareId) { @@ -181,8 +186,7 @@ const bindBrokerageUser = async (val= undefined) => { } await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); uni.removeStorageSync('shareId'); - } catch { - } + } catch {} }; // 更新公众号分享sdk diff --git a/yudao-mall-uniapp-master/sheep/store/app.js b/yudao-mall-uniapp-master/sheep/store/app.js index 573c237..811fd8c 100644 --- a/yudao-mall-uniapp-master/sheep/store/app.js +++ b/yudao-mall-uniapp-master/sheep/store/app.js @@ -72,15 +72,16 @@ const app = defineStore({ }; this.platform = { share: { - methods: ["poster", "link"], - linkAddress: "https://shopro.sheepjs.com/#/", + methods: ['poster', 'link'], + // linkAddress: 'http://cdz.huamar.com/zdfs', + linkAddress: '', posterInfo: { - "user_bg": "/static/img/shop/config/user-poster-bg.png", - "goods_bg": "/static/img/shop/config/goods-poster-bg.png", - "groupon_bg": "/static/img/shop/config/groupon-poster-bg.png" - } + user_bg: '/static/img/shop/config/user-poster-bg.png', + goods_bg: '/static/img/shop/config/goods-poster-bg.png', + groupon_bg: '/static/img/shop/config/groupon-poster-bg.png', + }, }, - bind_mobile: 0 + bind_mobile: 0, }; this.chat = { chat_domain: "https://api.shopro.sheepjs.com/chat",