123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>{$user_login} - 企业信息</title>
- <meta name="keywords" content=""/>
- <meta name="description" content="">
- <include file="public@head"/>
- </head>
- <body class="body-white" id="top">
- <include file="public@nav" />
- <div class="container tc-main">
- <div class="row">
- <div class="col-md-3">
- <include file="public@usernav" />
- </div>
- <div class="col-md-9">
- <div class="tabs">
- <ul class="nav nav-tabs">
- <li class="active"><a href="#one" data-toggle="tab"><i class="fa fa-edit"></i> 企业信息</a></li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane active" id="one">
- <br>
- <form class="js-ajax-form" action="{:url('user/profile/editPost')}" method="post">
- <div class="form-group">
- <label for="input-user_nickname">企业名称</label>
- <input type="text" class="form-control" id="input-companyname" placeholder="企业名称" name="companyname" value="{$companyname}">
- </div>
- <!-- <div class="form-group">
- <label for="input-sex">性别</label>
- <php>
- $sexs=array("0"=>"保密","1"=>"程序猿","2"=>"程序媛");
- </php>
- <select class="form-control" id="input-sex" name="sex">
- <foreach name="sexs" item="vo">
- <php>$sexselected=$key==$sex?"selected":"";</php>
- <option value="{$key}" {$sexselected}>{$vo}</option>
- </foreach>
- </select>
- </div>
- <div class="form-group">
- <label for="input-birthday">生日</label>
- <input class="form-control js-bootstrap-date" type="text" id="input-birthday" placeholder="2013-01-04" name="birthday" value="{:date('Y-m-d',$birthday)}">
- </div>
- <div class="form-group">
- <label for="input-user_url">个人网址</label>
- <input class="form-control" type="text" id="input-user_url" placeholder="http://thinkcmf.com" name="user_url" value="{$user_url}">
- </div>
- <div class="form-group">
- <label for="input-signature">个性签名</label>
- <textarea class="form-control" id="input-signature" placeholder="个性签名" name="signature">{$signature}</textarea>
- </div> -->
- <div class="form-group">
- <label for="input-user_nickname">联系人姓名</label>
- <input type="text" class="form-control" id="input-contactname" placeholder="联系人姓名" name="contactname" value="{$contactname}">
- </div>
- <div class="form-group">
- <label for="input-user_nickname">联系人电话</label>
- <input type="text" class="form-control" id="input-telno" placeholder="联系人电话" name="telno" value="{$telno}">
- </div>
- <div class="form-group">
- <label for="input-user_nickname" >营业执照</label>
- <div class="img_div">
- <div id="jqueryCropper" class="avatar-cropper">
- <img id="userAvatarImage" src="{$licensephoto}">
- </div>
- <div class="btn-group">
- <label class="btn btn-primary eventBtn" for="inputImage" title="打开图片">
- <input type="file" class="sr-only" id="inputImage" name="file" accept=".jpg,.jpeg,.png">
- <span class="fa fa-upload"></span> 上传
- </label>
- <button type="button" class="btn btn-primary eventBtn" role="group" data-method="reset" title="重置图片"><span class="fa fa-refresh"></span> 重置</button>
- <button type="button" class="btn btn-primary eventBtn btnsave" role="group" title="保存图片" id="saveavatar"></span> 保存图片</button>
- </div>
- </div>
-
- </div>
- <div class="form-group">
- <button id="saveinfo" type="button" class="btn btn-success btn-lg btn-block btnsave1 eventBtn"><i class="fa fa-save"></i> 确认保存</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- <include file="public@footer" />
- </div>
- <!-- /container -->
- <include file="public@scripts" />
- <style>
- .img_div{
- display: flex;
- flex-direction: row;
- align-items: flex-end;
- }
- .img_div .btn-group{
- padding-left: 1em;
- }
- #jqueryCropper{
- width: 50%;
- border: 1px solid #333;
- min-height: 200px;
- }
- #jqueryCropper img{
- object-fit: cover;
- width: 100%;
- }
- </style>
- <script type="text/javascript">
- <php>
- $uploadedImageName = empty($avatar) ? '' : 'temp_image.jpg';
- $licensephoto = empty($licensephoto) ? '' :$avatar;
- $userid = $user['id'];
- </php>
-
- var nzi = $('#userAvatarImage');
- var n2i = $('#inputImage');
- var originalImageURL = n2i.attr('src');
- var uploadedImageName = '{$uploadedImageName}';
- var uploadedImageType = 'image/jpeg';
- var uploadedImageURL = '';
- var uploadFile = '';
- var licensephoto='{$licensephoto}'
- let userid = '{$userid}'
-
- n2i.change(function () {
-
- var files = this.files;
- var file;
-
- if (files && files.length) {
- file = files[0];
- if (/^image\/\w+$/.test(file.type)) {
- uploadedImageName = file.name;
- uploadedImageType = file.type;
- if (uploadedImageURL) {
- URL.revokeObjectURL(uploadedImageURL);
- }
- uploadedImageURL = URL.createObjectURL(file);
- nzi.attr('src', uploadedImageURL);
- n2i.val('');
- uploadFile = file;
- } else {
- window.alert('Please choose an image file.');
- }
- }
- })
- $('#saveinfo').on('click',function(){
- let url ="{:cmf_url('portal/Companyinfo/addenterpriseapplyjoinplatform')}";
- var companyname = $('#input-companyname').val();
- var contactname = $('#input-contactname').val();
- var telno = $('#input-telno').val();
- let data= {
- userid:userid,
- licensephoto:licensephoto,
- companyname:companyname,
- contactname:contactname,
- telno:telno
- }
- console.log(data)
- $.ajax(url, {
- method: "POST",
- data: data,
- success: function (e) {
- console.log(e);
- console.log(e.code)
- if(1==e.code){
- noty({text: e.msg,type: 'success',layout: 'center'})
- }else{
- noty({text: e.msg,type: 'error',layout: 'center'})
- }
- },
- error: function (e) {
- console.log(e);
- }
- })
- })
- $('#saveavatar').on('click',function (){
- // 禁用所有控件
- $('.eventBtn').prop('disabled', true);
- $('.btnsave').html('<i class="fa fa-spinner fa-pulse fa-fw"></i> 上传中');
- // 判断是否有数据
- // let tmp_img = nzi.cropper('getCroppedCanvas',{width: 512,height: 512})
- if(!uploadFile) alert('请上传图片。');
- var formData = new FormData();
- formData.append('file',uploadFile);
- $url="https://app.tjzhxx.cn:5443/api/Cos/savephoto";
- $.ajax($url, {
- method: "POST",
- data: formData,
- processData: false,
- contentType: false,
- success: function (e) {
- console.log(e)
- let data = JSON.parse(e);
- console.log(data)
- if(1==data.status){
- let path = data.data.path
- licensephoto = path
- console.log(licensephoto)
- }else{
- noty({text: data.msg,type: 'error',layout: 'center'})
- }
- // delay_url = e.url
- // noty({text: e.msg,type: ((e.code == 0) ? 'error' : 'success'),layout: 'center'})
- $('.eventBtn').prop('disabled', false);
- $('.btnsave').html('<i class="fa fa-save"></i> 确认保存');
- // if(e.url != '') {
- // setTimeout(function(){ window.location.href = e.url }, (e.wait-1)*1000)
- // }
- console.log(e)
- },
- error: function (e) {
- noty({text: '网络连接失败。',type: 'error',layout: 'center'})
- $('.eventBtn').prop('disabled', false);
- $('.btnsave').html('<i class="fa fa-save"></i> 确认保存');
- nzi.cropper('enable')
- }
- })
-
- // 转blob上传
- // uploadedImageURL.toBlob(function (blob){
- // // 创建form
- // var formData = new FormData();
- // formData.append('file', blob, uploadedImageName);
- // // 禁用cropper
- // // nzi.cropper('disable')
- // // ajax 上传
- // Wind.use("noty", function () {
- // $url="https://app.tjzhxx.cn:5443/api/Cos/savephoto";
- // $.ajax($url, {
- // method: "POST",
- // data: formData,
- // processData: false,
- // contentType: false,
- // success: function (e) {
- // delay_url = e.url
- // noty({text: e.msg,type: ((e.code == 0) ? 'error' : 'success'),layout: 'center'})
- // $('.eventBtn').prop('disabled', false);
- // $('.btnsave').html('<i class="fa fa-save"></i> 确认保存');
- // if(e.url != '') {
- // setTimeout(function(){ window.location.href = e.url }, (e.wait-1)*1000)
- // }
- // console.log(e)
- // },
- // error: function (e) {
- // noty({text: '网络连接失败。',type: 'error',layout: 'center'})
- // $('.eventBtn').prop('disabled', false);
- // $('.btnsave').html('<i class="fa fa-save"></i> 确认保存');
- // nzi.cropper('enable')
- // }
- // })
- // })
- // }, "image/jpeg", 0.85);
- });
- </script>
- </body>
- </html>
|