| | |
| | | box-shadow: none; |
| | | color: #222f3e; |
| | | } |
| | | .hide-btn{ |
| | | display: none; |
| | | } |
| | | .show-btn{ |
| | | width: 80%;position: absolute;bottom:10px;left: 55px; margin: 0 auto;letter-spacing: 2px; display: block; |
| | | } |
| | | </style> |
| | | |
| | | </head> |
| | |
| | | <label class="tox-label" for="form-field_8471486645261603941857554">链接</label> |
| | | <div class="tox-form__controls-h-stack"> |
| | | <div class="tox-control-wrap"> |
| | | <input type="url" aria-errormessage="aria-invalid_348682591591603941621447" role="combobox" aria-autocomplete="list" aria-haspopup="true" tabindex="-1" data-alloy-tabstop="true" class="tox-textfield" aria-expanded="false" id="upFileUrlID"> |
| | | <input readonly type="url" aria-errormessage="aria-invalid_348682591591603941621447" role="combobox" aria-autocomplete="list" aria-haspopup="true" tabindex="-1" data-alloy-tabstop="true" class="tox-textfield" aria-expanded="false" id="upFileUrlID"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <button title="上传文件" type="button" onclick="sendUpFile()" style="width: 80%;position: absolute;bottom:10px;left: 55px; margin: 0 auto;letter-spacing: 2px; display: block;" class="tox-button"><svg width="24" height="24" style="margin-top:5px;" ><path fill="#fff" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-8 9.4l-2.3 2.3a1 1 0 1 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L13 13.4V20a1 1 0 0 1-2 0v-6.6z" fill-rule="nonzero"></path></svg><span style="top:-6px; position: relative; margin-left:5px;">开始上传</span></button> |
| | | <label class="hide-btn" ><span style="color: #207ab7;margin-left: 40%">附件上传中.....</span></label> |
| | | <button title="上传文件" type="button" onclick="sendUpFile()" class="tox-button show-btn"><svg width="24" height="24" style="margin-top:5px;" ><path fill="#fff" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-8 9.4l-2.3 2.3a1 1 0 1 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L13 13.4V20a1 1 0 0 1-2 0v-6.6z" fill-rule="nonzero"></path></svg><span style="top:-6px; position: relative; margin-left:5px;">开始上传</span></button> |
| | | </div> |
| | | </ul> |
| | | </div> |
| | |
| | | var upload_handler = upfile.file_callback; |
| | | var upfileData = "" |
| | | var upfileUrl = null |
| | | var loading = false; |
| | | var hideBtn = document.querySelector('.hide-btn') |
| | | var showBtn = document.querySelector('.show-btn') |
| | | |
| | | function addFile(file){ |
| | | upfileData = file[0]; |
| | | document.getElementById('upfileNameID').value=file[0].name; |
| | |
| | | let inputUrl = document.getElementById('upFileUrlID'); |
| | | let inputText = document.getElementById('upFileTextID'); |
| | | function sendUpFile(){ |
| | | console.log(upfileData,'upfileData') |
| | | if(upfileData != ""){ |
| | | showBtn.style.display = 'none' |
| | | hideBtn.style.display = 'block' |
| | | } |
| | | upload_handler(upfileData,function(url,_obj){ |
| | | if(url!='失败'){ |
| | | inputUrl.value = url; |
| | | inputText.value ?'': inputText.value = url; |
| | | _obj&&_obj.text?inputText.value=_obj.text:''; |
| | | _obj&&_obj.originName?inputText.value=_obj.originName:''; |
| | | upfile.res.url = upfileUrl = url; |
| | | upfile.res.text = inputText.value; |
| | | |
| | | hideBtn.style.display = 'none' |
| | | showBtn.style.display = 'block' |
| | | }else { |
| | | hideBtn.style.display = 'none' |
| | | showBtn.style.display = 'block' |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | inputUrl.oninput = function(){upfile.res.url = inputUrl.value; upfileUrl=== null?inputText.value=inputUrl.value:'' } |