Commit 5f138c83 by haojie

1

parent efaffa3b
No preview for this file type
...@@ -80,7 +80,8 @@ export default function () { ...@@ -80,7 +80,8 @@ export default function () {
ChainObj: any, ChainObj: any,
token: string, token: string,
title: string, title: string,
url: string url: string,
swapObj: any = {}
) => { ) => {
if (!url) { if (!url) {
return; return;
...@@ -97,6 +98,21 @@ export default function () { ...@@ -97,6 +98,21 @@ export default function () {
return; return;
} }
} else if (title === 'Transaction') { } else if (title === 'Transaction') {
// 先判断新加入的swap
if (swapObj && Object.keys(swapObj).length) {
if (swapObj.reg && swapObj.needToken) {
let url = swapObj.url.replace(swapObj.reg, token);
window.open(url);
return;
} else if (swapObj.needToken) {
let url = swapObj.url + token;
window.open(url);
return;
} else {
window.open(swapObj.url);
return;
}
}
// 交易平台 // 交易平台
if (ChainObj.url.Transaction.need_token) { if (ChainObj.url.Transaction.need_token) {
// 需要拼接token在跳转 // 需要拼接token在跳转
......
export default defineNuxtRouteMiddleware(() => { export default defineNuxtRouteMiddleware(() => {
console.log('0') try {
if (process.client) {
if (
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
window.location.href = 'http://m.dexfilter.com';
}
}
} catch (e) {
window.location.href = 'http://m.dexfilter.com';
console.log(e);
}
}); });
import viteCompression from 'vite-plugin-compression'; import viteCompression from 'vite-plugin-compression';
import visualizer from 'rollup-plugin-visualizer';
// 筛选接口地址 // 筛选接口地址
let filterApi = 'http://156.247.9.93:9501/'; let filterApi = 'http://156.247.9.93:9501/';
let loginApi = 'http://156.247.9.93:8001/'; let loginApi = 'http://156.247.9.93:8001/';
...@@ -39,26 +39,29 @@ export default defineNuxtConfig({ ...@@ -39,26 +39,29 @@ export default defineNuxtConfig({
// NODE_ENV: process.env.NODE_ENV, // NODE_ENV: process.env.NODE_ENV,
// }, // },
vite: { vite: {
plugins: [viteCompression()], plugins: [viteCompression(), visualizer({ open: true })],
envDir: '~/env', envDir: '~/env',
build: { build: {
minify: 'terser', // 混淆器,terser构建后文件体积更小 minify: 'terser', // 混淆器,terser构建后文件体积更小
// 构建后是否生成 source map 文件
// sourcemap: 'hidden',
cssCodeSplit: true, // 如果设置为false,整个项目中的所有 CSS 将被提取到一个 CSS 文件中 cssCodeSplit: true, // 如果设置为false,整个项目中的所有 CSS 将被提取到一个 CSS 文件中
terserOptions: { terserOptions: {
compress: { compress: {
//生产环境时移除console //生产环境时移除console
drop_console: true, drop_console: false,
// drop_debugger: true, // drop_debugger: true,
}, },
output: { output: {
// 去掉注释内容 // 去掉注释内容
comments: true, comments: false,
}, },
}, },
rollupOptions: { rollupOptions: {
output: { output: {
manualChunks: { manualChunks: {
TdesignVueNext: ['tdesign-vue-next'], TdesignVueNext: ['tdesign-vue-next'],
CustomEcharts: ['echarts'],
}, },
}, },
}, },
...@@ -73,6 +76,7 @@ export default defineNuxtConfig({ ...@@ -73,6 +76,7 @@ export default defineNuxtConfig({
? ['tdesign-vue-next', 'echarts', 'vue-i18n'] ? ['tdesign-vue-next', 'echarts', 'vue-i18n']
: ['echarts'], : ['echarts'],
// cssSourceMap: true, // cssSourceMap: true,
// analyze: true,
}, },
css: ['@/style/font-family.css'], css: ['@/style/font-family.css'],
}); });
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"dependencies": { "dependencies": {
"@metamask/detect-provider": "^2.0.0", "@metamask/detect-provider": "^2.0.0",
"@nuxtjs-alt/proxy": "^2.0.4", "@nuxtjs-alt/proxy": "^2.0.4",
"cross-env": "^7.0.3",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"install": "^0.13.0", "install": "^0.13.0",
...@@ -21,11 +22,11 @@ ...@@ -21,11 +22,11 @@
}, },
"devDependencies": { "devDependencies": {
"axios": "^0.24.0", "axios": "^0.24.0",
"cross-env": "^7.0.3",
"fontmin": "^0.9.9", "fontmin": "^0.9.9",
"less": "^4.1.3", "less": "^4.1.3",
"less-loader": "^11.1.0", "less-loader": "^11.1.0",
"nuxt": "^3.1.1", "nuxt": "^3.1.1",
"rollup-plugin-visualizer": "^5.9.0",
"vite-plugin-compression": "^0.5.1" "vite-plugin-compression": "^0.5.1"
} }
}, },
...@@ -4270,7 +4271,6 @@ ...@@ -4270,7 +4271,6 @@
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"dependencies": { "dependencies": {
"cross-spawn": "^7.0.1" "cross-spawn": "^7.0.1"
}, },
...@@ -4288,7 +4288,6 @@ ...@@ -4288,7 +4288,6 @@
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"dev": true,
"dependencies": { "dependencies": {
"path-key": "^3.1.0", "path-key": "^3.1.0",
"shebang-command": "^2.0.0", "shebang-command": "^2.0.0",
...@@ -7333,8 +7332,7 @@ ...@@ -7333,8 +7332,7 @@
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
"dev": true
}, },
"node_modules/jest-worker": { "node_modules/jest-worker": {
"version": "27.5.1", "version": "27.5.1",
...@@ -9376,7 +9374,6 @@ ...@@ -9376,7 +9374,6 @@
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
...@@ -11019,7 +11016,6 @@ ...@@ -11019,7 +11016,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"dependencies": { "dependencies": {
"shebang-regex": "^3.0.0" "shebang-regex": "^3.0.0"
}, },
...@@ -11031,7 +11027,6 @@ ...@@ -11031,7 +11027,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
...@@ -13657,7 +13652,6 @@ ...@@ -13657,7 +13652,6 @@
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"dependencies": { "dependencies": {
"isexe": "^2.0.0" "isexe": "^2.0.0"
}, },
...@@ -16962,7 +16956,6 @@ ...@@ -16962,7 +16956,6 @@
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"requires": { "requires": {
"cross-spawn": "^7.0.1" "cross-spawn": "^7.0.1"
} }
...@@ -16971,7 +16964,6 @@ ...@@ -16971,7 +16964,6 @@
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"dev": true,
"requires": { "requires": {
"path-key": "^3.1.0", "path-key": "^3.1.0",
"shebang-command": "^2.0.0", "shebang-command": "^2.0.0",
...@@ -19238,8 +19230,7 @@ ...@@ -19238,8 +19230,7 @@
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
"dev": true
}, },
"jest-worker": { "jest-worker": {
"version": "27.5.1", "version": "27.5.1",
...@@ -20846,8 +20837,7 @@ ...@@ -20846,8 +20837,7 @@
"path-key": { "path-key": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
"dev": true
}, },
"path-parse": { "path-parse": {
"version": "1.0.7", "version": "1.0.7",
...@@ -22045,7 +22035,6 @@ ...@@ -22045,7 +22035,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"requires": { "requires": {
"shebang-regex": "^3.0.0" "shebang-regex": "^3.0.0"
} }
...@@ -22053,8 +22042,7 @@ ...@@ -22053,8 +22042,7 @@
"shebang-regex": { "shebang-regex": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
"dev": true
}, },
"side-channel": { "side-channel": {
"version": "1.0.4", "version": "1.0.4",
...@@ -23974,7 +23962,6 @@ ...@@ -23974,7 +23962,6 @@
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": { "requires": {
"isexe": "^2.0.0" "isexe": "^2.0.0"
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"scripts": { "scripts": {
"build": "nuxt build", "build": "nuxt build",
"build:prod": "nuxt build --mode production", "build:prod": "nuxt build --mode production",
"start": "cross-env NITRO_PORT=7001 node .output/server/index.mjs", "start": "cross-env NITRO_PORT=83 node .output/server/index.mjs",
"dev": "nuxt dev", "dev": "nuxt dev",
"generate": "nuxt generate", "generate": "nuxt generate",
"preview": "nuxt preview", "preview": "nuxt preview",
...@@ -11,16 +11,17 @@ ...@@ -11,16 +11,17 @@
}, },
"devDependencies": { "devDependencies": {
"axios": "^0.24.0", "axios": "^0.24.0",
"cross-env": "^7.0.3",
"fontmin": "^0.9.9", "fontmin": "^0.9.9",
"less": "^4.1.3", "less": "^4.1.3",
"less-loader": "^11.1.0", "less-loader": "^11.1.0",
"nuxt": "^3.1.1", "nuxt": "^3.1.1",
"rollup-plugin-visualizer": "^5.9.0",
"vite-plugin-compression": "^0.5.1" "vite-plugin-compression": "^0.5.1"
}, },
"dependencies": { "dependencies": {
"@metamask/detect-provider": "^2.0.0", "@metamask/detect-provider": "^2.0.0",
"@nuxtjs-alt/proxy": "^2.0.4", "@nuxtjs-alt/proxy": "^2.0.4",
"cross-env": "^7.0.3",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"install": "^0.13.0", "install": "^0.13.0",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
const obj = { // 获取0的个数
name: 'zhangsan' let test = (1000000000 + '').match(/0/g);
} console.log(test);
\ No newline at end of file
...@@ -67,6 +67,7 @@ instance.interceptors.response.use( ...@@ -67,6 +67,7 @@ instance.interceptors.response.use(
(err) => { (err) => {
const { config } = err; const { config } = err;
// 只有在生产环境才执行reload // 只有在生产环境才执行reload
try {
if (!process.dev && 'response' in err) { if (!process.dev && 'response' in err) {
const { status } = err.response; const { status } = err.response;
if (status == 503) { if (status == 503) {
...@@ -74,6 +75,9 @@ instance.interceptors.response.use( ...@@ -74,6 +75,9 @@ instance.interceptors.response.use(
return; return;
} }
} }
} catch (e) {
console.log(e);
}
const { message: msg } = err.response.data; const { message: msg } = err.response.data;
MessagePlugin.closeAll(); MessagePlugin.closeAll();
MessagePlugin.error(msg || '请求错误'); MessagePlugin.error(msg || '请求错误');
......
...@@ -31,11 +31,11 @@ export const supportedResolutions = [ ...@@ -31,11 +31,11 @@ export const supportedResolutions = [
export class DataFeed { export class DataFeed {
private symbolInfo: any; private symbolInfo: any;
private subscribers: any[] = []; private subscribers: any[] = [];
private interval = null; private interval: any = null;
private resolution = '15'; private resolution = '15';
private currentPath = ''; private currentPath = '';
// 每个时间段都要给5次重试次数 // 每个时间段都要给5次重试次数
private RetryTime = { private RetryTime: any = {
r1: 0, r1: 0,
r5: 0, r5: 0,
r15: 0, r15: 0,
...@@ -43,7 +43,7 @@ export class DataFeed { ...@@ -43,7 +43,7 @@ export class DataFeed {
r240: 0, r240: 0,
r1D: 0, r1D: 0,
}; };
private KPirce = null; private KPirce: any = null;
constructor(symbolInfo: any, timeInterval = 1000) { constructor(symbolInfo: any, timeInterval = 1000) {
this.currentPath = symbolInfo.currentPath; this.currentPath = symbolInfo.currentPath;
this.KPirce = symbolInfo.KPirce; this.KPirce = symbolInfo.KPirce;
...@@ -96,7 +96,7 @@ export class DataFeed { ...@@ -96,7 +96,7 @@ export class DataFeed {
symbolInfo: any, symbolInfo: any,
resolution: string, resolution: string,
onRealtimeCallback: any, onRealtimeCallback: any,
subscriberUID: string, subscriberUID: string | any,
onResetCacheNeededCallback: () => void onResetCacheNeededCallback: () => void
) { ) {
if (this.subscribers[subscriberUID]) { if (this.subscribers[subscriberUID]) {
...@@ -114,7 +114,7 @@ export class DataFeed { ...@@ -114,7 +114,7 @@ export class DataFeed {
/** /**
* 取消订阅K线数据 * 取消订阅K线数据
*/ */
public unsubscribeBars(subscriberUID: string) { public unsubscribeBars(subscriberUID: string | any) {
if (!this.subscribers[subscriberUID]) { if (!this.subscribers[subscriberUID]) {
return; return;
} }
...@@ -154,7 +154,7 @@ export class DataFeed { ...@@ -154,7 +154,7 @@ export class DataFeed {
params.to = Date.now(); params.to = Date.now();
} }
const res = request const res = request
.get(`/v1/${this.currentPath}/chart/bars`, { .get(`/v1${this.currentPath}/chart/bars`, {
params, params,
}) })
.then((res: any) => { .then((res: any) => {
...@@ -209,7 +209,7 @@ export class DataFeed { ...@@ -209,7 +209,7 @@ export class DataFeed {
countBack: 2, countBack: 2,
}; };
request request
.get(`/v1/${this.currentPath}/chart/bars`, { .get(`/v1${this.currentPath}/chart/bars`, {
params: params, params: params,
}) })
.then((res: any) => { .then((res: any) => {
...@@ -234,7 +234,7 @@ export class DataFeed { ...@@ -234,7 +234,7 @@ export class DataFeed {
} }
export class Widget { export class Widget {
private options: any; private options: any;
public widget = null; public widget: any = null;
constructor(options = {}) { constructor(options = {}) {
const mode = useCurTheme(); const mode = useCurTheme();
// 获取当前语言 // 获取当前语言
...@@ -306,8 +306,7 @@ export class Widget { ...@@ -306,8 +306,7 @@ export class Widget {
maxLength = priceNum; maxLength = priceNum;
} }
// 获取0的个数 // 获取0的个数
let re = eval('/0/g'); let test = (maxLength + '').match(/0/g);
let test = (maxLength + '').match(re);
if (test && test.length) { if (test && test.length) {
// 这里将价格精度改为同样的长度 // 这里将价格精度改为同样的长度
newprice = price.toFixed(test.length); newprice = price.toFixed(test.length);
......
<template> <template>
<div class=""> <div class="">
<ClientOnly> 111 </ClientOnly> <ClientOnly></ClientOnly>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup></script>
const { data } = await useAsyncData(
"hello",
() => $fetch("http://156.247.9.93:9501/v1/eth/indexV1"),
{
// 在这里修改数据
transform: (input) => {
// 这里的 input 就是从服务器请求获取的数据
console.log(input); // { status: 200, message: 'Success', list: [ 1, 2, 3 ] }
return input;
},
lazy: true,
}
);
</script>
<style lang="less"></style> <style lang="less"></style>
...@@ -160,7 +160,7 @@ onBeforeMount(() => { ...@@ -160,7 +160,7 @@ onBeforeMount(() => {
} }
let obj = WebS(routeTb); let obj = WebS(routeTb);
request request
.get(`/v1/${currentPath.value}/getConfig`, { .get(`/v1${currentPath.value}/getConfig`, {
params: { params: {
tag: obj.token, tag: obj.token,
}, },
......
...@@ -67,7 +67,7 @@ useHead({ ...@@ -67,7 +67,7 @@ useHead({
title: `Dexfilter | ${tb.value}`, title: `Dexfilter | ${tb.value}`,
script: [ script: [
{ {
src: '/charting_library/charting_library.standalone.js', src: '/charting_library/charting_library.standalone2.js',
}, },
], ],
link: [webLogo], link: [webLogo],
...@@ -181,7 +181,7 @@ onMounted(() => { ...@@ -181,7 +181,7 @@ onMounted(() => {
} }
let obj = WebS(tb.value); let obj = WebS(tb.value);
request request
.get(`/v1/${currentPath.value}/getConfig`, { .get(`/v1${currentPath.value}/getConfig`, {
params: { params: {
tag: obj.token, tag: obj.token,
}, },
......
...@@ -390,7 +390,7 @@ const getHistoryList = async (type = 'update') => { ...@@ -390,7 +390,7 @@ const getHistoryList = async (type = 'update') => {
} }
// 请求 // 请求
let result: any = await request.get( let result: any = await request.get(
`/v1/${props.currentPath}/getBelowInfo`, `/v1${props.currentPath}/getBelowInfo`,
{ {
params, params,
} }
...@@ -511,7 +511,7 @@ const getfilterTimeList = async (value: any) => { ...@@ -511,7 +511,7 @@ const getfilterTimeList = async (value: any) => {
}; };
// 请求 // 请求
let result: any = await request.get( let result: any = await request.get(
`/v1/${props.currentPath}/getBelowInfo`, `/v1${props.currentPath}/getBelowInfo`,
{ {
params, params,
} }
......
<template> <template>
<!-- <div class="right-detail-wrapper"> <div class="right-detail-wrapper">
<div class="right-header"> <div class="right-header">
<template v-for="item in headerBtns" :key="item.value"> <template v-for="item in headerBtns" :key="item.value">
<t-button <t-button
...@@ -105,27 +105,26 @@ ...@@ -105,27 +105,26 @@
></details-echarts> ></details-echarts>
</div> </div>
</template> </template>
</div> --> </div>
<div></div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import request from "@/utils/request"; import request from '@/utils/request';
import { parsePercent, parseCoinAmount } from "@/utils/tool"; import { parsePercent, parseCoinAmount } from '@/utils/tool';
import TimeTab from "./TimeTab.vue"; import TimeTab from './TimeTab.vue';
import SecurityCheck from "./SecurityCheck.vue"; import SecurityCheck from './SecurityCheck.vue';
import TokenInfo from "./TokenInfo.vue"; import TokenInfo from './TokenInfo.vue';
import TokenPool from "./TokenPool.vue"; import TokenPool from './TokenPool.vue';
import TokenSocialList from "./TokenSocialList.vue"; import TokenSocialList from './TokenSocialList.vue';
import * as Cache from "@/utils/cache"; import * as Cache from '@/utils/cache';
import { MessagePlugin } from "tdesign-vue-next"; import { MessagePlugin } from 'tdesign-vue-next';
import DetailsEcharts from "../analysis/detailsEcharts.vue"; import DetailsEcharts from '../analysis/detailsEcharts.vue';
import Detailsicon from "/public/images/svg/rightDetail/detailsicon.svg"; import Detailsicon from '/public/images/svg/rightDetail/detailsicon.svg';
import Favo from "/public/images/svg/rightDetail/favo.svg"; import Favo from '/public/images/svg/rightDetail/favo.svg';
import CollectionSvg from "/public/images/svg/rightDetail/colection.svg"; import CollectionSvg from '/public/images/svg/rightDetail/colection.svg';
import { useI18n } from "vue-i18n"; import { useI18n } from 'vue-i18n';
import RightDetailHeader from "./rightDetailHeader"; import RightDetailHeader from './rightDetailHeader';
import SubmitSocialInfo from "./SubmitSocialInfo"; import SubmitSocialInfo from './SubmitSocialInfo';
import Collection from "./collection"; import Collection from './collection';
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t, locale } = useI18n();
// 通知表格收藏图表取消收藏 // 通知表格收藏图表取消收藏
...@@ -134,16 +133,16 @@ const CollectionDe = CollectionDelete(); ...@@ -134,16 +133,16 @@ const CollectionDe = CollectionDelete();
// const initEchart = computed(() => store.getters['echart/gethasInit']); // const initEchart = computed(() => store.getters['echart/gethasInit']);
const headerBtns = computed(() => [ const headerBtns = computed(() => [
{ {
label: t("securityCheck.details"), label: t('securityCheck.details'),
value: "details", value: 'details',
}, },
{ {
label: t("filter.Collection"), label: t('filter.Collection'),
value: "collection", value: 'collection',
}, },
{ {
label: t("securityCheck.analysis"), label: t('securityCheck.analysis'),
value: "echart", value: 'echart',
}, },
]); ]);
const props = defineProps({ const props = defineProps({
...@@ -155,52 +154,52 @@ const props = defineProps({ ...@@ -155,52 +154,52 @@ const props = defineProps({
mt: String, mt: String,
up: Number, up: Number,
}); });
const emit = defineEmits(["update:setPool", "SettwitterRul"]); const emit = defineEmits(['update:setPool', 'SettwitterRul']);
const r24h = ref(""); const r24h = ref('');
const numR24h = ref(""); const numR24h = ref('');
// 收藏列表是否首次加载 // 收藏列表是否首次加载
const CollectionOnload = ref(false); const CollectionOnload = ref(false);
// 判断当前路由,隐藏右侧详情box中的折线图模块 // 判断当前路由,隐藏右侧详情box中的折线图模块
const currentRouter = router.currentRoute.value.name; const currentRouter = router.currentRoute.value.name;
const currentTab = ref("info"); const currentTab = ref('info');
const isInCollection = ref(false); const isInCollection = ref(false);
// 默认选择detail按钮 // 默认选择detail按钮
const defaBtn = ref("details"); const defaBtn = ref('details');
const ifDetails = ref(false); const ifDetails = ref(false);
const WatchEcharts = useWatchEcharts(); const WatchEcharts = useWatchEcharts();
// 传给详情折线图的tbname // 传给详情折线图的tbname
const tb = ref(""); const tb = ref('');
// 点击pool才加载 // 点击pool才加载
const isPool = ref(false); const isPool = ref(false);
const PoolAddress = ref(""); const PoolAddress = ref('');
// 当前链 // 当前链
const chain = useChain(); const chain = useChain();
const tokenInfo: any = ref({ const tokenInfo: any = ref({
avatar: "", avatar: '',
token: "", token: '',
pool: [], pool: [],
}); });
const getPriceRange = () => { const getPriceRange = () => {
const { up, r24h: proR24h } = props; const { up, r24h: proR24h } = props;
if ((proR24h + "")[0] == "-") { if ((proR24h + '')[0] == '-') {
// -,跌 // -,跌
let newR24h = parseFloat((proR24h + "").replace("-", "")); let newR24h = parseFloat((proR24h + '').replace('-', ''));
// 原价 // 原价
let oldPrice = props.up / (1 - newR24h); let oldPrice = props.up / (1 - newR24h);
numR24h.value = oldPrice - props.up; numR24h.value = oldPrice - props.up;
numR24h.value = "-" + parseCoinAmount(numR24h.value); numR24h.value = '-' + parseCoinAmount(numR24h.value);
} else if (proR24h == 0) { } else if (proR24h == 0) {
numR24h.value = "+0"; numR24h.value = '+0';
} else { } else {
// +,涨 // +,涨
// 原价 // 原价
let oldPrice = props.up / (proR24h + 1); let oldPrice = props.up / (proR24h + 1);
numR24h.value = props.up - oldPrice; numR24h.value = props.up - oldPrice;
numR24h.value = "+" + parseCoinAmount(numR24h.value); numR24h.value = '+' + parseCoinAmount(numR24h.value);
} }
r24h.value = parsePercent(proR24h + ""); r24h.value = parsePercent(proR24h + '');
if (r24h.value[0] !== "-") { if (r24h.value[0] !== '-') {
r24h.value = "+" + r24h.value; r24h.value = '+' + r24h.value;
} }
}; };
watch( watch(
...@@ -214,13 +213,13 @@ watch( ...@@ -214,13 +213,13 @@ watch(
watch( watch(
() => props.r24h, () => props.r24h,
(v) => { (v) => {
if (typeof v !== "undefined") { if (typeof v !== 'undefined') {
getPriceRange(); getPriceRange();
} }
} }
); );
const btnLoad = (value: string) => { const btnLoad = (value: string) => {
if (currentRouter == "tokenAnalysis" && value == "echart") { if (currentRouter == 'tokenAnalysis' && value == 'echart') {
return false; return false;
} }
return true; return true;
...@@ -236,7 +235,7 @@ watch( ...@@ -236,7 +235,7 @@ watch(
); );
// 流动池tab改变 // 流动池tab改变
const changeTab = (value) => { const changeTab = (value) => {
if (value === "pool") { if (value === 'pool') {
isPool.value = true; isPool.value = true;
} }
}; };
...@@ -250,31 +249,31 @@ const getTokenInfo = async () => { ...@@ -250,31 +249,31 @@ const getTokenInfo = async () => {
}, },
}); });
result.marketCap = parseFloat(result.supply * result.up + "").toFixed(1); result.marketCap = parseFloat(result.supply * result.up + '').toFixed(1);
result.tokenSub = ""; result.tokenSub = '';
if (result.token) { if (result.token) {
result.tokenSub = result.tokenSub =
result.token.substr(0, 6) + result.token.substr(0, 6) +
"..." + '...' +
result.token.substr(result.token.length - 4, 4); result.token.substr(result.token.length - 4, 4);
} }
// tbname-掩码 // tbname-掩码
result.tbnameSub = ""; result.tbnameSub = '';
result.n_tb = ""; result.n_tb = '';
if (props.tb) { if (props.tb) {
// 先将d去掉 // 先将d去掉
result.n_tb = result.n_tb =
props.tb[0] == "d" ? props.tb.slice(1, props.tb.length) : props.tb; props.tb[0] == 'd' ? props.tb.slice(1, props.tb.length) : props.tb;
result.tbnameSub = result.tbnameSub =
result.n_tb.substr(0, 6) + result.n_tb.substr(0, 6) +
"..." + '...' +
result.n_tb.substr(result.n_tb.length - 4, 4); result.n_tb.substr(result.n_tb.length - 4, 4);
} }
isInCollection.value = Cache.hasSet(props.tb); isInCollection.value = Cache.hasSet(props.tb);
Object.assign(tokenInfo.value, result); Object.assign(tokenInfo.value, result);
// 如果有推特链接,提交给twitter组件解析 // 如果有推特链接,提交给twitter组件解析
if ("chat" in result) { if ('chat' in result) {
emit("SettwitterRul", result.chat.twitter); emit('SettwitterRul', result.chat.twitter);
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
...@@ -284,7 +283,7 @@ const getTokenInfo = async () => { ...@@ -284,7 +283,7 @@ const getTokenInfo = async () => {
watch( watch(
() => locale.value, () => locale.value,
(v) => { (v) => {
if (defaBtn.value == "echart") { if (defaBtn.value == 'echart') {
WatchEcharts.value += 1; WatchEcharts.value += 1;
} }
} }
...@@ -292,16 +291,16 @@ watch( ...@@ -292,16 +291,16 @@ watch(
// 点击查看token详情信息 // 点击查看token详情信息
// v-if v-show同时使用,折线图第一次加载后,不在使用v-if,减少请求 // v-if v-show同时使用,折线图第一次加载后,不在使用v-if,减少请求
const gotoDetail = (value) => { const gotoDetail = (value) => {
if (value == "collection" && !CollectionOnload.value) { if (value == 'collection' && !CollectionOnload.value) {
CollectionOnload.value = true; CollectionOnload.value = true;
} }
// 先判断是否有token,没有则禁止打开折线图模块 // 先判断是否有token,没有则禁止打开折线图模块
if (!props.tb && value === "echart") { if (!props.tb && value === 'echart') {
MessagePlugin.closeAll(); MessagePlugin.closeAll();
MessagePlugin.warning(t("MessagePlugin.plToken")); MessagePlugin.warning(t('MessagePlugin.plToken'));
return; return;
} }
if (value === "echart") { if (value === 'echart') {
tb.value = props.tb; tb.value = props.tb;
ifDetails.value = true; ifDetails.value = true;
} }
...@@ -316,14 +315,14 @@ const monitor = computed((value) => { ...@@ -316,14 +315,14 @@ const monitor = computed((value) => {
// 接收右侧详情流动池address // 接收右侧详情流动池address
const changePool = (PoolValue) => { const changePool = (PoolValue) => {
PoolAddress.value = PoolValue; PoolAddress.value = PoolValue;
emit("update:setPool", PoolValue); emit('update:setPool', PoolValue);
}; };
watch( watch(
() => props.token, () => props.token,
(v) => { (v) => {
if (v) { if (v) {
//如果折线图为隐藏状态,需注销折线图模块 //如果折线图为隐藏状态,需注销折线图模块
if (defaBtn.value != "echart") { if (defaBtn.value != 'echart') {
ifDetails.value = false; ifDetails.value = false;
} }
tb.value = props.tb; tb.value = props.tb;
...@@ -333,8 +332,8 @@ watch( ...@@ -333,8 +332,8 @@ watch(
); );
</script> </script>
<style lang="less"> <style lang="less">
@import "@/style/flex.less"; @import '@/style/flex.less';
@import "@/style/variables.less"; @import '@/style/variables.less';
.right-detail-wrapper { .right-detail-wrapper {
height: calc(100vh - 70px); height: calc(100vh - 70px);
flex: 1; flex: 1;
...@@ -362,7 +361,7 @@ watch( ...@@ -362,7 +361,7 @@ watch(
font-size: 14px; font-size: 14px;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: "Regular"; font-family: 'Regular';
.details-icon-cl { .details-icon-cl {
width: 30px; width: 30px;
fill: var(--td-search-btn-back-1); fill: var(--td-search-btn-back-1);
...@@ -438,7 +437,7 @@ watch( ...@@ -438,7 +437,7 @@ watch(
border-bottom-left-radius: @border-radius; border-bottom-left-radius: @border-radius;
border-bottom-right-radius: @border-radius; border-bottom-right-radius: @border-radius;
.t-tabs__nav-item-text-wrapper { .t-tabs__nav-item-text-wrapper {
font-family: "Medium"; font-family: 'Medium';
} }
.t-tabs__header { .t-tabs__header {
background-color: var(--td--right-back-color-2); background-color: var(--td--right-back-color-2);
......
<!--
* @Author: walker.liu
* @Date: 2022-04-09 14:54:44
* @Copyright(C): 2019-2020 ZP Inc. All rights reserved.
-->
<template> <template>
<div class="social-info-wrapper"> <div class="social-info-wrapper">
<template v-for="(item, index) in all_href_and_icon.list" :key="item"> <template v-for="(item, index) in all_href_and_icon.list" :key="item">
...@@ -28,7 +23,7 @@ ...@@ -28,7 +23,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { filterChainObj } from '@/constants/UnifiedManagementChain'; import { filterChainObj, getSwap } from '@/constants/UnifiedManagementChain';
import MoreUrlPopup from './moreUrlPopup'; import MoreUrlPopup from './moreUrlPopup';
import useSocial from '@/hooks/useSocial'; import useSocial from '@/hooks/useSocial';
const { sortImg, openSocialLink } = useSocial(); const { sortImg, openSocialLink } = useSocial();
...@@ -47,6 +42,10 @@ const ChainObj = ref( ...@@ -47,6 +42,10 @@ const ChainObj = ref(
true true
) )
); );
// 右侧数据
const RightInfo = useCurrentRightInfo();
// swap
const swapObj = ref<any>({});
// 默认的交易平台,跟随配置项 // 默认的交易平台,跟随配置项
const all_href_and_icon = reactive({ const all_href_and_icon = reactive({
list: [ list: [
...@@ -63,6 +62,7 @@ const all_href_and_icon = reactive({ ...@@ -63,6 +62,7 @@ const all_href_and_icon = reactive({
url: ChainObj.value.url.Transaction.link, url: ChainObj.value.url.Transaction.link,
title: ChainObj.value.url.Transaction.title, title: ChainObj.value.url.Transaction.title,
alt: 'Trading platform', alt: 'Trading platform',
type: 'default',
}, },
{ {
img: '/images/svg/rightDetail/other/Project-website.svg', img: '/images/svg/rightDetail/other/Project-website.svg',
...@@ -92,10 +92,33 @@ const all_href_and_icon = reactive({ ...@@ -92,10 +92,33 @@ const all_href_and_icon = reactive({
}); });
const gohref = (title: string, url: string) => { const gohref = (title: string, url: string) => {
if (title && url && props.token) { if (title && url && props.token) {
openSocialLink(ChainObj.value, props.token, title, url); openSocialLink(ChainObj.value, props.token, title, url, swapObj.value);
}
};
const changeSwap = () => {
if (RightInfo.value.swap) {
swapObj.value = getSwap(ChainObj.value.fullName, RightInfo.value.swap);
} else {
swapObj.value = {};
}
let TransactionIndex = all_href_and_icon.list.findIndex(
(item: any) => item.title === 'Transaction'
);
// 更换图标
if (swapObj.value && Object.keys(swapObj.value).length) {
// 使用表格里的swap
all_href_and_icon.list[TransactionIndex].img = swapObj.value.img;
all_href_and_icon.list[TransactionIndex].url = swapObj.value.url;
all_href_and_icon.list[TransactionIndex].type = 'swap';
} else {
// 交易平台
all_href_and_icon.list[TransactionIndex].img =
ChainObj.value.url.Transaction.img;
all_href_and_icon.list[TransactionIndex].url =
ChainObj.value.url.Transaction.link;
all_href_and_icon.list[TransactionIndex].type = 'default';
} }
}; };
// url变化 // url变化
watch( watch(
() => props.chat, () => props.chat,
...@@ -111,6 +134,7 @@ watch( ...@@ -111,6 +134,7 @@ watch(
}); });
sortAllHref(v); sortAllHref(v);
} }
changeSwap();
} }
); );
// 做个排序,有链接的放前面 // 做个排序,有链接的放前面
...@@ -137,19 +161,12 @@ const changeLink = (chain: string) => { ...@@ -137,19 +161,12 @@ const changeLink = (chain: string) => {
let websiteIndex = all_href_and_icon.list.findIndex( let websiteIndex = all_href_and_icon.list.findIndex(
(item: any) => item.title === 'website' (item: any) => item.title === 'website'
); );
// 筛出当前链交易平台图标的位置
let TransactionIndex = all_href_and_icon.list.findIndex(
(item: any) => item.title === 'Transaction'
);
// 更换图标和链接
// 官方浏览器 // 官方浏览器
all_href_and_icon.list[websiteIndex].img = ChainObj.value.url.website.img; all_href_and_icon.list[websiteIndex].img = ChainObj.value.url.website.img;
all_href_and_icon.list[websiteIndex].url = ChainObj.value.url.website.link; all_href_and_icon.list[websiteIndex].url = ChainObj.value.url.website.link;
// 交易平台
all_href_and_icon.list[TransactionIndex].img = // 更换swap
ChainObj.value.url.Transaction.img; changeSwap();
all_href_and_icon.list[TransactionIndex].url =
ChainObj.value.url.Transaction.link;
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
<!--
* @Author: lei 2897821407@qq.com
* @Date: 2023-02-20 19:44:54
* @LastEditors: lei 2897821407@qq.com
* @LastEditTime: 2023-02-20 20:00:08
* @FilePath: \dexfilter-web-nuxt3\views\token\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template> <template>
<MyLayout> <MyLayout>
<template #content> <template #content>
...@@ -37,29 +29,17 @@ ...@@ -37,29 +29,17 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import MyLayout from "@/views/layout/layout.vue"; import MyLayout from '@/views/layout/layout.vue';
import RightDetail from "@/views/token/RightDetail.vue"; import RightDetail from '@/views/token/RightDetail.vue';
import TokenFilter from "@/views/token/TokenFilter.vue"; import TokenFilter from '@/views/token/TokenFilter.vue';
import RollToken from "@/views/layout/rollToken.vue"; import RollToken from '@/views/layout/rollToken.vue';
const route = useRoute(); const route = useRoute();
const token = ref(); const token = ref();
const TbName = ref(); const TbName = ref();
const r24h = ref(); const r24h = ref();
const up = ref(); const up = ref();
const chain = useChain(); const chain = useChain();
const currentPath = ref(""); const currentPath = ref('');
const getUa = () => {
if (
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
)
) {
window.location.href = "http://m.dexfilter.com";
}
};
onBeforeMount(() => {
getUa();
});
onMounted(() => { onMounted(() => {
currentPath.value = chain.value; currentPath.value = chain.value;
}); });
...@@ -76,7 +56,7 @@ const changeChain = (chain) => { ...@@ -76,7 +56,7 @@ const changeChain = (chain) => {
</script> </script>
<style lang="less"> <style lang="less">
@import "@/style/variables.less"; @import '@/style/variables.less';
.home-wrapper { .home-wrapper {
width: 100vw; width: 100vw;
display: flex; display: flex;
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
& > :nth-child(1) { & > :nth-child(1) {
padding-right: 6px; padding-right: 6px;
} }
img {
width: 22px;
height: 22px;
border-radius: 50%;
}
} }
} }
.body-right { .body-right {
......
...@@ -2,7 +2,7 @@ import { defineComponent, ref } from 'vue'; ...@@ -2,7 +2,7 @@ import { defineComponent, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import './index.less'; import './index.less';
import ConnectCloseSvg from '/public/images/svg/rightDetail/connectClose.svg'; import ConnectCloseSvg from '/public/images/svg/rightDetail/connectClose.svg';
import { filterChainObj } from '@/constants/UnifiedManagementChain'; import { filterChainObj, getSwap } from '@/constants/UnifiedManagementChain';
import SubmitTableText from '../submitTableText.vue'; import SubmitTableText from '../submitTableText.vue';
import useSocial from '@/hooks/useSocial'; import useSocial from '@/hooks/useSocial';
export default defineComponent({ export default defineComponent({
...@@ -31,8 +31,31 @@ export default defineComponent({ ...@@ -31,8 +31,31 @@ export default defineComponent({
title: 'Transaction', title: 'Transaction',
alt: 'Trading platform', alt: 'Trading platform',
label: t('home.TokenTrading'), label: t('home.TokenTrading'),
type: 'default',
}, },
]); ]);
// 右侧数据
const RightInfo: any = useCurrentRightInfo();
// swap
const swapObj = ref<any>({});
const changeSwap = () => {
if (RightInfo.value.swap && ChainObj.value.fullName) {
swapObj.value = getSwap(ChainObj.value.fullName, RightInfo.value.swap);
} else {
swapObj.value = {};
}
// 更换图标
if (swapObj.value && Object.keys(swapObj.value).length) {
// 使用表格里的swap
tokenList.value[1].img = swapObj.value.img;
tokenList.value[1].url = swapObj.value.url;
tokenList.value[1].type = 'swap';
} else {
tokenList.value[1].img = ChainObj.value.url.Transaction.img;
tokenList.value[1].url = ChainObj.value.url.Transaction.link;
tokenList.value[1].type = 'default';
}
};
// 更换交易平台及官方浏览器 // 更换交易平台及官方浏览器
const changeLink = () => { const changeLink = () => {
ChainObj.value = filterChainObj('value', chain.value); ChainObj.value = filterChainObj('value', chain.value);
...@@ -40,18 +63,17 @@ export default defineComponent({ ...@@ -40,18 +63,17 @@ export default defineComponent({
// 官方浏览器 // 官方浏览器
tokenList.value[0].img = ChainObj.value.url.website.img; tokenList.value[0].img = ChainObj.value.url.website.img;
tokenList.value[0].url = ChainObj.value.url.website.link; tokenList.value[0].url = ChainObj.value.url.website.link;
// // 交易平台
tokenList.value[1].img = ChainObj.value.url.Transaction.img; changeSwap();
tokenList.value[1].url = ChainObj.value.url.Transaction.link;
}; };
watch( watch(
() => chain.value, () => chain.value,
(v) => { (v) => {
changeLink(); changeLink();
},
{
immediate: true,
} }
// {
// immediate: true,
// }
); );
watch( watch(
() => props.chat, () => props.chat,
...@@ -67,6 +89,7 @@ export default defineComponent({ ...@@ -67,6 +89,7 @@ export default defineComponent({
} }
}); });
} }
changeSwap();
} }
); );
const closeDialog = () => { const closeDialog = () => {
...@@ -74,7 +97,7 @@ export default defineComponent({ ...@@ -74,7 +97,7 @@ export default defineComponent({
}; };
const gohref = (title: string, url: string) => { const gohref = (title: string, url: string) => {
if (title && url && props.token) { if (title && url && props.token) {
openSocialLink(ChainObj.value, props.token, title, url); openSocialLink(ChainObj.value, props.token, title, url, swapObj.value);
} }
}; };
const popupContent = () => { const popupContent = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment