Browse Source

科室环境模块

xiaoming_global 5 years ago
parent
commit
6e94c2ab86

+ 62 - 0
src/api/site/site.js View File

1
 import request from '@/utils/request'
1
 import request from '@/utils/request'
2
 
2
 
3
+export function AddRotationChart(data){
4
+    console.log("新增轮播图",data);
5
+    return request({
6
+        url:"/api/site/addrotationchart",
7
+        method:"Post",
8
+        data:data,
9
+    })
10
+}
3
 
11
 
4
 export function saveHispital(data){
12
 export function saveHispital(data){
5
     console.log("添加医院",data);
13
     console.log("添加医院",data);
35
        method:"Post",
43
        method:"Post",
36
        data:data,
44
        data:data,
37
    })
45
    })
46
+}
47
+
48
+export function AddOfficeEnvironment(data){
49
+   console.log("新增科室环境",data);
50
+   return request({
51
+       url:"/api/site/keenvironment",
52
+       method:"Post",
53
+       data:data,
54
+   })
55
+}
56
+
57
+export function GetRationImages(params){
58
+    console.log("获取轮播图片",params)
59
+    return request({
60
+        url:"/api/site/getrationimages",
61
+        method:'Get',
62
+        params:params,
63
+    })
64
+}
65
+
66
+export function GetHospitalInfo(params){
67
+   console.log("获取医院信息",params)
68
+   return request({
69
+       url:"/api/site/gethospitalinfo",
70
+       method:'Get',
71
+       params:params,
72
+   })
73
+}
74
+
75
+export function GetOfficeInfo(params){
76
+   console.log("获取科室信息",params)
77
+   return request({
78
+       url:"/api/site/getofficeinfo",
79
+       method:'Get',
80
+       params:params,
81
+   })
82
+}
83
+
84
+export function GetDoctorInfo(params){
85
+    console.log("获取名医介绍",params)
86
+    return request({
87
+        url:"/api/site/getdoctorinfo",
88
+        method:'Get',
89
+        params:params,
90
+    })
91
+}
92
+
93
+export function GetOffEnvironment(params){
94
+   console.log("获取科室环境",params)
95
+   return request({
96
+       url:"/api/site/getOffEnvironment",
97
+       method:'Get',
98
+       params:params,
99
+   })
38
 }
100
 }

+ 2 - 1
src/main.js View File

4
 
4
 
5
 import Element from 'element-ui'
5
 import Element from 'element-ui'
6
 import 'element-ui/lib/theme-chalk/index.css'
6
 import 'element-ui/lib/theme-chalk/index.css'
7
-
7
+import '@/utils/directives.js'
8
 import '@/styles/index.scss' // global css
8
 import '@/styles/index.scss' // global css
9
 import '@/styles/variables.scss' // global css
9
 import '@/styles/variables.scss' // global css
10
 import '@/assets/iconfont/iconfont.css'
10
 import '@/assets/iconfont/iconfont.css'
31
 import vuescroll from 'vuescroll'
31
 import vuescroll from 'vuescroll'
32
 import { read } from 'fs';
32
 import { read } from 'fs';
33
 import 'vuescroll/dist/vuescroll.css';
33
 import 'vuescroll/dist/vuescroll.css';
34
+import 'swiper/dist/css/swiper.min.css'
34
 Vue.use(vuescroll)
35
 Vue.use(vuescroll)
35
 Vue.use(Element, {
36
 Vue.use(Element, {
36
   size: 'medium', // set element-ui default size
37
   size: 'medium', // set element-ui default size

+ 4 - 1
src/scrm_pages/article/articleList.vue View File

135
         checked: false,
135
         checked: false,
136
         selectAll:false,
136
         selectAll:false,
137
         selectReply:[],
137
         selectReply:[],
138
+       startPointX: 0,
139
+       changePointX: 0,
140
+       showIndex: 0,
138
       }
141
       }
139
     },
142
     },
140
     methods:{
143
     methods:{
300
                   })
303
                   })
301
                });
304
                });
302
           })
305
           })
303
-        }
306
+        },
304
     },
307
     },
