Browse Source

添加模版

gzb
guozhongbo 9 months ago
parent
commit
59cb502511

BIN
public/doc/student.xls View File


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

54
       <div class="content unicode" style="display: block;">
54
       <div class="content unicode" style="display: block;">
55
           <ul class="icon_lists dib-box">
55
           <ul class="icon_lists dib-box">
56
           
56
           
57
+            <li class="dib">
58
+              <span class="icon iconfont">&#xe703;</span>
59
+                <div class="name">关注-已关注</div>
60
+                <div class="code-name">&amp;#xe703;</div>
61
+              </li>
62
+          
57
             <li class="dib">
63
             <li class="dib">
58
               <span class="icon iconfont">&#xe6a2;</span>
64
               <span class="icon iconfont">&#xe6a2;</span>
59
                 <div class="name">钉-面型</div>
65
                 <div class="name">钉-面型</div>
198
 <pre><code class="language-css"
204
 <pre><code class="language-css"
199
 >@font-face {
205
 >@font-face {
200
   font-family: 'iconfont';
206
   font-family: 'iconfont';
201
-  src: url('iconfont.woff2?t=1711092475055') format('woff2'),
202
-       url('iconfont.woff?t=1711092475055') format('woff'),
203
-       url('iconfont.ttf?t=1711092475055') format('truetype');
207
+  src: url('iconfont.woff2?t=1712026774551') format('woff2'),
208
+       url('iconfont.woff?t=1712026774551') format('woff'),
209
+       url('iconfont.ttf?t=1712026774551') format('truetype');
204
 }
210
 }
205
 </code></pre>
211
 </code></pre>
206
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
212
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
226
       <div class="content font-class">
232
       <div class="content font-class">
227
         <ul class="icon_lists dib-box">
233
         <ul class="icon_lists dib-box">
228
           
234
           
235
+          <li class="dib">
236
+            <span class="icon iconfont icon-guanzhu-yiguanzhu"></span>
237
+            <div class="name">
238
+              关注-已关注
239
+            </div>
240
+            <div class="code-name">.icon-guanzhu-yiguanzhu
241
+            </div>
242
+          </li>
243
+          
229
           <li class="dib">
244
           <li class="dib">
230
             <span class="icon iconfont icon-ding-mianxing"></span>
245
             <span class="icon iconfont icon-ding-mianxing"></span>
231
             <div class="name">
246
             <div class="name">
442
       <div class="content symbol">
457
       <div class="content symbol">
443
           <ul class="icon_lists dib-box">
458
           <ul class="icon_lists dib-box">
444
           
459
           
460
+            <li class="dib">
461
+                <svg class="icon svg-icon" aria-hidden="true">
462
+                  <use xlink:href="#icon-guanzhu-yiguanzhu"></use>
463
+                </svg>
464
+                <div class="name">关注-已关注</div>
465
+                <div class="code-name">#icon-guanzhu-yiguanzhu</div>
466
+            </li>
467
+          
445
             <li class="dib">
468
             <li class="dib">
446
                 <svg class="icon svg-icon" aria-hidden="true">
469
                 <svg class="icon svg-icon" aria-hidden="true">
447
                   <use xlink:href="#icon-ding-mianxing"></use>
470
                   <use xlink:href="#icon-ding-mianxing"></use>

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

1
 @font-face {
1
 @font-face {
2
   font-family: "iconfont"; /* Project id 4468064 */
2
   font-family: "iconfont"; /* Project id 4468064 */
3
-  src: url('iconfont.woff2?t=1711092475055') format('woff2'),
4
-       url('iconfont.woff?t=1711092475055') format('woff'),
5
-       url('iconfont.ttf?t=1711092475055') format('truetype');
3
+  src: url('iconfont.woff2?t=1712026774551') format('woff2'),
4
+       url('iconfont.woff?t=1712026774551') format('woff'),
5
+       url('iconfont.ttf?t=1712026774551') format('truetype');
6
 }
6
 }
7
 
7
 
