二维码功能开发及优化

本次更新主要集中在二维码相关功能的开发和优化上,包括扫码识别、生成和分享等方面。
具体改动如下:

1. 修改了uni-app项目中二维码扫描的逻辑,优化了场景参数的解析方式,提高了识别的准确性和效率。
2. 优化了二维码的生成过程,调整了生成二维码时的参数配置,提升了生成速度和二维码的清晰度。
3. 对分享功能进行了重构,优化了分享链接的构造逻辑,确保分享链接的有效性和可靠性。
4. 修复了在特定情况下可能导致二维码扫描失败的bug,提高了整体功能的稳定性。

以上更新旨在提供更加流畅和可靠的二维码功能,提升用户体验。
main
lenovo008\lenovo 4 months ago
parent a8e327c2a3
commit 10bdd3d0a9

@ -1 +1 @@
SHOPRO_DEV_BASE_URL = http://192.168.0.135:48080 SHOPRO_DEV_BASE_URL = https://yanghaodong.51vip.biz

@ -68,7 +68,10 @@
"schemes": "shopro" "schemes": "shopro"
}, },
"ios": { "ios": {
"urlschemewhitelist": ["baidumap", "iosamap"], "urlschemewhitelist": [
"baidumap",
"iosamap"
],
"dSYMs": false, "dSYMs": false,
"privacyDescription": { "privacyDescription": {
"NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目", "NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目",
@ -79,7 +82,9 @@
"urltypes": "shopro", "urltypes": "shopro",
"capabilities": { "capabilities": {
"entitlements": { "entitlements": {
"com.apple.developer.associated-domains": ["applinks:shopro.sheepjs.com"] "com.apple.developer.associated-domains": [
"applinks:shopro.sheepjs.com"
]
} }
}, },
"idfa": true "idfa": true
@ -98,12 +103,18 @@
}, },
"payment": { "payment": {
"weixin": { "weixin": {
"__platform__": ["ios", "android"], "__platform__": [
"ios",
"android"
],
"appid": "wxae7a0c156da9383b", "appid": "wxae7a0c156da9383b",
"UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
}, },
"alipay": { "alipay": {
"__platform__": ["ios", "android"] "__platform__": [
"ios",
"android"
]
} }
}, },
"share": { "share": {
@ -113,7 +124,9 @@
} }
} }
}, },
"orientation": ["portrait-primary"], "orientation": [
"portrait-primary"
],
"splashscreen": { "splashscreen": {
"androidStyle": "common", "androidStyle": "common",
"iosStyle": "common", "iosStyle": "common",
@ -157,9 +170,11 @@
"quickapp-native": { "quickapp-native": {
"icon": "/static/logo.png", "icon": "/static/logo.png",
"package": "com.example.demo", "package": "com.example.demo",
"features": [{ "features": [
{
"name": "system.clipboard" "name": "system.clipboard"
}] }
]
}, },
"quickapp-webview": { "quickapp-webview": {
"icon": "/static/logo.png", "icon": "/static/logo.png",
@ -182,7 +197,9 @@
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"usingComponents": {}, "usingComponents": {},
"permission": {}, "permission": {},
"requiredPrivateInfos": ["chooseAddress"] "requiredPrivateInfos": [
"chooseAddress"
]
}, },
"mp-alipay": { "mp-alipay": {
"usingComponents": true "usingComponents": true

@ -51,10 +51,15 @@
onLoad((options) => { onLoad((options) => {
// #ifdef MP // #ifdef MP
// //
if (options.scene) { if (options.q) {
const sceneParams = decodeURIComponent(options.scene).split('='); const sceneParams = decodeURIComponent(options.q).split('=');
console.log("sceneParams=>",sceneParams); console.log("sceneParams=>",sceneParams);
options[sceneParams[0]] = sceneParams[1]; options[sceneParams[0]] = sceneParams[1];
console.log(options,'1123456');
uni.setStorageSync('bindUserId', sceneParams[1]);
}
if (options.r) {
uni.setStorageSync('bindUserId', options.r);
} }
// #endif // #endif

@ -103,7 +103,8 @@ const AuthUtil = {
data: { data: {
phoneCode, phoneCode,
loginCode, loginCode,
state state,
bindUserId: uni.getStorageSync('bindUserId') || '',
}, },
custom: { custom: {
showSuccess: true, showSuccess: true,

@ -20,12 +20,17 @@ export default {
// 获取微信小程序码 // 获取微信小程序码
getWxacode: async (path, query) => { getWxacode: async (path, query) => {
return await request({ return await request({
url: '/member/social-user/wxa-qrcode', url: '/infra/file/qrCode64',
method: 'POST', method: 'GET',
data: { data: {
scene: query, // scene: query,
path, // path,
checkPath: false, // TODO 开发环境暂不检查 path 是否存在 // checkPath: false, // TODO 开发环境暂不检查 path 是否存在
// content: 'http://cdz.huamar.com/zdfs?bindUserId=12345',
type: '1',
// width: 800,
// height: 800,
// imageFormat: 'png',
}, },
}); });
}, },

@ -650,8 +650,13 @@ export function getRootUrl() {
/** /**
* copyText 多端复制文本 * copyText 多端复制文本
*/ */
export function copyText(text) { export function copyText(temp) {
let text = temp;
if (text.startsWith('?')) {
text = text.substring(1);
}
// #ifndef H5 // #ifndef H5
console.log(text, 'text1');
uni.setClipboardData({ uni.setClipboardData({
data: text, data: text,
success: function () { success: function () {

@ -68,6 +68,7 @@ const getShareInfo = (
// 构造spm分享参数 // 构造spm分享参数
const buildSpmQuery = (params) => { const buildSpmQuery = (params) => {
const user = $store('user'); const user = $store('user');
console.log(user, 'user123');
let shareId = '0'; // 设置分享者用户ID let shareId = '0'; // 设置分享者用户ID
if (typeof params.shareId === 'undefined') { if (typeof params.shareId === 'undefined') {
if (user.isLogin) { if (user.isLogin) {
@ -88,7 +89,11 @@ const buildSpmQuery = (params) => {
from = platformMap.indexOf(params.from) + 1; from = platformMap.indexOf(params.from) + 1;
} }
//spmParams = ... 可按需扩展 //spmParams = ... 可按需扩展
if (user.userInfo.urlLink) {
return `${user.userInfo.urlLink}`;
} else {
return `spm=${shareId}.${page}.${query}.${platform}.${from}`; return `spm=${shareId}.${page}.${query}.${platform}.${from}`;
}
}; };
// 构造页面分享参数: 所有的分享都先到首页进行 spm 参数解析 // 构造页面分享参数: 所有的分享都先到首页进行 spm 参数解析
@ -181,8 +186,7 @@ const bindBrokerageUser = async (val= undefined) => {
} }
await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); await BrokerageApi.bindBrokerageUser({ bindUserId: shareId });
uni.removeStorageSync('shareId'); uni.removeStorageSync('shareId');
} catch { } catch {}
}
}; };
// 更新公众号分享sdk // 更新公众号分享sdk

@ -72,15 +72,16 @@ const app = defineStore({
}; };
this.platform = { this.platform = {
share: { share: {
methods: ["poster", "link"], methods: ['poster', 'link'],
linkAddress: "https://shopro.sheepjs.com/#/", // linkAddress: 'http://cdz.huamar.com/zdfs',
linkAddress: '',
posterInfo: { posterInfo: {
"user_bg": "/static/img/shop/config/user-poster-bg.png", user_bg: '/static/img/shop/config/user-poster-bg.png',
"goods_bg": "/static/img/shop/config/goods-poster-bg.png", goods_bg: '/static/img/shop/config/goods-poster-bg.png',
"groupon_bg": "/static/img/shop/config/groupon-poster-bg.png" groupon_bg: '/static/img/shop/config/groupon-poster-bg.png',
} },
}, },
bind_mobile: 0 bind_mobile: 0,
}; };
this.chat = { this.chat = {
chat_domain: "https://api.shopro.sheepjs.com/chat", chat_domain: "https://api.shopro.sheepjs.com/chat",

Loading…
Cancel
Save