睿达图片系统备份

管理图片上传下载网上有不少版本,我这里整理了下我系统中用到的图片系统,用作备份

1.

  <span><i class="red">*</i>名片:</span>
                    <div>
                      <div v-show='isshow2' class="pic">
                        <img :src="src2" alt="user image">
                      </div>
                      <input type="file" @change="getFile2" ref="file" id="file2">
                    </div>

2. getFile (e) {
        this.isshow = true;
        var that=this;
        var file = e.target.files[0];
         var imgSize=file.size/1024;
        if(!/image\/\w+/.test(file.type)){  
            alert("请上传图片!");  
            return;  
        }else if(imgSize>200){
            alert('请上传大小不要超过200KB的图片')
        }else{
            var rd = new FileReader();
            rd.readAsDataURL(file); 
            rd.onloadend=function(){
            var dataURL = rd .result;
            that.src = dataURL;
          }
        }
      
       
      },

3. reg_submit(){
        let parm={
          user_group:this.compyname,
          user_logo:this.src,
          card:this.src2,
          agent_project:this.daili.join(","),
          area_id:this.areaid,
          province_id:this.cityid,
          main_cust:this.customer,
          app_people:this.applicant,
          tel:this.phone,
          job:this.office
        };
            UserClient.post('/user/UserController/zhuceByQuDao',parm).then((res) => {
             if(res.code == 200){
                if(res.data >0){
                  alert("申请已提交,请耐心等待审核");
                }else{
                  alert("渠道已注册或申请有异常")
                }
              }else{
                console.info(res.desc);
              }
            }).catch(e=>{
              console.info(e);
            })

4.//制作图片保存在文件系统中   生产图片保存在图片自动中   数据库保存url
         String str = user_logo.substring(user_logo.indexOf(",")+1);
         String str2 = card.substring(card.indexOf(",")+1);
         String user_logoPath =  System.currentTimeMillis()+1+".jpg";
         String cardPath =  System.currentTimeMillis()+2+".jpg";
        Base64.GenerateImage(str,pictures+user_logoPath);
        Base64.GenerateImage(str2,pictures+cardPath);
        
        String insql = "insert into  user_group_t(user_logo,card,user_group,agent_project,area_id,province_id,main_cust,app_people,tel,job,status,create_time) values(?,?,?,?,?,?,?,?,?,?,?,NOW())"; 
        return userJt.update(insql, new Object[]{pictures_http+user_logoPath,pictures_http+cardPath,user_group,agent_project,area_id,province_id,main_cust,app_people,tel,job,"0"});
    }

猜你喜欢

转载自blog.csdn.net/qq_26562641/article/details/81667164