From 940b2fec2ddf00d5259613a9222004c4de400835 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Fri, 12 Dec 2025 15:22:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=9F=AD=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/profile/apply-vip.vue | 7 +++-- src/pages/profile/setting.vue | 11 +++++++- src/sheep/api/member/social.js | 8 ++++++ src/sheep/util/wechat-tool.ts | 47 +++++++++------------------------ 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/pages/profile/apply-vip.vue b/src/pages/profile/apply-vip.vue index 4d5d4e6f..5a9fb34f 100644 --- a/src/pages/profile/apply-vip.vue +++ b/src/pages/profile/apply-vip.vue @@ -200,6 +200,9 @@ const handleOpenVip = () => { uni.showToast({ title: `不支持${payMethodItem.title}支付`, icon: 'none' }); return } + + jumpToWechatPage() + return messageBox .confirm({ msg: '确认开通?', @@ -238,8 +241,8 @@ const disposeWechatPay = async (openTypeId: any) => { } // 跳转到微信小程序 -const jumpToWechatPage = () => { - jumpToWechatMiniProgram("openVip", { +const jumpToWechatPage = async () => { + await jumpToWechatMiniProgram("openVip", { openTypeId: curOpenTypeId.value, payMethod: payMethod.value }) diff --git a/src/pages/profile/setting.vue b/src/pages/profile/setting.vue index 65edc327..13abd8de 100644 --- a/src/pages/profile/setting.vue +++ b/src/pages/profile/setting.vue @@ -12,7 +12,7 @@ - + @@ -97,6 +97,15 @@ const beforeChange = ({ value, resolve }: any) => { resolve(true); }; +const copyEmail = (email: string) => { + uni.setClipboardData({ + data: email, + success: () => { + uni.showToast({ title: '复制成功', icon: 'none', }); + }, + }); +} + // 退出登录 const handleLogout = () => { message diff --git a/src/sheep/api/member/social.js b/src/sheep/api/member/social.js index 14e6edfa..f852a4f7 100644 --- a/src/sheep/api/member/social.js +++ b/src/sheep/api/member/social.js @@ -71,6 +71,14 @@ const SocialApi = { }, }); }, + // 获取微信小程短链 + getWxaQrcode: async (params) => { + return await request({ + url: '/member/social-user/wxa-url-scheme', + method: 'GET', + params, + }); + }, }; export default SocialApi; \ No newline at end of file diff --git a/src/sheep/util/wechat-tool.ts b/src/sheep/util/wechat-tool.ts index b6c2f456..068e2b2d 100644 --- a/src/sheep/util/wechat-tool.ts +++ b/src/sheep/util/wechat-tool.ts @@ -1,20 +1,10 @@ // @ts-nocheck import { isEmpty } from 'lodash-es'; +import SocialApi from '@/sheep/api/member/social'; const targetAppId = 'wx2b4e4d3feff8267f'; -const paramsToQuery = (params: Record) => { - if (isEmpty(params)) { - return ''; - } - let query = []; - for (let key in params) { - query.push(key + '=' + params[key]); - } - return query.join('&'); -} - -export const jumpToWechatMiniProgram = ( +export const jumpToWechatMiniProgram = async ( action: 'recharge' | 'openVip', params: Record, ) => { @@ -24,28 +14,15 @@ export const jumpToWechatMiniProgram = ( } if (action === 'openVip') { path = 'pages/profile/apply-vip'; - } - console.log("weixinShare:", path) - plus.share.getServices((data) => { - let sweixin = null; - data.forEach(item => { - if (item.id === "weixin") { - sweixin = item - } - }) - console.log("sweixin:", sweixin) - if (!sweixin) { - uni.showToast({ - title: "请安装微信", - icon: "none", - }); - return - } - sweixin.launchMiniProgram({ - id: targetAppId, + } + try { + // 获取小程序短链 + const { code, data } = await SocialApi.getWxaQrcode({ path: path, - // 可取值:0-正式版; 1-测试版; 2-体验版。默认值为0。 - type: 1, - }); - }) + json: JSON.stringify(params) + }) + console.log("|获取小程序短链|成功code:", code, "data:", data); + } catch (error) { + console.log("|获取小程序短链|意外的错误error:", error); + } } \ No newline at end of file