Files
OpenAuth.Net/Vue2/public/ueditor/formdesign/el-input.html
2025-06-06 12:17:02 +08:00

84 lines
2.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<el-form ref="form" label-width="80px" size="mini">
<el-form-item :label="title">
<el-upload class="upload-demo" :action="baseURL +'/Files/Upload'" :on-success="handleSucess"
:file-list="fileList" :on-remove="handleRemove" name="files">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
</el-form-item>
</el-form>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
var GetQueryString = function(name) {
var search = decodeURI(decodeURI(window.location.search))
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
var r = search.substr(1).match(reg)
if (r != null) return unescape(r[2])
return null
}
// eslint-disable-next-line no-undef
var appVue = new Vue({
el: '#app',
data: {
baseURL: 'http://119.84.146.233:52789/api', // api的base_url
fileList: [],
title: ''
},
created() {
var info = GetQueryString('info')
if (info && info.length > 0) {
var infoObj = JSON.parse(info)
if (infoObj && infoObj.gValue != '') {
this.title = infoObj.gValue
}
}
},
methods: {
getInfo() {
return this.fileList
},
handleSucess(response, file, fileList) {
console.log(response)
console.log(file)
if (response.code == 200) {
if (response.result.length > 0) {
this.fileList.push({
name: response.result[0].fileName,
url: 'http://119.84.146.233:52789/' + response.result[0].filePath
})
}
}
},
handleRemove(file, fileList) {
var indexOf = fileList.indexOf(file)
this.fileList.split(indexOf, 1)
}
}
})
// eslint-disable-next-line no-unused-vars
var getData = function() {
return appVue.fileList
}
</script>
</html>