Sfoglia il codice sorgente

Merge branch 'iteration-20240607-small' into online

lex 1 anno fa
parent
commit
51262a8f3c

+ 11 - 0
package-lock.json

@@ -20,6 +20,7 @@
         "eventemitter3": "^5.0.1",
         "howler": "^2.2.3",
         "html2canvas": "^1.4.1",
+        "mobile-drag-drop": "^3.0.0-rc.0",
         "moveable": "^0.52.0",
         "naive-ui": "^2.34.4",
         "numeral": "^2.0.6",
@@ -6500,6 +6501,11 @@
         "node": ">=10"
       }
     },
+    "node_modules/mobile-drag-drop": {
+      "version": "3.0.0-rc.0",
+      "resolved": "https://registry.npmmirror.com/mobile-drag-drop/-/mobile-drag-drop-3.0.0-rc.0.tgz",
+      "integrity": "sha512-f8wIDTbBYLBW/+5sei1cqUE+StyDpf/LP+FRZELlVX6tmOOmELk84r3wh1z3woxCB9G5octhF06K5COvFjGgqg=="
+    },
     "node_modules/moveable": {
       "version": "0.52.0",
       "resolved": "https://registry.npmmirror.com/moveable/-/moveable-0.52.0.tgz",
@@ -14247,6 +14253,11 @@
       "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
       "dev": true
     },