305
     created(){
308
     created(){
306
       this.GetAllArticles();
309
       this.GetAllArticles();

+ 203 - 115
src/scrm_pages/site/components/new-feature.vue View File

60
     :visible.sync="dialogVisible"
60
     :visible.sync="dialogVisible"
61
     width="550px"
61
     width="550px"
62
     :before-close="handleClose">
62
     :before-close="handleClose">
63
-    <el-form ref="rotationform" :model="rotationform" label-width="90px" rules="rules" >
64
-      <el-form-item label="模块标题: " required prop="title">
63
+    <el-form ref="rotationform" :model="rotationform" label-width="90px" :rules="rules" >
64
+      <el-form-item label="模块标题:" required prop="title">
65
         <el-input v-model="rotationform.title"></el-input>
65
         <el-input v-model="rotationform.title"></el-input>
66
       </el-form-item>
66
       </el-form-item>
67
-      <el-form-item label="排序值: " required prop="sort">
67
+      <el-form-item label="排序值:" required prop="sort">
68
         <el-input v-model="rotationform.sort"></el-input>
68
         <el-input v-model="rotationform.sort"></el-input>
69
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
69
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
70
       </el-form-item>
70
       </el-form-item>
71
-      <el-form-item label="添加图片: " v-model="rotationform.rotationImages" required prop="rotationImages">
72
-        <el-upload
73
-          limit="2"
71
+      <el-form-item label="添加图片:" v-model="rotationform.rotationImages" required prop="rotationImages">
72
+         <el-upload
74
           :data="rotationData"
73
           :data="rotationData"
75
           action="https://upload.qiniup.com"
74
           action="https://upload.qiniup.com"
76
           list-type="picture-card"
75
           list-type="picture-card"
77
-          :on-success="RotationchartSuccess"
78
-          :before-upload="beforeRotationUpload"
79
-          :file-list="filelist">
80
-          <i class="el-icon-plus"></i>
81
-        </el-upload>   
76
+         :on-success="RotationchartSuccess"
77
+         :before-upload="beforeRotationUpload"
78
+         >
79
+        <i slot="default" class="el-icon-plus"></i>
80
+        <div slot="file" slot-scope="{file}">
81
+          <img
82
+           class="el-upload-list__item-thumbnail"
83
+           :src="file.url"
84
+          >
85
+        <span class="el-upload-list__item-actions"> 
86
+         <span
87
+           v-if="!disabled"
88
+           class="el-upload-list__item-delete"
89
+         >
90
+         <i class="el-icon-edit-outline" @click="rotationEditImages()"></i>
91
+          </span> 
92
+         <span
93
+           v-if="!disabled"
94
+           class="el-upload-list__item-delete"
95
+         >
96
+          <i class="el-icon-delete"></i>
97
+          </span> 
98
+         </span> 
99
+        </div> 
100
+     </el-upload>
82
       </el-form-item>
101
       </el-form-item>
83
        <span class="uploadfont">图片已上传0张,最多上传9张图片</span>
102
        <span class="uploadfont">图片已上传0张,最多上传9张图片</span>
84
     </el-form>
103
     </el-form>
92
   <el-dialog
111
   <el-dialog
93
     title="新增医院介绍"
112
     title="新增医院介绍"
94
     :visible.sync="two"
113
     :visible.sync="two"
95
-    width="550px"
96
-    :before-close="handleClose">
114
+    width="50%"
115
+    :before-close="handleClose"
116
+     :modal='false'
117
+     v-dialogDrag
118
+     :close-on-click-modal="false">
97
     <el-form ref="hispitalform" :model="hispitalform" label-width="90px" :rules="rules">
119
     <el-form ref="hispitalform" :model="hispitalform" label-width="90px" :rules="rules">
98
       <el-form-item label="模块标题:" required prop="title">
120
       <el-form-item label="模块标题:" required prop="title">
99
         <el-input v-model="hispitalform.title"></el-input>
121
         <el-input v-model="hispitalform.title"></el-input>
103
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
125
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
104
       </el-form-item>
126
       </el-form-item>
105
       <el-form-item label="医院介绍:" required prop="introduction">
127
       <el-form-item label="医院介绍:" required prop="introduction">
106
-        <el-input
107
-          type="textarea"
108
-          :rows="6"
109
-          placeholder="请输入内容"
110
-          v-model="hispitalform.introduction">
111
-        </el-input>
128
+         <keep-alive v-show="editorshow">
129
+            <neditor ref="neditor"
130
+              id="editor"
131
+              v-bind:r_content="hispitalform.introduction">
132
+            </neditor>
133
+        </keep-alive>
112
       </el-form-item>
134
       </el-form-item>
113
     </el-form>
135
     </el-form>
114
     <span slot="footer" class="dialog-footer">
136
     <span slot="footer" class="dialog-footer">
121
   <el-dialog
143
   <el-dialog
122
     title="新增科室介绍"
144
     title="新增科室介绍"
123
     :visible.sync="three"
145
     :visible.sync="three"
124
-    width="550px"
146
+    width="50%"
125
     :before-close="handleClose">
147
     :before-close="handleClose">
126
     <el-form ref="administform" :model="administform" label-width="90px" :rules="rules">
148
     <el-form ref="administform" :model="administform" label-width="90px" :rules="rules">
127
       <el-form-item label="模块标题:" required prop="title">
149
       <el-form-item label="模块标题:" required prop="title">
132
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
154
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
133
       </el-form-item>
155
       </el-form-item>
134
       <el-form-item label="科室介绍:" required prop="introduction">
156
       <el-form-item label="科室介绍:" required prop="introduction">
135
-        <el-input
136
-          type="textarea"
137
-          :rows="6"
138
-          placeholder="请输入内容"
139
-          v-model="administform.introduction">
140
-        </el-input>
157
+         <keep-alive>
158
+            <neditor ref="neditor"
159
+              id="editor2"
160
+              v-bind:r_content="administform.introduction">
161
+            </neditor>
162
+        </keep-alive>
141
       </el-form-item>
163
       </el-form-item>
142
     </el-form>
164
     </el-form>
143
     <span slot="footer" class="dialog-footer">
165
     <span slot="footer" class="dialog-footer">
202
     :visible.sync="five"
224
     :visible.sync="five"
203
     width="550px"
225
     width="550px"
204
     :before-close="handleClose">
226
     :before-close="handleClose">
205
-    <el-form ref="keform" :model="keform" label-width="110px" rules="rules">
227
+    <el-form ref="keform" :model="keform" label-width="110px" :rules="rules">
206
       <el-form-item label="模块标题: " required prop="title">
228
       <el-form-item label="模块标题: " required prop="title">
207
         <el-input v-model="keform.title"></el-input>
229
         <el-input v-model="keform.title"></el-input>
208
       </el-form-item>
230
       </el-form-item>
210
         <el-input v-model="keform.sort"></el-input>
232
         <el-input v-model="keform.sort"></el-input>
211
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
233
         <p class="tips">请输入1-99的整数,数值越小,模块排序越靠前</p>
212
       </el-form-item>
234
       </el-form-item>
213
-      <el-form-item label="新增科室环境: " required prop="keimages">
214
-        <div class="flex-img">
215
-          <div class="el-upload-list el-upload-list--picture-card" v-show="keshow">            
216
-            <div class="el-upload-list__item is-success">              
217
-                 <img class="flex-img__image" :src="keform.images">              
218
-                <label class="el-upload-list__item-status-label">
219
-                    <i class="el-icon-upload-success el-icon-check"></i>
220
-                </label>
221
-                <span class="el-upload-list__item-actions">
222
-                    <span class="el-upload-list__item-delete">
223
-                        <i class="el-icon-edit-outline" ></i>
224
-                        <i class="el-icon-delete"></i>
225
-                    </span>
226
-                </span>
227
-            </div>   
228
-        </div>   
229
-          <el-upload
230
-           :data="keData"
231
-            action="https://upload.qiniup.com"
232
-            list-type="picture-card"
233
-            :on-success="handleSuccess"
234
-            :before-upload="beforehandleUpload"
235
-            v-show="!keshow">
236
-            <i class="el-icon-plus"></i>
237
-        </el-upload>
238
-        </div>
239
-      </el-form-item>
235
+      <el-form-item label="新增科室环境:" required prop="keImages" v-model="keform.keImages">
236
+        <el-upload
237
+          :data="keData"
238
+          action="https://upload.qiniup.com"
239
+          list-type="picture-card"
240
+         :on-success="imageKeSuccess"
241
+         :before-upload="beforekeUpload"
242
+         >
243
+        <i slot="default" class="el-icon-plus"></i>
244
+        <div slot="file" slot-scope="{file}">
245
+          <img
246
+           class="el-upload-list__item-thumbnail"
247
+           :src="file.url"
248
+          >
249
+        <span class="el-upload-list__item-actions"> 
250
+         <span
251
+           v-if="!disabled"
252
+           class="el-upload-list__item-delete"
253
+         >
254
+         <i class="el-icon-edit-outline"></i>
255
+          </span> 
256
+         <span
257
+           v-if="!disabled"
258
+           class="el-upload-list__item-delete"
259
+         >
260
+          <i class="el-icon-delete"></i>
261
+          </span> 
262
+         </span> 
263
+        </div> 
264
+     </el-upload>
265
+  </el-form-item>
240
     </el-form>
266
     </el-form>
241
     <span slot="footer" class="dialog-footer">
267
     <span slot="footer" class="dialog-footer">
242
       <el-button @click="five = false">取 消</el-button>
268
       <el-button @click="five = false">取 消</el-button>
243
-      <el-button type="primary" @click="five = false">确 定</el-button>
269
+      <el-button type="primary" @click="AddOfficeEnvironment('keform')">确 定</el-button>
244
     </span>
270
     </span>
245
   </el-dialog>
271
   </el-dialog>
246
   <!-- 新增文章列表 -->
272
   <!-- 新增文章列表 -->
318
         <el-upload
344
         <el-upload
319
           action="https://jsonplaceholder.typicode.com/posts/"
345
           action="https://jsonplaceholder.typicode.com/posts/"
320
           list-type="picture-card"
346
           list-type="picture-card"
321
-          :on-preview="handlePictureCardPreview"
322
           :on-remove="handleRemove"
347
           :on-remove="handleRemove"
323
           >
348
           >
324
           <i class="el-icon-plus"></i>
349
           <i class="el-icon-plus"></i>
382
       <el-button type="primary" @click="AddDoctorInfo('eidtDoctorform')">确 定</el-button>
407
       <el-button type="primary" @click="AddDoctorInfo('eidtDoctorform')">确 定</el-button>
383
       </span>
408
       </span>
384
    </el-dialog>
409
    </el-dialog>
410
+
411
+   <!-- 编辑图片 -->
412
+    <el-dialog
413
+       title="提示"
414
+       :visible.sync="dialogRotationVisible"
415
+        width="30%"
416
+        :before-close="handleClose"
417
+        center>
418
+        <div class="eidtRotationimages">
419
+          <img src="static/images/a.jpg" style="width:260px;height:200px">
420
+        </div>
421
+        <el-form label-width="90px" class="clearfix">
422
+           <el-form-item  label="图片描述:">
423
+              <el-input></el-input>
424
+           </el-form-item>
425
+           <el-form-item label="图片链接:">
426
+              <el-radio-group v-model="radio">
427
+                <el-radio :label="3">无</el-radio>
428
+                <el-radio :label="6">自定义</el-radio>
429
+              </el-radio-group>
430
+           </el-form-item>
431
+           <el-form-item label="链接地址:">
432
+               <el-input style="width:320px"></el-input>
433
+               <el-button  type="primary">链接地址</el-button>
434
+           </el-form-item>
435
+        </el-form>
436
+        <span slot="footer" class="dialog-footer">
437
+       <el-button @click="dialogRotationVisible = false">取 消</el-button>
438
+       <el-button type="primary" @click="dialogRotationVisible = false">确 定</el-button>
439
+      </span>
440
+   </el-dialog>
385
 </div>
441
 </div>
386
 </template>
442
 </template>
387
 
443
 
388
 <script>
444
 <script>
389
-   import { saveHispital,addOffices,AddDoctor,AddDoctorInfo } from '@/api/site/site'  
445
+   import { AddRotationChart, saveHispital,addOffices,AddDoctor,AddDoctorInfo,AddOfficeEnvironment } from '@/api/site/site'  
390
    import { getToken } from '@/api/qiniu'
446
    import { getToken } from '@/api/qiniu'
391
    import { getFileExtension} from '@/utils/tools'
447
    import { getFileExtension} from '@/utils/tools'
392
    import { isIP } from 'net';
448
    import { isIP } from 'net';
449
+   import { quillEditor } from 'vue-quill-editor'
450
+   import Neditor from '@/components/Neditor'
451
+   import 'quill/dist/quill.core.css'
452
+   import 'quill/dist/quill.snow.css'
453
+   import 'quill/dist/quill.bubble.css'
393
 export default {
454
 export default {
394
   name: "newfeature",
455
   name: "newfeature",
456
+  components:{
457
+     Neditor,
458
+   },
395
   props: ['image', 'clearList'],
459
   props: ['image', 'clearList'],
396
   data() {
460
   data() {
397
     return {
461
     return {
398
       new1: require("../../../assets/preview/new-1.png"),
462
       new1: require("../../../assets/preview/new-1.png"),
399
       dialogVisible: false,
463
       dialogVisible: false,
464
+      dialogRotationVisible: false,
400
       two: false,
465
       two: false,
401
       three: false,
466
       three: false,
402
       four: false,
467
       four: false,
413
       keData: { token: '' ,key: ''},
478
       keData: { token: '' ,key: ''},
414
       file: this.image ? this.image : '',
479
       file: this.image ? this.image : '',
415
       hideShow:false,
480
       hideShow:false,
416
-      keshow:false,
417
       show:false,
481
       show:false,
418
-      keShow:false,
419
       centerDialogVisible:false,
482
       centerDialogVisible:false,
420
       filelist:[],
483
       filelist:[],
484
+      radio:3,
421
       form: {
485
       form: {
422
         name: "",
486
         name: "",
423
         sort:"", 
487
         sort:"", 
454
         title:"",
518
         title:"",
455
         sort:"",
519
         sort:"",
456
         keImages:[],
520
         keImages:[],
457
-        images:"",
458
       },
521
       },
522
+
459
        rules: {
523
        rules: {
460
          title: [{required: true, message: "请填写模块标题",},],
524
          title: [{required: true, message: "请填写模块标题",},],
461
          sort: [{required: true,message:"请填写排序值"}],
525
          sort: [{required: true,message:"请填写排序值"}],
464
          docname: [{required:true,message:"请填写医生姓名"}],
528
          docname: [{required:true,message:"请填写医生姓名"}],
465
          docHead: [{required: true,message:"请填写医生头像"}],
529
          docHead: [{required: true,message:"请填写医生头像"}],
466
          docpositional:[{required:true,message:"请填写医生职位"}],
530
          docpositional:[{required:true,message:"请填写医生职位"}],
467
-         docintroduction:[{required:true,message:"请填写医生简介"}]
531
+         docintroduction:[{required:true,message:"请填写医生简介"}],
532
+         images:[{required:true,message:"请填写新增科室环境"}],
533
+         rotationImages:[{required:true,message:"请填写添加图片"}],
534
+         keimages:[{required:true,message:"请填写新增科室环境"}]
468
       },
535
       },
469
     };
536
     };
470
   },
537
   },
471
   // 医院介绍模块
538
   // 医院介绍模块
472
-  methods:{    
539
+  methods:{   
540
+     //轮播图
541
+     rotationEditImages(){
542
+        this.dialogRotationVisible = true;
543
+     },
544
+
473
       handleRemove(file) {
545
       handleRemove(file) {
474
         console.log(file);
546
         console.log(file);
475
       },
547
       },
476
-      handlePictureCardPreview(file,res) {
477
-        //  this.dialogImageUrl = this.qiniuDomain + res.url;   
478
-        //  this.dialogVisible = true;
479
-      },
480
-      handleDownload(file) {
481
-        console.log(file);
482
-      },
483
-      handleClose(done){
484
-         this.$confirm('确认关闭?').then(_ =>{
485
-           done();
486
-         })
487
-         .catch(_ =>{});
488
-      }, 
489
-
490
-      handleSuccess(res,file){
491
-         this.keform.keImages.push(this.qiniuDomain + res.url);
492
-         this.keform.images = this.qiniuDomain + res.url;
493
-         this.keshow = true;
494
-      },
495
-      beforehandleUpload(file){
496
-        const isJPG = file.type === 'image/jpeg';
497
-        const isLt2M = file.size / 1024 / 1024 < 2;
498
-        if (!isJPG) {
499
-          this.$message.error('上传头像图片只能是 JPG 格式!');
500
-         }
501
-        if (!isLt2M) {
502
-          this.$message.error('上传头像图片大小不能超过 2MB!');
503
-        }
504
-           var date = new Date()
505
-            var ext = getFileExtension(file.name)
506
-            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
507
-            this.uploading = true;
508
-            this.loadingText = '封面图片上传中'
509
-
510
-            const _self = this
511
-            return new Promise((resolve, reject) => {
512
-                getToken().then(response => {
513
-                    const tokentree = response.data.data.uptoken
514
-                    console.log("科室token是什么?",tokentree)
515
-                    _self._data.keData.token = tokentree;
516
-                    _self._data.keData.key = key;
517
-                    resolve(true)
518
-                }).catch(err => {
519
-                    reject(false)
520
-                    this.uploading = false;
521
-                })
522
-            })
523
-    
524
-      },
525
-      
526
       imageUploadSuccess(res,file) {
548
       imageUploadSuccess(res,file) {
527
         this.doctorform.image = this.qiniuDomain + res.url;  
549
         this.doctorform.image = this.qiniuDomain + res.url;  
528
         this.hideShow = true;
550
         this.hideShow = true;
640
       },
662
       },
641
 
663
 
642
       //新增轮播图
664
       //新增轮播图
643
-      AddRotationChart(forName){
665
+      AddRotationChart(formName){
644
           this.$refs[formName].validate((valid)=>{
666
           this.$refs[formName].validate((valid)=>{
645
             if(valid){
667
             if(valid){
646
               AddRotationChart(this.rotationform).then(response=>{
668
               AddRotationChart(this.rotationform).then(response=>{
647
                   if(response.data.state==1){
669
                   if(response.data.state==1){
648
-
670
+                    var rotation =  response.data.data.rotation;
671
+                    console.log("返回数据",rotation);
672
+                    this.$message.success("添加轮播图成功");
673
+                    this.dialogVisible = false;
649
                   }
674
                   }
650
               })
675
               })
651
             }
676
             }
654
 
679
 
655
     //医院介绍
680
     //医院介绍
656
      saveHispital(formName){
681
      saveHispital(formName){
682
+         this.hispitalform.introduction = this.$refs.neditor.content;
683
+        console.log("文章内容",this.$refs.neditor.content)  
657
         this.$refs[formName].validate((valid)=>{
684
         this.$refs[formName].validate((valid)=>{
658
           if(valid){
685
           if(valid){
659
              saveHispital(this.hispitalform).then(response=>{
686
              saveHispital(this.hispitalform).then(response=>{
670
 
697
 
671
      //科室介绍
698
      //科室介绍
672
      addAdminist(formName){
699
      addAdminist(formName){
700
+       this.administform.introduction = this.$refs.neditor.content;
673
         this.$refs[formName].validate((valid)=>{
701
         this.$refs[formName].validate((valid)=>{
674
           if(valid){
702
           if(valid){
675
              addOffices(this.administform).then(response=>{
703
              addOffices(this.administform).then(response=>{
721
            }
749
            }
722
          })
750
          })
723
      },   
751
      },   
752
+      
753
+      // 科室环境
754
+      deleteKe(){
755
+      },
756
+        //科室介绍
757
+      imageKeSuccess(res,file){
758
+        console.log("图片路径",file.url)
759
+         this.keform.keImages.push(this.qiniuDomain + res.url);
760
+         console.log("图片数组",this.keform.keImages)
761
+        // this.keform.images = this.qiniuDomain + res.url;
762
+        // console.log("图片url",this.keform.images)
763
+      },
764
+      beforekeUpload(file){
765
+        const isJPG = file.type === 'image/jpeg';
766
+        const isLt2M = file.size / 1024 / 1024 < 2;
767
+        console.log("图片尺寸",file.size)
768
+        if (!isJPG) {
769
+          this.$message.error('上传头像图片只能是 JPG 格式!');
770
+         }
771
+        if (!isLt2M) {
772
+          this.$message.error('上传头像图片大小不能超过 2MB!');
773
+        }
774
+           var date = new Date()
775
+            var ext = getFileExtension(file.name)
776
+            var key = date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours()  + date.getMinutes()  + date.getSeconds()  +'_o_' + file.uid + '.' + ext;
777
+            this.uploading = true;
778
+            this.loadingText = '图片上传中'
779
+
780
+            const _self = this
781
+            return new Promise((resolve, reject) => {
782
+                getToken().then(response => {
783
+                    const tokentree = response.data.data.uptoken
784
+                    console.log("科室token是什么?",tokentree)
785
+                    _self._data.keData.token = tokentree;
786
+                    _self._data.keData.key = key;
787
+                    resolve(true)
788
+                }).catch(err => {
789
+                    reject(false)
790
+                    this.uploading = false;
791
+                })
792
+            })
793
+      },
794
+
795
+      AddOfficeEnvironment(formName){
796
+         this.$refs[formName].validate((valid)=>{
797
+           if(valid){
798
+             AddOfficeEnvironment(this.keform).then(response=>{
799
+                  if(response.data.state == 1){
800
+                    var offenvironment = response.data.data.offenvironment;
801
+                    this.five = false;
802
+                    console.log("返回数据",offenvironment);
803
+                  }
804
+             })
805
+           }
806
+         })
807
+      }
724
   },  
808
   },  
725
  };
809
  };
726
 </script>
810
 </script>
727
 
811
 
728
 <style rel="stylesheet/scss" lang="scss" scoped>
812
 <style rel="stylesheet/scss" lang="scss" scoped>
729
-
813
+     .eidtRotationimages{
814
+       text-align: center;
815
+       margin-bottom: 12px;
816
+     }
817
+         
730
      .clearfix {
818
      .clearfix {
731
         clear: both;
819
         clear: both;
732
     }
820
     }

+ 330 - 44
src/scrm_pages/site/preview.vue View File

38
                    <vue-scroll :ops="ops" style="width:348px;height:100%;right:37px">  
38
                    <vue-scroll :ops="ops" style="width:348px;height:100%;right:37px">  
39
                      <div>              
39
                      <div>              
40
                       <mt-swipe :auto="4000">
40
                       <mt-swipe :auto="4000">
41
-                       <mt-swipe-item><img src="static/images/b.jpg" style="width:380px;height:250px"></mt-swipe-item>
42
-                       <mt-swipe-item><img src="static/images/c.jpg" style="width:380px;height:200px"></mt-swipe-item>
43
-                       <mt-swipe-item><img src="static/images/d.jpg" style="width:380px;height:200px"></mt-swipe-item>
44
-                       </mt-swipe>  
41
+                       <mt-swipe-item v-for="item in rotationImages" :key="item.id">
42
+                         <img :src="item" style="width:380px;height:250px">
43
+                      </mt-swipe-item>
44
+                      </mt-swipe>  
45
                      </div>  
45
                      </div>  
46
                      <div class="box"></div>
46
                      <div class="box"></div>
47
                      <div class="list"></div>  
47
                      <div class="list"></div>  
65
                      <div class="yyjs">医院介绍</div>
65
                      <div class="yyjs">医院介绍</div>
66
                      <div class="ckgd"><span @click="more()">查看更多</span></div>
66
                      <div class="ckgd"><span @click="more()">查看更多</span></div>
67
                      <div class="ljtp"></div>
67
                      <div class="ljtp"></div>
68
-                     <div class="yytp">
68
+                     <!-- <div class="yytp">
69
                        <img src="static/images/a.jpg" style="width:322px;height:100%">
69
                        <img src="static/images/a.jpg" style="width:322px;height:100%">
70
-                     </div>
70
+                     </div> -->
71
                      <div class="yyjj">
71
                      <div class="yyjj">
72
-                        <span>深圳市人民医院始建于1946年,前身是宝安县卫生院,1979年伴随深圳经济特区成立更名为深圳市人民医院。
72
+                        <!-- <span>深圳市人民医院始建于1946年,前身是宝安县卫生院,1979年伴随深圳经济特区成立更名为深圳市人民医院。
73
                               1994年被评为深圳首家“三级甲等”医院。1996年经国务院侨办批准成为暨南大学医学院第二附属医院
73
                               1994年被评为深圳首家“三级甲等”医院。1996年经国务院侨办批准成为暨南大学医学院第二附属医院
74
-                              2005年升格为暨南大学第二临床医学院。伴随着经济....</span>
74
+                              2005年升格为暨南大学第二临床医学院。伴随着经济....</span> -->
75
+                         <span v-html="hispitalform.introduction" id="content" class="yycontent"></span>   
75
                      </div>
76
                      </div>
76
                      <div class="box3"></div>
77
                      <div class="box3"></div>
77
                      <div class="u2"></div>
78
                      <div class="u2"></div>
78
                      <div class="kejsfont">科室介绍</div>
79
                      <div class="kejsfont">科室介绍</div>
79
                      <div class="ckgd2">查看更多</div>
80
                      <div class="ckgd2">查看更多</div>
80
                      <div class="ljtp2"></div>
81
                      <div class="ljtp2"></div>
81
-                     <div class="ketp">
82
+                     <!-- <div class="ketp">
82
                         <img src="static/images/a.jpg" style="width:322px;height:100%">
83
                         <img src="static/images/a.jpg" style="width:322px;height:100%">
83
-                     </div>
84
+                     </div> -->
84
                      <div class="kejj">
85
                      <div class="kejj">
85
-                         <span>
86
-                           深圳市人民医院始建于1946年,前身是宝安县卫生院,1979年伴随深圳经济特区成立更名为深圳市人民医院。
87
-                           1994年被评为深圳首家“三级甲等”医院。1996年经国务院侨办批准成为暨南大学医学院第二附属医院
88
-                           2005年升格为暨南大学第二临床医学院。伴随着经济....
89
-                         </span>
86
+                       <span v-html="officeform.introduction" id="officecontent" class="xxcontent"></span>
90
                      </div>
87
                      </div>
91
                      <div class="box4"></div>
88
                      <div class="box4"></div>
92
                      <div class="u3"></div>
89
                      <div class="u3"></div>
93
                      <div class="myjsfont">名医介绍</div>
90
                      <div class="myjsfont">名医介绍</div>
94
                      <div class="ckgd3">查看更多</div>
91
                      <div class="ckgd3">查看更多</div>
95
                      <div class="ljtp2"></div>
92
                      <div class="ljtp2"></div>
96
-                     <div class="ketp2">
93
+                     <div class="ketp2" v-for="item in doctorInfos" :key="item.id">
97
                         <div class="ketp3">
94
                         <div class="ketp3">
98
-                          <img src="static/images/a.jpg" style="width:100%;height:100%">
95
+                          <img :src="item.dochead" style="width:100%;height:100%">
99
                         </div>
96
                         </div>
100
                         <div class="ketp4">
97
                         <div class="ketp4">
101
-                            <div class="docname">吴教授</div>
102
-                            <div class="docintroduction">北京医科大学硕士,曾工作与中国医大二院妇、辽宁省...</div>
98
+                            <div class="docname">{{item.docname}}</div>
99
+                            <div class="docintroduction"><span  class="zzcontent">{{item.docintroduction}}</span></div>
103
                         </div>
100
                         </div>
104
                      </div>
101
                      </div>
105
-
106
-                      <div class="ketp2">
107
-                        <div class="ketp3">
108
-                          <img src="static/images/a.jpg" style="width:100%;height:100%">
109
-                        </div>
110
-                        <div class="ketp4">
111
-                            <div class="docname">吴教授</div>
112
-                            <div class="docintroduction">北京医科大学硕士,曾工作与中国医大二院妇、辽宁省...</div>
113
-                        </div>
114
-                     </div>
115
-
102
+ 
116
                      <div class="box4"></div>
103
                      <div class="box4"></div>
117
                      <div class="u3"></div>
104
                      <div class="u3"></div>
118
                      <div class="myjsfont">科室环境</div>
105
                      <div class="myjsfont">科室环境</div>
119
                      <div class="ckgd3">查看更多</div>
106
                      <div class="ckgd3">查看更多</div>
120
-                     <div class="ljtp2"></div>
121
-                     <div>              
107
+                     <div class="ljtp3"></div>
108
+                     <div class="swiper-container">
109
+                      <div class="swiper-wrapper">
110
+                        <div class="swiper-slide" v-for="item in keEnvironmentImages" :key="item.id">
111
+                          <img :src="item" style="width:150px;height:125px;border-radius:5px;"/>
112
+                        </div>
113
+                      </div>
114
+                     </div>
115
+                   <div class="box5"></div>
116
+                   <div class="u3"></div>
117
+                   <div class="myjsfont">新闻动态</div>
118
+                   <div class="ckgd3">查看更多</div>
119
+                   <div class="ljtp4"></div>
120
+                    <div class="swiper-container new">
121
+                      <div class="swiper-wrapper">
122
+                        <div class="swiper-slide">
123
+                           <div class="new1">
124
+                                <div class="new6">
125
+                                  <div class="new2">
126
+                                     <img src="static/images/a.jpg" style="width:150px;heigth:125px">
127
+                                  </div>
128
+                                 <div class="new3">
129
+                                      <span>亲子鉴定头发样品采集</span>
130
+                                 </div>
131
+                                 <div class="new4"> </div>
132
+                                 <div class="new5">
133
+                                    <span>亲子鉴定头发样品采集</span>
134
+                                 </div>
135
+                               </div>  
136
+                           </div>
137
+                        </div>
138
+                      </div>
139
+                     </div>         
140
+                     <!-- <div>              
122
                       <mt-swipe :auto="4000">
141
                       <mt-swipe :auto="4000">
123
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:250px"></mt-swipe-item>
142
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:250px"></mt-swipe-item>
124
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:200px"></mt-swipe-item>
143
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:200px"></mt-swipe-item>
131
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:200px"></mt-swipe-item>
150
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:200px"></mt-swipe-item>
132
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:200px"></mt-swipe-item>
151
                        <mt-swipe-item><img src="static/images/a.jpg" style="width:380px;height:200px"></mt-swipe-item>
133
                        </mt-swipe>  
152
                        </mt-swipe>  
134
-                     </div>    
153
+                     </div>     -->
135
                  </vue-scroll>
154
                  </vue-scroll>
136
                </div>                 
155
                </div>                 
137
             </div>  
156
             </div>  
147
                   <img src="static/images/a.jpg">   
166
                   <img src="static/images/a.jpg">   
148
                   <div class="shouye" @click="indexone()">首页</div> 
167
                   <div class="shouye" @click="indexone()">首页</div> 
149
                 </vue-scroll>            
168
                 </vue-scroll>            
150
-              </div>  
151
-                       
169
+              </div>                     
152
       </div>
170
       </div>
153
    </div>
171
    </div>
154
 </template>
172
 </template>
161
 import { Swipe, SwipeItem } from 'mint-ui';
179
 import { Swipe, SwipeItem } from 'mint-ui';
162
 import Vue from 'vue';
180
 import Vue from 'vue';
163
 import 'mint-ui/lib/style.css';
181
 import 'mint-ui/lib/style.css';
182
+import { GetRationImages,GetHospitalInfo,GetOfficeInfo,GetDoctorInfo,GetOffEnvironment } from '@/api/site/site'  
183
+import { IncomingMessage } from 'http';
184
+import { isIP } from 'net';
185
+import Swiper from "swiper";
164
 Vue.component(Swipe.name, Swipe);
186
 Vue.component(Swipe.name, Swipe);
165
 Vue.component(SwipeItem.name, SwipeItem);
187
 Vue.component(SwipeItem.name, SwipeItem);
166
 
188
 
172
     UsedList,
194
     UsedList,
173
     AddContact
195
     AddContact
174
   },
196
   },
197
+  filters:{
198
+     ellipsis (value) {
199
+       if(!value) return ''
200
+       if(value.length > 8){
201
+         return  value.slice(0,200)+ '...'
202
+       }
203
+       return value
204
+     }
205
+  },
175
   data() {
206
   data() {
176
     return {
207
     return {
177
       crumbs: [{ path: false, name: "预览" }],
208
       crumbs: [{ path: false, name: "预览" }],
179
       name: "car",
210
       name: "car",
180
       show:true,
211
       show:true,
181
       shows:false,
212
       shows:false,
213
+      showimages:true,
214
+      ellipsis:'',
182
        ops: {
215
        ops: {
183
           vuescroll: {},
216
           vuescroll: {},
184
           scrollPanel: {},
217
           scrollPanel: {},
191
             background: 'white',
224
             background: 'white',
192
           }
225
           }
193
         },
226
         },
227
+        rotationImages:[],
228
+        keEnvironmentImages:[],
229
+        hispitalform:{
230
+          title:"",
231
+          sort:"",
232
+          introduction:"",
233
+      },
234
+        officeform:{
235
+          title:"",
236
+          sort:"",
237
+          introduction:"", 
238
+      },
239
+       eidtDoctorform:{
240
+       docname:"",
241
+       docHead:"",
242
+       docpositional:"",
243
+       docintroduction:"",
244
+      },
245
+      doctorInfos:[],
194
     };
246
     };
195
   },
247
   },
196
 
248
 
197
   methods:{
249
   methods:{
250
+    
198
     more(){
251
     more(){
199
       this.show = false;
252
       this.show = false;
200
       this.shows = true;
253
       this.shows = true;
202
     indexone(){
255
     indexone(){
203
       this.shows = false;
256
       this.shows = false;
204
       this.show = true;
257
       this.show = true;
258
+    },
259
+    handleClick(){
260
+
261
+    },
262
+    //获取轮播图
263
+      GetRationImages(){
264
+        GetRationImages().then(response=>{
265
+            if(response.data.state ==1){
266
+                var rotation =  response.data.data.rotationImages;
267
+               console.log("获取轮播图数据",rotation); 
268
+               console.log("获取轮播图",rotation.rotation_images); 
269
+               var str = rotation.rotation_images;
270
+               var Images = [];
271
+               Images = str.split(",");
272
+               console.log("数组",Images)
273
+               this.rotationImages = Images;
274
+              //  this.rotationImages.splice(index,1);
275
+            }
276
+        })
277
+      },
278
+
279
+      //获取医院介绍
280
+      GetHospitalInfo(){
281
+        GetHospitalInfo().then(response=>{
282
+          if(response.data.state == 1){
283
+            var hospital =  response.data.data.hospital;
284
+            this.hispitalform =  response.data.data.hospital;
285
+            console.log("获取医院介绍数据",hospital);
286
+          }
287
+        })
288
+      },
289
+
290
+      //获取科室介绍
291
+      GetOfficeInfo(){
292
+        GetOfficeInfo().then(response=>{
293
+          if(response.data.state == 1){
294
+            var offices =   response.data.data.offices;
295
+            this.officeform =  response.data.data.offices;
296
+            console.log("获取科室介绍数据",offices);
297
+          }
298
+        })
299
+      },
300
+
301
+    //获取名医介绍
302
+    GetDoctorInfo(){
303
+      GetDoctorInfo().then(response=>{
304
+        if(response.data.state == 1){
305
+           var doctor = response.data.data.doctor;
306
+           this.doctorInfos = response.data.data.doctor;
307
+           console.log("获取名医介绍",doctor);
308
+        }
309
+      })
310
+    },
311
+
312
+    //获取科室环境
313
+    GetOffEnvironment(){
314
+       GetOffEnvironment().then(response=>{
315
+         if(response.data.state == 1){
316
+           var offenvironment = response.data.data.offenvironment;
317
+           console.log("获取科室环境",offenvironment);
318
+           console.log("获取轮播图片",offenvironment.keimages);
319
+           var str = offenvironment.keimages;
320
+           var Images = [];
321
+            Images = str.split(",");
322
+            console.log("数组",Images);
323
+            this.keEnvironmentImages =  Images;
324
+         }
325
+       })
326
+    }
327
+  },
328
+  created(){
329
+    this.GetRationImages();
330
+    this.GetHospitalInfo();
331
+    this.GetOfficeInfo();
332
+    this.GetDoctorInfo();
333
+    this.GetOffEnvironment();
334
+  },
335
+  mounted(){
336
+            var mySwiper = new Swiper('.swiper-container', {
337
+                // autoplay: {
338
+                //     disableOnInteraction: false, // 用户操作后,不停止自动切换
339
+                // }, // 自动播放
340
+                direction:"horizontal",
341
+                loop: true, // 循环播放,
342
+                autoplay:false,
343
+                spaceBetween:1,
344
+                loopAdditionalSlides:10,
345
+                slidesPerView: 'auto', // 设置slider容器能够同时显示的slides数量
346
+                centeredSlides: true, // active slide 居中
347
+                observer:true,//动态加载图片
348
+                observeParents:true,
349
+                pagination: {
350
+                    el: '.swiper-pagination',
351
+                },
352
+            })
353
+        },
354
+  updated(){
355
+    let obj = document.getElementById('content');
356
+    console.log("obj是什么",obj)
357
+    let imgs =  obj.getElementsByTagName('img');
358
+    console.log("imgs",imgs)
359
+    for(let i=0;i<imgs.length;i++){
360
+       imgs[i].style.width = '332px';
361
+       imgs[i].style.height = '100px';
362
+    }
363
+
364
+    let officObj =  document.getElementById('officecontent');
365
+    console.log("officeObj是什么",officObj)
366
+    let officeImages =  officObj.getElementsByTagName('img');
367
+    console.log("officeImages",officeImages)
368
+    for(let i=0;i<officeImages.length;i++){
369
+        officeImages[i].style.width = '332px';
370
+        officeImages[i].style.height = '100px';
205
     }
371
     }
206
   }
372
   }
207
 }
373
 }
209
 
375
 
210
 <style rel="stylesheet/scss" lang="scss" scoped>
376
 <style rel="stylesheet/scss" lang="scss" scoped>
211
   
377
   
378
+ .swiper-wrapper {
379
+        width: 50%;
380
+    }
381
+    //设置中间图片与左右图片的大小问题
382
+  .swiper-slide-prev, .swiper-slide-next {
383
+        transform: scale(1)
384
+  }
385
+  .swiper-container{
386
+    width: 315px;
387
+    height: 125px;
388
+    // border: solid 1px red;
389
+    margin-bottom: 100px;
390
+    margin-left: 33px;
391
+  }
392
+   
393
+   .new {
394
+     width: 315px;
395
+     height: 180px;
396
+     //border: solid 1px red;
397
+    margin-bottom: 100px;
398
+    margin-left: 33px;
399
+   }
400
+
401
+  .new1{
402
+    width: 180px;
403
+    height: 250px;
404
+   // border:solid 1px red;
405
+    margin-bottom: 100px;
406
+    margin-left: 40px;
407
+  }
408
+
409
+  .new2{
410
+    width: 220px;
411
+    height: 125px;
412
+   // border: solid 1px red;
413
+  }
414
+  .new3{
415
+    width:150px;
416
+    height: 20px;
417
+    font-size: 11px;
418
+  //  border: solid 1px red;
419
+    margin-left: 20px;
420
+    margin-top: -30px;
421
+  }
422
+  .new4{
423
+    width: 130px;
424
+    border: solid 1px black;
425
+    margin-left: 20px;
426
+    margin-top: 10px;
427
+    background-color: black;
428
+  }
429
+
430
+  .new5{
431
+    width: 150px;
432
+    height: 20px;
433
+  //  border: solid 1px red;
434
+    margin-left: 20px;
435
+    margin-top: 10px;
436
+    font-size: 11px;
437
+  }
438
+  .new6{
439
+    width:150px;
440
+    height: 160px;
441
+    border:solid 1px red;
442
+    margin-left: 20px;
443
+    margin-top: 5px;
444
+  }
445
+  
212
 .phone{
446
 .phone{
213
    margin-top: -490px;
447
    margin-top: -490px;
214
    margin-right: 670px;
448
    margin-right: 670px;
217
    height: 750px;
451
    height: 750px;
218
    background: url(../../assets/img/phone.png) 50% no-repeat;
452
    background: url(../../assets/img/phone.png) 50% no-repeat;
219
   }
453
   }
220
-
454
+  
221
  .time{
455
  .time{
222
    width: 34px;
456
    width: 34px;
223
    height: 20px;
457
    height: 20px;
259
  }
493
  }
260
  .mint-swipe-item{
494
  .mint-swipe-item{
261
    &:nth-child(1){
495
    &:nth-child(1){
262
-     background-color: red;
496
+     background-color: white;
263
    }
497
    }
264
    &:nth-child(2){
498
    &:nth-child(2){
265
-     background-color: blue;
499
+     background-color: white;
266
    }
500
    }
267
    &:nth-child(3){
501
    &:nth-child(3){
268
-     background-color: cyan;
502
+     background-color: white;
269
    }
503
    }
270
  }
504
  }
271
 
505
 
312
     margin-left: 35px;
546
     margin-left: 35px;
313
     margin-top: -100px;
547
     margin-top: -100px;
314
     margin-bottom: 100px;
548
     margin-bottom: 100px;
549
+  }
315
 
550
 
551
+  .box5{
552
+    width: 320px;
553
+    height: 6px;
554
+    border: 1px;
555
+    background-color:  rgba(204, 204, 204, 1);
556
+    margin-left: 35px;
557
+    margin-top: -95px;
558
+    margin-bottom: 100px;
316
   }
559
   }
317
  //名医列表
560
  //名医列表
318
    .list{
561
    .list{
490
    .yyjj{
733
    .yyjj{
491
      font-size: 14px;
734
      font-size: 14px;
492
      width: 320px;
735
      width: 320px;
493
-     height: 100px;
736
+     height: 210px;
494
      border: 1px;
737
      border: 1px;
495
      margin-left: 35px;
738
      margin-left: 35px;
496
      margin-top: 8px;
739
      margin-top: 8px;
497
-     margin-bottom: 100px;
740
+     margin-bottom: 100px;    
741
+   }
742
+
743
+   .yycontent{
744
+     overflow: hidden;
745
+     text-overflow: ellipsis;
746
+     display: -webkit-box;
747
+     -webkit-line-clamp: 6;
748
+     -webkit-box-orient: vertical   
749
+   }
750
+   .xxcontent{
751
+     overflow: hidden;
752
+     text-overflow: ellipsis;
753
+     display: -webkit-box;
754
+     -webkit-line-clamp: 6;
755
+     -webkit-box-orient: vertical   
756
+   }
757
+
758
+   .zzcontent{
759
+     overflow: hidden;
760
+     text-overflow: ellipsis;
761
+     display: -webkit-box;
762
+     -webkit-line-clamp: 2;
763
+     -webkit-box-orient: vertical   
498
    }
764
    }
499
 
765
 
500
    .kejsfont{
766
    .kejsfont{
529
      margin-bottom: 100px;
795
      margin-bottom: 100px;
530
    }
796
    }
531
 
797
 
798
+   .ljtp3{
799
+     width: 20px;
800
+     height: 20px;
801
+     border: 1px;
802
+     background: url(../../assets/img/u216.png) 50% no-repeat;
803
+     margin-left: 315px;
804
+     margin-top: -120px;
805
+     margin-bottom: 10px;
806
+   }
807
+
808
+    .ljtp4{
809
+     width: 20px;
810
+     height: 20px;
811
+     border: 1px;
812
+     background: url(../../assets/img/u216.png) 50% no-repeat;
813
+     margin-left: 315px;
814
+     margin-top: -120px;
815
+     margin-bottom: 10px;
816
+   }
817
+
532
    .xiangqing{
818
    .xiangqing{
533
      position: absolute;
819
      position: absolute;
534
      width: 313px;
820
      width: 313px;
556
      border:1px;
842
      border:1px;
557
      margin-top: -90px;
843
      margin-top: -90px;
558
      margin-left: 33px;
844
      margin-left: 33px;
559
-     margin-bottom: 200px;
845
+     margin-bottom: 100px;
560
    }
846
    }
561
 
847
 
562
     .ketp2{
848
     .ketp2{
604
 
890
 
605
    .kejj{
891
    .kejj{
606
      width: 320px;
892
      width: 320px;
607
-     height: 100px;
893
+     height: 210px;
608
      border:1px;
894
      border:1px;
609
      font-size: 14px;
895
      font-size: 14px;
610
      margin-bottom: 100px;
896
      margin-bottom: 100px;
611
-     margin-top: -195px;
897
+     margin-top: -88px;
612
      margin-left: 33px;
898
      margin-left: 33px;
613
    }
899
    }
614
 
900
 

+ 74 - 0
src/utils/directives.js View File

1
+import Vue from 'vue'
2
+
3
+// v-dialogDrag: 弹窗拖拽
4
+Vue.directive('dialogDrag', {
5
+  bind(el, binding, vnode, oldVnode) {
6
+    const dialogHeaderEl = el.querySelector('.el-dialog__header')
7
+    const dragDom = el.querySelector('.el-dialog')
8
+    dialogHeaderEl.style.cursor = 'move'
9
+
10
+    // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
11
+    const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
12
+
13
+    dialogHeaderEl.onmousedown = (e) => {
14
+      // 鼠标按下,计算当前元素距离可视区的距离
15
+      const disX = e.clientX - dialogHeaderEl.offsetLeft
16
+      const disY = e.clientY - dialogHeaderEl.offsetTop
17
+
18
+      // 获取到的值带px 正则匹配替换
19
+      let styL, styT
20
+
21
+      // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
22
+      if (sty.left.includes('%')) {
23
+        styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
24
+        styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
25
+      } else {
26
+        styL = +sty.left.replace(/\px/g, '')
27
+        styT = +sty.top.replace(/\px/g, '')
28
+      }
29
+
30
+      document.onmousemove = function(e) {
31
+        // 通过事件委托,计算移动的距离
32
+        const l = e.clientX - disX
33
+        const t = e.clientY - disY
34
+
35
+        // 移动当前元素
36
+        dragDom.style.left = `${l + styL}px`
37
+        dragDom.style.top = `${t + styT}px`
38
+
39
+        // 将此时的位置传出去
40
+        // binding.value({x:e.pageX,y:e.pageY})
41
+      }
42
+
43
+      document.onmouseup = function(e) {
44
+        document.onmousemove = null
45
+        document.onmouseup = null
46
+      }
47
+    }
48
+  }
49
+})
50
+
51
+// v-dialogDragWidth: 弹窗宽度拖大 拖小
52
+Vue.directive('dialogDragWidth', {
53
+  bind(el, binding, vnode, oldVnode) {
54
+    const dragDom = binding.value.$el.querySelector('.el-dialog')
55
+
56
+    el.onmousedown = (e) => {
57
+      // 鼠标按下,计算当前元素距离可视区的距离
58
+      const disX = e.clientX - el.offsetLeft
59
+
60
+      document.onmousemove = function(e) {
61
+        e.preventDefault() // 移动时禁用默认事件
62
+
63
+        // 通过事件委托,计算移动的距离
64
+        const l = e.clientX - disX
65
+        dragDom.style.width = `${l}px`
66
+      }
67
+
68
+      document.onmouseup = function(e) {
69
+        document.onmousemove = null
70
+        document.onmouseup = null
71
+      }
72
+    }
73
+  }
74
+})