8
 .iconfont {
8
 .iconfont {
13
   -moz-osx-font-smoothing: grayscale;
13
   -moz-osx-font-smoothing: grayscale;
14
 }
14
 }
15
 
15
 
16
+.icon-guanzhu-yiguanzhu:before {
17
+  content: "\e703";
18
+}
19
+
16
 .icon-ding-mianxing:before {
20
 .icon-ding-mianxing:before {
17
   content: "\e6a2";
21
   content: "\e6a2";
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
   "css_prefix_text": "icon-",
5
   "css_prefix_text": "icon-",
6
   "description": "",
6
   "description": "",
7
   "glyphs": [
7
   "glyphs": [
8
+    {
9
+      "icon_id": "9974412",
10
+      "name": "关注-已关注",
11
+      "font_class": "guanzhu-yiguanzhu",
12
+      "unicode": "e703",
13
+      "unicode_decimal": 59139
14
+    },
8
     {
15
     {
9
       "icon_id": "24267510",
16
       "icon_id": "24267510",
10
       "name": "钉-面型",
17
       "name": "钉-面型",

BIN
public/iconfont/iconfont.ttf View File


BIN
public/iconfont/iconfont.woff View File


BIN
public/iconfont/iconfont.woff2 View File


+ 11
- 9
src/api/school.js View File

42
 /**
42
 /**
43
  * 3.2.0.1用户--验证码登录
43
  * 3.2.0.1用户--验证码登录
44
  */
44
  */
45
-export const ulogin_login_code = (data) => setRequest("ulogin/login_code", data);
45
+export const ulogin_login_code = (data) =>
46
+  setRequest("ulogin/login_code", data);
46
 /**
47
 /**
47
  * 3.2.0.2用户--校验登录状态
48
  * 3.2.0.2用户--校验登录状态
48
  */
49
  */
49
-export const ulogin_check_login = (data) => setRequest("ulogin/check_login", data);
50
+export const ulogin_check_login = (data) =>
51
+  setRequest("ulogin/check_login", data);
50
 /**
52
 /**
51
  * 3.2.0.3用户--退出登录
53
  * 3.2.0.3用户--退出登录
52
  */
54
  */
78
 /**
80
 /**
79
  * 3.2.3.2用户--启用
81
  * 3.2.3.2用户--启用
80
  */
82
  */
81
-export const user_enable= (data) => setRequest("user/enable", data);
83
+export const user_enable = (data) => setRequest("user/enable", data);
82
 /**
84
 /**
83
  * 3.2.3.2用户--启用
85
  * 3.2.3.2用户--启用
84
  */
86
  */
85
-export const user_disabled= (data) => setRequest("user/disabled", data);
87
+export const user_disabled = (data) => setRequest("user/disabled", data);
86
 /**
88
 /**
87
  * 3.2.3.4用户--关注
89
  * 3.2.3.4用户--关注
88
  */
90
  */
89
-export const user_care= (data) => setRequest("user/care", data);
91
+export const user_care = (data) => setRequest("user/care", data);
90
 /**
92
 /**
91
  * 3.2.3.5用户--取消关注
93
  * 3.2.3.5用户--取消关注
92
  */
94
  */
93
-export const user_un_care= (data) => setRequest("user/un_care", data);
95
+export const user_un_care = (data) => setRequest("user/un_care", data);
94
 /**
96
 /**
95
  * 3.2.3.6用户--管控
97
  * 3.2.3.6用户--管控
96
  */
98
  */
97
-export const user_control= (data) => setRequest("user/control", data);
99
+export const user_control = (data) => setRequest("user/control", data);
98
 /**
100
 /**
99
  * 3.2.3.7用户--取消管控
101
  * 3.2.3.7用户--取消管控
100
  */
102
  */
101
-export const user_un_control= (data) => setRequest("user/un_control", data);
103
+export const user_un_control = (data) => setRequest("user/un_control", data);
102
 /**
104
 /**
103
  * 3.2.4用户--删除
105
  * 3.2.4用户--删除
104
  */
106
  */
106
 /**
108
 /**
107
  * 3.2.5用户--导入
109
  * 3.2.5用户--导入
108
  */
110
  */
109
-export const user_import = (data) => setRequest("user/import", data);
111
+export const user_import = (data) => setRequest("user/import", data);

+ 154
- 23
src/views/schoolSection/userManage/userManage.vue View File

62
           />
62
           />
63
         </div>
63
         </div>
64
         <div>
64
         <div>
65
-          <Button type="primary" class="primary_btn" @click="userExport()"
65
+          <Button type="primary" class="primary_btn" @click="userImport()"
66
             >用户导入</Button
66
             >用户导入</Button
67
           >
67
           >
68
           <Button
68
           <Button
69
             style="margin: 0 10px"
69
             style="margin: 0 10px"
70
             type="primary"
70
             type="primary"
71
             class="primary_btn"
71
             class="primary_btn"
72
-            @click="toAdd()"
72
+            @click="userExport()"
73
             >用户导出</Button
73
             >用户导出</Button
74
           >
74
           >
75
           <Button type="primary" class="primary_btn" @click="toAdd()"
75
           <Button type="primary" class="primary_btn" @click="toAdd()"
79
       </div>
79
       </div>
80
       <div class="table_wrap">
80
       <div class="table_wrap">
81
         <Table :columns="columns" :data="searchForm.list">
81
         <Table :columns="columns" :data="searchForm.list">
82
+          <template slot-scope="{ row }" slot="loginname">
83
+           <span v-if="row.care === 1" style="color: #FCC138" class="ivu-icon iconfont icon-guanzhu-yiguanzhu"></span> {{row.loginname}}
84
+          </template>
82
           <template slot-scope="{ row }" slot="enabled">
85
           <template slot-scope="{ row }" slot="enabled">
83
             <i-switch
86
             <i-switch
84
               size="large"
87
               size="large"
113
         ></Page>
116
         ></Page>
114
       </div>
117
       </div>
115
     </div>
118
     </div>
119
+    <!-- 导入 -->
120
+    <Modal
121
+        :mask-closable="false"
122
+        v-model="importInfo.show"
123
+        class="modal_tip"
124
+        title="导入"
125
+    >
126
+      <Upload
127
+          v-if="importInfo.show"
128
+          type="drag"
129
+          action
130
+          accept=".xls,.xlsx"
131
+          :before-upload="handleUpload"
132
+      >
133
+        <div style="padding: 30px 0; background: #f8f8f9">
134
+          <Button
135
+              type="primary"
136
+              class="primary_btn"
137
+              style="font-size: 16px"
138
+          >
139
+            <Icon type="ios-cloud-upload-outline" size="18"></Icon>上传excel
140
+          </Button>
141
+          <div style="margin-top: 10px; color: #999">支持上传xlsx/xls文件</div>
142
+        </div>
143
+      </Upload>
144
+      <div v-if="importInfo.file" class="files_list">
145
+        {{ importInfo.file.name }}
146
+      </div>
147
+      <div class="import_tip">
148
+        导入数据需按照模板填写信息,
149
+        <span class="theme_color" @click="download()">下载表格模板</span>
150
+      </div>
151
+      <div slot="footer">
152
+        <Button @click="importInfo.show = false">取消</Button>
153
+        <Button @click="ok_import"    class="primary_btn" :loading="wait_flag" type="primary"
154
+        >保存</Button
155
+        >
156
+      </div>
157
+    </Modal>
116
     <!-- 新建 -->
158
     <!-- 新建 -->
117
     <Modal
159
     <Modal
118
       class="modal1"
160
       class="modal1"
216
 <script>
258
 <script>
217
 import {
259
 import {
218
   class_list,
260
   class_list,
261
+  user_care,
262
+  user_delete,
219
   user_disabled,
263
   user_disabled,
220
   user_enable,
264
   user_enable,
221
   user_list
265
   user_list
222
 } from "@/api/school";
266
 } from "@/api/school";
223
-import {user_add, user_edit} from "@/api/school";
224
-import {generateRandomString} from "@/utils";
267
+import { user_add, user_edit } from "@/api/school";
225
 
268
 
226
 export default {
269
 export default {
227
   data() {
270
   data() {
228
     const reg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,32}$/;
271
     const reg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,32}$/;
229
     // 密码验证
272
     // 密码验证
230
     const pwdCheck = (rule, value, callback) => {
273
     const pwdCheck = (rule, value, callback) => {
231
-      console.log(value)
232
-      if (!reg.test(this.addInfo.loginpwd)) {
274
+      if (!reg.test(value)) {
233
         return callback(new Error("密码格式不正确!"));
275
         return callback(new Error("密码格式不正确!"));
234
       }
276
       }
235
-      console.log(this.addInfo.loginpwd)
277
+      callback();
236
     };
278
     };
237
     // 重复密码验证
279
     // 重复密码验证
238
     const pwdAgainCheck = async (rule, value, callback) => {
280
     const pwdAgainCheck = async (rule, value, callback) => {
239
-      if (!reg.test(this.addInfo.loginpwd1)) {
281
+      if (!value) {
240
         return callback(new Error("确认密码不能为空!"));
282
         return callback(new Error("确认密码不能为空!"));
241
       }
283
       }
242
-      if (!reg.test(this.addInfo.loginpwd1)) {
284
+      if (!reg.test(value)) {
243
         return callback(new Error("密码格式不正确!"));
285
         return callback(new Error("密码格式不正确!"));
244
       }
286
       }
245
-      if (this.addInfo.loginpwd != this.addInfo.loginpwd1) {
287
+      if (this.addInfo.loginpwd != value) {
246
         return callback(new Error("两次输入密码不一致!"));
288
         return callback(new Error("两次输入密码不一致!"));
247
       }
289
       }
290
+      callback();
248
     };
291
     };
249
     return {
292
     return {
250
       userInfo: {},
293
       userInfo: {},
294
+      importInfo: {
295
+        show: false,
296
+        file: null
297
+      },
298
+      wait_flag: false,
251
       showLoading: false,
299
       showLoading: false,
252
       care_list: [
300
       care_list: [
253
         { id: 0, title: "请选择关注状态" },
301
         { id: 0, title: "请选择关注状态" },
338
         },
386
         },
339
         {
387
         {
340
           title: "登录名",
388
           title: "登录名",
341
-          key: "loginname",
389
+          slot: "loginname",
342
           align: "center"
390
           align: "center"
343
         },
391
         },
344
         {
392
         {
388
   },
436
   },
389
   methods: {
437
   methods: {
390
     classChange() {
438
     classChange() {
391
-      if(this.schoolInfo.children.length === 0){
439
+      if (this.schoolInfo.children.length === 0) {
392
         return;
440
         return;
393
       }
441
       }
394
-      let classInfo = this.schoolInfo.children.filter(v=>v.id === this.addInfo.classid)[0];
442
+      let classInfo = this.schoolInfo.children.filter(
443
+        (v) => v.id === this.addInfo.classid
444
+      )[0];
395
       this.addInfo.classname = classInfo.name;
445
       this.addInfo.classname = classInfo.name;
396
     },
446
     },
397
-    userImport() {},
447
+    download(){
448
+      //下载模版
449
+      let url = "../../../../doc/student.xls";
450
+      console.log(url)
451
+      const a = document.createElement("a"); // 创建a标签
452
+      a.setAttribute("download", "学生信息模版"); // download属性
453
+      a.setAttribute("href", url); // href链接
454
+      a.click(); // 自执行点击事件
455
+    },
456
+    ok_import(){
457
+      //确定导入
458
+    },
459
+    //导入
460
+    userImport() {
461
+      this.importInfo = {
462
+        show: true,
463
+            file: null
464
+      }
465
+    },
466
+    // 上传文件
467
+    handleUpload(file) {
468
+      let str = file.name.split(".");
469
+      let suffix = str[str.length - 1];
470
+      suffix = suffix.toLowerCase();
471
+      if (suffix === "xls" || suffix === "xlsx") {
472
+        this.import_obj.file = file;
473
+        this.import_img = true;
474
+        this.form_data = new FormData();
475
+        this.form_data.append("file", file);
476
+        this.form_data.append("schoolid", this.userInfo.schoolid);
477
+        this.form_data.append("createid", this.userInfo.userid);
478
+        this.form_data.append("classid", this.form_list.classid);
479
+        this.form_data.append("groupid", 1);
480
+      } else {
481
+        this.import_obj.file = undefined;
482
+        this.$Message.error("请上传excel文件");
483
+      }
484
+      return false;
485
+    },
398
     userExport() {},
486
     userExport() {},
399
     toAdd() {
487
     toAdd() {
400
       this.addInfo = {
488
       this.addInfo = {
418
       console.log(this.addInfo);
506
       console.log(this.addInfo);
419
       this.$refs.addForm.validate((valid) => {
507
       this.$refs.addForm.validate((valid) => {
420
         if (valid) {
508
         if (valid) {
421
-          console.log(this.addInfo.classid)
422
-           if(!this.addInfo.classid){
423
-             this.$Message.error("请选择班级!")
424
-             return
425
-           }
509
+          console.log(this.addInfo.classid);
510
+          if (this.addInfo.userphone) {
511
+            var filter = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
512
+            if (!filter.test(this.addInfo.userphone)) {
513
+              this.$Message.error("手机号码格式不正确!");
514
+              return;
515
+            }
516
+          }
517
+          if (!this.addInfo.classid) {
518
+            this.$Message.error("请选择班级!");
519
+            return;
520
+          }
426
           let form = {
521
           let form = {
427
             username: this.addInfo.username,
522
             username: this.addInfo.username,
428
             loginname: this.addInfo.loginname,
523
             loginname: this.addInfo.loginname,
429
             loginpwd: this.addInfo.loginpwd,
524
             loginpwd: this.addInfo.loginpwd,
430
             classid: this.addInfo.classid,
525
             classid: this.addInfo.classid,
431
             classname: this.addInfo.classname,
526
             classname: this.addInfo.classname,
432
-            schoolid: this.addInfo.schoolid,
433
-            regionid: this.addInfo.regionid,
527
+            schoolid: this.addInfo.schoolid || 1,
528
+            regionid: this.userInfo.regionid,
434
             enabled: this.addInfo.enabled,
529
             enabled: this.addInfo.enabled,
435
             studentno: this.addInfo.studentno,
530
             studentno: this.addInfo.studentno,
436
             userphone: this.addInfo.userphone,
531
             userphone: this.addInfo.userphone,
456
         }
551
         }
457
       });
552
       });
458
     },
553
     },
459
-    toCare(row) {},
460
-    toDel(row) {},
554
+    toEdit(row) {},
555
+    toCare(row) {
556
+      user_care({ userid: row.userid, rversion: row.rversion }).then((res) => {
557
+        if (res.code === 0) {
558
+          this.searchList();
559
+          this.$Message.success(res.msg);
560
+        } else {
561
+          this.$Message.error(res.msg);
562
+        }
563
+      });
564
+    },
565
+    toDel(row) {
566
+      user_delete({ userid: row.userid, rversion: row.rversion }).then(
567
+        (res) => {
568
+          if (res.code === 0) {
569
+            this.searchList();
570
+            this.$Message.success(res.msg);
571
+          } else {
572
+            this.$Message.error(res.msg);
573
+          }
574
+        }
575
+      );
576
+    },
461
     enabledChange(row) {
577
     enabledChange(row) {
462
       let api = row.enabled === 1 ? user_enable : user_disabled;
578
       let api = row.enabled === 1 ? user_enable : user_disabled;
463
       api({
579
       api({
617
     }
733
     }
618
   }
734
   }
619
 }
735
 }
736
+.modal_tip{
737
+  .files_list{
738
+    height: 30px;
739
+    line-height: 30px;
740
+  }
741
+  .import_tip{
742
+    height: 30px;
743
+    line-height: 30px;
744
+    text-align: center;
745
+    .theme_color{
746
+      color: #339dff;
747
+      cursor: pointer;
748
+    }
749
+  }
750
+}
620
 </style>
751
 </style>

Loading…
Cancel
Save