Parcourir la source

feat: 默认显示节日文本并更新用户名字段

- 将showFestivalText默认值改为true
- 将userName字段统一改为username
- 添加国庆节节日配置
- 清理通知组件中的测试数据
zhanghaijun il y a 1 an
Parent
commit
7eddf43d65

+ 1 - 1
src/api/auth.api.ts

@@ -10,7 +10,7 @@ export interface LoginResponse extends UserItem {
 export interface UserItem {
   userGroupID: number /** 用户所属分组 */
   userId: number /** 用户ID */
-  userName: string /** 用户名 */
+  username: string /** 用户名 */
   UserType: number /** 用户类型 */
   roleCodes: string[] /** 用户角色编码 */
   buttons: string[] /** 用户按钮编码 */

+ 1 - 1
src/components/core/layouts/art-header-bar/index.vue

@@ -99,7 +99,7 @@
                 <div class="user-head">
                   <img class="cover" src="@imgs/user/avatar.webp" style="float: left" />
                   <div class="user-wrap">
-                    <span class="name">{{ userInfo.userName }}</span>
+                    <span class="name">{{ userInfo.username }}</span>
                     <span class="email">{{ userInfo.userId }}</span>
                   </div>
                 </div>

+ 10 - 111
src/components/core/layouts/art-notification/index.vue

@@ -15,14 +15,7 @@
     </div>
 
     <ul class="bar">
-      <li
-        v-for="(item, index) in barList"
-        :key="index"
-        :class="{ active: barActiveIndex === index }"
-        @click="changeBar(index)"
-      >
-        {{ item.name }} ({{ item.num }})
-      </li>
+      <li v-for="(item, index) in barList" :key="index" :class="{ active: barActiveIndex === index }" @click="changeBar(index)"> {{ item.name }} ({{ item.num }}) </li>
     </ul>
 
     <div class="content">
@@ -30,16 +23,8 @@
         <!-- 通知 -->
         <ul class="notice-list" v-show="barActiveIndex === 0">
           <li v-for="(item, index) in noticeList" :key="index">
-            <div
-              class="icon"
-              :style="{ background: getNoticeStyle(item.type).backgroundColor + '!important' }"
-            >
-              <i
-                class="iconfont-sys"
-                :style="{ color: getNoticeStyle(item.type).iconColor + '!important' }"
-                v-html="getNoticeStyle(item.type).icon"
-              >
-              </i>
+            <div class="icon" :style="{ background: getNoticeStyle(item.type).backgroundColor + '!important' }">
+              <i class="iconfont-sys" :style="{ color: getNoticeStyle(item.type).iconColor + '!important' }" v-html="getNoticeStyle(item.type).icon"> </i>
             </div>
             <div class="text">
               <h4>{{ item.title }}</h4>
@@ -92,14 +77,6 @@
   import { useI18n } from 'vue-i18n'
   import AppConfig from '@/config'
 
-  // 导入头像图片
-  import avatar1 from '@/assets/img/avatar/avatar1.webp'
-  import avatar2 from '@/assets/img/avatar/avatar2.webp'
-  import avatar3 from '@/assets/img/avatar/avatar3.webp'
-  import avatar4 from '@/assets/img/avatar/avatar4.webp'
-  import avatar5 from '@/assets/img/avatar/avatar5.webp'
-  import avatar6 from '@/assets/img/avatar/avatar6.webp'
-
   defineOptions({ name: 'ArtNotification' })
 
   interface NoticeItem {
@@ -147,9 +124,7 @@
 
   const { t } = useI18n()
 
-  const props = defineProps<{
-    value: boolean
-  }>()
+  const props = defineProps<{ value: boolean }>()
 
   const show = ref(false)
   const visible = ref(false)
@@ -157,90 +132,19 @@
 
   const useNotificationData = () => {
     // 通知数据
-    const noticeList = ref<NoticeItem[]>([
-      {
-        title: '新增国际化',
-        time: '2024-6-13 0:10',
-        type: 'notice'
-      },
-      {
-        title: '冷月呆呆给你发了一条消息',
-        time: '2024-4-21 8:05',
-        type: 'message'
-      },
-      {
-        title: '小肥猪关注了你',
-        time: '2020-3-17 21:12',
-        type: 'collection'
-      },
-      {
-        title: '新增使用文档',
-        time: '2024-02-14 0:20',
-        type: 'notice'
-      },
-      {
-        title: '小肥猪给你发了一封邮件',
-        time: '2024-1-20 0:15',
-        type: 'email'
-      },
-      {
-        title: '菜单mock本地真实数据',
-        time: '2024-1-17 22:06',
-        type: 'notice'
-      }
-    ])
+    const noticeList = ref<NoticeItem[]>([])
 
     // 消息数据
-    const msgList = ref<MessageItem[]>([
-      {
-        title: '池不胖 关注了你',
-        time: '2021-2-26 23:50',
-        avatar: avatar1
-      },
-      {
-        title: '唐不苦 关注了你',
-        time: '2021-2-21 8:05',
-        avatar: avatar2
-      },
-      {
-        title: '中小鱼 关注了你',
-        time: '2020-1-17 21:12',
-        avatar: avatar3
-      },
-      {
-        title: '何小荷 关注了你',
-        time: '2021-01-14 0:20',
-        avatar: avatar4
-      },
-      {
-        title: '誶誶淰 关注了你',
-        time: '2020-12-20 0:15',
-        avatar: avatar5
-      },
-      {
-        title: '冷月呆呆 关注了你',
-        time: '2020-12-17 22:06',
-        avatar: avatar6
-      }
-    ])
+    const msgList = ref<MessageItem[]>([])
 
     // 待办数据
     const pendingList = ref<PendingItem[]>([])
 
     // 标签栏数据
     const barList = computed<BarItem[]>(() => [
-      {
-        name: computed(() => t('notice.bar[0]')),
-        num: noticeList.value.length
-      },
-      {
-        name: computed(() => t('notice.bar[1]')),
-        num: msgList.value.length
-      },
-      {
-        name: computed(() => t('notice.bar[2]')),
-        num: pendingList.value.length
-      }
+      { name: computed(() => t('notice.bar[0]')), num: noticeList.value.length },
+      { name: computed(() => t('notice.bar[1]')), num: msgList.value.length },
+      { name: computed(() => t('notice.bar[2]')), num: pendingList.value.length }
     ])
 
     return {
@@ -393,12 +297,7 @@
   const { getNoticeStyle } = useNotificationStyles()
   const { showNotice } = useNotificationAnimation()
   const { handleNoticeAll, handleMsgAll, handlePendingAll } = useBusinessLogic()
-  const { changeBar, currentTabIsEmpty, handleViewAll } = useTabManagement(
-    noticeList,
-    msgList,
-    pendingList,
-    { handleNoticeAll, handleMsgAll, handlePendingAll }
-  )
+  const { changeBar, currentTabIsEmpty, handleViewAll } = useTabManagement(noticeList, msgList, pendingList, { handleNoticeAll, handleMsgAll, handlePendingAll })
 
   // 监听属性变化
   watch(

+ 1 - 1
src/components/core/layouts/art-page-content/index.vue

@@ -2,7 +2,7 @@
 <template>
   <div class="layout-content" :class="{ 'no-basic-layout': isFullPage }" :style="containerStyle">
     <!-- 节日滚动 -->
-    <ArtFestivalTextScroll v-if="!isFullPage" />
+    <ArtFestivalTextScroll />
 
     <RouterView v-if="isRefresh" v-slot="{ Component, route }" :style="contentStyle">
       <!-- 路由信息调试 -->

+ 2 - 2
src/components/core/layouts/art-screen-lock/index.vue

@@ -19,7 +19,7 @@
       <ElDialog v-model="visible" :width="370" :show-close="false" @open="handleDialogOpen">
         <div class="lock-content">
           <img class="cover" src="@imgs/user/avatar.webp" alt="用户头像" />
-          <div class="username">{{ userInfo.userName }}</div>
+          <div class="username">{{ userInfo.username }}</div>
           <ElForm ref="formRef" :model="formData" :rules="rules" @submit.prevent="handleLock">
             <ElFormItem prop="password">
               <ElInput v-model="formData.password" type="password" :placeholder="$t('lockScreen.lock.inputPlaceholder')" :show-password="true" ref="lockInputRef" @keyup.enter="handleLock">
@@ -42,7 +42,7 @@
     <div v-else class="unlock-content">
       <div class="box">
         <img class="cover" src="@imgs/user/avatar.webp" alt="用户头像" />
-        <div class="username">{{ userInfo.userName }}</div>
+        <div class="username">{{ userInfo.username }}</div>
         <ElForm ref="unlockFormRef" :model="unlockForm" :rules="rules" @submit.prevent="handleUnlock">
           <ElFormItem prop="password">
             <ElInput v-model="unlockForm.password" type="password" :placeholder="$t('lockScreen.unlock.inputPlaceholder')" :show-password="true" ref="unlockInputRef">

+ 3 - 7
src/components/core/text-effect/art-festival-text-scroll/index.vue

@@ -1,15 +1,11 @@
 <!-- 节日文本滚动 -->
 <template>
-  <div
-    class="festival-text-scroll"
-    :style="{
-      height: showFestivalText ? '48px' : '0'
-    }"
-  >
+  <div class="festival-text-scroll" :style="{ height: showFestivalText ? '48px' : '0' }">
     <ArtTextScroll
       v-if="showFestivalText && currentFestivalData?.scrollText !== ''"
-      :text="currentFestivalData?.scrollText || ''"
+      :text="currentFestivalData?.scrollText || '暂无滚动公告'"
       style="margin-bottom: 12px"
+      type="warning"
       show-close
       @close="handleClose"
       typewriter

+ 9 - 1
src/config/festival.ts

@@ -4,5 +4,13 @@
  */
 // 图片需要在 components/Ceremony/Fireworks 文件预先定义
 import { FestivalConfig } from '@/types/config'
+import sd from '@imgs/ceremony/sd.png'
 
-export const festivalConfigList: FestivalConfig[] = []
+export const festivalConfigList: FestivalConfig[] = [
+  {
+    date: '2025-10-01',
+    name: '国庆节',
+    image: sd,
+    scrollText: '国庆节快乐!祝愿国家繁荣昌盛,社会和谐发展,实现社会 goals!'
+  }
+]

+ 1 - 1
src/store/modules/setting.ts

@@ -54,7 +54,7 @@ export const useSettingStore = defineStore(
     /** 是否显示设置引导 */
     const showSettingGuide = ref(false)
     /** 是否显示节日文本 */
-    const showFestivalText = ref(false)
+    const showFestivalText = ref(true)
     /** 是否显示水印 */
     const watermarkVisible = ref(false)
 

+ 1 - 1
src/views/dashboard/ecommerce/widget/Banner.vue

@@ -2,7 +2,7 @@
   <ArtBasicBanner
     class="banner"
     height="13.3rem"
-    :title="`欢迎回来 ${userInfo.userName}`"
+    :title="`欢迎回来 ${userInfo.username}`"
     backgroundColor="var(--el-color-primary-light-9)"
     titleColor="var(--art-gray-900)"
     :decoration="false"

+ 1 - 1
src/views/system/user-center/index.vue

@@ -5,7 +5,7 @@
         <div class="user-wrap box-style">
           <img class="bg" src="@imgs/user/bg.webp" />
           <img class="avatar" src="@imgs/user/avatar.webp" />
-          <h2 class="name">{{ userInfo.userName }}</h2>
+          <h2 class="name">{{ userInfo.username }}</h2>
           <p class="des">教员管理系统 是一款漂亮的后台管理系统模版.</p>
 
           <div class="outer-info">