ADD wiki profile function
This commit is contained in:
+9
-1
@@ -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 = () => {
|
const get_profile = () => {
|
||||||
return service({
|
return service({
|
||||||
url: '/wiki/api/v1/author/profile',
|
url: '/wiki/api/v1/author/profile',
|
||||||
@@ -51,5 +58,6 @@ export {
|
|||||||
get_profile,
|
get_profile,
|
||||||
update_profile,
|
update_profile,
|
||||||
get_profileName,
|
get_profileName,
|
||||||
judge_profile
|
judge_profile,
|
||||||
|
publish_profile
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-button @click="openBlogEditer">创作</el-button>
|
<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">
|
<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>
|
<h3 style="cursor: pointer; width: min-content;white-space:nowrap" @click="openBlog(item.bid)">{{ item.title }}</h3>
|
||||||
@@ -48,9 +49,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie'
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue'
|
||||||
import { getBlogs, getBtName, publish, publishAll } from '../../api/blogView'
|
import { getBlogs, getBtName, publish, publishAll } from '../../api/blogView'
|
||||||
|
import { publish_profile } from '../../api/profile'
|
||||||
import router from '../../router/index'
|
import router from '../../router/index'
|
||||||
|
|
||||||
// -- INTERFACE OR TYPE DEFINITION --
|
// -- INTERFACE OR TYPE DEFINITION --
|
||||||
@@ -111,6 +113,10 @@ const publishbyBids = () => {
|
|||||||
publishAll()
|
publishAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const publishProfile = () => {
|
||||||
|
publish_profile()
|
||||||
|
}
|
||||||
|
|
||||||
const publishbyBid = (bid: string) => {
|
const publishbyBid = (bid: string) => {
|
||||||
publish(bid)
|
publish(bid)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,13 +101,17 @@
|
|||||||
<el-dialog v-model="profileNameCreateDialogVisible" title="发现主人还没有创建新的wiki个人主页, 来创建吧" width="30%"
|
<el-dialog v-model="profileNameCreateDialogVisible" title="发现主人还没有创建新的wiki个人主页, 来创建吧" width="30%"
|
||||||
@close="onCloseProfileDialog">
|
@close="onCloseProfileDialog">
|
||||||
Profile name:
|
Profile name:
|
||||||
|
<div>
|
||||||
<el-autocomplete v-model="profileName" :fetch-suggestions="querySearchAsync" />
|
<el-autocomplete v-model="profileName" :fetch-suggestions="querySearchAsync" />
|
||||||
<el-input v-model="profileName">
|
<el-icon v-if="profileNameCheckStatus == 1" color="green">
|
||||||
</el-input>
|
<CircleCheckFilled />
|
||||||
<el-descriptions title="你的 wiki 主页将为">
|
|
||||||
<el-icon>
|
|
||||||
<Link />
|
|
||||||
</el-icon>
|
</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>https://www.violin-home.cn/docs#/{{ profileName ? profileName : profileNameText
|
||||||
}}/</el-descriptions-item>
|
}}/</el-descriptions-item>
|
||||||
<!-- <el-descriptions-item label="Remarks">
|
<!-- <el-descriptions-item label="Remarks">
|
||||||
@@ -121,7 +125,7 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="onCloseProfileDialog">取消</el-button>
|
<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>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -130,7 +134,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import $moment from "moment"
|
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 EchartsLine from '@/view/dashboard/dashboardCharts/index.vue'
|
||||||
import DashboardTable from '@/view/dashboard/dashboardTable/index.vue'
|
import DashboardTable from '@/view/dashboard/dashboardTable/index.vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
@@ -151,6 +155,11 @@ const useSettingsStore = settingsStore()
|
|||||||
let time = ref<String>($moment().format("YYYY年MM月DD日 HH:mm:ss"));
|
let time = ref<String>($moment().format("YYYY年MM月DD日 HH:mm:ss"));
|
||||||
const profileNameCreateDialogVisible = ref(false)
|
const profileNameCreateDialogVisible = ref(false)
|
||||||
const profileName = ref<string>()
|
const profileName = ref<string>()
|
||||||
|
|
||||||
|
// 0 false
|
||||||
|
// 1 true
|
||||||
|
// -1 なにもしない
|
||||||
|
const profileNameCheckStatus = ref<number>(-1)
|
||||||
const profileNameText = ref<string>("{Profile name}")
|
const profileNameText = ref<string>("{Profile name}")
|
||||||
|
|
||||||
const statistics = ref({
|
const statistics = ref({
|
||||||
@@ -236,8 +245,13 @@ const onCreateProfile = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await create_profile({ name: profileName.value }).then(() => {
|
await create_profile({ name: profileName.value }).then((resp) => {
|
||||||
|
|
||||||
|
if (resp) {
|
||||||
|
profileNameCreateDialogVisible.value = false
|
||||||
openTag()
|
openTag()
|
||||||
|
}
|
||||||
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
profileNameCreateDialogVisible.value = false
|
profileNameCreateDialogVisible.value = false
|
||||||
})
|
})
|
||||||
@@ -252,16 +266,23 @@ const openTag = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const querySearchAsync = async (queryString: string, cb: any) => {
|
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 = () => {
|
const onCloseProfileDialog = () => {
|
||||||
profileName.value = ""
|
profileName.value = ""
|
||||||
profileNameCreateDialogVisible.value = false
|
profileNameCreateDialogVisible.value = false
|
||||||
|
profileNameCheckStatus.value = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user