zhb hace 1 mes
padre
commit
565e5e728d
Se han modificado 1 ficheros con 26 adiciones y 186 borrados
  1. 26 186
      pages/common/download.vue

+ 26 - 186
pages/common/download.vue

@@ -12,7 +12,7 @@
                         </view>
                         <view class="download-cards">
                             <cwg-link type="download" class="download-card"
-                                :url="myLink + '/mt/cwgmarketssvgltd4setup.exe'"
+                                :url="config.Host80 + '/mt/cwgmarketssvgltd4setup.exe'"
                                 downloadName="cwgmarketssvgltd4setup.exe">
                                 <image class="card-icon" src="/static/images/windows-os-1-48.png" alt=""
                                     mode="widthFix" />
@@ -22,7 +22,7 @@
                                 </view>
                                 <view class="download-badge">Windows</view>
                             </cwg-link>
-                            <cwg-link type="download" class="download-card" :url="myLink + '/mt/mt4.zip'"
+                            <cwg-link type="download" class="download-card" :url="config.Host80 + '/mt/mt4.zip'"
                                 downloadName="mt4.zip">
                                 <image class="card-icon" src="/static/images/windows-os-1-48.png" alt=""
                                     mode="widthFix" />
@@ -32,7 +32,7 @@
                                 </view>
                                 <view class="download-badge">ZIP</view>
                             </cwg-link>
-                            <cwg-link type="download" class="download-card" :url="myLink + '/mt/MetaTrader4.pkg'"
+                            <cwg-link type="download" class="download-card" :url="config.Host80 + '/mt/MetaTrader4.pkg'"
                                 downloadName="MetaTrader4.pkg">
                                 <image class="card-icon" src="/static/images/apple-os-1-48.png" alt=""
                                     mode="widthFix" />
@@ -50,7 +50,7 @@
                         </view>
                         <view class="download-cards">
                             <cwg-link type="html" class="download-card download-card-web" target="_blank"
-                                :url="'https://www.' + link + '.com/' + locale + '/mt4/web'">
+                                :url="'https://www.' + config.host + '.com/' + locale + '/mt4/web'">
                                 <view class="card-info">
                                     <view class="card-title" v-t="'Downloadpage.item40'" />
                                 </view>
@@ -75,11 +75,11 @@
                                 <view class="qr-codes">
                                     <view class="qr-item">
                                         <view class="qr-label">Google Play</view>
-                                        <QrCode v-if="mt41" :key="mt41" :text="mt41" :logoImage="logoImage"></QrCode>
+                                        <QrCode v-if="showQrcode && mt41" :key="mt41" :text="mt41"></QrCode>
                                     </view>
                                     <view class="qr-item">
                                         <view class="qr-label">MetaTrader .Apk</view>
-                                        <QrCode v-if="mt42" :key="mt42" :text="mt42" :logoImage="logoImage"></QrCode>
+                                        <QrCode v-if="showQrcode && mt41" :key="mt42" :text="mt42"></QrCode>
                                     </view>
                                 </view>
                             </view>
@@ -95,7 +95,7 @@
                                 <view class="qr-codes qr-codes-single">
                                     <view class="qr-item">
                                         <view class="qr-label">App Store</view>
-                                        <QrCode v-if="mt43" :key="mt43" :text="mt43" :logoImage="logoImage"></QrCode>
+                                        <QrCode v-if="showQrcode && mt41" :key="mt43" :text="mt43"></QrCode>
                                     </view>
                                 </view>
                             </view>
@@ -111,7 +111,8 @@
                         </view>
                         <view class="download-cards">
                             <cwg-link type="download" class="download-card"
-                                :url="myLink + '/mt/cwgmarketssvg5setup.exe'" downloadName="cwgmarketssvg5setup.exe">
+                                :url="config.Host80 + '/mt/cwgmarketssvg5setup.exe'"
+                                downloadName="cwgmarketssvg5setup.exe">
                                 <image class="card-icon" src="/static/images/windows-os-1-48.png" alt=""
                                     mode="widthFix" />
                                 <view class="card-info">
@@ -120,7 +121,7 @@
                                 </view>
                                 <view class="download-badge">Windows</view>
                             </cwg-link>
-                            <cwg-link type="download" class="download-card" :url="myLink + '/mt/mt5.zip'"
+                            <cwg-link type="download" class="download-card" :url="config.Host80 + '/mt/mt5.zip'"
                                 downloadName="mt5.zip">
                                 <image class="card-icon" src="/static/images/windows-os-1-48.png" alt=""
                                     mode="widthFix" />
@@ -130,7 +131,7 @@
                                 </view>
                                 <view class="download-badge">ZIP</view>
                             </cwg-link>
-                            <cwg-link type="download" class="download-card" :url="myLink + '/mt/MetaTrader5.pkg'"
+                            <cwg-link type="download" class="download-card" :url="config.Host80 + '/mt/MetaTrader5.pkg'"
                                 downloadName="MetaTrader5.dmg">
                                 <image class="card-icon" src="/static/images/apple-os-1-48.png" alt=""
                                     mode="widthFix" />
