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
</div> type="tongzheng"
<div style="background-color: #F5F6FA;" class="flex-grow"> :current="current"
<router-view></router-view> :setCurrent="setCurrent"
</div> ></syBusinessMenu>
</div> </div>
<div style="background-color: #f5f6fa" class="flex-grow">
<router-view></router-view>
</div>
</div>
</template> </template>
<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>
.passIndex * { .passIndex * {
box-sizing: content-box; box-sizing: content-box;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.left { .left {
box-sizing: content-box; box-sizing: content-box;
width: 237px; width: 237px;
flex-shrink: 0; flex-shrink: 0;
background: #ffffff; background: #ffffff;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<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"
@nextPage="nextPage" @nextPage="nextPage"
@update="updateSinglePass" @update="updateSinglePass"
/> />
</div>
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
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: {
PassListTable, PassListTable,
Search, Search,
syButton, syButton,
},
data() {
return {
query: {
// 查询通证列表的查询条件
type: 0,
identifier: "",
amount_sort: 0,
},
page: 1,
page_size: 50,
passList: [] as any, // 查询到的通证列表
total: 0,
loading: true,
};
},
async mounted() {
this.loading = true;
await this.getList(true);
this.loading = false;
},
watch: {
query() {
this.getList(true);
}, },
data() { },
return { methods: {
query: { /**
// 查询通证列表的查询条件 * @param refresh 当查询条件改变时传入整个列表刷新,否则查询数据添加到 passList
type: 0, */
identifier: '', async getList(refresh: any) {
amount_sort: 0 console.log(refresh, "show refresh");
}, if (refresh) {
page: 1, this.page = 1;
page_size: 50, }
passList: [] as any, // 查询到的通证列表 const params = Object.assign({}, this.query, {
total: 0, page: this.page,
loading: true, page_size: this.page_size,
});
let newParams = params as any;
if (params.identifier === "") {
const { identifier, ...restResult } = params;
newParams = restResult;
}
const res = await $ajax({
type: "get",
url: GO_URLS.passList,
params: newParams,
});
if (res) {
this.total = res.data.total;
if (refresh) {
this.passList = res.data.results || [];
} else {
this.passList = this.passList.concat(res.data.results);
} }
}
}, },
async mounted() { /**
this.loading = true; * 滚动加载通证列表
let service = null as unknown as iService; */
this.$nextTick(() => { async nextPage() {
service = ElLoading.service({ if (this.total > this.page * this.page_size) {
target: this.$refs.loading as HTMLElement this.page += 1;
}) await this.getList(false);
}) }
await this.getList(true);
this.loading = false;
service.close();
}, },
watch: { async updateSinglePass(id: any, balance: any) {
query() { let times = 5;
this.getList(true) let i = setInterval(async () => {
} times -= 1;
}, const res = await $ajax({
methods: { type: "get",
/** url: GO_URLS.pass,
* @param refresh 当查询条件改变时传入整个列表刷新,否则查询数据添加到 passList params: {
*/ id,
async getList(refresh: any) { },
if (refresh) { });
this.page = 1; if ((res && res.data.balance !== balance) || times <= 0) {
} this.passList.forEach((item: any, index: number) => {
const params = Object.assign( if (item.id === id) {
{}, const list = [this.passList];
this.query, list[index].balance = res?.data.balance;
{ this.passList = list;
page: this.page,
page_size: this.page_size
}
)
let newParams = params as any;
if (params.identifier === '') {
const { identifier, ...restResult } = params
newParams = restResult;
};
const res = await $ajax({
type: "get",
url: GO_URLS.passList,
params: newParams
});
if (res) {
this.total = res.data.total;
if (refresh) {
this.passList = res.data.results || [];
} else {
this.passList = this.passList.concat(res.data.results);
}
}
},
/**
* 滚动加载通证列表
*/
async nextPage() {
if (this.total > this.page * this.page_size) {
this.page += 1;
await this.getList(false);
} }
}, });
async updateSinglePass(id: any, balance: any) { clearInterval(i);
let times = 5;
let i = setInterval(async () => {
times -= 1;
const res = await $ajax({
type: 'get',
url: GO_URLS.pass,
params: {
id
}
})
if ((res && res.data.balance !== balance) || times <= 0) {
this.passList.forEach((item: any, index: number) => {
if (item.id === id) {
const list = [this.passList]
list[index].balance = res?.data.balance;
this.passList = list;
}
})
clearInterval(i);
}
}, 1000 * 5)
} }
}, 1000 * 5);
}, },
}) },
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.list-table { .list-table {
margin-top: 21px; margin-top: 21px;
margin-left: 13px; margin-left: 13px;
margin-right: 11px; margin-right: 11px;
} }
</style> </style>
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