|
|
@@ -51,8 +51,16 @@
|
|
|
:size="65"
|
|
|
defaultAvatar="https://xy.wenlvti.net/app_static/images/mine/DefaultAvatar.png"
|
|
|
/>
|
|
|
- <FlexCol gap="gap.sm" :padding="[0,30,0,0]">
|
|
|
- <Text :text="displayMyName" fontSize="23" :lines="1" :maxWidth="200" fontConfig="lightImportantTitle" />
|
|
|
+ <FlexCol position="relative" gap="gap.sm" :padding="[0,30,0,0]">
|
|
|
+ <FlexRow align="center" :gap="10">
|
|
|
+ <Text :text="displayMyName" fontSize="23" :lines="1" :maxWidth="150" fontConfig="lightImportantTitle" />
|
|
|
+ <Button
|
|
|
+ v-if="isStaff"
|
|
|
+ :innerStyle="{ position: 'absolute', right: 0, top: 0, transform: 'translate(5%,-50%)' }"
|
|
|
+ text="管理" size="mini" radius="radius.md" type="danger"
|
|
|
+ @click="staffInfoRef?.show()"
|
|
|
+ />
|
|
|
+ </FlexRow>
|
|
|
<IconButton icon="edit-filling" size="26" @click="changeNickRef?.show()">
|
|
|
<Text text="改昵称" fontSize="22" fontConfig="subText" />
|
|
|
</IconButton>
|
|
|
@@ -298,6 +306,14 @@
|
|
|
:villageId="villageStore.currentVillage.id"
|
|
|
ref="changeNickRef"
|
|
|
/>
|
|
|
+ <StaffInfoDialog
|
|
|
+ v-if="villageStore.currentVillage && staffInfo"
|
|
|
+ :villageId="villageStore.currentVillage.id"
|
|
|
+ :staffEndTime="staffInfo.staffEndTime"
|
|
|
+ :staffSource="staffInfo.staffSource"
|
|
|
+ :staffTimeType="staffInfo.staffTimeType"
|
|
|
+ ref="staffInfoRef"
|
|
|
+ />
|
|
|
<Popup
|
|
|
:show="showUnLight"
|
|
|
:zIndex="100"
|
|
|
@@ -375,6 +391,7 @@ import Popup from '@/components/dialog/Popup.vue';
|
|
|
import Image from '@/components/basic/Image.vue';
|
|
|
import Avatar from '@/components/display/Avatar.vue';
|
|
|
import ChangeNickDialog from '../dialogs/ChangeNickDialog.vue';
|
|
|
+import StaffInfoDialog from '../dialogs/StaffInfoDialog.vue';
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
(e: 'goTree'): void;
|
|
|
@@ -430,10 +447,15 @@ const villageInfoLoader = useSimpleDataLoader(async () => {
|
|
|
const isLight = computed(() => {
|
|
|
return villageStore.currentVillage?.isLight ?? false;
|
|
|
});
|
|
|
-const displayMyName = computed(() => {
|
|
|
- const villageInfoInList = villageStore.myJoinedVillages.find(v => v.id === villageStore.currentVillage?.id);
|
|
|
- return villageInfoInList?.villageNickname || authStore.userInfo?.nickname || authStore.userInfo?.username || '暂无昵称';
|
|
|
-});
|
|
|
+const extraInfoInList = computed(() => villageStore.myJoinedVillages.find(v => v.id === villageStore.currentVillage?.id));
|
|
|
+const displayMyName = computed(() => extraInfoInList.value?.villageNickname || authStore.userInfo?.nickname || authStore.userInfo?.username || '暂无昵称');
|
|
|
+const staffInfo = computed(() => extraInfoInList.value ? {
|
|
|
+ type: extraInfoInList.value.type as string,
|
|
|
+ staffEndTime: extraInfoInList.value.staffEndTime as Date,
|
|
|
+ staffSource: extraInfoInList.value.staffSource as number,
|
|
|
+ staffTimeType: extraInfoInList.value.staffTimeType as number,
|
|
|
+} : null);
|
|
|
+const isStaff = computed(() => staffInfo.value?.type === 'staff');
|
|
|
|
|
|
const rankActiveTag = ref('文化积分');
|
|
|
const listActiveTag = ref('广场');
|
|
|
@@ -525,13 +547,21 @@ function handleGoGallery() {
|
|
|
maxCount: villageStore.currentVillage?.imageLimit || 3,
|
|
|
});
|
|
|
}
|
|
|
-async function handleGoOfficalManage() {
|
|
|
+
|
|
|
+const staffInfoRef = ref<InstanceType<typeof StaffInfoDialog>>();
|
|
|
+
|
|
|
+async function checkIsStaff(needTopic?: boolean) {
|
|
|
assertNotNull(villageStore.currentVillage?.id)
|
|
|
- const isAdmin = await OfficialApi.checkTopicRule(villageStore.currentVillage.id);
|
|
|
+ const isAdmin = needTopic ?
|
|
|
+ await OfficialApi.checkTopicRule(villageStore.currentVillage.id)
|
|
|
+ : (authStore.isAdmin || isStaff.value);
|
|
|
if (!isAdmin) {
|
|
|
const goUpgrade = await confirm({
|
|
|
title: '提示',
|
|
|
- content: '您还不是管理员,无法管理贴图哦。您可以联系村社管理员将你添加为管理员,若当前村社暂无管理员,您可以点击“去升级”将您升级为管理员。',
|
|
|
+ content: '您还不是管理员'
|
|
|
+ + (needTopic ? '/或暂无管理贴图权限' : '')
|
|
|
+ + ',无法管理贴图哦。'
|
|
|
+ + '您可以联系村社管理员将你添加为管理员,若当前村社暂无管理员,您可以点击“去升级”将您升级为管理员。',
|
|
|
confirmText: '去升级',
|
|
|
cancelText: '取消',
|
|
|
});
|
|
|
@@ -540,8 +570,15 @@ async function handleGoOfficalManage() {
|
|
|
villageId: villageStore.currentVillage.id,
|
|
|
});
|
|
|
}
|
|
|
- return;
|
|
|
+ return false;
|
|
|
}
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+async function handleGoOfficalManage() {
|
|
|
+ assertNotNull(villageStore.currentVillage?.id)
|
|
|
+ if (!await checkIsStaff(true))
|
|
|
+ return;
|
|
|
navTo('/pages/home/village/post/management-list', {
|
|
|
villageId: villageStore.currentVillage.id,
|
|
|
topic: recommendTagName.value,
|
|
|
@@ -549,42 +586,16 @@ async function handleGoOfficalManage() {
|
|
|
}
|
|
|
async function handleGoEdit() {
|
|
|
assertNotNull(villageStore.currentVillage?.id)
|
|
|
- /* const isAdmin = (authStore.isAdmin || await OfficialApi.checkTopicRule(villageStore.currentVillage.id));
|
|
|
- if (!isAdmin) {
|
|
|
- const goUpgrade = await confirm({
|
|
|
- title: '提示',
|
|
|
- content: '您还不是管理员,您可以联系村社管理员将你添加为管理员,若当前村社暂无管理员,您可以点击“去升级”将您升级为管理员。',
|
|
|
- confirmText: '去升级',
|
|
|
- cancelText: '取消',
|
|
|
- });
|
|
|
- if (goUpgrade) {
|
|
|
- navTo('/pages/home/village/upgrade/my-upgrade-management', {
|
|
|
- villageId: villageStore.currentVillage.id,
|
|
|
- });
|
|
|
- }
|
|
|
+ if (!await checkIsStaff())
|
|
|
return;
|
|
|
- } */
|
|
|
navTo('/pages/home/village/introd/edit', {
|
|
|
villageId: villageStore.currentVillage.id,
|
|
|
});
|
|
|
}
|
|
|
async function handleGoDigManage() {
|
|
|
assertNotNull(villageStore.currentVillage?.id)
|
|
|
- const isAdmin = (authStore.isAdmin || await OfficialApi.checkTopicRule(villageStore.currentVillage.id));
|
|
|
- if (!isAdmin) {
|
|
|
- const goUpgrade = await confirm({
|
|
|
- title: '提示',
|
|
|
- content: '您还不是管理员,您可以联系村社管理员将你添加为管理员,若当前村社暂无管理员,您可以点击“去升级”将您升级为管理员。',
|
|
|
- confirmText: '去升级',
|
|
|
- cancelText: '取消',
|
|
|
- });
|
|
|
- if (goUpgrade) {
|
|
|
- navTo('/pages/home/village/upgrade/my-upgrade-management', {
|
|
|
- villageId: villageStore.currentVillage.id,
|
|
|
- });
|
|
|
- }
|
|
|
+ if (!await checkIsStaff())
|
|
|
return;
|
|
|
- }
|
|
|
navTo('/pages/dig/details', {
|
|
|
name: villageStore.currentVillage.title,
|
|
|
villageId: villageStore.currentVillage.id,
|