@@ -148,7 +149,7 @@
                         </view>
                         <view class="download-cards">
                             <cwg-link type="html" class="download-card download-card-web" target="_blank"
-                                :url="'https://www.' + link + '.com/' + locale + '/mt5/web'">
+                                :url="'https://www.' + config.host + '.com/' + locale + '/mt5/web'">
                                 <view class="card-info">
                                     <view class="card-title" v-t="'Downloadpage.item40'" />
                                 </view>
@@ -173,11 +174,11 @@
                                 <view class="qr-codes">
                                     <view class="qr-item">
                                         <view class="qr-label">Google Play</view>
-                                        <QrCode v-if="mt51" :key="mt51" :text="mt51" :logoImage="logoImage"></QrCode>
+                                        <QrCode v-if="showQrcode && mt41" :key="mt51" :text="mt51"></QrCode>
                                     </view>
                                     <view class="qr-item">
                                         <view class="qr-label">MetaTrader .Apk</view>
-                                        <QrCode v-if="mt52" :key="mt52" :text="mt52" :logoImage="logoImage"></QrCode>
+                                        <QrCode v-if="showQrcode && mt41" :key="mt52" :text="mt52"></QrCode>
                                     </view>
                                 </view>
                             </view>
@@ -193,205 +194,44 @@
                                 <view class="qr-codes qr-codes-single">
                                     <view class="qr-item">
                                         <view class="qr-label">App Store</view>
-                                        <QrCode v-if="mt53" :key="mt53" :text="mt53" :logoImage="logoImage"></QrCode>
+                                        <QrCode v-if="showQrcode && mt41" :key="mt53" :text="mt53"></QrCode>
                                     </view>
                                 </view>
                             </view>
                         </view>
                     </view>
                 </view>
-                <view v-if="activeName == 'Instruments'">
-                    <view class="instruments-banner">
-                        <view class="banner-content">
-                            <view class="banner-title" v-t="'Downloadpage.item18'" />
-                            <view class="banner-subtitle" v-t="'Downloadpage.item19'" />
-                        </view>
-                        <view class="banner-buttons">
-                            <cwg-link type="download" class="banner-btn" style="padding: 10px 25px;min-width: 220px;"
-                                url="https://mt.tradingcentral.cn/download"
-                                v-if="['cn', 'zhHant'].indexOf(Session.Get('lang')) != -1">
-                                <view v-t="'Downloadpage.item20'" />
-                                <view class="btn-tag">中国大陆用户</view>
-                            </cwg-link>
-                            <cwg-link type="download" class="banner-btn" style="padding: 10px 25px;min-width: 220px;"
-                                url="https://mt.tradingcentral.com/download"
-                                v-if="['cn', 'zhHant'].indexOf(Session.Get('lang')) != -1">
-                                <view v-t="'Downloadpage.item20'" />
-                                <view class="btn-tag">港澳台地区及海外用户</view>
-                            </cwg-link>
-                            <cwg-link type="download" class="banner-btn" url="https://mt.tradingcentral.com/download"
-                                v-if="['cn', 'zhHant'].indexOf(Session.Get('lang')) == -1">
-                                <span v-t="'Downloadpage.item20'"></span>
-                            </cwg-link>
-                        </view>
-                    </view>
-                    <view class="features-grid">
-                        <view class="feature-item">
-                            <view class="feature-icon">
-                                <i class="iconfenxi1 iconfont"></i>
-                            </view>
-                            <view class="feature-content">
-                                <view class="feature-title" v-t="'Downloadpage.item21'" />
-                                <view class="feature-desc" v-t="'Downloadpage.item22'" />
-                            </view>
-                        </view>
-                        <view class="feature-item">
-                            <view class="feature-icon">
-                                <i class="iconlazhutu iconfont"></i>
-                            </view>
-                            <view class="feature-content">
-                                <view class="feature-title" v-t="'Downloadpage.item23'" />
-                                <view class="feature-desc" v-t="'Downloadpage.item24'" />
-                            </view>
-                        </view>
-                        <view class="feature-item">
-                            <view class="feature-icon">
-                                <i class="iconzhibiao iconfont"></i>
-                            </view>
-                            <view class="feature-content">
-                                <view class="feature-title" v-t="'Downloadpage.item25'" />
-                                <view class="feature-desc" v-t="'Downloadpage.item26'" />
-                            </view>
-                        </view>
-                    </view>
-                    <view class="info-section">
-                        <view class="info-block">
-                            <view class="info-title"><span v-t="'Downloadpage.item27'"></span></view>
-                            <view class="info-content">
-                                <view class="info-item">
-                                    <view v-t="'Downloadpage.item28'" class="info-label" />
-                                    <view v-t="'Downloadpage.item29'" class="info-text" />
-                                </view>
-                                <view class="info-item info-item-border">
-                                    <view v-t="'Downloadpage.item30'" class="info-label" />
-                                    <view v-t="'Downloadpage.item31'" class="info-text" />
-                                </view>
-                            </view>
-                        </view>
-                    </view>
-                    <view class="info-section">
-                        <view class="info-block">
-                            <view class="info-title"><span v-t="'Downloadpage.item32'"></span></view>
-                            <view class="info-subtitle" v-t="'Downloadpage.item33'" />
-                            <view class="info-content">
-                                <view class="info-item">
-                                    <view v-t="'Downloadpage.item34'" class="info-label" />
-                                    <view v-t="'Downloadpage.item35'" class="info-text" />
-                                    <view class="info-image">
-                                        <image src="/static/images/tc-bg1.jpg" alt="" mode="widthFix" />
-                                    </view>
-                                </view>
-                                <view class="info-item">
-                                    <view v-t="'Downloadpage.item36'" class="info-label" />
-                                    <view v-t="'Downloadpage.item37'" class="info-text" />
-                                </view>
-                            </view>
-                        </view>
-                    </view>
-                </view>
             </view>
         </view>
     </cwg-page-wrapper>
 </template>
 
 <script setup lang="ts">
