Browse Source

平板策略引用优化

gzb
guozhongbo 9 months ago
parent
commit
551d52db38

+ 26
- 3
public/iconfont/demo_index.html View File

@@ -54,6 +54,12 @@
54 54
       <div class="content unicode" style="display: block;">
55 55
           <ul class="icon_lists dib-box">
56 56
           
57
+            <li class="dib">
58
+              <span class="icon iconfont">&#xe62b;</span>
59
+                <div class="name">三点</div>
60
+                <div class="code-name">&amp;#xe62b;</div>
61
+              </li>
62
+          
57 63
             <li class="dib">
58 64
               <span class="icon iconfont">&#xeb2a;</span>
59 65
                 <div class="name">时间</div>
@@ -234,9 +240,9 @@
234 240
 <pre><code class="language-css"
235 241
 >@font-face {
236 242
   font-family: 'iconfont';
237
-  src: url('iconfont.woff2?t=1712547599749') format('woff2'),
238
-       url('iconfont.woff?t=1712547599749') format('woff'),
239
-       url('iconfont.ttf?t=1712547599749') format('truetype');
243
+  src: url('iconfont.woff2?t=1713162473058') format('woff2'),
244
+       url('iconfont.woff?t=1713162473058') format('woff'),
245
+       url('iconfont.ttf?t=1713162473058') format('truetype');
240 246
 }
241 247
 </code></pre>
242 248
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -262,6 +268,15 @@
262 268
       <div class="content font-class">
263 269
         <ul class="icon_lists dib-box">
264 270
           
271
+          <li class="dib">
272
+            <span class="icon iconfont icon-sandian"></span>
273
+            <div class="name">
274
+              三点
275
+            </div>
276
+            <div class="code-name">.icon-sandian
277
+            </div>
278
+          </li>
279
+          
265 280
           <li class="dib">
266 281
             <span class="icon iconfont icon-shijian"></span>
267 282
             <div class="name">
@@ -532,6 +547,14 @@
532 547
       <div class="content symbol">
533 548
           <ul class="icon_lists dib-box">
534 549
           
550
+            <li class="dib">
551
+                <svg class="icon svg-icon" aria-hidden="true">
552
+                  <use xlink:href="#icon-sandian"></use>
553
+                </svg>
554
+                <div class="name">三点</div>
555
+                <div class="code-name">#icon-sandian</div>
556
+            </li>
557
+          
535 558
             <li class="dib">
536 559
                 <svg class="icon svg-icon" aria-hidden="true">
537 560
                   <use xlink:href="#icon-shijian"></use>

+ 7
- 3
public/iconfont/iconfont.css View File

@@ -1,8 +1,8 @@
1 1
 @font-face {
2 2
   font-family: "iconfont"; /* Project id 4468064 */
3
-  src: url('iconfont.woff2?t=1712547599749') format('woff2'),
4
-       url('iconfont.woff?t=1712547599749') format('woff'),
5
-       url('iconfont.ttf?t=1712547599749') format('truetype');
3
+  src: url('iconfont.woff2?t=1713162473058') format('woff2'),
4
+       url('iconfont.woff?t=1713162473058') format('woff'),
5
+       url('iconfont.ttf?t=1713162473058') format('truetype');
6 6
 }
7 7
 
8 8
 .iconfont {
@@ -13,6 +13,10 @@
13 13
   -moz-osx-font-smoothing: grayscale;
14 14
 }
15 15
 
16
+.icon-sandian:before {
17
+  content: "\e62b";
18
+}
19
+
16 20
 .icon-shijian:before {
17 21
   content: "\eb2a";
18 22
 }

+ 1
- 1
public/iconfont/iconfont.js
File diff suppressed because it is too large
View File


+ 7
- 0
public/iconfont/iconfont.json View File

@@ -5,6 +5,13 @@
5 5
   "css_prefix_text": "icon-",
6 6
   "description": "",
