|
|
@ -17,8 +17,8 @@
|
|
|
|
<div class="uid">UID. {{ user.id }}</div>
|
|
|
|
<div class="uid">UID. {{ user.id }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="user-opts">
|
|
|
|
<div class="user-opts" v-if="store.state.userInfo.id > 0">
|
|
|
|
<n-space vertical>
|
|
|
|
<n-space>
|
|
|
|
<n-button
|
|
|
|
<n-button
|
|
|
|
size="small"
|
|
|
|
size="small"
|
|
|
|
secondary
|
|
|
|
secondary
|
|
|
@ -27,6 +27,15 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
私信
|
|
|
|
私信
|
|
|
|
</n-button>
|
|
|
|
</n-button>
|
|
|
|
|
|
|
|
<n-button
|
|
|
|
|
|
|
|
v-if="store.state.userInfo.is_admin"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
secondary
|
|
|
|
|
|
|
|
:type="user.status === 1 ? 'error' : 'warning'"
|
|
|
|
|
|
|
|
@click="banUser"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ user.status === 1 ? '禁言' : '解封' }}
|
|
|
|
|
|
|
|
</n-button>
|
|
|
|
</n-space>
|
|
|
|
</n-space>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -72,17 +81,22 @@
|
|
|
|
import { ref, reactive, watch, onMounted } from 'vue';
|
|
|
|
import { ref, reactive, watch, onMounted } from 'vue';
|
|
|
|
import { useStore } from 'vuex';
|
|
|
|
import { useStore } from 'vuex';
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
import { getUserProfile, getUserPosts } from '@/api/user';
|
|
|
|
import { getUserProfile, getUserPosts, changeUserStatus } from '@/api/user';
|
|
|
|
|
|
|
|
import { useDialog, useMessage } from 'naive-ui';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const message = useMessage();
|
|
|
|
|
|
|
|
const dialog = useDialog();
|
|
|
|
const store = useStore();
|
|
|
|
const store = useStore();
|
|
|
|
const route = useRoute();
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(false);
|
|
|
|
const loading = ref(false);
|
|
|
|
const user = reactive({
|
|
|
|
const user = reactive<Item.UserInfo>({
|
|
|
|
id: 0,
|
|
|
|
id: 0,
|
|
|
|
avatar: '',
|
|
|
|
avatar: '',
|
|
|
|
username: '',
|
|
|
|
username: '',
|
|
|
|
nickname: '',
|
|
|
|
nickname: '',
|
|
|
|
|
|
|
|
is_admin: false,
|
|
|
|
|
|
|
|
status: 1,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const userLoading = ref(false);
|
|
|
|
const userLoading = ref(false);
|
|
|
|
const showWhisper = ref(false);
|
|
|
|
const showWhisper = ref(false);
|
|
|
@ -121,6 +135,8 @@ const loadUser = () => {
|
|
|
|
user.avatar = res.avatar;
|
|
|
|
user.avatar = res.avatar;
|
|
|
|
user.username = res.username;
|
|
|
|
user.username = res.username;
|
|
|
|
user.nickname = res.nickname;
|
|
|
|
user.nickname = res.nickname;
|
|
|
|
|
|
|
|
user.is_admin = res.is_admin;
|
|
|
|
|
|
|
|
user.status = res.status;
|
|
|
|
loadPosts();
|
|
|
|
loadPosts();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
.catch((err) => {
|
|
|
@ -135,12 +151,37 @@ const updatePage = (p: number) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const openWhisper = () => {
|
|
|
|
const openWhisper = () => {
|
|
|
|
// window.$message.warning('您尚未获得私信权限');
|
|
|
|
|
|
|
|
showWhisper.value = true;
|
|
|
|
showWhisper.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const whisperSuccess = () => {
|
|
|
|
const whisperSuccess = () => {
|
|
|
|
showWhisper.value = false;
|
|
|
|
showWhisper.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const banUser = () => {
|
|
|
|
|
|
|
|
dialog.warning({
|
|
|
|
|
|
|
|
title: '警告',
|
|
|
|
|
|
|
|
content:
|
|
|
|
|
|
|
|
'确定对该用户进行' +
|
|
|
|
|
|
|
|
(user.status === 1 ? '禁言' : '解封') +
|
|
|
|
|
|
|
|
'处理吗?',
|
|
|
|
|
|
|
|
positiveText: '确定',
|
|
|
|
|
|
|
|
negativeText: '取消',
|
|
|
|
|
|
|
|
onPositiveClick: () => {
|
|
|
|
|
|
|
|
userLoading.value = true;
|
|
|
|
|
|
|
|
changeUserStatus({
|
|
|
|
|
|
|
|
id: user.id,
|
|
|
|
|
|
|
|
status: user.status === 1 ? 2 : 1,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
|
|
userLoading.value = false;
|
|
|
|
|
|
|
|
loadUser();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
userLoading.value = false;
|
|
|
|
|
|
|
|
console.log(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
watch(
|
|
|
|
watch(
|
|
|
|
() => ({
|
|
|
|
() => ({
|
|
|
|
path: route.path,
|
|
|
|
path: route.path,
|
|
|
@ -186,6 +227,12 @@ onMounted(() => {
|
|
|
|
opacity: 0.75;
|
|
|
|
opacity: 0.75;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.user-opts {
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
top: 16px;
|
|
|
|
|
|
|
|
right: 16px;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.pagination-wrap {
|
|
|
|
.pagination-wrap {
|
|
|
|