소스 검색

feat: 分享功能完善

liangan 1 주 전
부모
커밋
5ef968940d
6개의 변경된 파일13개의 추가작업 그리고 12개의 파일을 삭제
  1. 2 2
      manifest.config.ts
  2. 1 0
      src/locale/bn.json
  3. 1 0
      src/locale/en.json
  4. 1 0
      src/locale/zh-Hans.json
  5. 3 2
      src/pages/mine/share.vue
  6. 5 8
      src/pages/productDetail/productDetail.vue

+ 2 - 2
manifest.config.ts

@@ -24,8 +24,8 @@ export default defineManifestConfig({
   'name': VITE_APP_TITLE,
   'appid': VITE_UNI_APPID,
   'description': '',
-  'versionName': '1.2.4',
-  'versionCode': '124',
+  'versionName': '1.2.5',
+  'versionCode': '125',
   'transformPx': false,
   'locale': VITE_FALLBACK_LOCALE === 'bn' ? 'bn' : 'en', // 此app需默认英文
   'fallbackLocale': 'en',

+ 1 - 0
src/locale/bn.json

@@ -147,6 +147,7 @@
   "mine.pages.share.description": "আপনার বন্ধুদের সাথে আপনার কিউআর কোড শেয়ার করুন, তারা তাদের ক্যামেরা দিয়ে স্ক্যান করে আপনার ডাউনলাইন হিসাবে নিবন্ধন করতে পারবে।",
   "mine.pages.share.copySuccess": "ক্লিপবোর্ডে অনুলিপি করা হয়েছে",
   "mine.pages.share.shareTo": "{0} এ শেয়ার করুন",
+  "share.appNotInstalled": "শেয়ারিং সক্ষম করতে অ্যাপ ডাউনলোড করুন",
   "mine.pages.myFavorite.title": "আমার পছন্দ",
   "mine.pages.myFavorite.empty": "এখনও পছন্দ নেই",
   "wallet.withdraw.title": "উত্তোলন",

+ 1 - 0
src/locale/en.json

@@ -172,6 +172,7 @@
   "mine.pages.share.description": "Share your QR code with your friends, they can scan it with their camera to register as your downline.",
   "mine.pages.share.copySuccess": "Copied to clipboard",
   "mine.pages.share.shareTo": "Share to {0}",
+  "share.appNotInstalled": "Please download the APP to enable sharing",
   "mine.pages.myFavorite.title": "My Favorite",
   "mine.pages.myFavorite.empty": "No favorites yet",
   "auth.login.title": "Login",

+ 1 - 0
src/locale/zh-Hans.json

@@ -147,6 +147,7 @@
   "mine.pages.share.description": "与您的朋友分享二维码,他们可以用相机扫描以注册成为您的下线。",
   "mine.pages.share.copySuccess": "已复制到剪贴板",
   "mine.pages.share.shareTo": "分享到{0}",
+  "share.appNotInstalled": "请下载APP以启用分享功能",
   "mine.pages.myFavorite.title": "我的收藏",
   "mine.pages.myFavorite.empty": "暂无收藏",
   "wallet.withdraw.title": "提现",

+ 3 - 2
src/pages/mine/share.vue

@@ -11,6 +11,7 @@
 <script setup lang="ts">
 import tkiQrcode from 'tki-qrcode'
 import { getUserInfoHook } from '@/hooks/usePageAuth'
+import { t } from '@/locale'
 import { useUserStore } from '@/store'
 import { goBack } from '@/utils/page'
 import { toast } from '@/utils/toast'
@@ -123,7 +124,7 @@ function openSocialApp(platform: string) {
   if (shareUrl) {
     plus.runtime.openURL(shareUrl, (error) => {
       console.error('打开APP失败:', error)
-      toast.info('APP未安装,请先安装对应的社交媒体应用')
+      toast.info(t('share.appNotInstalled'))
     })
   }
 }
@@ -132,7 +133,7 @@ function openSocialApp(platform: string) {
 function handleShare(platform: string) {
   // 检查APP是否安装
   if (!checkAppInstalled(platform)) {
-    toast.info('APP未安装')
+    toast.info(t('share.appNotInstalled'))
     return
   }
 

+ 5 - 8
src/pages/productDetail/productDetail.vue

@@ -370,11 +370,11 @@ const showShare = ref<boolean>(false)
 // 生成商品分享链接
 function generateShareLink() {
   // 基础域名 - 根据需求使用bandhubuy.shop.com
-  const baseUrl = 'https://bandhubuy.shop.com'
-  const productUrl = `${baseUrl}/abc123` // 示例链接格式,实际应该根据商品ID生成
+  const baseUrl = 'http://124.222.152.234:8078'
+  const productUrl = `${baseUrl}/pages/productDetail/productDetail?productId=${productId.value}`
 
   // 分享文案格式:[BandhuBuy] + 商品链接 + 商品名称 + 邀请文案
-  const productName = detail.value.storeName || 'BOLON Classic Aviator Polarized Sunglasses, Exclusive Eyewear Brand'
+  const productName = detail.value.storeName
   const shareText = `[BandhuBuy] ${productUrl} ${productName}\nGet it on BandhuBuy now!`
 
   return {
@@ -390,9 +390,6 @@ function copyToClipboard() {
   uni.setClipboardData({
     data: text,
     success: () => {},
-    fail: () => {
-      toast.error('复制失败,请重试')
-    },
   })
 }
 
@@ -438,7 +435,7 @@ function openSocialApp(platform: string) {
   if (shareUrl) {
     plus.runtime.openURL(shareUrl, (error) => {
       console.error('打开APP失败:', error)
-      toast.info('APP未安装,请先安装对应的社交媒体应用')
+      toast.info(t('share.appNotInstalled'))
     })
   }
 }
@@ -452,7 +449,7 @@ function handleShare(platform: string) {
 
   // 检查APP是否安装
   if (!checkAppInstalled(platform)) {
-    toast.info('APP未安装,请先安装对应的社交媒体应用')
+    toast.info(t('share.appNotInstalled'))
     return
   }