-import { ref, computed, onMounted } from 'vue'
+import { ref, computed, onMounted, nextTick } from 'vue'
 import QrCode from "@/components/QRCode.vue"
-// import logoImage from "@/assets/images/MTBG.jpg"
 import { useI18n } from 'vue-i18n'
-
+import config from '@/config';
 const { t, locale } = useI18n()
-
-// ---------- 存储辅助函数(模拟原 Session) ----------
-const Session = {
-    Get(key: string, parse = false) {
-        const value = uni.getStorageSync(key)
-        if (parse && value) {
-            try {
-                return JSON.parse(value)
-            } catch {
-                return value
-            }
-        }
-        return value
-    }
-}
-
-// ---------- 响应式数据 ----------
 const activeName = ref('MT4')
-const link = ref('')
-const myLink = ref('')
 const logoImageRef = ref('')  // 保持变量名 logoImage
 const mt41 = ref('https://www.metatrader4.com/en/download#download-block-android?server=CWGMarketsSVGLtd-Demo,CWGMarketsSVGLtd-Live')
-const mt42 = ref('')  // 稍后动态计算
+const mt42 = ref(`${config.Host80}/metatrader/metatrader4.apk`)  // 稍后动态计算
 const mt43 = ref('https://apps.apple.com/us/app/metatrader-4/id496212596?server=CWGMarketsSVGLtd-Demo,CWGMarketsSVGLtd-Live')
 const mt51 = ref('https://download.metatrader.com/cdn/mobile/mt5/android?server=CWGMarketsSVG-Demo,CWGMarketsSVG-Live')
-const mt52 = ref('')
+const mt52 = ref(`${config.Host80}/mt/metatrader5.apk`)
 const mt53 = ref('https://download.metatrader.com/cdn/mobile/mt5/ios?server=CWGMarketsSVG-Demo,CWGMarketsSVG-Live')
-
-// ---------- 辅助函数:获取当前域名主体(兼容 H5) ----------
-const getDomainMain = () => {
-    // 在 uni-app H5 环境下可使用 window.location
-    // 若在其他环境(如 App 内嵌 webview)可能没有 window,这里做兼容
-    if (typeof window !== 'undefined' && window.location && window.location.host) {
-        const parts = window.location.host.split('.')
-        return parts.length > 1 ? parts[1] : ''
-    }
-    // 降级方案:从配置或空字符串
-    return ''
-}
-
-const getOrigin = () => {
-    if (typeof window !== 'undefined' && window.location && window.location.origin) {
-        return window.location.origin
-    }
-    return ''
-}
 const tabsConfig = computed(() => [
     { text: 'MT4', value: 'MT4' },
     { text: 'MT5', value: 'MT5' },
 ])
 // ---------- 计算属性 ----------
-const country = computed(() => {
-    const user = Session.Get("user", true)
-    return user?.customInfo?.country
-})
-
-const lang = computed(() => {
-    return Session.Get('lang')
-})
-
-// ---------- 方法 ----------
-const getLang = (lang: string) => {
-    let val = 'en'
-    if (lang == 'cn') {
-        val = 'cn'
-    } else if (lang == 'zhHant') {
-        val = 'zh'
-    } else {
-        val = 'en'
-    }
-    return val
-}
-
-// ---------- 生命周期 ----------
-onMounted(() => {
-    // 计算动态链接
-    const domainMain = getDomainMain()
-    const origin = getOrigin()
-
-    link.value = domainMain
-    myLink.value = origin
-
-    // 原 mt42 动态拼接
-    mt42.value = `https://secure.${domainMain}.com/metatrader/metatrader4.apk`
-    // 原 mt52 动态拼接
-    mt52.value = `${origin}/mt/metatrader5.apk`
-})
-
-// 组件导出(可选,defineOptions 保留组件名)
-defineOptions({
-    name: "custom_Downloadpage"
+const isZh = computed(() => ['cn', 'zh', 'zhHant'].includes(locale.value))
+const showQrcode = ref(false)
+onMounted(async () => {
+    await nextTick()
+    setTimeout(() => {
+        showQrcode.value = true
+    }, 200)
 })
 </script>
 <style lang="scss" scoped>