fix shiki.

This commit is contained in:
2023-02-22 23:10:31 +08:00
parent 86315f63dc
commit b66fbe594b
7 changed files with 306 additions and 275 deletions

View File

@@ -1,4 +1,7 @@
// Generated by 'unplugin-auto-import'
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
@@ -114,6 +117,7 @@ declare global {
const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter']
const useArrayFind: typeof import('@vueuse/core')['useArrayFind']
const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex']
const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast']
const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin']
const useArrayMap: typeof import('@vueuse/core')['useArrayMap']
const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce']

8
src/components.d.ts vendored
View File

@@ -1,5 +1,7 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
@@ -19,7 +21,7 @@ declare module '@vue/runtime-core' {
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCode: typeof import("naive-ui")["NCode"]
NCode: typeof import('naive-ui')['NCode']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NCountdown: typeof import("naive-ui")["NCountdown"]
NDataTable: typeof import('naive-ui')['NDataTable']

View File

@@ -79,11 +79,11 @@ function next() {
</template>
<style>
.__layout-dark .shiki-light {
.__layout-dark .vitesse-light {
display: none;
}
.__layout .shiki-dark {
.__layout .vitesse-dark {
display: none;
}

View File

@@ -1,25 +1,24 @@
<script setup lang="ts">
import VueAvatarUpload from "vue-avatar-upload"
import "vue-avatar-upload/lib/style.css"
import { isDesktop } from "~/shared/composables/breakpoints"
import { useUserStore } from "~/shared/store/user"
const [showAvatarModal] = useToggle()
const userStore = useUserStore()
function choose() {}
</script>
<template>
<n-grid v-if="userStore.profile" :x-gap="20" :cols="isDesktop ? 3 : 1">
<n-gi>
<h3>个人信息设置</h3>
<n-form>
<n-form-item label="头像">
<n-button @click="showAvatarModal = true">打开</n-button>
<n-modal v-model:show="showAvatarModal" :mask-closable="false">
<VueAvatarUpload
:avatar="userStore.profile.avatar"
@close="showAvatarModal = false"
/>
</n-modal>
<n-avatar
round
:size="120"
:src="userStore.profile.avatar"
alt="头像"
/>
<n-form-item>
<n-button @click="choose">更换头像</n-button>
</n-form-item>
<n-form-item label="真名">
<n-input />

View File

@@ -6,18 +6,18 @@ import { getProfile } from "../api"
export const useUserStore = defineStore("user", () => {
const profile = ref<Profile | null>(null)
const [isFinished] = useToggle(false)
const user = computed<User>(() => profile!.value!.user)
const isAuthed = computed(() => !!user.value.email)
const user = computed<User | null>(() => profile.value?.user ?? null)
const isAuthed = computed(() => !!user.value?.email ?? false)
const isAdminRole = computed(
() =>
user.value.admin_type === USER_TYPE.ADMIN ||
user.value.admin_type === USER_TYPE.SUPER_ADMIN
user.value?.admin_type === USER_TYPE.ADMIN ||
user.value?.admin_type === USER_TYPE.SUPER_ADMIN
)
const isSuperAdmin = computed(
() => user.value.admin_type === USER_TYPE.SUPER_ADMIN
() => user.value?.admin_type === USER_TYPE.SUPER_ADMIN
)
const hasProblemPermission = computed(
() => user.value.problem_permission !== PROBLEM_PERMISSION.NONE
() => user.value?.problem_permission !== PROBLEM_PERMISSION.NONE
)
async function getMyProfile() {
@@ -25,7 +25,7 @@ export const useUserStore = defineStore("user", () => {
const res = await getProfile()
profile.value = res.data
isFinished.value = true
storage.set(STORAGE_KEY.AUTHED, !!user.value.email)
storage.set(STORAGE_KEY.AUTHED, !!user.value?.email ?? false)
}
function clearProfile() {