Commit 5f138c83 by haojie

1

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