refactor: update committee appointment components to use NuxtLink for navigation and improve code readability
This commit is contained in:
parent
04a72d6441
commit
15dd679c2a
@ -52,7 +52,7 @@ import { committeeManagement } from "@/api/auth";
|
|||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
const localePath = useLocalePath();
|
||||||
const committeeData = ref([]);
|
const committeeData = ref([]);
|
||||||
const getData = async (params) => {
|
const getData = async (params) => {
|
||||||
// 只在客户端执行
|
// 只在客户端执行
|
||||||
@ -62,13 +62,15 @@ const getData = async (params) => {
|
|||||||
const res = await committeeManagement(params);
|
const res = await committeeManagement(params);
|
||||||
committeeData.value = res.data?.item || [];
|
committeeData.value = res.data?.item || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch committee data:', error);
|
console.error("Failed to fetch committee data:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 只在客户端环境下监听语言变化
|
// 只在客户端环境下监听语言变化
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
watch(locale, (newLocale, oldLocale) => {
|
watch(
|
||||||
|
locale,
|
||||||
|
(newLocale, oldLocale) => {
|
||||||
console.log("语言已切换:", newLocale);
|
console.log("语言已切换:", newLocale);
|
||||||
const map = {
|
const map = {
|
||||||
en: "enUS",
|
en: "enUS",
|
||||||
@ -77,7 +79,9 @@ if (process.client) {
|
|||||||
"zh-TW": "zhTW",
|
"zh-TW": "zhTW",
|
||||||
};
|
};
|
||||||
getData({ langType: map[newLocale] });
|
getData({ langType: map[newLocale] });
|
||||||
}, { immediate: true });
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -90,13 +94,13 @@ const columns = [
|
|||||||
className: "name",
|
className: "name",
|
||||||
render(row) {
|
render(row) {
|
||||||
return (
|
return (
|
||||||
<router-link
|
<NuxtLink
|
||||||
to="/boarddirectors"
|
to={localePath("/boarddirectors")}
|
||||||
style={{ fontSize: "18px" }}
|
style={{ fontSize: "18px" }}
|
||||||
class="director-link text-[#ff7bac] font-bold"
|
class="director-link text-[#ff7bac] font-bold"
|
||||||
>
|
>
|
||||||
{row.name}
|
{row.name}
|
||||||
</router-link>
|
</NuxtLink>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -252,7 +256,7 @@ const getCommitteeRole = (name, committee) => {
|
|||||||
.n-data-table
|
.n-data-table
|
||||||
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
||||||
> .n-data-table-td
|
> .n-data-table-td
|
||||||
) {
|
) {
|
||||||
background-color: #f8f8f8 !important;
|
background-color: #f8f8f8 !important;
|
||||||
}
|
}
|
||||||
:deep(.n-data-table-th) {
|
:deep(.n-data-table-th) {
|
||||||
|
|||||||
@ -52,7 +52,7 @@ import { committeeManagement } from "@/api/auth";
|
|||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
const localePath = useLocalePath();
|
||||||
const committeeData = ref([]);
|
const committeeData = ref([]);
|
||||||
const getData = async (params) => {
|
const getData = async (params) => {
|
||||||
// 只在客户端执行
|
// 只在客户端执行
|
||||||
@ -62,13 +62,15 @@ const getData = async (params) => {
|
|||||||
const res = await committeeManagement(params);
|
const res = await committeeManagement(params);
|
||||||
committeeData.value = res.data?.item || [];
|
committeeData.value = res.data?.item || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch committee data:', error);
|
console.error("Failed to fetch committee data:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 只在客户端环境下监听语言变化
|
// 只在客户端环境下监听语言变化
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
watch(locale, (newLocale, oldLocale) => {
|
watch(
|
||||||
|
locale,
|
||||||
|
(newLocale, oldLocale) => {
|
||||||
console.log("语言已切换:", newLocale);
|
console.log("语言已切换:", newLocale);
|
||||||
const map = {
|
const map = {
|
||||||
en: "enUS",
|
en: "enUS",
|
||||||
@ -77,7 +79,9 @@ if (process.client) {
|
|||||||
"zh-TW": "zhTW",
|
"zh-TW": "zhTW",
|
||||||
};
|
};
|
||||||
getData({ langType: map[newLocale] });
|
getData({ langType: map[newLocale] });
|
||||||
}, { immediate: true });
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -90,13 +94,13 @@ const columns = [
|
|||||||
className: "name",
|
className: "name",
|
||||||
render(row) {
|
render(row) {
|
||||||
return (
|
return (
|
||||||
<router-link
|
<NuxtLink
|
||||||
to="/boarddirectors"
|
to={localePath("/boarddirectors")}
|
||||||
style={{ fontSize: "18px" }}
|
style={{ fontSize: "18px" }}
|
||||||
class="director-link text-[#ff7bac] font-bold"
|
class="director-link text-[#ff7bac] font-bold"
|
||||||
>
|
>
|
||||||
{row.name}
|
{row.name}
|
||||||
</router-link>
|
</NuxtLink>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -252,7 +256,7 @@ const getCommitteeRole = (name, committee) => {
|
|||||||
.n-data-table
|
.n-data-table
|
||||||
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
||||||
> .n-data-table-td
|
> .n-data-table-td
|
||||||
) {
|
) {
|
||||||
background-color: #f8f8f8 !important;
|
background-color: #f8f8f8 !important;
|
||||||
}
|
}
|
||||||
:deep(.n-data-table-th) {
|
:deep(.n-data-table-th) {
|
||||||
|
|||||||
@ -19,7 +19,9 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 标题区 -->
|
<!-- 标题区 -->
|
||||||
<div class="title w-[343PX] mx-auto pl-[15PX] mb-[50px] text-leftPX] mx-auto pl-[15PX] mb-[50px] text-left">
|
<div
|
||||||
|
class="title w-[343PX] mx-auto pl-[15PX] mb-[50px] text-leftPX] mx-auto pl-[15PX] mb-[50px] text-left"
|
||||||
|
>
|
||||||
<h1 style="font-size: 24px; margin-top: 60px">
|
<h1 style="font-size: 24px; margin-top: 60px">
|
||||||
{{ t("committeeComposition.title") }}
|
{{ t("committeeComposition.title") }}
|
||||||
</h1>
|
</h1>
|
||||||
@ -39,7 +41,7 @@
|
|||||||
:bordered="false"
|
:bordered="false"
|
||||||
:bottom-bordered="false"
|
:bottom-bordered="false"
|
||||||
:scrollbar-props="{
|
:scrollbar-props="{
|
||||||
trigger: 'none'
|
trigger: 'none',
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -52,7 +54,7 @@ import { committeeManagement } from "@/api/auth";
|
|||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
const localePath = useLocalePath();
|
||||||
const committeeData = ref([]);
|
const committeeData = ref([]);
|
||||||
const getData = async (params) => {
|
const getData = async (params) => {
|
||||||
// 只在客户端执行
|
// 只在客户端执行
|
||||||
@ -62,13 +64,15 @@ const getData = async (params) => {
|
|||||||
const res = await committeeManagement(params);
|
const res = await committeeManagement(params);
|
||||||
committeeData.value = res.data?.item || [];
|
committeeData.value = res.data?.item || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch committee data:', error);
|
console.error("Failed to fetch committee data:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 只在客户端环境下监听语言变化
|
// 只在客户端环境下监听语言变化
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
watch(locale, (newLocale, oldLocale) => {
|
watch(
|
||||||
|
locale,
|
||||||
|
(newLocale, oldLocale) => {
|
||||||
console.log("语言已切换:", newLocale);
|
console.log("语言已切换:", newLocale);
|
||||||
const map = {
|
const map = {
|
||||||
en: "enUS",
|
en: "enUS",
|
||||||
@ -77,7 +81,9 @@ if (process.client) {
|
|||||||
"zh-TW": "zhTW",
|
"zh-TW": "zhTW",
|
||||||
};
|
};
|
||||||
getData({ langType: map[newLocale] });
|
getData({ langType: map[newLocale] });
|
||||||
}, { immediate: true });
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -90,13 +96,13 @@ const columns = [
|
|||||||
className: "name",
|
className: "name",
|
||||||
render(row) {
|
render(row) {
|
||||||
return (
|
return (
|
||||||
<router-link
|
<NuxtLink
|
||||||
to="/boarddirectors"
|
to={localePath("/boarddirectors")}
|
||||||
style={{ fontSize: "18px" }}
|
style={{ fontSize: "18px" }}
|
||||||
class="director-link text-[#ff7bac] font-bold"
|
class="director-link text-[#ff7bac] font-bold"
|
||||||
>
|
>
|
||||||
{row.name}
|
{row.name}
|
||||||
</router-link>
|
</NuxtLink>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -252,7 +258,7 @@ const getCommitteeRole = (name, committee) => {
|
|||||||
.n-data-table
|
.n-data-table
|
||||||
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
||||||
> .n-data-table-td
|
> .n-data-table-td
|
||||||
) {
|
) {
|
||||||
background-color: #f8f8f8 !important;
|
background-color: #f8f8f8 !important;
|
||||||
}
|
}
|
||||||
:deep(.n-data-table-th) {
|
:deep(.n-data-table-th) {
|
||||||
@ -312,10 +318,9 @@ const getCommitteeRole = (name, committee) => {
|
|||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 60PX;
|
width: 60px;
|
||||||
top: -5PX;
|
top: -5px;
|
||||||
height: 5PX
|
height: 5px;
|
||||||
;
|
|
||||||
background: #ff7bac;
|
background: #ff7bac;
|
||||||
// border-radius: 3px;
|
// border-radius: 3px;
|
||||||
transition: width 0.3s ease;
|
transition: width 0.3s ease;
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
:bordered="false"
|
:bordered="false"
|
||||||
:bottom-bordered="false"
|
:bottom-bordered="false"
|
||||||
:scrollbar-props="{
|
:scrollbar-props="{
|
||||||
trigger: 'none'
|
trigger: 'none',
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -52,7 +52,7 @@ import { committeeManagement } from "@/api/auth";
|
|||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
const localePath = useLocalePath();
|
||||||
const committeeData = ref([]);
|
const committeeData = ref([]);
|
||||||
const getData = async (params) => {
|
const getData = async (params) => {
|
||||||
// 只在客户端执行
|
// 只在客户端执行
|
||||||
@ -62,13 +62,15 @@ const getData = async (params) => {
|
|||||||
const res = await committeeManagement(params);
|
const res = await committeeManagement(params);
|
||||||
committeeData.value = res.data?.item || [];
|
committeeData.value = res.data?.item || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch committee data:', error);
|
console.error("Failed to fetch committee data:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 只在客户端环境下监听语言变化
|
// 只在客户端环境下监听语言变化
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
watch(locale, (newLocale, oldLocale) => {
|
watch(
|
||||||
|
locale,
|
||||||
|
(newLocale, oldLocale) => {
|
||||||
console.log("语言已切换:", newLocale);
|
console.log("语言已切换:", newLocale);
|
||||||
const map = {
|
const map = {
|
||||||
en: "enUS",
|
en: "enUS",
|
||||||
@ -77,7 +79,9 @@ if (process.client) {
|
|||||||
"zh-TW": "zhTW",
|
"zh-TW": "zhTW",
|
||||||
};
|
};
|
||||||
getData({ langType: map[newLocale] });
|
getData({ langType: map[newLocale] });
|
||||||
}, { immediate: true });
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -90,13 +94,13 @@ const columns = [
|
|||||||
className: "name",
|
className: "name",
|
||||||
render(row) {
|
render(row) {
|
||||||
return (
|
return (
|
||||||
<router-link
|
<NuxtLink
|
||||||
to="/boarddirectors"
|
to={localePath("/boarddirectors")}
|
||||||
style={{ fontSize: "18px" }}
|
style={{ fontSize: "18px" }}
|
||||||
class="director-link text-[#ff7bac] font-bold"
|
class="director-link text-[#ff7bac] font-bold"
|
||||||
>
|
>
|
||||||
{row.name}
|
{row.name}
|
||||||
</router-link>
|
</NuxtLink>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -252,7 +256,7 @@ const getCommitteeRole = (name, committee) => {
|
|||||||
.n-data-table
|
.n-data-table
|
||||||
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
.n-data-table-tr:not(.n-data-table-tr--summary):hover
|
||||||
> .n-data-table-td
|
> .n-data-table-td
|
||||||
) {
|
) {
|
||||||
background-color: #f8f8f8 !important;
|
background-color: #f8f8f8 !important;
|
||||||
}
|
}
|
||||||
:deep(.n-data-table-th) {
|
:deep(.n-data-table-th) {
|
||||||
@ -312,10 +316,9 @@ const getCommitteeRole = (name, committee) => {
|
|||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 60PX;
|
width: 60px;
|
||||||
top: -5PX;
|
top: -5px;
|
||||||
height: 5PX
|
height: 5px;
|
||||||
;
|
|
||||||
background: #ff7bac;
|
background: #ff7bac;
|
||||||
// border-radius: 3px;
|
// border-radius: 3px;
|
||||||
transition: width 0.3s ease;
|
transition: width 0.3s ease;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user