+    "mobile-drag-drop": {
+      "version": "3.0.0-rc.0",
+      "resolved": "https://registry.npmmirror.com/mobile-drag-drop/-/mobile-drag-drop-3.0.0-rc.0.tgz",
+      "integrity": "sha512-f8wIDTbBYLBW/+5sei1cqUE+StyDpf/LP+FRZELlVX6tmOOmELk84r3wh1z3woxCB9G5octhF06K5COvFjGgqg=="
+    },
     "moveable": {
       "version": "0.52.0",
       "resolved": "https://registry.npmmirror.com/moveable/-/moveable-0.52.0.tgz",

+ 1 - 0
package.json

@@ -34,6 +34,7 @@
     "eventemitter3": "^5.0.1",
     "howler": "^2.2.3",
     "html2canvas": "^1.4.1",
+    "mobile-drag-drop": "^3.0.0-rc.0",
     "moveable": "^0.52.0",
     "naive-ui": "^2.34.4",
     "numeral": "^2.0.6",

+ 22 - 12
src/hooks/useDrag/index.ts

@@ -105,19 +105,22 @@ export default function useDrag(
 
 // 拖动
 function drag(el: HTMLElement, parentElement: HTMLElement, pos: Ref<posType>) {
-  function mousedown(e: MouseEvent) {
+  function onDown(e: MouseEvent | TouchEvent) {
+    const isTouchEv = isTouchEvent(e);
+    const event = isTouchEv ? e.touches[0] : e;
     const parentElementRect = parentElement.getBoundingClientRect();
-    const downX = e.clientX;
-    const downY = e.clientY;
+    const downX = event.clientX;
+    const downY = event.clientY;
     const clientWidth = document.documentElement.clientWidth;
     const clientHeight = document.documentElement.clientHeight;
     const maxLeft = clientWidth - parentElementRect.width;
     const maxTop = clientHeight - parentElementRect.height;
     const minLeft = 0;
     const minTop = 0;
-    function onMousemove(e: MouseEvent) {
-      let moveX = parentElementRect.left + (e.clientX - downX);
-      let moveY = parentElementRect.top + (e.clientY - downY);
+    function onMove(e: MouseEvent | TouchEvent) {
+      const event = isTouchEvent(e) ? e.touches[0] : e;
+      let moveX = parentElementRect.left + (event.clientX - downX);
+      let moveY = parentElementRect.top + (event.clientY - downY);
       moveX = moveX < minLeft ? minLeft : moveX > maxLeft ? maxLeft : moveX;
       moveY = moveY < minTop ? minTop : moveY > maxTop ? maxTop : moveY;
       pos.value = {
@@ -125,16 +128,23 @@ function drag(el: HTMLElement, parentElement: HTMLElement, pos: Ref<posType>) {
         left: moveX
       };
     }
-    function onMouseup() {
-      document.removeEventListener('mousemove', onMousemove);
-      document.removeEventListener('mouseup', onMouseup);
+    function onUp() {
+      document.removeEventListener(
+        isTouchEv ? 'touchmove' : 'mousemove',
+        onMove
+      );
+      document.removeEventListener(isTouchEv ? 'touchend' : 'mouseup', onUp);
     }
-    document.addEventListener('mousemove', onMousemove);
-    document.addEventListener('mouseup', onMouseup);
+    document.addEventListener(isTouchEv ? 'touchmove' : 'mousemove', onMove);
+    document.addEventListener(isTouchEv ? 'touchend' : 'mouseup', onUp);
   }
-  el.addEventListener('mousedown', mousedown);
+  el.addEventListener('mousedown', onDown);
+  el.addEventListener('touchstart', onDown);
 }
 
+function isTouchEvent(e: MouseEvent | TouchEvent): e is TouchEvent {
+  return window.TouchEvent && e instanceof window.TouchEvent;
+}
 // 缓存
 const localStorageName = 'dragCachePos';
 function getCachePos(useIdDargClass: string): null | undefined | posType {

+ 7 - 0
src/main.ts

@@ -31,6 +31,13 @@ setToastDefaultOptions({ duration: 3000 });
 // // 初始化polyfill
 // polyfill(options);
 
+// document.addEventListener('dragstart', (event: any) => {
+//   if (!event.target.classList.contains('draggable')) {
+//     event.preventDefault();
+//   }
+// });
+
+
 
 // 获取token
 promisefiyPostMessage({ api: 'getToken' }).then((res: any) => {

+ 5 - 5
src/views/tempo-practice/index.module.less

@@ -45,7 +45,7 @@
 .pc {
   .container {
     max-width: 1200px;
-    gap: 30px 0;
+    gap: 20px 0;
   }
 
   .beatSection {
@@ -60,11 +60,11 @@
 
     &.small {
       .beat {
-        width: 139px !important;
-        height: 191px !important;
+        width: 117px !important;
+        height: 161px !important;
 
         img {
-          width: 108px;
+          width: 80px;
         }
       }
     }
@@ -379,7 +379,7 @@
 :global {
   .settingBoxClass_drag .settingContainer_pc {
     border-radius: 16px;
-    height: 55vh !important;
+    height: 60vh !important;
   }
 }
 

+ 1 - 0
src/views/tempo-practice/index.tsx

@@ -646,6 +646,7 @@ export default defineComponent({
           style={
             state.platform === 'modal' ? settingBoxDragData.styleDrag.value : {}
           }
+          closeOnClickOverlay={false}
           v-model:show={state.settingPcStatus}
           class={[styles.settingPopup, settingBoxClass]}>
           <SettingPcModal

+ 1 - 0
src/views/tempo-practice/setting-modal/index.tsx

@@ -324,6 +324,7 @@ export default defineComponent({
                           }}
                           onClick={() => onChangeTempo(item)}>
                           <img
+                            class={'draggable'}
                             // class={state.tempo.includes(item) && styles.active}
                             src={getImage(
                               (state.element === 'jianpu' ? 'j-' : 'f-') +

+ 8 - 1
src/views/tenantAllData/index.module.less

@@ -296,6 +296,13 @@
       font-weight: 500;
       color: #333333;
       line-height: 20px;
+
+      span {
+        font-weight: 400;
+        color: #777777;
+        line-height: 17px;
+        font-size: 12px;
+      }
     }
 
     .personNum {
@@ -656,4 +663,4 @@
       margin-left: 15px;
     }
   }
-}
+}

+ 25 - 23
src/views/tenantAllData/tenantDataSchool.tsx

@@ -1,39 +1,26 @@
 import { defineComponent, onMounted, reactive, ref } from 'vue';
 import styles from './index.module.less';
-import {
-  Cell,
-  CellGroup,
-  Col,
-  List,
-  Picker,
-  Popup,
-  Row,
-  Tab,
-  Tabs,
-  DatePicker,
-  Button,
-  Popover
-} from 'vant';
+import { List, Popup, DatePicker, Popover } from 'vant';
 import MSticky from '@/components/m-sticky';
 import personIcon from './images/personIcon.png';
 import homeIcon from './images/icon-class.png';
 import memberIcon from './images/memberIcon.png';
 import memberRateIcon from './images/memberRateIcon.png';
-import sanIcon from './images/san.png';
+// import sanIcon from './images/san.png';
 import iconArrow from './images/icon-arrow.png';
 import iconArrowActive from './images/icon-arrow-active.png';
 import request from '@/helpers/request';
 import topDot from './images/topDot.png';
 import { useRoute, useRouter } from 'vue-router';
-import { moneyFormat, numberFormat } from '@/helpers/utils';
+// import { moneyFormat, numberFormat } from '@/helpers/utils';
 import OFullRefresh from '@/components/m-full-refresh';
 import OEmpty from '@/components/m-empty';
-import arrowIcon from './images/arrowIcon.png';
-import OHeader from '@/components/m-header';
+// import arrowIcon from './images/arrowIcon.png';
+// import OHeader from '@/components/m-header';
 import OSearch from '@/components/m-search';
 import numeral from 'numeral';
-import MQrcode from '@/components/m-qrcode';
-import html2canvas from 'html2canvas';
+// import MQrcode from '@/components/m-qrcode';
+// import html2canvas from 'html2canvas';
 import MWxTip from '@/components/m-wx-tip';
 export default defineComponent({
   name: 'tenant-apply-data',
@@ -56,7 +43,7 @@ export default defineComponent({
         registerMemberShipNum: 0
       } as any,
       perponStatus: false,
-      sortKey: 'CLASS' as 'CLASS' | 'MEMBER',
+      sortKey: 'CLASS' as 'CLASS' | 'MEMBER' | 'GRADEYEAR',
       sortId: 'desc',
       sortName: '报名人数降序',
       sortType: 'desc',
@@ -64,7 +51,9 @@ export default defineComponent({
         { value: 'desc', text: '报名人数降序' },
         { value: 'asc', text: '报名人数升序' },
         { value: 'mdesc', text: '会员人数降序' },
-        { value: 'masc', text: '会员人数升序' }
+        { value: 'masc', text: '会员人数升序' },
+        { value: 'gdesc', text: '按学年降序' },
+        { value: 'gasc', text: '按学年升序' }
       ] as any,
       page: 1,
       rows: 20,
@@ -353,6 +342,16 @@ export default defineComponent({
                                 forms.sortKey = 'MEMBER';
                               }
 
+                              if (selectedOption.value === 'gdesc') {
+                                forms.sortId = 'desc';
+                                forms.sortKey = 'GRADEYEAR';
+                              }
+
+                              if (selectedOption.value === 'gasc') {
+                                forms.sortId = 'asc';
+                                forms.sortKey = 'GRADEYEAR';
+                              }
+
                               forms.sortType = selectedOption.value;
                               forms.sortName = selectedOption.text;
                               refreshing.value = true;
@@ -386,7 +385,10 @@ export default defineComponent({
                   <div class={styles.schoolItem}>
                     <div class={styles.schoolNameWrap}>
                       {/* <p class={styles.title}>学校名称</p> */}
-                      <p class={styles.schoolName}>{item.classGroupName}</p>
+                      <p class={styles.schoolName}>
+                        {item.classGroupName}
+                        {item.gradeYear && <span>({item.gradeYear}学年)</span>}
+                      </p>
                     </div>
                     <div class={styles.schoolCountWrap}>
                       <div>

+ 1 - 1
vite.config.ts

@@ -16,7 +16,7 @@ function resolve(dir: string) {
 // const proxyUrl = 'https://test.lexiaoya.cn/';
 // const proxyUrl = 'https://kt.colexiu.com/';
 // const proxyUrl = 'http://192.168.3.143:7093/';
-const proxyUrl = 'https://dev.kt.colexiu.com/';
+const proxyUrl = 'https://test.kt.colexiu.com/';
 export default defineConfig({
   base: './',
   plugins: [