Browse Source

fix: (bug) bug选择

gemercheung 2 năm trước cách đây
mục cha
commit
b89070017c

+ 2 - 0
src/utils/dateUtil.ts

@@ -2,6 +2,8 @@
  * Independent time operation tool to facilitate subsequent switch to dayjs
  */
 import dayjs from 'dayjs';
+import duration from 'dayjs/plugin/duration';
+dayjs.extend(duration);
 
 const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
 const DATE_FORMAT = 'YYYY-MM-DD';

+ 25 - 0
src/views/dashboard/analysis/enterprise.vue

@@ -69,16 +69,19 @@
     {
       title: '总观看人数',
       dataIndex: 'spectatorNum',
+      sorter: true,
       width: 120,
     },
     {
       title: '总直播时长',
       dataIndex: 'duration',
+      sorter: true,
       width: 120,
     },
     {
       title: '总分享人数',
       dataIndex: 'shareNum',
+      sorter: true,
       width: 120,
     },
   ];
@@ -188,6 +191,28 @@
             return current && current > dateUtil().endOf('day');
           },
         },
+        rules: [
+          {
+            required: true,
+            // @ts-ignore
+            validator: async (rule, value) => {
+              if (!value) {
+                return Promise.reject('请选择时间段');
+              }
+              const days = Math.abs(value[1].diff(value[0], 'days'));
+              console.log('days', days);
+              if (days > 30) {
+                return Promise.reject('请选择小于一个月');
+              }
+              if (days < 1) {
+                return Promise.reject('至少选择2天以上');
+              }
+              return Promise.resolve();
+            },
+
+            trigger: 'change',
+          },
+        ],
       },
     ],
     resetFunc: handleReset,

+ 23 - 0
src/views/dashboard/analysis/index.vue

@@ -160,6 +160,28 @@
           //   console.log('onchange', value);
           // },
         },
+        rules: [
+          {
+            required: true,
+            // @ts-ignore
+            validator: async (rule, value) => {
+              if (!value) {
+                return Promise.reject('请选择时间段');
+              }
+              const days = Math.abs(value[1].diff(value[0], 'days'));
+              console.log('days', days);
+              if (days > 30) {
+                return Promise.reject('请选择小于一个月');
+              }
+              if (days < 1) {
+                return Promise.reject('至少选择2天以上');
+              }
+              return Promise.resolve();
+            },
+
+            trigger: 'change',
+          },
+        ],
       },
     ],
     resetFunc: handleReset,
@@ -194,6 +216,7 @@
     handleSearchInfoFn(data) {
       searchInfo.value = Object.assign(searchInfo.value, data);
       console.log(searchInfo.value);
+      return;
     },
   });
 

+ 12 - 0
src/views/member/list.vue

@@ -126,6 +126,18 @@
               xxl: 5,
             },
           },
+          {
+            field: 'mobile',
+            label: '手机号',
+            component: 'Input',
+            componentProps: {
+              maxLength: 100,
+            },
+            colProps: {
+              xl: 5,
+              xxl: 5,
+            },
+          },
         ],
       };
 

+ 7 - 7
src/views/scenes/roomDetail.vue

@@ -442,11 +442,11 @@
   });
 </script>
 <style lang="less">
-  .ant-form-item-control-input {
-    div {
-      div {
-        width: 100%;
-      }
-    }
-  }
+  // .ant-form-item-control-input {
+  //   div {
+  //     div {
+  //       width: 100%;
+  //     }
+  //   }
+  // }
 </style>