静态部分

上级 61a868a9
<template>
<div class="question-wrap">
<bread-crumb
:curmbFirst="curmbFirst"
:curmbSecond="curmbSecond">
<bread-crumb :curmbFirst="curmbFirst" :curmbSecond="curmbSecond">
</bread-crumb>
<div class="question-content screenSet" id="screenSet">
<el-row :gutter="30" class="row" type="flex" style="margin-top: 10px;">
<el-form ref="serchForm" :model="searchParam" label-width="75px" label-suffix=":" style="width:100%;">
<el-form
ref="serchForm"
:model="searchParam"
label-width="75px"
label-suffix=":"
style="width:100%;"
>
<el-col :span="6">
<el-form-item label="问卷名称">
<el-input v-model="searchParam.name" size="mini" placeholder="请输入问卷名称"></el-input>
<el-input
v-model="searchParam.name"
size="mini"
placeholder="请输入问卷名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态">
<el-select clearable v-model="searchParam.status" size="mini" placeholder="请选择问卷状态">
<el-select
clearable
v-model="searchParam.status"
size="mini"
placeholder="请选择问卷状态"
>
<el-option
v-for="(item,index) in statuSelect"
v-for="(item, index) in statuSelect"
:key="index"
:label="item.label"
:value="item.value">
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" style="text-align:right;padding:0 30px 15px 0;">
<el-button type="primary" size="small" @click="search(1)">查询</el-button>
<el-button type="default" size="small" @click="reseat">重置</el-button>
<el-button type="primary" size="small" @click="search(1)"
>查询</el-button
>
<el-button type="default" size="small" @click="reseat"
>重置</el-button
>
</el-col>
</el-form>
</el-row>
<el-button class="add-question" type="primary" size="small" @click="addQuestion">新增问卷</el-button>
<el-table
:data="tableData"
style="width: 100%" v-loading="loading">
<el-table-column prop="id" label="问卷编号" min-width="50" align="center"></el-table-column>
<el-table-column prop="name" label="问卷名称" min-width="100" align="center"></el-table-column>
<el-button
class="add-question"
type="primary"
size="small"
@click="addQuestion"
>新增问卷</el-button
>
<el-table :data="tableData" style="width: 100%" v-loading="loading">
<el-table-column
prop="id"
label="问卷编号"
min-width="50"
align="center"
></el-table-column>
<el-table-column
prop="name"
label="问卷名称"
min-width="100"
align="center"
></el-table-column>
<el-table-column label="最后修改人" min-width="50" align="center">
<template slot-scope="scope">
<span>{{ scope.row.modifiedId | modifyType(modifyArray) }}</span>
......@@ -51,11 +83,33 @@
<span>{{ scope.row.status | questionStatus }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" min-width="200">
<el-table-column
label="操作"
fixed="right"
align="center"
min-width="200"
>
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editQuestion(scope.row)">编辑</el-button>
<el-button type="primary" v-if="scope.row.status == 1" size="small" @click="onAndDownLine(scope.row)">上线</el-button>
<el-button type="primary" v-if="scope.row.status == 2" size="small" @click="onAndDownLine(scope.row)">下线</el-button>
<el-button
type="primary"
size="small"
@click="editQuestion(scope.row)"
>编辑</el-button
>
<el-button
type="primary"
v-if="scope.row.status == 1"
size="small"
@click="onAndDownLine(scope.row)"
>上线</el-button
>
<el-button
type="primary"
v-if="scope.row.status == 2"
size="small"
@click="onAndDownLine(scope.row)"
>下线</el-button
>
<!-- <el-button type="primary" size="small" @click="reviewQuestion(scope.row)">查看题库</el-button> -->
</template>
</el-table-column>
......@@ -76,7 +130,8 @@
:page-sizes="[15, 30, 50, 100, 200, 500, 700, 1000, 1500, 2000]"
:page-size="searchParam.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows">
:total="totalRows"
>
</el-pagination>
</div>
</div>
......@@ -86,20 +141,42 @@
:title="questionTitle"
:visible.sync="discussEditVisible"
:close-on-click-modal="false"
:close-on-press-escape="false">
<el-form ref="questionForm" :rules="rules" :model="questionEditList" label-width="220px" label-suffix=":" size="mini">
:close-on-press-escape="false"
>
<el-form
ref="questionForm"
:rules="rules"
:model="questionEditList"
label-width="220px"
label-suffix=":"
size="mini"
>
<el-form-item>
<el-radio-group v-model="questionEditList.showType" style="margin-left: -65px;">
<el-radio-group
v-model="questionEditList.showType"
style="margin-left: -65px;"
>
<el-radio :label="1">单题显示</el-radio>
<el-radio :label="2">平铺显示</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="问卷标题" prop="name">
<el-input v-model="questionEditList.name" maxlength="10" placeholder="标题最多10字符" style="width: 300px;"></el-input>
<el-input
v-model="questionEditList.name"
maxlength="30"
placeholder="标题最多30字符"
style="width: 300px;"
></el-input>
</el-form-item>
<el-form-item label="题库导入" prop="fileName">
<el-col :span="12">
<el-input class="form-input" :placeholder="excelFileName" v-model="fileName" disabled style="width: 99%;"/>
<el-input
class="form-input"
:placeholder="excelFileName"
v-model="fileName"
disabled
style="width: 99%;"
/>
</el-col>
<el-col :span="10">
<el-upload
......@@ -108,10 +185,13 @@
action="#"
accept=".xlsx"
:before-upload="beforeImport"
:limit="1">
:limit="1"
>
<el-button type="primary" size="mini">导入题库</el-button>
</el-upload>
<el-button type="default" size="mini" @click="uploadTemplate">模板下载</el-button>
<el-button type="default" size="mini" @click="uploadTemplate"
>模板下载</el-button
>
</el-col>
</el-form-item>
<el-form-item label="下一题按钮" v-if="questionEditList.showType == 1">
......@@ -122,12 +202,21 @@
class="avatar-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeAvatarUpload_1">
:before-upload="beforeAvatarUpload_1"
>
<el-button size="mini" type="primary">上传</el-button>
</el-upload>
<div class="uploat-content">
<img v-if="questionEditList.nextDisableClickUrl" :src="questionEditList.nextDisableClickUrl" class="bg-img">
<img v-if="!questionEditList.nextDisableClickUrl" class="bg-img" src="https://files.yunqueyi.com/image/png/common/20190408164003674.png">
<img
v-if="questionEditList.nextDisableClickUrl"
:src="questionEditList.nextDisableClickUrl"
class="bg-img"
/>
<img
v-if="!questionEditList.nextDisableClickUrl"
class="bg-img"
src="https://files.yunqueyi.com/image/png/common/20190408164003674.png"
/>
</div>
</div>
<div class="submit-btn">
......@@ -137,12 +226,21 @@
class="avatar-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeAvatarUpload_2">
:before-upload="beforeAvatarUpload_2"
>
<el-button size="mini" type="primary">上传</el-button>
</el-upload>
<div class="uploat-content">
<img v-if="questionEditList.nextClickUrl" :src="questionEditList.nextClickUrl" class="bg-img">
<img v-if="!questionEditList.nextClickUrl" class="bg-img" src="https://files.yunqueyi.com/image/png/common/20190408164015812.png">
<img
v-if="questionEditList.nextClickUrl"
:src="questionEditList.nextClickUrl"
class="bg-img"
/>
<img
v-if="!questionEditList.nextClickUrl"
class="bg-img"
src="https://files.yunqueyi.com/image/png/common/20190408164015812.png"
/>
</div>
</div>
</el-form-item>
......@@ -152,13 +250,42 @@
<el-radio :label="2">图片</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="副标题" v-if="questionEditList.showType == 2 && questionEditList.headStyle == 1">
<el-input v-model="questionEditList.subheading" maxlength="20" placeholder="副标题最多20字符" style="width: 300px;"></el-input>
<el-form-item
label="副标题"
v-if="
questionEditList.showType == 2 && questionEditList.headStyle == 1
"
>
<el-input
v-model="questionEditList.subheading"
maxlength="20"
placeholder="副标题最多20字符"
style="width: 300px;"
></el-input>
</el-form-item>
<el-form-item label="问卷导言" v-if="questionEditList.showType == 2">
<el-input v-model="questionEditList.questionIntro" maxlength="210" placeholder="最多210字符" style="width: 300px;"></el-input>
<el-input
v-model="questionEditList.questionIntro"
maxlength="210"
placeholder="最多210字符"
style="width: 300px;"
></el-input>
</el-form-item>
<el-form-item label="问卷起始时间" v-if="questionEditList.showType == 2 && questionEditList.headStyle == 1">
<el-form-item label="基本信息" v-if="questionEditList.showType == 2">
<el-checkbox
v-for="(item, index) in questionEditList.baseInfoList"
:label="item.typeValue"
:key="index"
v-model="item.checked"
>{{ item.typeName }}</el-checkbox
>
</el-form-item>
<el-form-item
label="问卷起始时间"
v-if="
questionEditList.showType == 2 && questionEditList.headStyle == 1
"
>
<el-date-picker
type="datetime"
placeholder="开始时间"
......@@ -178,19 +305,34 @@
>
</el-date-picker>
</el-form-item>
<div v-if="questionEditList.showType == 2 && questionEditList.headStyle == 2">
<div
v-if="
questionEditList.showType == 2 && questionEditList.headStyle == 2
"
>
<el-form-item class="submit-btn" label="头图">
<el-upload
v-model="questionEditList.headDiagramUrl"
class="avatar-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeAvatarUpload_4">
<el-button class="head-btn" size="mini" type="primary">上传</el-button>
:before-upload="beforeAvatarUpload_4"
>
<el-button class="head-btn" size="mini" type="primary"
>上传</el-button
>
</el-upload>
<div class="uploat-content">
<img v-if="questionEditList.headDiagramUrl" :src="questionEditList.headDiagramUrl" class="head-bg-img">
<img v-if="!questionEditList.headDiagramUrl" class="head-bg-img" src="../../assets/image/default.png">
<img
v-if="questionEditList.headDiagramUrl"
:src="questionEditList.headDiagramUrl"
class="head-bg-img"
/>
<img
v-if="!questionEditList.headDiagramUrl"
class="head-bg-img"
src="../../assets/image/default.png"
/>
</div>
</el-form-item>
</div>
......@@ -200,73 +342,135 @@
class="avatar-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeAvatarUpload_3">
:before-upload="beforeAvatarUpload_3"
>
<el-button size="mini" type="primary">上传</el-button>
</el-upload>
<div class="uploat-content">
<img v-if="questionEditList.submitButtomUrl" :src="questionEditList.submitButtomUrl" class="bg-img">
<img v-if="!questionEditList.submitButtomUrl" class="bg-img" src="https://files.yunqueyi.com/image/png/common/20190408164026451.png">
<img
v-if="questionEditList.submitButtomUrl"
:src="questionEditList.submitButtomUrl"
class="bg-img"
/>
<img
v-if="!questionEditList.submitButtomUrl"
class="bg-img"
src="https://files.yunqueyi.com/image/png/common/20190408164026451.png"
/>
</div>
</el-form-item>
<el-form-item label="问卷填写完毕提示文案" prop="promptCopy">
<el-input v-model="questionEditList.promptCopy" maxlength="40" style="width: 300px;"></el-input>
<span style="font-size:12px;">标题最多40字符</span>
<el-input
v-model="questionEditList.promptCopy"
maxlength="40"
style="width: 300px;"
></el-input>
<span style="font-size:12px;">限40字符</span>
</el-form-item>
<el-form-item
label="登录权限控制"
v-if="questionEditList.showType == 2"
>
<div class="login-auth">
<el-checkbox
v-for="(item, index) in questionEditList.loginAuthList"
:label="item.typeValue"
:key="index"
v-model="item.checked"
>{{ item.typeName }}</el-checkbox
>
</div>
</el-form-item>
<el-form-item
label="问卷填写次数"
v-if="questionEditList.showType == 2"
>
<el-radio v-model="questionEditList.limitNumFlag" label="0">
<el-input
v-model="questionEditList.limitNum"
controls-position="right"
:min="1"
style="width: 100px;"
@blur="checkLimitNum"
@focus="questionEditList.limitNumFlag = '0'"
></el-input>
</el-radio>
<el-radio v-model="questionEditList.limitNumFlag" label="1"
>不限制填写次数</el-radio
>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align:center;">
<el-button type="primary" size="small" @click="submitQuestion" style="width:120px;">提交</el-button>
<el-button
type="primary"
size="small"
@click="submitQuestion"
style="width:120px;"
>提交</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import BreadCrumb from '../../components/breadcrumb.vue'
import * as commonUtil from '../../utils/utils'
import { getFilePath, doUpload } from '../../utils/qiniu-util'
import { QUESTION_UPLOAD_TEMPLATE } from '../../utils/constants'
let vm = null
import BreadCrumb from "../../components/breadcrumb.vue";
import * as commonUtil from "../../utils/utils";
import { getFilePath, doUpload } from "../../utils/qiniu-util";
import { QUESTION_UPLOAD_TEMPLATE } from "../../utils/constants";
let vm = null;
export default {
components: {
BreadCrumb
},
data() {
return {
curmbFirst: '组件',
curmbSecond: '问卷管理',
questionTitle: '问卷新增/编辑',
curmbFirst: "组件",
curmbSecond: "问卷管理",
questionTitle: "问卷新增/编辑",
discussEditVisible: false,
excelFileName: '',
fileName: '',
excelFileName: "",
fileName: "",
fileArray: [],
tableData: [],
totalRows: 0,
loading:false,
loading: false,
searchParam: {
name: '',
status: '',
name: "",
status: "",
pageSize: 15,
pageNo: 1
},
modifyArray: [],
questionEditList: {
id: '',
id: "",
showType: 1,
name: '',
nextDisableClickUrl: '',
nextClickUrl: '',
submitButtomUrl: '',
promptCopy: '',
headDiagramUrl: '',
name: "",
nextDisableClickUrl: "",
nextClickUrl: "",
submitButtomUrl: "",
promptCopy: "",
headDiagramUrl: "",
headStyle: 1,
subheading: '',
questionIntro: '',
startDate: '',
endDate: ''
subheading: "",
baseInfoList: [], //基本信息
questionIntro: "",
startDate: "",
endDate: "",
loginAuthList: [], //登录权限控制
limitNumFlag: "0", //填写次数flag
limitNum: 1 //填写次数
},
endDateOpt: {
disabledData: (time) => {
if ( this.questionEditList.endDate != "" && this.questionEditList.endDate != null) {
return time.getTime() > new Date(this.questionEditList.startDate).getTime();
disabledData: time => {
if (
this.questionEditList.endDate != "" &&
this.questionEditList.endDate != null
) {
return (
time.getTime() >
new Date(this.questionEditList.startDate).getTime()
);
}
}
},
......@@ -278,251 +482,332 @@ export default {
}
},
rules: {
name: [
{ required: true, message: '请输入问卷标题', trigger: 'blur' }
],
name: [{ required: true, message: "请输入问卷标题", trigger: "blur" }],
promptCopy: [
{ required: true, message: '请输入问卷填写完毕提示文案', trigger: 'blur' }
{
required: true,
message: "请输入问卷填写完毕提示文案",
trigger: "blur"
}
]
},
statuSelect: [
{
label: '下线',
label: "下线",
value: 1
},{
label: '上线',
},
{
label: "上线",
value: 2
}
]
}
};
},
created() {
vm = this
vm.search()
vm.getAllModify()
vm = this;
vm.search();
vm.getAllModify();
},
// 挂载到Dom完成时
mounted: function() {
commonUtil.resizeHeight()
commonUtil.resizeHeight();
},
methods: {
// 查询
search(flag) {
if(flag) vm.searchParam.pageNo = 1
vm.GET('/campaign/adminQuestionnaire/queryList',vm.searchParam).then((res) => {
if(res.code == '000000') {
vm.tableData = res.data.questionnaireList
vm.totalRows = res.data.total
if (flag) vm.searchParam.pageNo = 1;
vm.GET("/campaign/adminQuestionnaire/queryList", vm.searchParam).then(
res => {
if (res.code == "000000") {
vm.tableData = res.data.questionnaireList;
vm.totalRows = res.data.total;
}
})
}
);
},
handleSizeChange(value) {
vm.searchParam.pageSize = value
vm.search()
vm.searchParam.pageSize = value;
vm.search();
},
handleCurrentChange(value) {
vm.searchParam.pageNo = value
vm.search()
vm.searchParam.pageNo = value;
vm.search();
},
reseat() {
vm.searchParam.name = ''
vm.searchParam.status = ''
vm.search()
vm.searchParam.name = "";
vm.searchParam.status = "";
vm.search();
},
// 获取所有修改人
getAllModify() {
vm.GET('/campaign/adminQuestionnaire/getAllUser').then((res) => {
if(res.code == '000000') {
vm.modifyArray = res.data
vm.GET("/campaign/adminQuestionnaire/getAllUser").then(res => {
if (res.code == "000000") {
vm.modifyArray = res.data;
}
})
});
},
// 新增问卷
addQuestion() {
vm.discussEditVisible = true
vm.discussEditVisible = true;
if (vm.$refs.questionForm !== undefined) {
vm.$refs.questionForm.resetFields();
}
vm.questionEditList = Object.assign({},{
id: '',
vm.questionEditList = Object.assign(
{},
{
id: "",
showType: 1,
name: '',
nextDisableClickUrl: '',
nextClickUrl: '',
submitButtomUrl: '',
promptCopy: '',
headDiagramUrl: '',
name: "",
nextDisableClickUrl: "",
nextClickUrl: "",
submitButtomUrl: "",
promptCopy: "您已成功提交问卷,感谢您的参与!",
headDiagramUrl: "",
headStyle: 1,
subheading: '',
questionIntro: '',
startDate: '',
endDate: ''
});
vm.fileName = ''
vm.fileArray = []
vm.excelFileName = ''
subheading: "",
baseInfoList: [
{
typeName: "姓名",
typeValue: "name",
checked: true
},
{
typeName: "手机号",
typeValue: "mobile",
checked: false
},
{
typeName: "地址",
typeValue: "address",
checked: false
}
],
questionIntro: "",
startDate: "",
endDate: "",
loginAuthList: [
{
typeName: "云鹊医app",
typeValue: "1",
checked: true
},
{
typeName: "云鹊医h5",
typeValue: "2",
checked: false
}
],
limitNumFlag: "0",
limitNum: 1
}
);
vm.fileName = "";
vm.fileArray = [];
vm.excelFileName = "";
},
// 编辑
editQuestion(row) {
if (vm.$refs.questionForm !== undefined) {
vm.$refs.questionForm.resetFields();
}
vm.discussEditVisible = true
vm.excelFileName = ''
vm.fileName = ''
vm.fileArray = []
vm.GET('/campaign/adminQuestionnaire/getQuestionnaireById',{id:row.id}).then((res) => {
if(res.code == '000000') {
vm.questionEditList = Object.assign({},res.data)
vm.discussEditVisible = true;
vm.excelFileName = "";
vm.fileName = "";
vm.fileArray = [];
vm.GET("/campaign/adminQuestionnaire/getQuestionnaireById", {
id: row.id
}).then(res => {
if (res.code == "000000") {
console.log(res.data);
vm.questionEditList = Object.assign({}, res.data);
vm.questionEditList.limitNumFlag = res.data.limitNum < 1 ? "0" : "1";
}
})
});
},
// 上线/下线
onAndDownLine(row) {
let req = null
if(row.status == 1) {
let req = null;
if (row.status == 1) {
req = {
id: row.id,
status: 2
}
};
} else {
req = {
id: row.id,
status: 1
};
}
vm.GET("/campaign/adminQuestionnaire/upperOrLowerShip", req).then(res => {
if (res.code == "000000") {
vm.search();
}
vm.GET('/campaign/adminQuestionnaire/upperOrLowerShip',req).then((res) => {
if(res.code == '000000') {
vm.search()
}
})
});
},
// 导入题库
beforeImport(file) {
if (commonUtil.isEmptyUtils(file)) return;
let arr = file.type.split('/');
let arr = file.type.split("/");
let ext = "." + arr[1];
let reader = new FileReader();
reader.onload = function (e) {
reader.onload = function(e) {
let fileJson = {
fileName: file.name,
file: e.target.result.substr(e.target.result.indexOf("base64,") + 7),
ext: ext
};
vm.fileArray = [{
vm.fileArray = [
{
base64: fileJson
}];
}
];
vm.fileName = file.name;
vm.excelFileName = file.name;
vm.$message.info('读取完毕');
vm.$message.info("读取完毕");
};
reader.readAsDataURL(file);
},
// 模板下载
uploadTemplate() {
window.location.href = QUESTION_UPLOAD_TEMPLATE
window.location.href = QUESTION_UPLOAD_TEMPLATE;
},
// 置灰不可点图片上传
beforeAvatarUpload_1(file) {
if (commonUtil.isEmptyUtils(file)) return;
vm.imgDoUpload(file,1,50,750,100)
vm.imgDoUpload(file, 1, 50, 750, 100);
},
// 点亮图片上传
beforeAvatarUpload_2(file) {
if (commonUtil.isEmptyUtils(file)) return;
vm.imgDoUpload(file,2,50,750,100)
vm.imgDoUpload(file, 2, 50, 750, 100);
},
// 提交图片上传
beforeAvatarUpload_3(file) {
if (commonUtil.isEmptyUtils(file)) return;
vm.imgDoUpload(file,3,50,750,100)
vm.imgDoUpload(file, 3, 50, 750, 100);
},
// 头图图片上传
beforeAvatarUpload_4(file) {
if (commonUtil.isEmptyUtils(file)) return;
vm.imgDoUpload(file,4,100,750,468)
vm.imgDoUpload(file, 4, 1024, 750, -1);
},
imgDoUpload(file,urlType,size,w,h) {
imgDoUpload(file, urlType, size, w, h) {
const isSize = file.size / 1024 < size;
if(!isSize) {
vm.$message.info('上传图片要小于' + size + 'k')
if (!isSize) {
if (size / 1024) {
vm.$message.info("上传图片要小于" + size / 1024 + "M");
} else {
vm.$message.info("上传图片要小于" + size + "k");
}
return;
}
var _img = new FileReader()
_img.readAsDataURL(file)
var _img = new FileReader();
_img.readAsDataURL(file);
_img.onload = function(theFile) {
let image = new Image()
image.src = theFile.target.result
let image = new Image();
image.src = theFile.target.result;
image.onload = function() {
let _this = this
if( _this.width != w || _this.height != h) {
vm.$message.info("上传图片尺寸应为"+ w +"*"+ h +",请重新上传")
}else {
vm.$message.info('开始上传');
doUpload(vm,file, getFilePath(file,null), 'preview4', 'progress1', 1).then(function (path) {
if(urlType == 1) {
vm.questionEditList.nextDisableClickUrl = path.fullPath
}else if(urlType == 2) {
vm.questionEditList.nextClickUrl = path.fullPath
}else if(urlType == 3) {
vm.questionEditList.submitButtomUrl = path.fullPath
}else {
vm.questionEditList.headDiagramUrl = path.fullPath
}
vm.$message.success('上传成功')
});
let _this = this;
let uploadFlag = false;
if (h == -1) {
if (_this.width != w) {
vm.$message.info("上传图片宽度应为" + w + ",请重新上传");
} else {
uploadFlag = true;
}
} else {
if (_this.width != w || _this.height != h) {
vm.$message.info(
"上传图片尺寸应为" + w + "*" + h + ",请重新上传"
);
} else {
uploadFlag = true;
}
}
if (uploadFlag) {
vm.$message.info("开始上传");
doUpload(
vm,
file,
getFilePath(file, null),
"preview4",
"progress1",
1
).then(function(path) {
if (urlType == 1) {
vm.questionEditList.nextDisableClickUrl = path.fullPath;
} else if (urlType == 2) {
vm.questionEditList.nextClickUrl = path.fullPath;
} else if (urlType == 3) {
vm.questionEditList.submitButtomUrl = path.fullPath;
} else {
vm.questionEditList.headDiagramUrl = path.fullPath;
}
vm.$message.success("上传成功");
});
}
};
};
},
// 提交
submitQuestion() {
let req = {
model: vm.questionEditList,
fileArray: vm.fileArray
};
if (vm.questionEditList.showType == 1) {
// 单题显示
vm.questionEditList.subheading = "";
vm.questionEditList.questionIntro = "";
vm.questionEditList.headDiagramUrl = "";
} else {
vm.questionEditList.nextDisableClickUrl = "";
vm.questionEditList.nextClickUrl = "";
if (vm.questionEditList.headStyle == 1) {
// 文字
vm.questionEditList.headDiagramUrl = "";
} else {
vm.questionEditList.subheading = "";
vm.questionEditList.startDate = "";
vm.questionEditList.endDate = "";
}
if(vm.questionEditList.showType == 1) { // 单题显示
vm.questionEditList.subheading = ''
vm.questionEditList.questionIntro = ''
vm.questionEditList.headDiagramUrl = ''
}else {
vm.questionEditList.nextDisableClickUrl = ''
vm.questionEditList.nextClickUrl = ''
if(vm.questionEditList.headStyle == 1) { // 文字
vm.questionEditList.headDiagramUrl = ''
}else {
vm.questionEditList.subheading = ''
vm.questionEditList.startDate = ''
vm.questionEditList.endDate = ''
}
if (!vm.questionEditList.id) {
if (commonUtil.isEmptyList(vm.fileArray)) {
vm.$message.info("请导入题库");
return;
}
if(!vm.questionEditList.id) {
if(commonUtil.isEmptyList(vm.fileArray)) {
vm.$message.info('请导入题库')
return
}
vm.$refs.questionForm.validate(valid => {
if (valid) {
commonUtil.openLoading(vm);
vm.POST(
"/campaign/adminQuestionnaire/insertOrUpdateQuestionnaire",
req
).then(res => {
commonUtil.closeLoading(vm);
if (res.code == "000000") {
vm.discussEditVisible = false;
vm.search();
} else {
vm.$message.info(res.message);
}
vm.$refs.questionForm.validate((valid) => {
if(valid) {
commonUtil.openLoading(vm)
vm.POST('/campaign/adminQuestionnaire/insertOrUpdateQuestionnaire',req).then((res) => {
commonUtil.closeLoading(vm)
if(res.code == '000000') {
vm.discussEditVisible = false
vm.search()
}else {
vm.$message.info(res.message)
});
}
})
});
},
// 校验输入数字为正整数
checkLimitNum() {
const regexp = /^[1-9]\d*$/;
if (!regexp.test(vm.questionEditList.limitNum)) {
vm.questionEditList.limitNum = 1;
}
})
}
}
}
};
</script>
<style lang="scss" scoped>
.question-wrap {
.question-wrap {
.question-content {
background: #fff;
.add-question {
......@@ -530,7 +815,7 @@ export default {
margin: 10px;
}
.table-empty {
img{
img {
width: 100px;
}
p {
......@@ -565,7 +850,15 @@ export default {
}
}
}
.login-auth {
width: 400px;
.el-checkbox {
display: inline-block;
width: 150px;
text-align: left;
}
}
}
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册