Commit 7c51f718 by lei

1

parent 95be55e0
No preview for this file type
/*
* @Author: lei 2897821407@qq.com
* @Date: 2023-02-20 19:44:53
* @LastEditors: lei 2897821407@qq.com
* @LastEditTime: 2023-02-22 18:10:45
* @FilePath: \dexfilter-web-nuxt3\composables\useTable.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { import {
DefaultChain, DefaultChain,
filterChainObj, filterChainObj,
......
...@@ -21,6 +21,14 @@ let filter: filterfield = { ...@@ -21,6 +21,14 @@ let filter: filterfield = {
page: 1, page: 1,
page_size: 100, page_size: 100,
}; };
export interface RightInfoType {
token: string;
tb: string;
tbname: string;
r24h: string;
up: string | null;
swap: string;
}
// 获取当前交易token // 获取当前交易token
export const useCurToken = () => { export const useCurToken = () => {
return useState(tokenName, () => "bar"); return useState(tokenName, () => "bar");
...@@ -47,13 +55,17 @@ export const useChangeTable = () => { ...@@ -47,13 +55,17 @@ export const useChangeTable = () => {
// 当前右侧的token和tb等数据 // 当前右侧的token和tb等数据
export const useCurrentRightInfo = () => { export const useCurrentRightInfo = () => {
return useState("RightInfo", () => ({ return useState(
"RightInfo",
() =>
({
token: "", token: "",
tb: "", tb: "",
r24h: "", r24h: "",
up: null, up: null,
swap: "", swap: "",
})); } as RightInfoType)
);
}; };
// 当前主题 // 当前主题
......
interface JumpParams {
path: string;
tb: string;
}
/**
* 跳转k线
* @param params
* @param type
*/
export const JumpKLine = (params: JumpParams, type: "open" | "jump") => {
const router = useRouter();
if (type == "open") {
// 打开新的页面
const url = router.resolve({
path: `/${params.path}/${params.tb}`,
});
window.open(url.href);
}
};
...@@ -157,12 +157,12 @@ const headerBtns = computed(() => [ ...@@ -157,12 +157,12 @@ const headerBtns = computed(() => [
]); ]);
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
token: string; token?: string;
scene: string; scene?: string;
tb: string; tb?: string;
currentPath: string; currentPath: string;
r24h: number; r24h?: number;
mt: string; mt?: string;
up?: number; up?: number;
}>(), }>(),
{ {
......
...@@ -42,11 +42,11 @@ import { useI18n } from "vue-i18n"; ...@@ -42,11 +42,11 @@ import { useI18n } from "vue-i18n";
import { Button as TButton } from "tdesign-vue-next"; import { Button as TButton } from "tdesign-vue-next";
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
token: string; token?: string;
currentPath: string; currentPath: string;
tb: string; tb?: string;
PoolAddress: string; PoolAddress: string;
mt: string; mt?: string;
}>(); }>();
// 当前链 // 当前链
const chain = useChain(); const chain = useChain();
......
...@@ -63,15 +63,15 @@ import TableEmpty from "@/components/TableEmpty.vue"; ...@@ -63,15 +63,15 @@ import TableEmpty from "@/components/TableEmpty.vue";
import request from "@/utils/request"; import request from "@/utils/request";
import { parseNumberToK, parseCoinAmount } from "@/utils/tool"; import { parseNumberToK, parseCoinAmount } from "@/utils/tool";
import { WebS } from "@/utils/TokenTrans"; 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"; import { Loading as TLoading } from "tdesign-vue-next";
import { JumpKLine } from "@/utils/router/RouterChange";
const route = useRoute(); const route = useRoute();
const props = defineProps<{ const props = defineProps<{
poolToken: string; poolToken: string;
currentPath: string; currentPath: string;
tb: string; tb: string;
mt: string; mt?: string;
}>(); }>();
const emit = defineEmits(["update:address"]); const emit = defineEmits(["update:address"]);
interface PoolListValue { interface PoolListValue {
...@@ -100,7 +100,6 @@ watch( ...@@ -100,7 +100,6 @@ watch(
} }
); );
const currentPoolValue = ref(); const currentPoolValue = ref();
const currentPoolAddress = ref("");
onMounted(() => { onMounted(() => {
getPoolToken(); getPoolToken();
}); });
...@@ -167,7 +166,6 @@ const getPoolToken = async () => { ...@@ -167,7 +166,6 @@ const getPoolToken = async () => {
isLoading.value = false; isLoading.value = false;
} }
isLoading.value = false; isLoading.value = false;
console.log(poolInfo.value);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
isLoading.value = false; isLoading.value = false;
...@@ -175,20 +173,16 @@ const getPoolToken = async () => { ...@@ -175,20 +173,16 @@ const getPoolToken = async () => {
}; };
// 切换流动池 // 切换流动池
const switchPool = (item: PoolListValue, index: number) => { const switchPool = (item: PoolListValue, index: number) => {
// currentPoolValue.value = index;
// currentPoolAddress.value = item.address;
// emit('update:address', currentPoolAddress.value);
if (currentPoolValue.value === index) { if (currentPoolValue.value === index) {
return; return;
} }
let Obj = filterChainObj("value", chain.value); let Obj = filterChainObj("value", chain.value);
// 打开新的流动池 // 打开新页面
let params = { let params = {
path: Obj.name, path: Obj.name,
tb: item.address, tb: item.address,
}; };
// goDetailK(params); JumpKLine(params, "open");
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
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