7 7
   "glyphs": [
8
+    {
9
+      "icon_id": "766814",
10
+      "name": "三点",
11
+      "font_class": "sandian",
12
+      "unicode": "e62b",
13
+      "unicode_decimal": 58923
14
+    },
8 15
     {
9 16
       "icon_id": "5387666",
10 17
       "name": "时间",

BIN
public/iconfont/iconfont.ttf View File


BIN
public/iconfont/iconfont.woff View File


BIN
public/iconfont/iconfont.woff2 View File


+ 8
- 0
src/api/school.js View File

@@ -117,3 +117,11 @@ export const user_import = (data) => setRequest("user/import", data);
117 117
  * 3.2.6用户--获取班级sn
118 118
  */
119 119
 export const user_list_cs = (data) => setRequest("user/list_cs", data);
120
+/**
121
+ * 3.4.3班级--更新
122
+ */
123
+export const class_edit = (data) => setRequest("class/edit", data);
124
+/**
125
+ * 3.4.4班级--删除
126
+ */
127
+export const class_delete = (data) => setRequest("class/delete", data);

+ 1
- 0
src/views/login/login.vue View File

@@ -32,6 +32,7 @@
32 32
             oncopy="return false"
33 33
             onpaste="return false"
34 34
             oncut="return false"
35
+            :maxlength="16"
35 36
             v-model="loginForm.loginpwd"
36 37
             @keyup.enter.native="login_by_username('loginForm')"
37 38
             placeholder="请输入密码"

+ 2
- 0
src/views/schoolSection/strategy/publicStrategy.vue View File

@@ -532,6 +532,8 @@ export default {
532 532
                 arr.length > 0 ? arr[0].handleMethod.split(";") : [];
533 533
             });
534 534
           }
535
+          //刷新左侧树
536
+          this.$emit("refresh");
535 537
           this.curState = 2; //编辑状态
536 538
           this.stPadInfo.show = false;
