From 72283b50ceb72f4efe16848d6267f7aa05bf4d0a Mon Sep 17 00:00:00 2001 From: yuhawu <15545526+yuhawu@user.noreply.gitee.com> Date: Fri, 5 Sep 2025 15:12:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9EPDD=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2code=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/redirectUrl/index.vue | 59 +++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/src/views/redirectUrl/index.vue b/src/views/redirectUrl/index.vue index 44d2578..6eb9509 100644 --- a/src/views/redirectUrl/index.vue +++ b/src/views/redirectUrl/index.vue @@ -81,6 +81,18 @@ + +
+

授权码:

+
+ {{ urlParams.code }} + + 复制授权码 + +
+

复制授权码并在软件上粘贴后完成店铺绑定,授权码有效期为10分钟

+
+

操作流程图

@@ -126,7 +138,8 @@ const urlParams = ref({ pddMallName: '', type: '', accessToken: '', - skuSpec: '' + skuSpec: '', + code: '' }) // 表单数据 @@ -201,10 +214,11 @@ const getUrlParams = () => { pddMallName: decodeURIComponent(query.pddMallName || ''), type: query.type || '', accessToken: query.accessToken || '', - skuSpec: decodeURIComponent(query.skuSpec || '') + skuSpec: decodeURIComponent(query.skuSpec || ''), + code: query.code || '' } - // 将 "ppd" + pddMallId 回填到用户名 + // 将 "pdd" + pddMallId 回填到用户名 if (urlParams.value.pddMallId) { formData.value.username = 'pdd' + urlParams.value.pddMallId } @@ -437,6 +451,33 @@ const copyLoginUrl = async () => { } } +// 复制授权码 +const copyAuthCode = async () => { + const authCode = urlParams.value.code + if (!authCode) { + ElMessage.error('授权码不存在') + return + } + + try { + await navigator.clipboard.writeText(authCode) + ElMessage.success('授权码已复制到剪贴板!') + } catch (err) { + // 如果复制失败,使用备用方法 + try { + const textArea = document.createElement('textarea') + textArea.value = authCode + document.body.appendChild(textArea) + textArea.select() + document.execCommand('copy') + document.body.removeChild(textArea) + ElMessage.success('授权码已复制到剪贴板!') + } catch (fallbackErr) { + ElMessage.error('复制失败,请手动复制授权码') + } + } +} + // 显示流程图大图 const showImageViewer = ref(false) @@ -530,6 +571,18 @@ onMounted(() => { margin-bottom: 30px; } +.auth-code { + margin-bottom: 30px; +} + +.auth-code-tip { + font-size: 12px; + color: #909399; + margin-top: 8px; + margin-bottom: 0; + line-height: 1.4; +} + .url-label { font-size: 16px; color: #333;