Browse Source

✨ feat: 增加用户头像显示

Pchen. 10 months ago
parent
commit
cc004f8190
3 changed files with 16 additions and 7 deletions
  1. 12 6
      src/pages/lepao/accountList/index.vue
  2. 3 0
      src/pages/path/pathList.vue
  3. 1 1
      src/router/index.js

+ 12 - 6
src/pages/lepao/accountList/index.vue

@@ -39,8 +39,8 @@
           <a-table-column title="" :width="60" data-index="user_avatar" tooltip>
             <template #cell="{ record }">
               <a-avatar>
-                <img :alt="record.name ?? ''"
-                  :src="record.user_avatar" />
+                <IconUser v-if="!record.user_avatar"/>
+                <img :alt="record.name ?? ''" :src="record.user_avatar" v-else/>
               </a-avatar>
             </template>
           </a-table-column>
@@ -55,7 +55,7 @@
             icon: () => h(IconSearch)
           }">
             <template #cell="{ record }">
-              {{ record.name }}
+              {{ record.name ?? '请使用乐跑登录器更新信息' }}
             </template>
           </a-table-column>
           <a-table-column title="性别" :width="80" ellipsis tooltip :filterable="{
@@ -67,8 +67,8 @@
           }">
             <template #cell="{ record }">
               <icon-man v-if="record.sex === 1" />
-              <icon-woman v-else />
-              {{ record.sex === 1 ? '男' : '女' }}
+              <icon-woman v-else-if="record.sex === 2" />
+              {{ record.sex === 1 ? '男' : (record.sex === 2 ? '女' : '') }}
             </template>
           </a-table-column>
           <a-table-column title="学院" :width="220" data-index="academy_name" ellipsis tooltip :filterable="{
@@ -312,8 +312,14 @@ const handleBeforeOk = async (done) => {
       return false
     }
 
+    const studentNumRegex = /^\d{10}$/
+    if (!studentNumRegex.test(student_num)) {
+      Message.error('请检查学号格式是否正确')
+      return false
+    }
+
     const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
-    if(!emailRegex.test(email)) {
+    if (!emailRegex.test(email)) {
       Message.error('请检查邮箱格式是否正确')
       return false
     }

+ 3 - 0
src/pages/path/pathList.vue

@@ -124,6 +124,9 @@ const columns = [{
 }, {
     title: '配速',
     dataIndex: 'speed',
+}, {
+    title: '使用次数',
+    dataIndex: 'count',
 }, {
     title: '状态',
     slotName: 'state'

+ 1 - 1
src/router/index.js

@@ -74,7 +74,7 @@ const routes = [
         component: DEFAULT_LAYOUT,
         meta: {
             title: '校园乐跑',
-            icon: 'icon-bug'
+            icon: 'icon-robot'
         },
         children: [
             {