537 539
         } else {

+ 4
- 2
src/views/schoolSection/strategy/strategyManage.vue View File

@@ -116,12 +116,14 @@ export default {
116 116
         if (res.code === 0) {
117 117
           this.schoolInfo = res.obj;
118 118
           this.schoolInfo.schoolid = this.schoolInfo.id;
119
-          this.curClass = this.schoolInfo;
120
-          if (this.schoolInfo.children.length > 0 && !this.curClass.id) {
119
+          if (this.schoolInfo.children.length > 0) {
121 120
             this.schoolInfo.children.forEach((item) => {
122 121
               item.schoolid = this.schoolInfo.id;
123 122
             });
124 123
           }
124
+          if (!this.curClass.id) {
125
+            this.curClass = this.schoolInfo;
126
+          }
125 127
           this.strategy = this.strategy ? this.strategy : 1; //渲染页面
126 128
         } else {
127 129
           this.$Message.error(res.msg);

+ 190
- 2
src/views/schoolSection/userManage/userManage.vue View File

@@ -16,6 +16,7 @@
16 16
         <div v-for="item in schoolInfo.children" :key="item.id">
17 17
           <div
18 18
             :class="[
19
+              'class_item',
19 20
               curClass.id === item.id && curClass.type === item.type
20 21
                 ? 'active'
21 22
                 : ''
@@ -25,6 +26,10 @@
25 26
           >
26 27
             {{ item.name }}
27 28
           </div>
29
+          <span
30
+            @click="toOpenMenu(item, $event)"
31
+            class="ivu-icon iconfont icon-sandian"
32
+          ></span>
28 33
         </div>
29 34
       </div>
30 35
     </div>
@@ -138,6 +143,45 @@
138 143
         ></Page>
139 144
       </div>
140 145
     </div>
146
+    <!-- 更多菜单弹窗 -->
147
+    <div
148
+      class="more_menu"
149
+      ref="moreMenuRef"
150
+      @mousedown.stop
151
+      @contextmenu.stop.prevent
152
+      @mousewheel.stop
153
+    >
154
+      <div @click="toSelectMenuItem(1)" class="menu_group">编辑</div>
155
+      <div @click="toSelectMenuItem(2)" class="menu_group">删除</div>
156
+    </div>
157
+    <!-- 编辑班级 -->
158
+    <Modal
159
+      v-model="classInfo.show"
160
+      :mask-closable="false"
161
+      class="modal_tip"
162
+      title="编辑"
163
+    >
164
+      <Form
165
+        v-if="classInfo.show"
166
+        ref="classInfo"
167
+        :model="classInfo"
168
+        :rules="rules"
169
+        :label-width="110"
170
+      >
171
+        <FormItem label="班级名称" prop="classname">
172
+          <Input
173
+            v-model.trim="classInfo.classname"
174
+            placeholder="请输入班级名称"
175
+          ></Input>
176
+        </FormItem>
177
+      </Form>
178
+      <div slot="footer" style="text-align: right">
179
+        <Button @click="exitInfo.show = false">取消</Button>
180
+        <Button @click="saveclassInfo()" type="primary" class="primary_btn"
181
+          >保存</Button
182
+        >
183
+      </div>
184
+    </Modal>
141 185
     <!-- 已存在列表 -->
142 186
     <Modal
143 187
       v-model="exitInfo.show"
@@ -321,6 +365,8 @@
321 365
 
322 366
 <script>
323 367
 import {
368
+  class_delete,
369
+  class_edit,
324 370
   class_list,
325 371
   user_care,
326 372
   user_delete,
@@ -333,9 +379,26 @@ import {
333 379
 } from "@/api/school";
334 380
 import { user_add, user_edit } from "@/api/school";
335 381
 import { exportToExcel } from "@/utils/exportToExcel";
336
-import { generateRandomString, pwdCheck, reg} from "@/utils";
382
+import { generateRandomString, pwdCheck, reg } from "@/utils";
337 383
 export default {
338 384
   data() {
385
+    const classnameCheck = async (rule, value, callback) => {
386
+      if (value) {
387
+        let flag = this.schoolInfo.children.some((v) => {
388
+          return (
389
+            v.name === this.classInfo.classname &&
390
+            v.id != this.classInfo.classid
391
+          );
392
+        });
393
+        if (flag) {
394
+          return callback(new Error("班级名称已存在!"));
395
+        } else {
396
+          callback();
397
+        }
398
+      } else {
399
+        return callback(new Error("班级名称不能为空!"));
400
+      }
401
+    };
339 402
     // 重复密码验证
340 403
     const pwdAgainCheck = async (rule, value, callback) => {
341 404
       if (!reg.test(value)) {
@@ -417,6 +480,13 @@ export default {
417 480
         cardid: ""
418 481
       },
419 482
       rules: {
483
+        classname: [
484
+          {
485
+            required: true,
486
+            validator: classnameCheck,
487
+            trigger: "blur"
488
+          }
489
+        ],
420 490
         username: [
421 491
           {
422 492
             required: true,
@@ -508,6 +578,8 @@ export default {
508 578
           align: "center"
509 579
         }
510 580
       ],
581
+      classInfo: {},
582
+      selectedModel: {},
511 583
       schoolInfo: {
512 584
         children: [],
513 585
         name: ""
@@ -527,6 +599,91 @@ export default {
527 599
     this.searchList();
528 600
   },
529 601
   methods: {
602
+    saveclassInfo() {
603
+      this.$refs.classInfo.validate((valid) => {
604
+        if (valid) {
605
+          this.showLoading = true;
606
+          class_edit({
607
+            classid: this.classInfo.classid,
608
+            classname: this.classInfo.classname,
609
+            rversion: this.classInfo.rversion
610
+          }).then((res) => {
611
+            this.showLoading = false;
612
+            if (res.code === 0) {
613
+              if (this.classInfo.classid === this.curClass.id) {
614
+                this.curClass.name = this.classInfo.classname;
615
+              }
616
+              this.classInfo.show = false;
617
+              this.init();
618
+              this.$Message.success(res.msg);
619
+            } else {
620
+              this.$Message.error(res.msg);
621
+            }
622
+          });
623
+        }
624
+      });
625
+    },
626
+    toSelectMenuItem(type) {
627
+      this.removeMoreMenu();
628
+      //type 1编辑 2删除
629
+      if (type === 1) {
630
+        this.classInfo = {
631
+          show: true,
632
+          classid: this.selectedModel.id,
633
+          rversion: this.selectedModel.rversion,
634
+          classname: this.selectedModel.name
635
+        };
636
+      } else {
637
+        this.$Modal.confirm({
638
+          title: "提示",
639
+          content: "您确定删除【" + this.selectedModel.name + "】吗?",
640
+          onOk: () => {
641
+            class_delete({
642
+              classid: this.selectedModel.id,
643
+              rversion: this.selectedModel.rversion
644
+            }).then((res) => {
645
+              if (res.code === 0) {
646
+                this.init();
647
+                this.$Message.success(res.msg);
648
+              } else {
649
+                this.$Message.error(res.msg);
650
+              }
651
+            });
652
+          },
653
+          onCancel: () => {}
654
+        });
655
+      }
656
+    },
657
+    // 打开弹窗菜单
658
+    toOpenMenu(Item, event) {
659
+      this.selectClass(Item);
660
+      if (!this.$refs.moreMenuRef) {
661
+        return;
662
+      }
663
+      this.selectedModel = Item;
664
+      let _clientX = event.clientX;
665
+      let _clientY = event.clientY;
666
+      this.$refs.moreMenuRef.style.display = `block`;
667
+      this.$nextTick(() => {
668
+        let _bodyHeight = document.body.clientHeight;
669
+        let _domHeight = this.$refs.moreMenuRef.getBoundingClientRect().height;
670
+        this.$refs.moreMenuRef.style.left = `${_clientX - 105}px`;
671
+        if (_clientY + _domHeight > _bodyHeight) {
672
+          this.$refs.moreMenuRef.style.top = `${_bodyHeight - _domHeight}px`;
673
+        } else {
674
+          this.$refs.moreMenuRef.style.top = `${_clientY}px`;
675
+        }
676
+      });
677
+    },
678
+    // 隐藏弹窗菜单
679
+    removeMoreMenu() {
680
+      if (!this.$refs.moreMenuRef) {
681
+        return;
682
+      }
683
+      this.$refs.moreMenuRef.style.display = `none`;
684
+      this.$refs.moreMenuRef.style.left = `-9999px`;
685
+      this.$refs.moreMenuRef.style.top = `-9999px`;
686
+    },
530 687
     classChange() {
531 688
       if (this.schoolInfo.children.length === 0) {
532 689
         return;
@@ -767,7 +924,9 @@ export default {
767 924
         this.showLoading = false;
768 925
         if (res.code === 0) {
769 926
           this.schoolInfo = res.obj;
770
-          this.curClass = res.obj;
927
+          if (!this.curClass.id) {
928
+            this.curClass = res.obj;
929
+          }
771 930
         } else {
772 931
           this.$Message.error(res.msg);
773 932
         }
@@ -846,6 +1005,19 @@ export default {
846 1005
         height: 30px;
847 1006
         text-align: center;
848 1007
         cursor: pointer;
1008
+        position: relative;
1009
+        .icon-sandian {
1010
+          display: none;
1011
+        }
1012
+        &:hover {
1013
+          .icon-sandian {
1014
+            display: block;
1015
+            position: absolute;
1016
+            top: 4px;
1017
+            right: 6px;
1018
+            font-size: 24px;
1019
+          }
1020
+        }
849 1021
       }
850 1022
     }
851 1023
     .active {
@@ -945,4 +1117,20 @@ export default {
945 1117
     }
946 1118
   }
947 1119
 }
1120
+.more_menu {
1121
+  width: 100px;
1122
+  text-align: center;
1123
+  background: #ffffff;
1124
+  box-shadow: 0 8px 30px 0 #bcc9e380;
1125
+  border-radius: 10px;
1126
+  border: none;
1127
+  .menu_group {
1128
+    height: 35px;
1129
+    line-height: 35px;
1130
+    cursor: pointer;
1131
+    &:hover {
1132
+      background-color: #dbeeffcc;
1133
+    }
1134
+  }
1135
+}
948 1136
 </style>

Loading…
Cancel
Save