Browse Source

fix: 样式调整,列表添加loading

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 6 tháng trước cách đây
mục cha
commit
876f3d065c

+ 8 - 5
apps/mobile/src/views/entgroup/detail.vue

@@ -81,13 +81,15 @@ export default {
       if (code === 0) {
         if (type === 'del') {
           this.$toast.success('删除成功')
-        } else {
+        }
+        else {
           this.$toast.success('保存成功')
         }
         setTimeout(() => {
           this.$router.back()
         }, 1000)
-      } else {
+      }
+      else {
         this.$toast.fail(msg)
       }
     },
@@ -104,12 +106,13 @@ export default {
       if (this.groupNameValue === '') {
         this.errorMessageText = '分组名称不能为空'
         this.isConfirmButtonDisabled = true
-      } else {
+      }
+      else {
         const exists = this.entGroupList.some(
-          (item) => item.name === this.groupNameValue
+          item => item.name === this.groupNameValue
         )
         if (exists) {
-          this.errorMessageText = '分组已存在'
+          this.errorMessageText = '分组名称已存在'
           this.isConfirmButtonDisabled = true
         }
       }

+ 18 - 2
apps/mobile/src/views/entgroup/index.vue

@@ -10,6 +10,7 @@
           @click="setGroupEvent(item)"
         />
       </van-cell-group>
+      <Empty v-if="groupList.length === 0" />
     </div>
     <div class="j-footer">
       <div class="j-button-group">
@@ -36,7 +37,7 @@
         @input="setGroupingName"
       />
       <div class="dialog-footer">
-        <van-button type="default" @click="showAddGroupingDialog = false">
+        <van-button type="default" @click="cancelAddGrouping">
           取消
         </van-button>
         <van-button
@@ -56,6 +57,7 @@
 import { Button, Cell, CellGroup, Dialog, Field, Icon } from 'vant'
 import { mapActions } from 'vuex'
 import { getGroupList } from '@/api/modules/'
+import Empty from '@/components/common/Empty'
 
 export default {
   name: 'EntGroupIndex',
@@ -65,7 +67,8 @@ export default {
     [Dialog.name]: Dialog,
     [Button.name]: Button,
     [Icon.name]: Icon,
-    [Field.name]: Field
+    [Field.name]: Field,
+    Empty
   },
   data() {
     return {
@@ -82,11 +85,17 @@ export default {
   methods: {
     ...mapActions('group', ['setEntGroupList']),
     async getMyFollowList() {
+      const loading = this.$toast.loading()
       const { error_code: code, data } = await this.setEntGroupList()
       console.log(data)
       if (code === 0) {
+        loading.clear()
         this.groupList = data?.groupUserArr || []
       }
+      else {
+        loading.clear()
+        this.$toast('获取分组列表失败')
+      }
     },
     setGroupEvent(data) {
       if (data.name === '默认分组')
@@ -132,6 +141,10 @@ export default {
       else {
         this.$toast('新增分组失败')
       }
+    },
+    cancelAddGrouping() {
+      this.groupingName = ''
+      this.showAddGroupingDialog = false
     }
   }
 }
@@ -156,6 +169,9 @@ export default {
       .van-dialog__header {
         font-size: 18px;
       }
+      .van-field__control {
+        padding-right: 3.32rem;
+      }
       .dialog-footer {
         display: flex;
         justify-content: space-between;