wang jun 2 年之前
父節點
當前提交
4820f7e551
共有 1 個文件被更改,包括 64 次插入25 次删除
  1. 64 25
      application/page/view/tools/workercard.html

+ 64 - 25
application/page/view/tools/workercard.html

@@ -27,10 +27,10 @@
         }
         .demo-upload-list{
         display: inline-block;
-        width: 60px;
-        height: 60px;
+        width: 100%;
+        height: 200px;
         text-align: center;
-        line-height: 60px;
+        line-height: 200px;
         border: 1px solid transparent;
         border-radius: 4px;
         overflow: hidden;
@@ -57,9 +57,9 @@
     }
     .demo-upload-list-cover i{
         color: #fff;
-        font-size: 20px;
+        font-size: 70px;
         cursor: pointer;
-        margin: 0 2px;
+        margin: 0 20px;
     }
     #form .ivu-card-head{
         padding: 0px;
@@ -143,7 +143,7 @@
                                     <img :src="url">
                                     <div class="demo-upload-list-cover">
                                         <Icon type="ios-eye-outline" @click.native="handleView2(index)" class="red"></Icon>
-                                        <Icon type="ios-trash-outline" @click.native="handleRemove2(index)" class="red"></Icon>
+                                        <Icon type="ios-trash-outline" @click.native="setdel2(index)" class="red"></Icon>
                                     </div>
                                     <i-button type="primary" long>提交</i-button>
                                 </div>
@@ -158,12 +158,12 @@
                                 :on-format-error="handleFormatError"
                                 :before-upload="handleBeforeUpload"
                                 :on-exceeded-size="handleMaxSize"
-                                :max-size="20480"
+                                :max-size="2048"
                                 name="file"
                                 type="drag"
                                 action="https://app.tjzhxx.cn:5443/api/Cos/savephoto"
-                                style="display: inline-block;width:58px;">
-                                <div style="width: 58px;height:58px;line-height: 58px;">
+                                style="display: inline-block;width:100%;">
+                                <div style="width: 100%;height:58px;line-height: 58px;">
                                     <Icon type="md-camera" size="20" class="red"></Icon>
                                 </div>
                             </Upload>
@@ -175,15 +175,13 @@
                     <Form-item>
                         <i-button type="primary" long @click="saveinfo" :loading="issavingloading">提交</i-button>
                     </Form-item>
-                    <Form-item label="用户照片">
-                        <div v-if="imglist"> 
-                            <div class="img_list">
-                                <div class="demo-upload-list" v-for="(item,index) in imglist" :key="index">
-                                    <img :src="item">
-                                    <div class="demo-upload-list-cover">
-                                        <Icon type="ios-eye-outline" @click.native="handleView(index)" class="red"></Icon>
-                                        <Icon type="ios-trash-outline" @click.native="delimg(item)"></Icon>
-                                    </div>
+                    <Form-item label="用户照片"  v-if="imglist&&imglist.length>0">
+                        <div class="img_list">
+                            <div class="demo-upload-list" v-for="(item,index) in imglist" :key="index">
+                                <img :src="item">
+                                <div class="demo-upload-list-cover">
+                                    <Icon type="ios-eye-outline" @click.native="handleView(index)" class="red"></Icon>
+                                    <Icon type="ios-trash-outline" @click.native="setdel1(item)"></Icon>
                                 </div>
                             </div>
                         </div>
@@ -191,6 +189,24 @@
                 </div>
             </i-form>
         </Card>
+        <Modal v-model="del1" width="360">
+            <p style="color:#f60;text-align:center">
+                <Icon type="information-circled"></Icon>
+                <span>确认删除用户图片</span>
+            </p>
+            <div slot="footer">
+                <Button type="error" size="large" long  @click="delimg">删除</Button>
+            </div>
+        </Modal>
+        <Modal v-model="del2" width="360">
+            <p style="color:#f60;text-align:center">
+                <Icon type="information-circled"></Icon>
+                <span>确认删除上传图片</span>
+            </p>
+            <div slot="footer">
+                <Button type="error" size="large" long  @click="handleRemove2">删除</Button>
+            </div>
+        </Modal>
     </div>
     <script>
         var sharedata = {php}echo json_encode($sharedata);{/php}; 
@@ -253,10 +269,15 @@
                 uploadList:[],
                 viewimgurl:'',
                 visible:false,
-                url_host:"http://newwatercatserver.com/index.php/index",
+                //url_host:"http://newwatercatserver.com/index.php/index",
+                url_host:"https://app.tjzhxx.cn:11443/index.php/index",
                 worktypeonelabel:[],
                 userid:0,
-                isedit:false
+                isedit:false,
+                del1:false,
+                del2:false,
+                del_file:false,
+                del_imgurl:false,
             },
             watch: {
                 'formdata.telno' (newValue, old) {
@@ -274,16 +295,28 @@
                     this.viewimgurl = this.imglist[index];
                     this.visible = true;
                 },
-                handleRemove (file) {
+                setdel2(index){
+                    this.del2=true
+                    this.del_index = index;
+                },
+                setdel1(imgurl){
+                    //删除用户图片
+                    this.del1=true
+                    this.del_imgurl = imgurl;
+                },
+                handleRemove () {
+                    var file =this.del_file
                     // 从 upload 实例删除数据
                     const fileList = this.$refs.upload.fileList;
                     this.$refs.upload.fileList.splice(fileList.indexOf(file), 1);
+                    this.del_file=false
                 },
                 handleView2 (key) {
                     this.viewimgurl = this.uploadList[key];
                     this.visible = true;
                 },
-                handleRemove2 (index) {
+                handleRemove2 () {
+                    var index = this.del_index
                     // 从 upload 实例删除数据
                     //const fileList = this.$refs.upload.fileList;
                     //console.log(fileList);
@@ -291,9 +324,11 @@
                     //this.uploadList = this.$refs.upload.fileList;
                     //console.log(this.uploadList);
                     this.uploadList.splice(index, 1);
+                    this.del_index=false
+                    this.del2=false
                 },
                 handleSuccess (res, file) {
-                    console.log(res,file)
+                    this.$Message.destroy()
                     if(1!=res.status){
                         this.$Message.error(res.msg);
                         return
@@ -314,7 +349,7 @@
                 handleMaxSize (file) {
                     this.$Notice.warning({
                         title: '超出文件大小限制',
-                        desc: '文件 ' + file.name + ' 太大,不能超过 20M。'
+                        desc: '文件 ' + file.name + ' 太大,不能超过 2M。'
                     });
                 },
                 handleBeforeUpload () {
@@ -324,6 +359,7 @@
                             title: '最多只能上传 5 张图片。'
                         });
                     }
+                    this.$Message.loading('图片上传中', 0);
                     return check;
                 },
                 getinfobytelno(telno){
@@ -495,7 +531,8 @@
                     var r = window.location.search.substr(1).match(reg); //匹配目标参数
                     if (r != null) return unescape(r[2]); return null; //返回参数值
                 },
-                delimg(imgurl){
+                delimg(){
+                    var imgurl = this.del_imgurl
                     var that = this;
                     var url= this.url_host+"/workercardv1/deleteuserimg";
                     var data ={
@@ -513,10 +550,12 @@
                                     title: res.msg
                                 });
                             }else{
+                                this.del_imgurl =false
                                 that.$Notice.success({
                                     title: res.msg
                                 });
                                 that.getimglist();
+                                that.del1=false
                             }
                         }
                     });