Commit e461e713 authored by 王启林's avatar 王启林

增加封面以及封面上传

parent 048a6db9
......@@ -34,18 +34,6 @@
</template>
</fc-designer>
</div>
<!-- <div class="tool">
<el-row>
<el-button icon="el-icon-download" type="primary" size="small" @click="getFormJson()"
round>生成表单JSON</el-button>
<el-button icon="el-icon-download" type="success" size="small" @click="getFormOption()"
round>生成表单配置</el-button>
<el-button icon="el-icon-upload" type="primary" size="small" @click="showDrawer"
round>移动端预览</el-button>
</el-row>
</div> -->
<el-drawer :visible.sync="drawer" title="预览">
<div class="showPhone">
<div class="phone">
......@@ -59,14 +47,20 @@
<el-dialog title="问卷发布" :visible.sync="issueDialog" width="30%" top="25vh">
<el-form :model="issueForm" :rules="issueRules" ref="issueForm">
<!-- <el-form-item label="问卷封面:" label-width="125px">
<el-form-item label="问卷封面:" label-width="125px">
<div style="display: flex;align-items: center;">
<img style="width:80px; height: 50px; margin-right: 10px;cursor: pointer;"
v-for="(i, j) in issueForm.cover" :key="j" :src="i" alt=""
<img style="width:80px; height: 80px; margin-right: 10px;cursor: pointer;"
v-for="(i, j) in coverImg" :key="j" :src="ImgUrl + '/' + i.url" alt=""
:class="selImg == j ? 'selImg' : ''" @click="selImg = j">
<el-upload v-show="coverImg.length < 4" :action="ImgUrl + '/attendance/file/commonupload'"
accept="image/jpeg,image/png,image/jpg" list-type="picture-card" class="upload"
auto-upload="false" :show-file-list="false" :before-upload="beforeAvatarUploada"
:on-success="handleUploadSuccess" :on-error="handleUploadError">
<i class="el-icon-plus"></i>
</el-upload>
</div>
<el-input v-model="issueForm.cover" autocomplete="off"></el-input>
</el-form-item> -->
</el-form-item>
<el-form-item label="反馈期限:" label-width="125px" prop="time">
<el-date-picker v-model="issueForm.time" type="datetimerange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss">
......@@ -74,7 +68,6 @@
</el-form-item>
<el-form-item label="邀请人员:" label-width="125px">
<el-button size="small" type="success" @click="treeDialog = 1">选择人员</el-button>
</el-form-item>
<div style="text-align: center;">
<el-button size="small" @click="issueDialog = false">取消</el-button>
......@@ -161,11 +154,6 @@ export default {
issueForm: {
id: '',
title: '',
cover: [
'http://sy.scsmile.cn/YX-JXgl/v1.0/HT/images/%E6%96%B0%E5%A2%9E%E5%8F%8D%E9%A6%88_%E7%AC%AC3%E6%AD%A5_/u26101.svg',
'http://sy.scsmile.cn/YX-JXgl/v1.0/HT/images/%E6%96%B0%E5%A2%9E%E5%8F%8D%E9%A6%88_%E7%AC%AC3%E6%AD%A5_/u26102.svg',
],
},
issueRules: {
time: [
......@@ -184,14 +172,17 @@ export default {
checkedUser: [],
checkAll: false,
checkAllArr: [],
editStyle: false,
loadingstate: false,
ImgUrl: process.env.VUE_APP_API_BASE_URL,
coverImg: []
}
},
mounted() {
console.log(process.env.VUE_APP_API_BASE_URL)
this.getDeptData()
let query = this.$route
console.log(query)
// console.log(query)
if (query.query.id) {
this.editStyle = true
this.feedbackId = query.query.id
......@@ -205,8 +196,74 @@ export default {
this.$refs.designer.setRule(this.Frule)
this.$refs.designer.setOption(this.Fopthion)
}
this.getFile()
},
methods: {
handleUploadSuccess(res) {
console.log(res)
this.coverImg.push(res)
console.log(this.coverImg)
this.$post('/feedback/file/save', {
feedbackFileName: res.fileName,
feedbackFilePath: res.url
}).then(res => {
console.log(res)
})
},
handleUploadError() {
this.$message({
type: "error",
message: "上传失败",
});
},
// 文件格式验证
beforeAvatarUploada(file) {
this.loadingstate = true;
let index = file.name.lastIndexOf(".");
let extension = file.name.substr(index + 1);
let extensionList = [
"png",
"PNG",
"jpg",
"JPG",
"jpeg",
"JPEG",
"bmp",
];
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
this.$message({
message: "封面不可超出10M",
type: "warning",
center: true,
});
return false;
} else if (extensionList.indexOf(extension) < 0) {
this.$message({
message: "当前文件格式不支持",
type: "error",
center: true,
});
return false;
} else {
console.log(file)
}
},
//获取问卷封面
getFile() {
this.$post('/feedback/file/list', { page: 1, size: 3 }).then(res => {
console.log(res)
res.data.data.forEach(i => {
i.url = i.feedbackFilePath
})
console.log(res.data.data)
this.coverImg = res.data.data
console.log(this.coverImg)
})
},
//提交选择的人员
subUser() {
console.log(this.checkedUser)
if (this.checkedUser.length > 0) {
......@@ -324,6 +381,7 @@ export default {
})
let sub = {
staffList: this.checkedUser,
id: this.feedbackId,
...this.titleForm,
......@@ -334,7 +392,8 @@ export default {
ruleContent: JSON.stringify(this.Fopthion),
feedbackQuestionList: [
...this.Frule
]
],
feedbackFilePath: this.coverImg[this.selImg].url
}
console.log(sub)
this.$post('/feedback/save', sub).then(res => {
......@@ -392,7 +451,7 @@ export default {
"children": [this.titleForm.remark],
"_fc_drag_tag": "span",
"hidden": false,
"display": true
"display": true,
}]
this.$refs.designer.setRule(rule)
}
......@@ -403,6 +462,29 @@ export default {
</script>
<style lang="less" scoped>
.upload {
width: 80px;
line-height: 80px;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
// border: 1px dashed #CCCCCC;
// color: #CCCCCC;
cursor: pointer;
}
// .upload:hover{
// border: 1px dashed #1a7af8;
// color: #1a7af8;
// }
/deep/.el-upload--picture-card {
width: 80px;
height: 80px;
line-height: 80px;
}
.treeDialog {
// border: 1px solid;
......
......@@ -91,7 +91,7 @@
<div style="text-align: center; margin-right: 40px;" v-for="j in i.optionList">
<el-progress type="circle"
:percentage="(j.optionCount / i.allCount * 100).toFixed(2)" show-text
width="75"></el-progress>
width="75"></el-progress>
<div>{{ j.optionContent }}</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment