ADD wiki profile function

This commit is contained in:
simple321vip
2023-04-08 22:47:23 +08:00
parent c0a8a9cd95
commit 67c4658f6b
3 changed files with 51 additions and 16 deletions
+9 -1
View File
@@ -20,6 +20,13 @@ const update_profile = (data: Object) => {
})
}
const publish_profile = () => {
return service({
url: '/wiki/api/v1/author/profile/publish',
method: 'PUT'
})
}
const get_profile = () => {
return service({
url: '/wiki/api/v1/author/profile',
@@ -51,5 +58,6 @@ export {
get_profile,
update_profile,
get_profileName,
judge_profile
judge_profile,
publish_profile
}
+9 -3
View File
@@ -28,7 +28,8 @@
</el-form-item>
</el-form>
<el-button @click="openBlogEditer">创作</el-button>
<el-button @click="publishbyBids">全部重新发布</el-button>
<el-button @click="publishbyBids">重新发布Wiki</el-button>
<el-button @click="publishProfile">重新发布profile</el-button>
<div class="blog_list" v-for="item in data_list">
<h3 style="cursor: pointer; width: min-content;white-space:nowrap" @click="openBlog(item.bid)">{{ item.title }}</h3>
@@ -48,9 +49,10 @@
</template>
<script setup lang="ts">
import Cookies from 'js-cookie';
import { reactive } from 'vue';
import Cookies from 'js-cookie'
import { reactive } from 'vue'
import { getBlogs, getBtName, publish, publishAll } from '../../api/blogView'
import { publish_profile } from '../../api/profile'
import router from '../../router/index'
// -- INTERFACE OR TYPE DEFINITION --
@@ -111,6 +113,10 @@ const publishbyBids = () => {
publishAll()
}
const publishProfile = () => {
publish_profile()
}
const publishbyBid = (bid: string) => {
publish(bid)
}
+31 -10
View File
@@ -101,13 +101,17 @@
<el-dialog v-model="profileNameCreateDialogVisible" title="发现主人还没有创建新的wiki个人主页, 来创建吧" width="30%"
@close="onCloseProfileDialog">
Profile name:
<div>
<el-autocomplete v-model="profileName" :fetch-suggestions="querySearchAsync" />
<el-input v-model="profileName">
</el-input>
<el-descriptions title="你的 wiki 主页将为">
<el-icon>
<Link />
<el-icon v-if="profileNameCheckStatus == 1" color="green">
<CircleCheckFilled />
</el-icon>
<el-icon v-if="profileNameCheckStatus == 0" color="red">
<WarningFilled />
</el-icon>
</div>
<el-descriptions title="你的 wiki 主页将为">
<el-descriptions-item>https://www.violin-home.cn/docs#/{{ profileName ? profileName : profileNameText
}}/</el-descriptions-item>
<!-- <el-descriptions-item label="Remarks">
@@ -121,7 +125,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="onCloseProfileDialog">取消</el-button>
<el-button type="primary" @click="onCreateProfile">确认</el-button>
<el-button type="primary" @click="onCreateProfile" :disabled="profileNameCheckStatus != 1">确认</el-button>
</span>
</template>
</el-dialog>
@@ -130,7 +134,7 @@
<script setup lang="ts">
import { ref } from 'vue'
import $moment from "moment"
import { Link } from "@element-plus/icons-vue"
import { CircleCheckFilled, WarningFilled } from "@element-plus/icons-vue"
import EchartsLine from '@/view/dashboard/dashboardCharts/index.vue'
import DashboardTable from '@/view/dashboard/dashboardTable/index.vue'
import { useRouter } from 'vue-router'
@@ -151,6 +155,11 @@ const useSettingsStore = settingsStore()
let time = ref<String>($moment().format("YYYY年MM月DD日 HH:mm:ss"));
const profileNameCreateDialogVisible = ref(false)
const profileName = ref<string>()
// 0 false
// 1 true
// -1 なにもしない
const profileNameCheckStatus = ref<number>(-1)
const profileNameText = ref<string>("{Profile name}")
const statistics = ref({
@@ -236,8 +245,13 @@ const onCreateProfile = async () => {
return
}
await create_profile({ name: profileName.value }).then(() => {
await create_profile({ name: profileName.value }).then((resp) => {
if (resp) {
profileNameCreateDialogVisible.value = false
openTag()
}
}).finally(() => {
profileNameCreateDialogVisible.value = false
})
@@ -252,16 +266,23 @@ const openTag = () => {
}
const querySearchAsync = async (queryString: string, cb: any) => {
judge_profile({ name: profileName.value }).then(() => {
}).then(e => {
if (!queryString) {
profileNameCheckStatus.value = -1
return
}
judge_profile({ name: profileName.value }).then((resp) => {
profileNameCheckStatus.value = resp.data
}).catch(e => {
profileNameCheckStatus.value = -1
})
}
const onCloseProfileDialog = () => {
profileName.value = ""
profileNameCreateDialogVisible.value = false
profileNameCheckStatus.value = -1
}
/**