Commit 02c58ee7 authored by chenqikuai's avatar chenqikuai

fix

parent fb73c34c
......@@ -39,6 +39,7 @@ const sideBarState = reactive({
name: "存证",
icon: "",
path: "/categoryManage",
pathAlsoSelect: [],
fontSize: "14px",
navigate: () => {
router.push("/categoryManage");
......@@ -49,6 +50,7 @@ const sideBarState = reactive({
// fontClass: "icon-a-pass-activec9b87262",
slotName: "passList",
path: "/passList",
pathAlsoSelect: ["/transferRecord"],
navigate: () => {
router.push("/passList");
},
......@@ -66,6 +68,15 @@ const sideBarState = reactive({
name: "管理",
icon: "",
fontSize: "16px",
pathAlsoSelect: [
"/choosePackage",
"/initPassword",
"/companyVerify",
"/editPassword",
"/editPhone",
"/personVerify",
"/editTemplate",
],
path: "/userCenter",
navigate: () => {
router.push("/userCenter");
......@@ -86,7 +97,9 @@ const sideBarState = reactive({
},
});
const menuIndex = sideBarState.menuList.findIndex((i) => i.path === route.path);
const menuIndex = sideBarState.menuList.findIndex(
(i) => i.path === route.path || i.pathAlsoSelect?.includes(route.path)
);
sideBarState.current = menuIndex;
const handleLogout = () => {
......
<template>
<div class="flex passIndex">
<div class="left flex-grow-0" style="width: 220px;">
<syBusinessMenu type="tongzheng" :current="current" :setCurrent="setCurrent"></syBusinessMenu>
<div class="left flex-grow-0" style="width: 220px">
<syBusinessMenu
type="tongzheng"
:current="current"
:setCurrent="setCurrent"
></syBusinessMenu>
</div>
<div style="background-color: #F5F6FA;" class="flex-grow">
<div style="background-color: #f5f6fa" class="flex-grow">
<router-view></router-view>
</div>
</div>
......@@ -11,41 +15,37 @@
<script lang="ts" setup>
import { router } from "@/router";
import { syBusinessMenu } from "cqk-sy-ui"
import { syBusinessMenu } from "cqk-sy-ui";
import { ref } from "vue";
import { useRoute } from "vue-router";
const menuList = [
{
path: '/passList',
path: "/passList",
},
{
path: '/transferRecord'
}
]
path: "/transferRecord",
},
];
const route = useRoute();
const current = ref(0)
const current = ref(0);
const setCurrent = (v: number) => {
current.value = v;
if (v === 0) {
router.push('/passList')
router.push("/passList");
} else if (v === 1) {
router.push('/transferRecord')
router.push("/transferRecord");
}
};
(function () {
if (route.path) {
const index = menuList.findIndex(i => i.path === route.path)
const index = menuList.findIndex((i) => i.path === route.path);
current.value = index;
}
})()
})();
</script>
<style>
......
......@@ -2,7 +2,7 @@
<div class="h-full flex flex-col">
<Search v-model:query="query" :showCreateAsset="true"></Search>
<div class="flex-grow overflow-hidden list-table">
<div class="h-full" v-if="loading" ref="loading"></div>
<div class="h-full" v-if="loading" v-loading="loading"></div>
<pass-list-table
v-if="!loading"
:pass-list="passList"
......@@ -17,11 +17,9 @@
import { $ajax } from "@/service";
import { GO_URLS, syButton } from "cqk-sy-ui";
import { defineComponent } from "vue";
import Search from "./Search.vue"
import Search from "./Search.vue";
import PassListTable from "./PassListTable.vue";
import { ElLoading } from "element-plus";
type iService = ReturnType<typeof ElLoading.service>
export default defineComponent({
components: {
......@@ -34,58 +32,48 @@ export default defineComponent({
query: {
// 查询通证列表的查询条件
type: 0,
identifier: '',
amount_sort: 0
identifier: "",
amount_sort: 0,
},
page: 1,
page_size: 50,
passList: [] as any, // 查询到的通证列表
total: 0,
loading: true,
}
};
},
async mounted() {
this.loading = true;
let service = null as unknown as iService;
this.$nextTick(() => {
service = ElLoading.service({
target: this.$refs.loading as HTMLElement
})
})
await this.getList(true);
this.loading = false;
service.close();
},
watch: {
query() {
this.getList(true)
}
this.getList(true);
},
},
methods: {
/**
* @param refresh 当查询条件改变时传入整个列表刷新,否则查询数据添加到 passList
*/
async getList(refresh: any) {
console.log(refresh, "show refresh");
if (refresh) {
this.page = 1;
}
const params = Object.assign(
{},
this.query,
{
const params = Object.assign({}, this.query, {
page: this.page,
page_size: this.page_size
}
)
page_size: this.page_size,
});
let newParams = params as any;
if (params.identifier === '') {
const { identifier, ...restResult } = params
if (params.identifier === "") {
const { identifier, ...restResult } = params;
newParams = restResult;
};
}
const res = await $ajax({
type: "get",
url: GO_URLS.passList,
params: newParams
params: newParams,
});
if (res) {
this.total = res.data.total;
......@@ -110,26 +98,26 @@ export default defineComponent({
let i = setInterval(async () => {
times -= 1;
const res = await $ajax({
type: 'get',
type: "get",
url: GO_URLS.pass,
params: {
id
}
})
id,
},
});
if ((res && res.data.balance !== balance) || times <= 0) {
this.passList.forEach((item: any, index: number) => {
if (item.id === id) {
const list = [this.passList]
const list = [this.passList];
list[index].balance = res?.data.balance;
this.passList = list;
}
})
});
clearInterval(i);
}
}, 1000 * 5)
}
}, 1000 * 5);
},
},
})
});
</script>
<style scoped lang="scss">
......
This diff is collapsed.
......@@ -6,7 +6,7 @@
:show-create-asset="false"
></search>
<div class="flex-grow overflow-hidden list-table">
<div class="h-full" v-if="loading" ref="loading"></div>
<div class="h-full" v-if="loading" v-loading="loading"></div>
<transfer-record-list
v-if="!loading"
@nextPage="nextPage"
......@@ -22,9 +22,6 @@ import SearchVue from "../PassList/Search.vue";
import TransferRecordList from "./TransferRecordList.vue";
import { GO_URLS } from "cqk-sy-ui";
import { $ajax } from "@/service";
import { ElLoading } from "element-plus";
type iService = ReturnType<typeof ElLoading.service>;
export default defineComponent({
data() {
......@@ -47,15 +44,8 @@ export default defineComponent({
TransferRecordList,
},
async mounted() {
let service = null as unknown as iService;
this.$nextTick(() => {
service = ElLoading.service({
target: this.$refs.loading as HTMLElement,
});
});
await this.getList(true);
this.loading = false;
service.close();
},
watch: {
query() {
......
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