wang jun 2 年 前
コミット
6287bded50
1 ファイル変更47 行追加5 行削除
  1. 47 5
      application/page/view/tools/workercard.html

+ 47 - 5
application/page/view/tools/workercard.html

@@ -103,9 +103,12 @@
                 <img src="/static/image/workercard/banner.png">
             </div>
             <i-form :model="formdata" :label-width="80">
-                <Form-item label="手机号">
+                <Form-item label="手机号" v-if="!isedit">
                     <i-input v-model="formdata.telno" placeholder="请输入手机号"></i-input>
                 </Form-item>
+                <Form-item label="手机号" v-else>
+                   {{formdata.telno}}
+                </Form-item>
                 <div id="editform"> 
                     <Form-item label="姓名">
                         <i-input v-model="formdata.name" placeholder="请输入姓名"></i-input>
@@ -179,7 +182,7 @@
                                     <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="handleRemove(item)"></Icon>-->
+                                        <Icon type="ios-trash-outline" @click.native="delimg(item)"></Icon>
                                     </div>
                                 </div>
                             </div>
@@ -245,13 +248,15 @@
                     key_word:[],
                     user_id:0
                 },
+                imglistobj:{},
                 imglist:false,
                 uploadList:[],
                 viewimgurl:'',
                 visible:false,
                 url_host:"http://newwatercatserver.com/index.php/index",
                 worktypeonelabel:[],
-                userid:0
+                userid:0,
+                isedit:false
             },
             watch: {
                 'formdata.telno' (newValue, old) {
@@ -333,14 +338,17 @@
                         dataType: "json",
                         success: function(res){
                             //res = JSON.parse(res);
+                            console.log(res);
                             if(200!=res.code){
                                 if(res.code<0){
+                                    that.isedit =false;
                                 }else{
                                     that.$Notice.error({
                                         title: res.msg
                                     });
                                 }
                             }else{
+                                that.isedit =true
                                 that.formdata=res.data
                                 that.userid  = that.formdata.user_id;
                                 //查询素材图片
@@ -365,14 +373,15 @@
                         dataType: "json",
                         success: function(res){
                             if(200!=res.code){
-                                if(res.code<0){
+                                /*if(res.code<0){
                                 }else{
                                     that.$Notice.error({
                                         title: res.msg
                                     });
-                                }
+                                }*/
                             }else{
                                 var resultData = res.resultData
+                                that.imglistobj = resultData
                                 that.imglist =  resultData.urls;
                             }
                         },
@@ -480,9 +489,42 @@
                             }
                         }
                     });
+                },
+                getUrlParam(name) {
+                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
+                    var r = window.location.search.substr(1).match(reg); //匹配目标参数
+                    if (r != null) return unescape(r[2]); return null; //返回参数值
+                },
+                delimg(imgurl){
+                    var that = this;
+                    var url= this.url_host+"/workercardv1/deleteuserimg";
+                    var data ={
+                        'url':imgurl,
+                        'userid':this.userid
+                    }
+                    $.ajax({
+                        type: 'POST',
+                        url: url,
+                        data:data,
+                        dataType: "json",
+                        success: function(res){
+                            if(200!=res.code){
+                                that.$Notice.warning({
+                                    title: res.msg
+                                });
+                            }else{
+                                that.$Notice.success({
+                                    title: res.msg
+                                });
+                                that.getimglist();
+                            }
+                        }
+                    });
                 }
             },
             mounted() {
+                var web_user_id=this.getUrlParam('reid');
+                this.formdata.referrer_uid = web_user_id;
                 this.getworktypelabel();
             }
         })