Commit daa7ebe1 by lei

1

parent 02b3d41d
......@@ -28,7 +28,11 @@
import AnnSvg from "/public/images/svg/filter/announcement.svg";
import closeSvg from "/public/images/svg/filter/close.svg";
import { tgUrl } from "@/utils/open";
import { Button as TButton } from "tdesign-vue-next";
interface AnnLocalData {
last?: number;
value?: string;
}
// 是否展示广告
const hasOpen = ref(false);
// 获取当前时间
......@@ -38,11 +42,15 @@ const getCurTime = () => {
return date.valueOf();
};
onMounted(() => {
let open = JSON.parse(window.localStorage.getItem("openAnn"));
if (open && Object.keys(open).length) {
let localData = window.localStorage.getItem("openAnn");
let stringifyData: AnnLocalData = {};
if (localData) {
stringifyData = JSON.parse(localData);
}
if (stringifyData && Object.keys(stringifyData).length) {
// 获取当前时间
let curTime = getCurTime();
if (curTime - open.last >= 86400000) {
if (curTime - (stringifyData.last ?? 0) >= 86400000) {
hasOpen.value = true;
} else {
hasOpen.value = false;
......
import { useState } from '#app';
import { useState } from "#app";
interface UserInfo {
name: string;
vip_type?: string;
avatar?: string;
vip_time?: string;
is_bind?: number;
id: number;
}
// 用户token
export const useUserToken = () => {
return useState('userToken', () => '');
return useState("userToken", () => "");
};
// 用户信息
export const useTokenInfo = () => {
return useState('userInfo', () => ({
name: '---',
vip_type: '免费会员',
}));
return useState(
"userInfo",
() =>
({
name: "---",
vip_type: "免费会员",
} as UserInfo)
);
};
// 需要切换的路由
export const useChangeRouter = () => {
return useState('ChangeRouterPath', () => ({
name: 'router',
path: '/user',
return useState("ChangeRouterPath", () => ({
name: "router",
path: "/user",
id: 0,
}));
};
// 修改用户信息中的某个属性或多个属性
export const useUserName = () => {
return useState('UserName', () => ({
name: 'router',
path: '/user',
return useState("UserName", () => ({
name: "router",
path: "/user",
}));
};
......@@ -11,6 +11,7 @@ interface filterfield {
page_size?: number;
date_orderby?: string;
sort?: string;
[key: string]: string | number | undefined;
}
let filter: filterfield = {
pool_column: "wb",
......
import { defineNuxtPlugin } from "#app";
import {
Button as TButton,
Input as TInput,
Loading as TLoading,
TabPanel as TTabPanel,
Tooltip as TTooltip,
Select as TSelect,
Popup as TPopup,
Dialog as TDialog,
Option as TOption,
Switch as TSwitch,
Checkbox as TCheckbox,
Swiper as TSwiper,
SwiperItem as TSwiperItem,
} from "tdesign-vue-next";
const components = [
TButton,
TInput,
TLoading,
TTabPanel,
TTooltip,
TSelect,
TPopup,
TDialog,
TOption,
TSwitch,
TCheckbox,
TSwiper,
TSwiperItem,
];
export default defineNuxtPlugin((nuxtApp) => {
components.forEach((item: any) => {
nuxtApp.vueApp.use(item);
});
});
const vImage = {
mounted: async (el: HTMLImageElement) => {
// let imgURL = el.src; //获取图片地址
// if (imgURL) {
// let copyNode = el.cloneNode(true);
// // 给一个默认图片
// let defaultImg = "/images/img/empty.png";
// copyNode.src = defaultImg;
// // 在头部添加一个gif加载动画
// let parent = el.parentNode;
// parent?.insertBefore(copyNode);
// el.style.display = "none";
// el.onerror = () => {
// el.src = defaultImg;
// };
// }
console.log(el);
},
};
......
......@@ -18,6 +18,7 @@
<script lang="ts" setup>
import QrCode from "qrcode";
import { Dialog as TDialog } from "tdesign-vue-next";
const props = defineProps({
QrCodevisible: Boolean,
QrCode: String,
......@@ -34,7 +35,9 @@ const props = defineProps({
const emit = defineEmits(["closeDialog"]);
const getQrcode = () => {
let canvas = document.querySelector(`#${props.id}`);
QrCode.toCanvas(canvas, props.QrCode);
if (props.QrCode) {
QrCode.toCanvas(canvas, props.QrCode);
}
};
watch(
() => props.QrCode,
......
......@@ -13,6 +13,7 @@
<script lang="ts" setup>
import { useI18n } from "vue-i18n";
import { Select as TSelect, SelectValue } from "tdesign-vue-next";
const props = defineProps({
type: {
type: String,
......@@ -30,9 +31,11 @@ const languageOptions = [
value: "en",
},
];
const changeLanguage = (v: string) => {
locale.value = v;
localStorage.setItem("lang", v);
const changeLanguage = (v: SelectValue) => {
if (typeof v == "string") {
locale.value = v;
localStorage.setItem("lang", v);
}
};
</script>
......
......@@ -10,26 +10,26 @@
</template>
<script lang="ts" setup>
import ThemeLightSvg from '/public/images/svg/header/theme-light.svg';
import ThemeDarkSvg from '/public/images/svg/header/theme-dark.svg';
import ThemeLightSvg from "/public/images/svg/header/theme-light.svg";
import ThemeDarkSvg from "/public/images/svg/header/theme-dark.svg";
import { Tooltip as TTooltip } from "tdesign-vue-next";
// 当前主题
const theme = useCurTheme();
const themeLabel = computed(() => {
return theme.value === 'light' ? '点击切换夜间模式' : '点击切换白天模式';
return theme.value === "light" ? "点击切换夜间模式" : "点击切换白天模式";
});
const changeTheme = () => {
if (theme.value === 'light') {
theme.value = 'dark';
if (theme.value === "light") {
theme.value = "dark";
} else {
theme.value = 'light';
theme.value = "light";
}
document.documentElement.setAttribute('theme-mode', theme.value);
document.documentElement.setAttribute("theme-mode", theme.value);
};
</script>
<style lang="less" scoped>
@import '@/style/flex.less';
@import "@/style/flex.less";
.theme-change {
width: 28px;
height: 28px;
......
......@@ -13,10 +13,10 @@
</span>
<div class="comfim-box">
<t-button @click="comfimawalY">
<slot name="comfirm">{{ $t('user.Confirm') }}</slot>
<slot name="comfirm">{{ $t("user.Confirm") }}</slot>
</t-button>
<t-button @click="closeDialog">
<slot name="close">{{ $t('user.Cancel') }}</slot>
<slot name="close">{{ $t("user.Cancel") }}</slot>
</t-button>
</div>
</div>
......@@ -25,27 +25,28 @@
</template>
<script lang="ts" setup>
import { Dialog as TDialog, Button as TButton } from "tdesign-vue-next";
const props = defineProps({
confirmDialog: Boolean,
});
const emit = defineEmits(['closeComfrimDialog', 'comfimawal']);
const emit = defineEmits(["closeComfrimDialog", "comfimawal"]);
// 取消
const closeDialog = () => {
emit('closeComfrimDialog', false);
emit("closeComfrimDialog", false);
};
// 确认
const comfimawalY = () => {
emit('comfimawal', true);
emit("comfimawal", true);
};
</script>
<style lang="less" scoped>
// 红点
@import '@/style/components/dot.less';
@import "@/style/components/dot.less";
// 第二层dialog的蒙层颜色
@import '@/style/components/hierarchyDialog.less';
@import '@/style/variables.less';
@import '@/style/flex.less';
@import "@/style/components/hierarchyDialog.less";
@import "@/style/variables.less";
@import "@/style/flex.less";
.hierarchy-dialog {
:deep(.t-dialog) {
padding: 12px;
......
<!--
* @Author: walker.liu
* @Date: 2022-03-09 11:10:22
* @Copyright(C): 2019-2020 ZP Inc. All rights reserved.
-->
<template>
<div class="chart-box-wrapper">
<div class="header" v-if="title || $slots['title']">
......@@ -13,7 +8,7 @@
class="go-ana-btn custom_button_back_border"
size="small"
@click="goAnalysis"
>{{ $t('collection.goAna') }}</t-button
>{{ $t("collection.goAna") }}</t-button
>
</div>
<div class="chart-switch">
......@@ -34,29 +29,34 @@
</div>
</template>
<script setup lang="tsx">
import { filterChainObj } from '@/constants/UnifiedManagementChain';
import { filterChainObj } from "@/constants/UnifiedManagementChain";
import { Button as TButton } from "tdesign-vue-next";
const router = useRouter();
const props = defineProps({
title: String,
subTitle: String,
r24h: String,
token: String,
tb: String,
currentPath: String,
name: String,
// 是否需要header信息
hasHeader: {
type: Boolean,
default: true,
},
});
const props = withDefaults(
defineProps<{
title?: string;
subTitle?: string;
r24h?: string;
token?: string;
tb?: string;
currentPath?: string;
name?: string;
hasHeader?: boolean;
}>(),
{
hasHeader: true,
name: "",
tb: "",
currentPath: "",
}
);
const goAnalysis = () => {
// 临时存储
window.sessionStorage.setItem('echart-box', props.name);
let Obj = filterChainObj('value', props.currentPath);
window.sessionStorage.setItem("echart-box", props.name);
let Obj = filterChainObj("value", props.currentPath);
let params: any = {
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,
path: Obj.name,
};
const routeUrl = router.resolve({
......@@ -66,8 +66,8 @@ const goAnalysis = () => {
};
</script>
<style lang="less" scoped>
@import '@/style/variables.less';
@import '@/style/flex.less';
@import "@/style/variables.less";
@import "@/style/flex.less";
.chart-box-wrapper {
margin-top: 2px;
background: var(--td--right-back-color-2);
......@@ -87,7 +87,7 @@ const goAnalysis = () => {
border-bottom: 1px solid var(--new-border-9);
padding-left: 8px;
.dja(space-between,center);
font-family: 'Medium';
font-family: "Medium";
span {
display: block;
white-space: nowrap;
......@@ -96,7 +96,7 @@ const goAnalysis = () => {
}
.go-ana-btn {
margin-right: 6px;
font-family: 'Medium';
font-family: "Medium";
}
}
.left {
......@@ -119,7 +119,7 @@ const goAnalysis = () => {
flex-wrap: wrap;
row-gap: 6px;
& > :deep(*) {
font-family: 'Regular';
font-family: "Regular";
.label {
color: #7b7d87;
}
......@@ -141,7 +141,7 @@ const goAnalysis = () => {
.t-radio-button {
font-size: @font-size-s;
padding: 2px 20px;
font-family: 'Medium';
font-family: "Medium";
}
.t-is-checked {
background: var(--new-background-7);
......
......@@ -55,12 +55,17 @@
</template>
<script lang="ts" setup>
import { MessagePlugin } from "tdesign-vue-next";
import {
MessagePlugin,
Dialog as TDialog,
Tooltip as TTooltip,
} from "tdesign-vue-next";
import { useI18n } from "vue-i18n";
import Timefilter from "/public/images/svg/analysis/timefilter.svg";
import {
DatePicker as TDatePicker,
TimePicker as TTimePicker,
Button as TButton,
} from "tdesign-vue-next";
const route = useRoute();
const emit = defineEmits(["change"]);
......
......@@ -28,7 +28,8 @@
</chart-box>
</template>
<script setup lang="tsx">
import ChartBox from './ChartBox.vue';
import ChartBox from "./ChartBox.vue";
import { Loading as TLoading } from "tdesign-vue-next";
const props = defineProps({
token: String,
url: String,
......@@ -63,12 +64,12 @@ onMounted(() => {
}
}, 5000);
});
const changeTwitter = (url) => {
const changeTwitter = (url: string) => {
// twitter_url.value = url;
// window.__twttr.widgets.init = false;
// window.__twttr.widgets.loaded = false;
// window.twttr.widgets.load();
let script: any = document.getElementById('twitter-script');
let script: any = document.getElementById("twitter-script");
if (script) {
script.remove();
let win: any = window;
......@@ -77,37 +78,38 @@ const changeTwitter = (url) => {
// window.twttr.widgets.load();
}
let timestamp = new Date().getTime();
getScript('/widgets.js?t=' + timestamp).then(() => {
let iframeBox = document.getElementById('twitter-iframe');
getScript("/widgets.js?t=" + timestamp).then(() => {
let iframeBox: HTMLElement | null =
document.getElementById("twitter-iframe");
// 优化代码 用户频繁点击一直执行删除推文(解决页面嵌入多个推文)
while (iframeBox.lastChild) {
while (iframeBox && iframeBox.lastChild) {
iframeBox.removeChild(iframeBox.lastChild);
}
let element = document.createElement('a');
element.setAttribute('href', url);
element.setAttribute('class', 'twitter-timeline narrow-scrollbar');
element.setAttribute('theme', 'dark');
element.setAttribute('data-chrome', 'noheader nofooter transparent');
element.setAttribute('data-height', '314');
element.setAttribute('data-width', '348px');
element.setAttribute('data-aria-polite', 'assertive');
let element = document.createElement("a");
element.setAttribute("href", url);
element.setAttribute("class", "twitter-timeline narrow-scrollbar");
element.setAttribute("theme", "dark");
element.setAttribute("data-chrome", "noheader nofooter transparent");
element.setAttribute("data-height", "314");
element.setAttribute("data-width", "348px");
element.setAttribute("data-aria-polite", "assertive");
iframeBox?.appendChild(element);
});
};
const getScript = (path) => {
const getScript = (path: string) => {
return new Promise((resolve, reject) => {
let head = document.getElementsByTagName('head')[0];
let script: any = document.createElement('script');
let head = document.getElementsByTagName("head")[0];
let script: any = document.createElement("script");
script.src = path;
script.type = 'text/javascript';
script.id = 'twitter-script';
script.type = "text/javascript";
script.id = "twitter-script";
head.appendChild(script);
script.onload = script.onreadystatechange = function () {
/*判断是否加载成功*/
if (
!this.readyState ||
this.readyState === 'loaded' ||
this.readyState === 'complete'
this.readyState === "loaded" ||
this.readyState === "complete"
) {
script.onload = script.onreadystatechange = null;
return resolve;
......@@ -120,7 +122,7 @@ const getScript = (path) => {
// const socialInfo = computed(() => store.getters['token/getSocialInfo'](props.token));
</script>
<style lang="less">
@import '@/style/flex.less';
@import "@/style/flex.less";
.empty-twitter {
height: 330px;
}
......
......@@ -7,13 +7,13 @@
</div>
<template #content>
<div class="s-header-fox-box">
<div class="fox-title">{{ $t('header.FoxwalletTitle') }}</div>
<div class="fox-title">{{ $t("header.FoxwalletTitle") }}</div>
<div class="wallet-Connect">
<t-button class="center-btn-box" @click="connectionFox">
<template #icon>
<img :src="Imgs.FoxSvg" alt="" class="icon" />
</template>
{{ $t('header.FoxwalletTitle2') }}
{{ $t("header.FoxwalletTitle2") }}
</t-button>
</div>
</div>
......@@ -24,32 +24,36 @@
</template>
<script lang="ts" setup>
import { MessagePlugin } from 'tdesign-vue-next';
import detectEthereumProvider from '@metamask/detect-provider';
import { useI18n } from 'vue-i18n';
import {
MessagePlugin,
Popup as TPopup,
Button as TButton,
} from "tdesign-vue-next";
import detectEthereumProvider from "@metamask/detect-provider";
import { useI18n } from "vue-i18n";
const i18n = useI18n();
let provider;
let provider: any = null;
if (process.client) {
provider = detectEthereumProvider();
}
const Imgs = {
FoxSvg: '/images/svg/header/fox.svg',
FoxSvg: "/images/svg/header/fox.svg",
};
// 用户token
const Cookie = useCookie('userCookie');
const Cookie = useCookie("userCookie");
const hasdisabled = ref(false);
const defaultTitle = computed(() => i18n.t('header.Foxwalletbutton'));
const defaultTitle = computed(() => i18n.t("header.Foxwalletbutton"));
const UserAddress = useUserAddress();
// 连接钱包后展示的文字
const AfterConnection = ref('');
const AfterConnection = ref("");
// 用户原始交易地址
const account = ref('');
const account = ref("");
onBeforeMount(() => {
// 是否可以连接
// console.log(ethereum.isConnected());
let ConnectFox = window.sessionStorage.getItem('ConnectFox');
let ConnectFox = window.sessionStorage.getItem("ConnectFox");
let eth: any = window;
if (ConnectFox === 'true' && eth.ethereum?.isConnected()) {
if (ConnectFox === "true" && eth.ethereum?.isConnected()) {
// 这里自动连接钱包,不需要存储本地
hasdisabled.value = true;
getConnectFox();
......@@ -58,7 +62,7 @@ onBeforeMount(() => {
const connectionFox = () => {
if (!provider) {
MessagePlugin.warning('请先下载MetaMask');
MessagePlugin.warning("请先下载MetaMask");
return;
}
// 连接钱包
......@@ -67,14 +71,14 @@ const connectionFox = () => {
const getConnectFox = async () => {
if (!Cookie.value) {
MessagePlugin.closeAll();
MessagePlugin.warning('请先登录');
MessagePlugin.warning("请先登录");
return;
}
// 这里是用户主动连接,临时存储到本地,刷新页面时自动赋值
let eth: any = window;
try {
const accounts = await eth.ethereum.request({
method: 'eth_requestAccounts',
method: "eth_requestAccounts",
});
if (accounts[0]) {
account.value = accounts[0];
......@@ -82,7 +86,7 @@ const getConnectFox = async () => {
accounts[0].length - 4,
accounts[0].length
)}`;
window.sessionStorage.setItem('ConnectFox', 'true');
window.sessionStorage.setItem("ConnectFox", "true");
// 禁用下拉菜单
setTimeout(() => {
hasdisabled.value = true;
......@@ -90,7 +94,7 @@ const getConnectFox = async () => {
}
UserAddress.value = account.value;
} catch (e) {
MessagePlugin.warning(i18n.t('MessagePlugin.Foxwallet'));
MessagePlugin.warning(i18n.t("MessagePlugin.Foxwallet"));
hasdisabled.value = false;
return;
}
......@@ -98,7 +102,7 @@ const getConnectFox = async () => {
</script>
<style lang="less">
@import '@/style/flex.less';
@import "@/style/flex.less";
// dropdown挂载在根元素
.s-header-fox-box {
width: 240px;
......@@ -107,14 +111,14 @@ const getConnectFox = async () => {
padding: 0 0 6px 6px;
font-weight: bold;
user-select: none;
font-family: 'bold';
font-family: "bold";
}
.wallet-Connect {
.t-button {
width: 100%;
background-color: var(--td--main-btn-color-1);
border: none;
font-family: 'Medium';
font-family: "Medium";
.icon {
padding-right: 8px;
}
......@@ -138,7 +142,7 @@ const getConnectFox = async () => {
font-weight: 700;
font-size: 15px;
color: var(--td--main-btn-color-1);
font-family: 'bold';
font-family: "bold";
}
}
</style>
......@@ -18,17 +18,17 @@
<div class="small-userinfo">
<div class="small-logo">
<userOneSvg></userOneSvg>
<p class="small-logo-p1">{{ userInfo.name ?? '-----' }}</p>
<p class="small-logo-p1">{{ userInfo.name ?? "-----" }}</p>
<p class="small-logo-p2">
{{ userInfo.vip_type ?? '免费会员' }}
{{ userInfo.vip_type ?? "免费会员" }}
</p>
<div class="post-box">
<div class="small-item">
<p class="small-p1">{{ $t('header.email') }}</p>
<p class="small-p1">{{ $t("header.email") }}</p>
<p class="small-p2">-------</p>
</div>
<div class="small-item">
<p class="small-p1">{{ $t('header.wallets') }}</p>
<p class="small-p1">{{ $t("header.wallets") }}</p>
<p class="small-p2">-------</p>
</div>
</div>
......@@ -39,22 +39,22 @@
@click="gotoMember('/user/personal')"
>
<userTwo class="icon"></userTwo>
<p>{{ $t('user.PersonalInfo') }}</p>
<p>{{ $t("user.PersonalInfo") }}</p>
</div>
<div class="small-iconData" @click="gotoMember('/user/member')">
<VipSvg class="icon"></VipSvg>
<p>{{ $t('user.MemberCenter') }}</p>
<p>{{ $t("user.MemberCenter") }}</p>
</div>
<div
class="small-iconData"
@click="gotoMember('/user/InviteWelfare')"
>
<InvitationSvg class="icon"></InvitationSvg>
<p>{{ $t('user.InvitationCenter') }}</p>
<p>{{ $t("user.InvitationCenter") }}</p>
</div>
<div class="small-iconData" @click="gotoMember('install')">
<InstallSvg class="icon"></InstallSvg>
<p>{{ $t('header.settings') }}</p>
<p>{{ $t("header.settings") }}</p>
</div>
<div class="small-iconData" @click="logout">
<logoutSvg
......@@ -62,8 +62,8 @@
class="icon last-icon"
></logoutSvg>
<HomeLogoutSvg v-else class="icon last-icon"></HomeLogoutSvg>
<p v-if="Cookie">{{ $t('header.logout') }}</p>
<p v-else>{{ $t('header.goLogin') }}</p>
<p v-if="Cookie">{{ $t("header.logout") }}</p>
<p v-else>{{ $t("header.goLogin") }}</p>
</div>
</div>
</div>
......@@ -79,26 +79,26 @@
</template>
<script setup lang="ts">
import userTwo from '/public/images/svg/header/userTwo.svg';
import DefaultAvatar from '/public/images/svg/header/default-avatar.svg';
import upDownSvg from '/public/images/svg/header/upDown.svg';
import VipSvg from '/public/images/svg/header/vip.svg';
import InvitationSvg from '/public/images/svg/header/invitation.svg';
import InstallSvg from '/public/images/svg/header/install.svg';
import logoutSvg from '/public/images/svg/header/logout.svg';
import HomeLogoutSvg from '/public/images/svg/header/homeLogout.svg';
import userOneSvg from '/public/images/svg/header/userOne.svg';
import { MessagePlugin } from 'tdesign-vue-next';
import userTwo from "/public/images/svg/header/userTwo.svg";
import DefaultAvatar from "/public/images/svg/header/default-avatar.svg";
import upDownSvg from "/public/images/svg/header/upDown.svg";
import VipSvg from "/public/images/svg/header/vip.svg";
import InvitationSvg from "/public/images/svg/header/invitation.svg";
import InstallSvg from "/public/images/svg/header/install.svg";
import logoutSvg from "/public/images/svg/header/logout.svg";
import HomeLogoutSvg from "/public/images/svg/header/homeLogout.svg";
import userOneSvg from "/public/images/svg/header/userOne.svg";
import { MessagePlugin, Popup as TPopup } from "tdesign-vue-next";
const router = useRouter();
const userInfo = useTokenInfo();
// 当前主题
const mode = useCurTheme();
// 用户token
const Cookie = useCookie('userCookie');
const Cookie = useCookie("userCookie");
// 点击不同选项
const gotoMember = (label: string) => {
if (label === 'install') {
if (label === "install") {
return;
}
const resUrl = router.resolve({
......@@ -110,21 +110,21 @@ const gotoMember = (label: string) => {
const logout = () => {
if (!Cookie.value) {
router.push({
path: '/login',
path: "/login",
});
} else {
// 退出
if (Cookie.value) {
Cookie.value = '';
MessagePlugin.success('退出成功');
Cookie.value = "";
MessagePlugin.success("退出成功");
}
}
};
</script>
<style lang="less">
@import '@/style/variables.less';
@import '@/style/flex.less';
@import "@/style/variables.less";
@import "@/style/flex.less";
.user-info {
.da();
cursor: pointer;
......
......@@ -106,7 +106,11 @@ import { WebS } from "@/utils/TokenTrans";
import SearchRecords from "./searchRecords.vue";
import SearchList from "./searchList.vue";
import * as Cache from "@/utils/cache";
import { Drawer as TDrawer } from "tdesign-vue-next";
import {
Drawer as TDrawer,
Input as TInput,
Loading as TLoading,
} from "tdesign-vue-next";
import { getPopupMaxHeight } from "@/utils/plugin/PopupTool";
const keyword = ref("");
const inputPlaceholder = ref("");
......@@ -177,7 +181,7 @@ const getHeight = () => {
}
let search_popup = document.getElementById("search-drawer");
if (search_popup) {
let child = search_popup.children[1];
let child = <HTMLElement>search_popup.children[1];
if (child) {
child.style.maxHeight = PopupMaxHeight.value + "px";
}
......
......@@ -69,13 +69,19 @@
</template>
<script setup lang="ts">
import { LoadingPlugin, MessagePlugin } from "tdesign-vue-next";
import {
LoadingPlugin,
MessagePlugin,
Button as TButton,
FormRule,
} from "tdesign-vue-next";
import md5 from "md5";
import request from "@/utils/request";
import {
Icon as TIcon,
Form as TForm,
FormItem as TFormItem,
Input as TInput,
} from "tdesign-vue-next";
const emit = defineEmits(["registerSuccess", "go"]);
......@@ -83,7 +89,7 @@ const emit = defineEmits(["registerSuccess", "go"]);
const userToken = useUserToken();
interface FormData {
email: string;
password?: string;
password: string;
}
const formData = ref<FormData>({
email: "",
......@@ -95,11 +101,11 @@ const formRules = computed(() => {
email: [
{ required: true, message: "email required", type: "error" },
{ email: true, message: "email error", type: "error" },
],
] as FormRule[],
password: [
{ required: true, message: "password required", type: "error" },
// { min: 6, message: '至少需要6位', type: 'error' },
],
] as FormRule[],
};
return rules;
});
......@@ -112,8 +118,8 @@ const onSubmit = async ({ validateResult }: any) => {
if (validateResult === true) {
let params: FormData = {
email: formData.value.email,
password: md5(formData.value.password),
};
params.password = md5(formData.value.password);
LoadingPlugin(true);
let data: any;
try {
......
......@@ -121,7 +121,14 @@
</template>
<script setup lang="ts">
import { MessagePlugin, LoadingPlugin } from "tdesign-vue-next";
import {
MessagePlugin,
LoadingPlugin,
Checkbox as TCheckbox,
Input as TInput,
Button as TButton,
FormRule,
} from "tdesign-vue-next";
import request from "@/utils/request";
import md5 from "md5";
import { useCounter } from "@/hooks";
......@@ -130,7 +137,6 @@ import {
Form as TForm,
FormItem as TFormItem,
} from "tdesign-vue-next";
const [countDown, handleCounter] = useCounter();
const props = defineProps({
InvitCode: String,
......@@ -155,7 +161,7 @@ const showPsw2 = ref(false);
const form = ref(null);
const emit = defineEmits(["go"]);
// 数据校验
const repasswordValidator = (value) => {
const repasswordValidator = (value: string) => {
if (formData.value.password === value) {
return { result: true };
} else {
......@@ -200,15 +206,15 @@ const FORM_RULES = {
email: [
{ required: true, message: "email required", type: "error" },
{ email: true, message: "email error", type: "error" },
],
] as FormRule[],
password: [
{ required: true, message: "password required", type: "error" },
// { min: 6, message: '至少需要6位', type: 'error' },
],
] as FormRule[],
password2: [
{ required: true, message: "confirm password required", type: "error" },
{ validator: repasswordValidator },
],
] as FormRule[],
};
const onSubmit = async ({ validateResult }: any) => {
if (validateResult === true) {
......@@ -238,7 +244,7 @@ const onSubmit = async ({ validateResult }: any) => {
}
};
const goLogin = (val) => {
const goLogin = () => {
emit("go", "login");
};
</script>
......
......@@ -104,17 +104,23 @@
</template>
<script setup lang="ts">
import { MessagePlugin, LoadingPlugin } from "tdesign-vue-next";
import { useCounter } from "@/hooks";
import { ArrowLeftIcon } from "tdesign-icons-vue-next";
import request from "@/utils/request";
import md5 from "md5";
import { useI18n } from "vue-i18n";
import {
MessagePlugin,
LoadingPlugin,
Checkbox as TCheckbox,
Button as TButton,
FormRule,
Icon as TIcon,
Form as TForm,
FormItem as TFormItem,
Input as TInput,
SubmitContext,
} from "tdesign-vue-next";
import { useCounter } from "@/hooks";
import { ArrowLeftIcon } from "tdesign-icons-vue-next";
import request from "@/utils/request";
import md5 from "md5";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const INITIAL_DATA = {
......@@ -171,15 +177,15 @@ const FORM_RULES = {
email: [
{ required: true, message: t("login.EMailRequired"), type: "error" },
{ email: true, message: t("login.entercorrectemail"), type: "error" },
],
] as FormRule[],
vcCode: [
{ required: true, message: t("login.Verificatioquired"), type: "error" },
{ min: 4, message: t("login.Captchaerror"), type: "error" },
],
] as FormRule[],
password: [
{ required: true, message: t("login.PasswordRequired"), type: "error" },
{ min: 6, message: t("login.Ateeded"), type: "error" },
],
] as FormRule[],
password2: [
{
required: true,
......@@ -187,11 +193,11 @@ const FORM_RULES = {
type: "error",
},
{ validator: repasswordValidator },
],
] as FormRule[],
};
const emit = defineEmits(["go"]);
const onSubmit = async ({ validateResult }) => {
const onSubmit = async ({ validateResult }: SubmitContext) => {
if (validateResult === true) {
if (!formData.value.checked) {
MessagePlugin.error("请同意用户隐私政策");
......
......@@ -84,7 +84,6 @@ const goHome = () => {
.login-wrapper {
background-color: var(--td-bg-color-page);
display: flex;
min-height: 800px;
width: 100vw;
height: 100vh;
overflow-y: hidden;
......
......@@ -39,6 +39,7 @@ import ChainSearch from "/public/images/svg/filter/chainSearch.svg";
import { ChevronDownIcon } from "tdesign-icons-vue-next";
import { useI18n } from "vue-i18n";
import { isChildOf, getPopupFixedSite } from "@/utils/plugin/PopupTool";
import { Input as TInput } from "tdesign-vue-next";
const { t } = useI18n();
const route = useRoute();
const ChainImgIndex = ref(0);
......@@ -189,15 +190,15 @@ const popupContent = () => {
return (
<div class="custom-chose-chain-content">
<div class="search-box">
<t-input
<TInput
placeholder={t("Search.search")}
prefixIcon={() => <ChainSearch></ChainSearch>}
onChange={InputChange}
></t-input>
></TInput>
</div>
<div class="chain-box-body narrow-scrollbar">
{filterList.list.map((item: any) => (
<NuxtLink to={getChainHref(item)} class="chain-box">
<nuxt-link to={getChainHref(item)} class="chain-box">
<div
class="chain-box-child"
onClick={selectChange.bind(this, item.value)}
......@@ -205,7 +206,7 @@ const popupContent = () => {
<img src={item.img} alt="" />
<span>{item.fullName}</span>
</div>
</NuxtLink>
</nuxt-link>
))}
</div>
</div>
......
......@@ -119,7 +119,7 @@
<template v-else>
<div
class="drag-icon custom-collection-drag"
@mousedown="MouseStart(index)"
@mousedown="MouseStart($event, index)"
>
<DragSvg></DragSvg>
</div>
......@@ -151,7 +151,6 @@
</template>
<script lang="tsx" setup>
import { useI18n } from "vue-i18n";
import EditSvg from "/public/images/svg/collection/edit.svg";
import DefaultTokenSvg from "/public/images/svg/collection/filter-default-icon.svg";
import StickyTopSvg from "/public/images/svg/collection/StickyTop.svg";
......@@ -169,7 +168,7 @@ import {
import CustomTableSort from "./tableSort.vue";
import { filterChainObj } from "@/constants/UnifiedManagementChain";
import { deleteCollection, changeCollection } from "@/utils/cache";
const { t } = useI18n();
import { Checkbox as TCheckbox } from "tdesign-vue-next";
const router = useRouter();
const chain = useChain();
const ChainObj = ref<any>({});
......@@ -234,7 +233,7 @@ const toEdit = () => {
}
};
// 鼠标按下
const MouseStart = (index: number, e: any) => {
const MouseStart = (e: any, index: number) => {
MouseParameter.index = index;
// 开始位置
MouseParameter.StartY = e.clientY;
......
......@@ -8,7 +8,7 @@
}"
>
<t-swiper :duration="300" :interval="50000" :type="swiperType">
<t-swiper-item v-for="item in picList.list" :key="item">
<t-swiper-item v-for="(item, index) in picList.list" :key="index">
<img
:src="item.picture_link"
alt=""
......@@ -24,8 +24,13 @@
<script lang="ts" setup>
import request from "@/utils/request";
const swiperType = ref("default");
const picList = reactive({
import { Swiper as TSwiper, SwiperItem as TSwiperItem } from "tdesign-vue-next";
interface picListType {
goto_link: string;
picture_link: string;
}
const swiperType = ref<"default" | "card">("default");
const picList = reactive<{ list: picListType[] }>({
list: [],
});
const goDetail = (item: any) => {
......
......@@ -21,43 +21,44 @@
</template>
<script lang="ts" setup>
import { filterChainObj } from '@/constants/UnifiedManagementChain';
import { filterChainObj } from "@/constants/UnifiedManagementChain";
import { Tooltip as TTooltip, Button as TButton } from "tdesign-vue-next";
const props = defineProps<{
tb: string;
type: string;
content: string;
row?: any;
}>();
const emit = defineEmits(['CustomClick']);
const emit = defineEmits(["CustomClick"]);
// 筛选链下标
// 当前链
const chain = useChain();
const filterchain = () => {
return filterChainObj('value', chain.value);
return filterChainObj("value", chain.value);
};
const getDetailLink = computed(() => {
const { tb, type } = props;
let tbname = '';
if (tb[0] == 'd') {
tbname = tb.slice(1, tb.length) + '';
let tbname = "";
if (tb[0] == "d") {
tbname = tb.slice(1, tb.length) + "";
} else {
tbname = tb;
}
let Obj = filterchain();
let path = Obj.name;
if (type == 'detail') {
if (type == "detail") {
return `/${path}/${tbname}`;
}
if (type == 'collection') {
return '';
if (type == "collection") {
return "";
} else {
return `/analysis/${path}/${tbname}`;
}
});
const getType = () => {
const { type, row } = props;
if (type == 'collection') {
emit('CustomClick', row);
if (type == "collection") {
emit("CustomClick", row);
}
};
......
......@@ -117,7 +117,13 @@ import TokenInfo from "./TokenInfo.vue";
import TokenPool from "./TokenPool.vue";
import TokenSocialList from "./TokenSocialList.vue";
import * as Cache from "@/utils/cache";
import { MessagePlugin, Tabs as TTabs } from "tdesign-vue-next";
import {
MessagePlugin,
Tabs as TTabs,
TabPanel as TTabPanel,
Button as TButton,
TabValue,
} from "tdesign-vue-next";
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";
......@@ -149,18 +155,18 @@ const headerBtns = computed(() => [
value: "echart",
},
]);
const props = defineProps({
token: String,
scene: String,
tb: String,
currentPath: String,
r24h: Number,
mt: String,
up: Number,
});
const props = defineProps<{
token: string;
scene: string;
tb: string;
currentPath: string;
r24h: number;
mt: string;
up?: number;
}>();
const emit = defineEmits(["update:setPool", "SettwitterRul"]);
const r24h = ref("");
const numR24h = ref("");
const numR24h = ref<string>("");
// 收藏列表是否首次加载
const CollectionOnload = ref(false);
// 判断当前路由,隐藏右侧详情box中的折线图模块
......@@ -190,7 +196,7 @@ const getPriceRange = () => {
let newR24h = parseFloat((proR24h + "").replace("-", ""));
// 原价
let oldPrice = props.up / (1 - newR24h);
numR24h.value = oldPrice - props.up;
numR24h.value = oldPrice - props.up + "";
numR24h.value = "-" + parseCoinAmount(numR24h.value);
} else if (proR24h == 0) {
numR24h.value = "+0";
......@@ -198,7 +204,7 @@ const getPriceRange = () => {
// +,涨
// 原价
let oldPrice = props.up / (proR24h + 1);
numR24h.value = props.up - oldPrice;
numR24h.value = props.up - oldPrice + "";
numR24h.value = "+" + parseCoinAmount(numR24h.value);
}
r24h.value = parsePercent(proR24h + "");
......@@ -238,7 +244,7 @@ watch(
}
);
// 流动池tab改变
const changeTab = (value) => {
const changeTab = (value: TabValue) => {
if (value === "pool") {
isPool.value = true;
}
......@@ -294,7 +300,7 @@ watch(
);
// 点击查看token详情信息
// v-if v-show同时使用,折线图第一次加载后,不在使用v-if,减少请求
const gotoDetail = (value) => {
const gotoDetail = (value: string) => {
if (value == "collection" && !CollectionOnload.value) {
CollectionOnload.value = true;
}
......@@ -317,7 +323,7 @@ const monitor = computed((value) => {
};
});
// 接收右侧详情流动池address
const changePool = (PoolValue) => {
const changePool = (PoolValue: string) => {
PoolAddress.value = PoolValue;
emit("update:setPool", PoolValue);
};
......
......@@ -227,7 +227,16 @@ import discordSvg from "/public/images/svg/filter/discord.svg";
import emailSvg from "/public/images/svg/filter/email.svg";
import phoneSvg from "/public/images/svg/filter/phone.svg";
import CustomerSvg from "/public/images/svg/filter/Customer.svg";
import { Form as TForm, FormItem as TFormItem } from "tdesign-vue-next";
import {
Form as TForm,
FormItem as TFormItem,
Input as TInput,
Dialog as TDialog,
Option as TOption,
Switch as TSwitch,
Select as TSelect,
Button as TButton,
} from "tdesign-vue-next";
import {
TIME_RANGE_OPTIONS,
PRICE_RANGE_OPTIONS,
......
......@@ -36,12 +36,11 @@
</template>
<script lang="tsx" setup>
import { useI18n } from "vue-i18n";
import SubmitSvg from "/public/images/svg/rightDetail/submit.svg";
import ConnectCloseSvg from "/public/images/svg/rightDetail/connectClose.svg";
import { submitInfoLink } from "@/constants/global";
import { Dialog as TDialog, Button as TButton } from "tdesign-vue-next";
const visible = ref(false);
const { t } = useI18n();
const OpenDialog = () => {
visible.value = true;
};
......
......@@ -4,6 +4,7 @@ import "./index.less";
import SubmitSvg from "/public/images/svg/rightDetail/submit.svg";
import ConnectCloseSvg from "/public/images/svg/rightDetail/connectClose.svg";
import { submitInfoLink } from "@/constants/global";
import { Dialog as TDialog, Button as TButton } from "tdesign-vue-next";
export default defineComponent({
setup() {
const visible = ref(false);
......@@ -27,7 +28,7 @@ export default defineComponent({
<SubmitSvg></SubmitSvg>
<span class="span1">更新社区信息</span>
</div>
<t-dialog
<TDialog
footer={false}
v-model:visible={visible.value}
placement="center"
......@@ -46,15 +47,15 @@ export default defineComponent({
<p>{t("home.message5")}</p>
</div>
<div class="message-popup-footer">
<t-button class="clear-btn" onClick={closeDialog}>
<TButton class="clear-btn" onClick={closeDialog}>
{t("user.Cancel")}
</t-button>
<t-button class="submit-btn" onClick={submit}>
</TButton>
<TButton class="submit-btn" onClick={submit}>
{t("home.toSubmit")}
</t-button>
</TButton>
</div>
</div>
</t-dialog>
</TDialog>
</div>
);
},
......
......@@ -13,60 +13,61 @@
</div>
<div class="time-range-data">
<div class="item">
<div class="label">{{ $t('home.newHolder') }}</div>
<div class="value new">{{ timeMap[current].newHolders ?? '-' }}</div>
<div class="label">{{ $t("home.newHolder") }}</div>
<div class="value new">{{ timeMap[current].newHolders ?? "-" }}</div>
</div>
<div class="item">
<div class="label">{{ $t('home.txns') }}</div>
<div class="value">{{ timeMap[current].txns ?? '-' }}</div>
<div class="label">{{ $t("home.txns") }}</div>
<div class="value">{{ timeMap[current].txns ?? "-" }}</div>
</div>
<div class="item">
<div class="label">{{ $t('TableList.buys') }}</div>
<div class="value">{{ timeMap[current].buys ?? '-' }}</div>
<div class="label">{{ $t("TableList.buys") }}</div>
<div class="value">{{ timeMap[current].buys ?? "-" }}</div>
</div>
<div class="item">
<div class="label">{{ $t('TableList.sells') }}</div>
<div class="value">{{ timeMap[current].sells ?? '-' }}</div>
<div class="label">{{ $t("TableList.sells") }}</div>
<div class="value">{{ timeMap[current].sells ?? "-" }}</div>
</div>
<div class="item">
<div class="label">{{ $t('TableList.volume') }}</div>
<div class="value">{{ timeMap[current].vns ?? '-' }}</div>
<div class="label">{{ $t("TableList.volume") }}</div>
<div class="value">{{ timeMap[current].vns ?? "-" }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { parseNumberToK } from '@/utils/tool';
import request from '@/utils/request';
import { useI18n } from 'vue-i18n';
import { parseNumberToK } from "@/utils/tool";
import request from "@/utils/request";
import { useI18n } from "vue-i18n";
import { Button as TButton } from "tdesign-vue-next";
const { t } = useI18n();
const props = defineProps({
token: String,
currentPath: String,
tb: String,
PoolAddress: String,
mt: String,
});
const props = defineProps<{
token: string;
currentPath: string;
tb: string;
PoolAddress: string;
mt: string;
}>();
// 当前链
const chain = useChain();
const current = ref('5m');
const current = ref("5m");
const tabOptions = computed(() => {
return [
{
label: t('TableList.time1'),
value: '5m',
label: t("TableList.time1"),
value: "5m",
},
{
label: t('TableList.time2'),
value: '1h',
label: t("TableList.time2"),
value: "1h",
},
{
label: t('TableList.time3'),
value: '4h',
label: t("TableList.time3"),
value: "4h",
},
{
label: t('TableList.time4'),
value: '24h',
label: t("TableList.time4"),
value: "24h",
},
];
});
......@@ -81,19 +82,19 @@ watch(
Object.keys(timeMap).forEach((item, index) => {
timeMap[item] = {};
});
getTimeList('');
getTimeList("");
}
}
);
const timeMap: any = reactive({
'5m': {},
'1h': {},
'4h': {},
'24h': {},
"5m": {},
"1h": {},
"4h": {},
"24h": {},
});
watch(current, (v) => {
if (timeMap[v].newHolders === undefined) {
getTimeList('');
getTimeList("");
}
});
watch(
......@@ -107,7 +108,7 @@ watch(
}
}
);
const getTimeList = async (PoolAddress) => {
const getTimeList = async (PoolAddress: string) => {
if (!props.token) {
return;
}
......@@ -120,14 +121,14 @@ const getTimeList = async (PoolAddress) => {
},
})
.then((result: any) => {
result.vns = '$' + parseNumberToK(result.vns);
result.vns = "$" + parseNumberToK(result.vns);
timeMap[current.value] = result;
});
};
</script>
<style lang="less">
@import '@/style/flex.less';
@import '@/style/variables.less';
@import "@/style/flex.less";
@import "@/style/variables.less";
.token-time-range {
margin-top: 8px;
border-radius: 3px;
......@@ -142,7 +143,7 @@ const getTimeList = async (PoolAddress) => {
background: var(--td--right-back-color-2);
border-radius: 0;
margin: 0;
font-family: 'bold';
font-family: "bold";
}
.active {
background: #287eff;
......@@ -171,14 +172,14 @@ const getTimeList = async (PoolAddress) => {
color: var(--new-color-7);
font-size: 12px;
margin-bottom: 6px;
font-family: 'Regular';
font-family: "Regular";
}
.value {
color: var(--td-text-color-primary);
font-size: 12px;
text-align: center;
margin-bottom: 6px;
font-family: 'Medium';
font-family: "Medium";
&.new {
color: #23ab94;
}
......
......@@ -221,7 +221,6 @@ import {
IS_HPT_LIST,
} from "@/constants/token";
import {
chain_options,
filterChainObj,
SwitchCurrency,
} from "@/constants/UnifiedManagementChain";
......@@ -229,7 +228,14 @@ import FilterTips from "./FilterTips.vue";
import ResetSvg from "/public/images/svg/filter/reset.svg";
import SmartSvg from "/public/images/svg/filter/Smart.svg";
import QuestionSvg from "/public/images/svg/filter/Question.svg";
import { MessagePlugin } from "tdesign-vue-next";
import {
MessagePlugin,
Option as TOption,
Tooltip as TTooltip,
Switch as TSwitch,
Select as TSelect,
Button as TButton,
} from "tdesign-vue-next";
import SmartAlerts from "./SmartAlerts.vue";
import { useI18n } from "vue-i18n";
import ChoseChain from "./ChoseChain.vue";
......@@ -289,7 +295,7 @@ const ContractDetection = computed(() => [
// 当前链整个对象数据
const ChainObj = ref();
if (route.params.chain) {
if (route.params.chain && typeof route.params.chain == "string") {
let Obj = filterChainObj("name", route.params.chain, true);
if (Obj) {
ChainObj.value = Obj;
......@@ -313,12 +319,6 @@ const Reset = () => {
MessagePlugin.closeAll();
MessagePlugin.success(t("MessagePlugin.resetSuccess"));
};
// 反选按钮
const ReverseBtn = (label: string, value: string) => {
if (formData[label] === value) {
formData[label] = "";
}
};
const allHpt = () => {
Cur_hpt_list.value = [];
};
......@@ -366,7 +366,7 @@ const filterFn = async () => {
try {
// 是否加入貔貅检测
if (Cur_hpt_list.value.length) {
Cur_hpt_list.value.forEach((item: any) => {
Cur_hpt_list.value.forEach((item: string) => {
if (formData.iSHpt == "yes") {
GlbFilter.value[item] = "1";
} else {
......
......@@ -4,22 +4,22 @@
<div v-if="poolInfo.length > 0" class="pool-token-info">
<div class="pool-token-header">
<div class="Mating-pool">
<span>{{ $t('tokenInfo.pair') }}</span>
<span>{{ $t("tokenInfo.pair") }}</span>
</div>
<div class="Mating-AMM">
<span>AMM</span>
</div>
<div class="Currency-amount">
<span>{{ $t('tokenInfo.poolCoinNum') }}</span>
<span>{{ $t("tokenInfo.poolCoinNum") }}</span>
</div>
<div class="total-turnover">
<span>{{ $t('tokenInfo.total') }}</span>
<span>{{ $t("tokenInfo.total") }}</span>
</div>
</div>
<div
class="pool-token-line"
v-for="(item, index) in poolInfo"
:key="item"
:key="item.address"
@click="switchPool(item, index)"
>
<div
......@@ -36,10 +36,10 @@
{{ item.swap }}
</div>
<div class="balance-info">
<span>{{ item.total?.ub ?? '--' }}</span>
<span>{{ item.total?.ub ?? "--" }}</span>
</div>
<div class="liquidity-info">
{{ item.total?.vn ?? '--' }}
{{ item.total?.vn ?? "--" }}
</div>
</div>
</div>
......@@ -59,26 +59,37 @@
</div>
</template>
<script setup lang="ts">
import TableEmpty from '@/components/TableEmpty.vue';
import request from '@/utils/request';
import { parseNumberToK, parseCoinAmount } from '@/utils/tool';
import { WebS } from '@/utils/TokenTrans';
import TableEmpty from "@/components/TableEmpty.vue";
import request from "@/utils/request";
import { parseNumberToK, parseCoinAmount } from "@/utils/tool";
import { WebS } from "@/utils/TokenTrans";
// import { goDetailK } from '@/utils/router/routerGo';
import { filterChainObj } from '@/constants/UnifiedManagementChain';
import { filterChainObj } from "@/constants/UnifiedManagementChain";
import { Loading as TLoading } from "tdesign-vue-next";
const route = useRoute();
const props = defineProps({
poolToken: {
type: String,
default: () => {},
},
currentPath: String,
tb: String,
mt: String,
});
const emit = defineEmits(['update:address']);
const props = defineProps<{
poolToken: string;
currentPath: string;
tb: string;
mt: string;
}>();
const emit = defineEmits(["update:address"]);
interface PoolListValue {
address: string;
pair: string;
pair1: string;
pair2: string;
swap: string;
total: {
swap: string;
ub: string;
vn: string | number;
type: string;
};
}
// 当前链
const chain = useChain();
const poolInfo = ref([]);
const poolInfo = ref<PoolListValue[]>([]);
watch(
() => props.poolToken,
(v) => {
......@@ -89,16 +100,16 @@ watch(
}
);
const currentPoolValue = ref();
const currentPoolAddress = ref('');
const currentPoolAddress = ref("");
onMounted(() => {
getPoolToken();
});
// 监听当前流动池
const monitoring = (index) => {
const monitoring = (index: number) => {
if (currentPoolValue.value === index) {
return '';
return "";
} else {
return 'none';
return "none";
}
};
......@@ -107,7 +118,7 @@ const getPoolToken = async () => {
isLoading.value = true;
const res: any = await request.get(
`/v1${
route.name !== 'tokenIndex' ? props.currentPath : chain.value
route.name !== "tokenIndex" ? props.currentPath : chain.value
}/getRightPondInfo`,
{
params: {
......@@ -118,35 +129,35 @@ const getPoolToken = async () => {
try {
if (res.list.length > 0) {
// 拆分字段内容
res.list.forEach((item, index) => {
res.list.forEach((item: PoolListValue, index: number) => {
if (props.tb.toLowerCase().substr(1) === item.address.toLowerCase()) {
currentPoolValue.value = index;
}
let pairs = item.pair.split('/');
let pairs = item.pair.split("/");
let pair1 = pairs[0];
let pair2 = pairs[1];
item.pair1 = pair1;
item.pair2 = pair2;
// item.pair_balance = item.pair_balance.toLocaleString();
if (item.total?.ub) {
item.total.ub = '$' + parseNumberToK(item.total.ub);
item.total.ub = "$" + parseNumberToK(item.total.ub);
}
if (item.total?.vn) {
if (item.total?.vn.toString().indexOf('e') !== -1) {
if (item.total?.vn.toString().indexOf("e") !== -1) {
item.total.vn = parseCoinAmount(item.total?.vn);
} else {
item.total.vn = '$' + Math.round(item.total?.vn);
item.total.vn = "$" + Math.round(parseFloat(item.total.vn + ""));
}
}
if (item.swap === '') {
item.swap = 'None';
if (item.swap === "") {
item.swap = "None";
}
});
poolInfo.value = res.list;
// 判断是哪个池子
let index = res.list.findIndex((item: any, index: number) => {
let 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;
let obj1 = WebS(item.address);
let obj2 = WebS(tb);
return obj1.token === obj2.token;
......@@ -156,13 +167,14 @@ const getPoolToken = async () => {
isLoading.value = false;
}
isLoading.value = false;
console.log(poolInfo.value);
} catch (e) {
console.log(e);
isLoading.value = false;
}
};
// 切换流动池
const switchPool = (item, index) => {
const switchPool = (item: PoolListValue, index: number) => {
// currentPoolValue.value = index;
// currentPoolAddress.value = item.address;
......@@ -170,7 +182,7 @@ const switchPool = (item, index) => {
if (currentPoolValue.value === index) {
return;
}
let Obj = filterChainObj('value', chain.value);
let Obj = filterChainObj("value", chain.value);
// 打开新的流动池
let params = {
path: Obj.name,
......@@ -180,8 +192,8 @@ const switchPool = (item, index) => {
};
</script>
<style lang="less">
@import '@/style/variables.less';
@import '@/style/flex.less';
@import "@/style/variables.less";
@import "@/style/flex.less";
.token-pool-wrapper {
margin-top: 12px;
font-size: 12px;
......@@ -197,7 +209,7 @@ const switchPool = (item, index) => {
font-size: @font-size-s;
white-space: nowrap;
border-bottom: 1px solid var(--td-component-border);
font-family: 'Medium';
font-family: "Medium";
.Mating-pool {
width: 28%;
padding-left: 10px;
......@@ -221,7 +233,7 @@ const switchPool = (item, index) => {
font-size: @font-size-s;
padding: 0 6px;
position: relative;
font-family: 'Regular';
font-family: "Regular";
.dot-box {
width: 10px;
height: 10px;
......
......@@ -15,6 +15,7 @@ import DeleteSvg from "/public/images/svg/collection/delete.svg";
import { myCollect } from "@/utils/api";
import Animation from "@/components/Animation.vue";
import { loading_background } from "@/constants/global";
import { Checkbox as TCheckbox } from "tdesign-vue-next";
import {
TableSort,
TableSortAsc,
......@@ -294,7 +295,7 @@ export default defineComponent({
""
) : (
<td class="edit-td">
<t-checkbox v-model={item.select}></t-checkbox>
<TCheckbox v-model={item.select}></TCheckbox>
</td>
)}
<td>
......@@ -354,9 +355,9 @@ export default defineComponent({
{!LatestStatus() ? (
<div class="collection-footer">
<div class="check-all">
<t-checkbox v-model={checkAll.value} onChange={onCheckAll}>
<TCheckbox v-model={checkAll.value} onChange={onCheckAll}>
{t("collection.selectall")}
</t-checkbox>
</TCheckbox>
</div>
<div class="delete-collection" onClick={DeleteSelected}>
<DeleteSvg></DeleteSvg>
......
......@@ -95,7 +95,13 @@
</template>
<script lang="ts" setup>
import { MessagePlugin, InputNumber as TInputNumber } from "tdesign-vue-next";
import {
MessagePlugin,
InputNumber as TInputNumber,
Dialog as TDialog,
Button as TButton,
InputNumberValue,
} from "tdesign-vue-next";
import { useI18n } from "vue-i18n";
import {
DatePicker as TDatePicker,
......@@ -108,9 +114,12 @@ const props = defineProps({
const emit = defineEmits(["update:visible"]);
const dialogVisible = ref(false);
// input最大值最小值-number类型
const inputV = reactive({
min: null,
max: null,
const inputV = reactive<{
min: InputNumberValue;
max: InputNumberValue;
}>({
min: 0,
max: 0,
});
// 日期选择
const CurDate = ref("");
......@@ -119,22 +128,27 @@ const time1 = ref("");
const time2 = ref("");
const choseTime = ref([0, 0]);
// 记录上次的筛选条件
const hisfilter = reactive({
const hisfilter = reactive<{
[key: string]: {
min: InputNumberValue;
max: InputNumberValue;
};
}>({
oldtokenNumStr: {
min: null,
max: null,
min: 0,
max: 0,
},
vn: {
min: null,
max: null,
min: 0,
max: 0,
},
up: {
min: null,
max: null,
min: 0,
max: 0,
},
oldsr: {
min: null,
max: null,
min: 0,
max: 0,
},
});
const i18n = useI18n();
......@@ -143,9 +157,10 @@ watch(
(v) => {
dialogVisible.value = v;
if (v && props.option && props.option.value !== "ts") {
console.log("我执行了");
// 监听打开事件,将对应的筛选条件放入input
inputV.min = hisfilter[props.option.value].min;
inputV.max = hisfilter[props.option.value].max;
inputV.min = hisfilter[props.option.value as keyof typeof hisfilter].min;
inputV.max = hisfilter[props.option.value as keyof typeof hisfilter].max;
}
}
);
......@@ -157,7 +172,7 @@ const closeDialog = () => {
},
});
};
const submit = (value) => {
const submit = (value: string) => {
if (value !== "ts") {
if (!inputV.min || !inputV.max) {
MessagePlugin.closeAll();
......@@ -169,8 +184,8 @@ const submit = (value) => {
return;
}
// 提交前记录本次筛选条件
hisfilter[props.option.value].min = inputV.min;
hisfilter[props.option.value].max = inputV.max;
hisfilter[props.option.value as keyof typeof hisfilter]["min"] = inputV.min;
hisfilter[props.option.value as keyof typeof hisfilter]["max"] = inputV.max;
emit("update:visible", {
visible: false,
value: {
......@@ -213,7 +228,7 @@ const submit = (value) => {
}
};
// 具体时分秒-1
const onTimeChange = (value) => {
const onTimeChange = (value: string) => {
if (CurDate.value && value) {
// 拼接日期并转换为时间戳
let date = new Date(CurDate.value + " " + time1.value);
......@@ -221,7 +236,7 @@ const onTimeChange = (value) => {
}
};
// 2
const onTimeChange2 = (value) => {
const onTimeChange2 = (value: string) => {
if (CurDate.value && value) {
// 拼接日期并转换为时间戳
let date = new Date(CurDate.value + " " + time2.value);
......
import { defineComponent, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import './index.less';
import ConnectCloseSvg from '/public/images/svg/rightDetail/connectClose.svg';
import { filterChainObj, getSwap } from '@/constants/UnifiedManagementChain';
import SubmitTableText from '../submitTableText.vue';
import useSocial from '@/hooks/useSocial';
import { defineComponent, ref } from "vue";
import { useI18n } from "vue-i18n";
import "./index.less";
import ConnectCloseSvg from "/public/images/svg/rightDetail/connectClose.svg";
import { filterChainObj, getSwap } from "@/constants/UnifiedManagementChain";
import SubmitTableText from "../submitTableText.vue";
import useSocial from "@/hooks/useSocial";
import { Popup as TPopup } from "tdesign-vue-next";
export default defineComponent({
props: {
chat: Object as any,
token: String,
},
emits: ['update:visible'],
emits: ["update:visible"],
setup(props, { emit }) {
const DialogVisible = ref(false);
const chain = useChain();
......@@ -19,19 +20,19 @@ export default defineComponent({
const { otherLink, openSocialLink } = useSocial();
const tokenList = ref([
{
img: '',
url: '',
title: 'website',
alt: 'website',
label: t('home.ViewContract'),
img: "",
url: "",
title: "website",
alt: "website",
label: t("home.ViewContract"),
},
{
img: '',
url: '',
title: 'Transaction',
alt: 'Trading platform',
label: t('home.TokenTrading'),
type: 'default',
img: "",
url: "",
title: "Transaction",
alt: "Trading platform",
label: t("home.TokenTrading"),
type: "default",
},
]);
// 右侧数据
......@@ -49,16 +50,16 @@ export default defineComponent({
// 使用表格里的swap
tokenList.value[1].img = swapObj.value.img;
tokenList.value[1].url = swapObj.value.url;
tokenList.value[1].type = 'swap';
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';
tokenList.value[1].type = "default";
}
};
// 更换交易平台及官方浏览器
const changeLink = () => {
ChainObj.value = filterChainObj('value', chain.value);
ChainObj.value = filterChainObj("value", chain.value);
// 更换图标和链接
// 官方浏览器
tokenList.value[0].img = ChainObj.value.url.website.img;
......@@ -104,14 +105,14 @@ export default defineComponent({
return (
<div class="custom-submit-info-dialog-box">
<div class="submit-info-title">
<span class="label">{t('home.Connect')}</span>
<span class="label">{t("home.Connect")}</span>
<span onClick={closeDialog} class="close-icon">
<ConnectCloseSvg></ConnectCloseSvg>
</span>
</div>
<div class="submit-info-body">
<div class="body-left">
<div class="label">{t('home.token2')}</div>
<div class="label">{t("home.token2")}</div>
{tokenList.value.map((item: any) => (
<div>
<div
......@@ -122,7 +123,7 @@ export default defineComponent({
<img
src={item.img}
alt=""
class={[item.url ? '' : 'active']}
class={[item.url ? "" : "active"]}
/>
<span>{item.label}</span>
</div>
......@@ -130,7 +131,7 @@ export default defineComponent({
))}
</div>
<div class="body-right">
<div class="label">{t('home.info')}</div>
<div class="label">{t("home.info")}</div>
{otherLink.value.map((item: any) => (
<div
class="value"
......@@ -140,7 +141,7 @@ export default defineComponent({
<img
src={item.img}
alt=""
class={[item.url ? '' : 'active']}
class={[item.url ? "" : "active"]}
/>
<span>{item.label}</span>
</div>
......@@ -155,7 +156,7 @@ export default defineComponent({
DialogVisible.value = visible;
};
return () => (
<t-popup
<TPopup
content={popupContent}
placement="bottom-left"
trigger="click"
......@@ -164,12 +165,11 @@ export default defineComponent({
onVisibleChange={onVisibleChange}
>
<img
placement="top"
class="social-img"
src="/images/svg/rightDetail/more.svg"
alt="more"
/>
</t-popup>
</TPopup>
);
},
});
......@@ -6,7 +6,9 @@
<div class="left-token-name">
<div class="token-name-child">
<template v-if="getImg">
<img :src="getImg" alt="swap" v-image />
<ClientOnly>
<img :src="getImg" alt="swap" v-image />
</ClientOnly>
</template>
<template v-else>
<AvatarVue
......@@ -218,7 +220,7 @@ const getImg = computed(() => {
border-radius: 50%;
}
:not(:first-child) {
& > :last-child {
margin-left: 10px;
}
.avatar-icon {
......
......@@ -19,7 +19,7 @@
<script lang="ts" setup>
import AscSvg from "/public/images/svg/collection/asc.svg";
import DescSvg from "/public/images/svg/collection/desc.svg";
import { Tooltip as TTooltip } from "tdesign-vue-next";
const props = defineProps({
sort: String,
field: String,
......
......@@ -51,6 +51,10 @@ import {
MessagePlugin,
Form as TForm,
FormItem as TFormItem,
Input as TInput,
Button as TButton,
FormRule,
SubmitContext,
} from "tdesign-vue-next";
import md5 from "md5";
......@@ -67,7 +71,7 @@ const backCenter = () => {
emit("backPersonal", true);
};
// 数据校验
const repasswordValidator = (value) => {
const repasswordValidator = (value: string) => {
if (formData.password === value) {
return { result: true };
} else {
......@@ -78,14 +82,14 @@ const FORM_RULES = {
password: [
{ required: true, message: "密码必填", type: "error" },
{ min: 6, message: "至少需要6位", type: "error" },
],
] as FormRule[],
password_confirmation: [
{ required: true, message: "确认密码必填", type: "error" },
{ validator: repasswordValidator },
],
] as FormRule[],
};
// 提交
const onSubmit = async ({ validateResult }) => {
const onSubmit = async ({ validateResult }: SubmitContext) => {
if (validateResult === true) {
const res: any = await request.post(
"/api/user/edit/password",
......
......@@ -42,7 +42,11 @@
</template>
<script lang="ts" setup>
import { Divider as TDivider } from "tdesign-vue-next";
import {
Divider as TDivider,
Dialog as TDialog,
Button as TButton,
} from "tdesign-vue-next";
import comfirmDialog from "@/views/CustomComponent/comfirmDialog.vue";
const props = defineProps({
InvitedVisible: Boolean,
......
......@@ -76,7 +76,12 @@ import CopySvg from "/public/images/svg/header/copy.svg";
import comfirmDialog from "@/views/CustomComponent/comfirmDialog.vue";
import ChangePassword from "./ChangePassword.vue";
import request from "@/utils/request";
import { MessagePlugin } from "tdesign-vue-next";
import {
MessagePlugin,
Input as TInput,
Tooltip as TTooltip,
Button as TButton,
} from "tdesign-vue-next";
const route = useRoute();
const userInfo = useTokenInfo();
const Cookie = useCookie("userCookie");
......
......@@ -139,7 +139,11 @@ import InvitedDialog from "./InvitedDialog.vue";
import RecordDialog from "./recordDialog.vue";
import request from "@/utils/request";
import useCopy from "@/hooks/useCopy";
import { InputNumber as TInputNumber } from "tdesign-vue-next";
import {
InputNumber as TInputNumber,
Dialog as TDialog,
Button as TButton,
} from "tdesign-vue-next";
import QrCodeDialog from "@/views/CustomComponent/QrCodeDialog.vue";
const { doCopy } = useCopy();
const Cookie = useCookie("userCookie");
......
......@@ -7,11 +7,11 @@
>
<template #body>
<div class="logout-body">
<p class="title">{{ $t('user.LogoutSure') }}</p>
<p class="title">{{ $t("user.LogoutSure") }}</p>
<div class="comfim">
<t-button @click="DetermineT">{{ $t('user.Confirm') }}</t-button>
<t-button @click="DetermineT">{{ $t("user.Confirm") }}</t-button>
<t-button class="Cancel" @click="closeLogout">{{
$t('user.Cancel')
$t("user.Cancel")
}}</t-button>
</div>
</div>
......@@ -20,15 +20,16 @@
</template>
<script lang="ts" setup>
import { Dialog as TDialog, Button as TButton } from "tdesign-vue-next";
const visible = ref(true);
const Cookie = useCookie('userCookie');
const Cookie = useCookie("userCookie");
const ChangeRouter = useChangeRouter();
// 退出登录
const DetermineT = () => {
Cookie.value = '';
Cookie.value = "";
// 通知tab切换路由
ChangeRouter.value.name = 'personal';
ChangeRouter.value.path = '/user/personal';
ChangeRouter.value.name = "personal";
ChangeRouter.value.path = "/user/personal";
ChangeRouter.value.id += 1;
visible.value = false;
// 清空Cookie
......@@ -36,16 +37,16 @@ const DetermineT = () => {
// 取消
const closeLogout = () => {
// 通知tab切换路由
ChangeRouter.value.name = 'personal';
ChangeRouter.value.path = '/user/personal';
ChangeRouter.value.name = "personal";
ChangeRouter.value.path = "/user/personal";
ChangeRouter.value.id += 1;
visible.value = false;
};
</script>
<style lang="less" scoped>
@import '@/style/variables.less';
@import '@/style/flex.less';
@import "@/style/variables.less";
@import "@/style/flex.less";
:deep(.t-dialog) {
.t-dialog__body {
padding-bottom: 16px;
......
......@@ -82,7 +82,12 @@
<script lang="ts" setup>
import PayFox from "./payFox.vue";
import request from "@/utils/request";
import { MessagePlugin, Divider as TDivider } from "tdesign-vue-next";
import {
MessagePlugin,
Divider as TDivider,
Input as TInput,
Button as TButton,
} from "tdesign-vue-next";
// 用户信息
const userInfo = useTokenInfo();
// 用户token
......
......@@ -43,32 +43,36 @@
</template>
<script lang="ts" setup>
import request from '@/utils/request';
import { MessagePlugin } from 'tdesign-vue-next';
const props = defineProps({
hasPayDialog: Boolean,
price: String,
});
import request from "@/utils/request";
import {
MessagePlugin,
Dialog as TDialog,
Button as TButton,
} from "tdesign-vue-next";
const props = defineProps<{
hasPayDialog: boolean;
price: string;
}>();
// 用户交易地址
const userAddress = useUserAddress();
// 用户token
const userToken = useUserToken();
// 用户所有信息
const userInfo = useTokenInfo();
const emit = defineEmits(['closePayDialog']);
const emit = defineEmits(["closePayDialog"]);
const closeDialog = () => {
emit('closePayDialog', false);
emit("closePayDialog", false);
// console.log(userToken.value);
};
// 交易轮询
let Interval: any = null;
// 默认的选择币
const defaBtn = ref({
label: 'BUSD',
label: "BUSD",
value: 1,
});
// 收款地址--先写死,之后从接口获取
let MyAddress = '0x1601f342dBfbf76d27Fe35C09fFfEa7bfCCaE4b5';
let MyAddress = "0x1601f342dBfbf76d27Fe35C09fFfEa7bfCCaE4b5";
const moring = computed((label: string) => {
return function (label: string) {
return defaBtn.value.label === label;
......@@ -77,19 +81,19 @@ const moring = computed((label: string) => {
// img
const Imgs = [
{
img: '/images/svg/user/usdt.svg',
value: 'USDT',
address: '0x55d398326f99059fF775485246999027B3197955',
img: "/images/svg/user/usdt.svg",
value: "USDT",
address: "0x55d398326f99059fF775485246999027B3197955",
},
{
img: '/images/svg/user/busd.svg',
value: 'BUSD',
address: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56',
img: "/images/svg/user/busd.svg",
value: "BUSD",
address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
},
{
img: '/images/svg/user/usdc.svg',
value: 'USDC',
address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d',
img: "/images/svg/user/usdc.svg",
value: "USDC",
address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
},
];
// 切换支付方式
......@@ -101,7 +105,7 @@ const changeb = (label: string, index: number) => {
const recharge = (hash: string, price: number) => {
request
.post(
'/api/recharge',
"/api/recharge",
{
hash: hash,
amount: price,
......@@ -119,7 +123,7 @@ const recharge = (hash: string, price: number) => {
}
)
.then((res: any) => {
if (res.code === 2 && 'token' in res.data) {
if (res.code === 2 && "token" in res.data) {
userToken.value = res.data.token;
}
});
......@@ -128,18 +132,18 @@ const recharge = (hash: string, price: number) => {
const Payment = () => {
let eth: any = window;
// 转换后的收款地址
let MyNewAddress = MyAddress.substring(2).padStart(64, '0');
let MyNewAddress = MyAddress.substring(2).padStart(64, "0");
// 实际价格--props.price
// 测试价格
// let price = 0.01;
// 转换后的价格
let newPrice = (parseInt(props.price) * Math.pow(10, 18))
.toString(16)
.padStart(64, '0');
.padStart(64, "0");
// 小狐狸支付
eth.ethereum
.request({
method: 'eth_sendTransaction',
method: "eth_sendTransaction",
params: [
{
// 用户钱包地址
......@@ -150,11 +154,11 @@ const Payment = () => {
// gasPrice: "0x12a05f200",
// gas: "0x16e360",
// 交易数据十六进制 交易0xa9059cbb 目标钱包地址(我们的钱包地址) 交易金额(十六转换)
data: '0xa9059cbb' + MyNewAddress + newPrice,
data: "0xa9059cbb" + MyNewAddress + newPrice,
},
],
})
.then((hash) => {
.then((hash: string) => {
// 交易hash
if (hash) {
// 发送充值信息
......@@ -163,7 +167,7 @@ const Payment = () => {
Interval = setInterval(() => {
request
.post(
'/api/recharge/check',
"/api/recharge/check",
{
hash: hash,
},
......@@ -175,27 +179,27 @@ const Payment = () => {
)
.then((res: any) => {
if (res.data.status == 1) {
MessagePlugin.success('支付成功');
MessagePlugin.success("支付成功");
// 关闭轮询
clearInterval(Interval);
// 关闭弹窗
emit('closePayDialog', false);
} else if (res.code === 2 && 'token' in res.data) {
emit("closePayDialog", false);
} else if (res.code === 2 && "token" in res.data) {
userToken.value = res.data.token;
}
});
}, 2000);
}
})
.catch((e) => {
.catch((e: any) => {
// 关闭轮询
clearInterval(Interval);
if (e.code == -32602) {
MessagePlugin.closeAll();
MessagePlugin.warning('未连接钱包');
MessagePlugin.warning("未连接钱包");
} else {
MessagePlugin.closeAll();
MessagePlugin.warning('交易关闭');
MessagePlugin.warning("交易关闭");
}
});
//
......@@ -207,8 +211,8 @@ onMounted(() => {
</script>
<style lang="less" scoped>
@import '@/style/flex.less';
@import '@/style/variables.less';
@import "@/style/flex.less";
@import "@/style/variables.less";
.pay-dialog-box {
:deep(.t-dialog) {
width: 420px;
......
......@@ -68,7 +68,11 @@
<script lang="ts" setup>
import { useI18n } from "vue-i18n";
import { Table as TTable } from "tdesign-vue-next";
import {
Table as TTable,
Dialog as TDialog,
Button as TButton,
} from "tdesign-vue-next";
import QrCodeDialog from "@/views/CustomComponent/QrCodeDialog.vue";
const { t } = useI18n();
const props = defineProps({
......
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