Commit 02c58ee7 authored by chenqikuai's avatar chenqikuai

fix

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