diff --git a/src/api/profile.ts b/src/api/profile.ts new file mode 100644 index 0000000..b8bd3f9 --- /dev/null +++ b/src/api/profile.ts @@ -0,0 +1,55 @@ +import { service } from '../utils/request' + +const headers = { + 'Content-Type': 'application/json;charsetset=UTF-8' +} + +const create_profile = (data: Object) => { + return service({ + url: '/wiki/api/v1/author/profile', + method: 'POST', + data: data + }) +} + +const update_profile = (data: Object) => { + return service({ + url: '/wiki/api/v1/author/profile', + method: 'PUT', + data: data + }) +} + +const get_profile = () => { + return service({ + url: '/wiki/api/v1/author/profile', + method: 'GET', + headers: headers + }) +} + +const get_profileName = () => { + return service({ + url: '/wiki/api/v1/author/profile/name', + method: 'GET', + headers: headers + }) +} + +const judge_profile = (data: Object) => { + return service({ + url: '/wiki/api/v1/author/profile/judge', + method: 'POST', + data: data + }) +} + + + +export { + create_profile, + get_profile, + update_profile, + get_profileName, + judge_profile +} \ No newline at end of file diff --git a/src/permission.ts b/src/permission.ts index 449efdb..be1fdb7 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -22,6 +22,9 @@ router.beforeEach((to, from, next) => { if (url.search("write") != -1) { next('/BlogEditer') } + if (url.search("profile") != -1) { + next('/ProfileEditer') + } if (url.search("view") != -1) { let arr = url.split('?') let bid = arr[1].split('=')[1] diff --git a/src/router/index.ts b/src/router/index.ts index 96ceccf..ab11305 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -95,6 +95,10 @@ const routes: Array = [ path: "/BlogEditer", component: () => import('@/view/blog/createBlog.vue'), }, + { + path: "/ProfileEditer", + component: () => import('@/view/dashboard/editProfile.vue'), + }, { path: "/BlogViewer", component: () => import('@/view/blog/mdview.vue'), diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index a02b6bb..85363fd 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -7,13 +7,15 @@ export const settingsStore = defineStore('settings', () => { sideMode: '#191a23', isMobile: false, isRouterAlive: true, - isLoading: false + isLoading: false, + profileName: null, }) const sideMode = computed(() => settings.value.sideMode) const isMobile = computed(() => settings.value.isMobile) const isRouterAlive = computed(() => settings.value.isRouterAlive) const isLoading = computed(() => settings.value.isLoading) + const profileName = computed(() => settings.value.profileName) return { settings, @@ -21,6 +23,7 @@ export const settingsStore = defineStore('settings', () => { isMobile, isRouterAlive, isLoading, + profileName, } }) diff --git a/src/view/dashboard/editProfile.vue b/src/view/dashboard/editProfile.vue new file mode 100644 index 0000000..b93087a --- /dev/null +++ b/src/view/dashboard/editProfile.vue @@ -0,0 +1,44 @@ + + + + + \ No newline at end of file diff --git a/src/view/dashboard/index.vue b/src/view/dashboard/index.vue index 58de034..7e1c4ff 100644 --- a/src/view/dashboard/index.vue +++ b/src/view/dashboard/index.vue @@ -97,26 +97,61 @@ + + + Profile name: + + + + + + + + https://www.violin-home.cn/docs#/{{ profileName ? profileName : profileNameText + }}/ + + + + + +