增加微信登录流程(需调整)
This commit is contained in:
@@ -125,7 +125,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getUserInfo']),
|
...mapActions(['getUserInfo', "getCode"]),
|
||||||
getForm() {
|
getForm() {
|
||||||
let {id} = this.$route.query
|
let {id} = this.$route.query
|
||||||
this.$http.post("/app/appquestionnairetemplate/queryDetailById", null, {
|
this.$http.post("/app/appquestionnairetemplate/queryDetailById", null, {
|
||||||
@@ -239,8 +239,10 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.getUserInfo().then(() => {
|
this.getUserInfo().then(res => {
|
||||||
if (!!this.openUser?.openId) {
|
if (res == "getCode") {
|
||||||
|
this.getCode({url: location.href})
|
||||||
|
} else if (!!this.openUser?.openId) {
|
||||||
this.checkForm()?.then(() => this.checkUser && this.getForm())
|
this.checkForm()?.then(() => this.checkUser && this.getForm())
|
||||||
} else {
|
} else {
|
||||||
this.result = {
|
this.result = {
|
||||||
@@ -252,7 +254,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}).catch()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,700 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="add-form" v-if="pageShow">
|
|
||||||
<div class="header-pic">
|
|
||||||
<image v-if="form.headPicture" :src="form.headPicture" />
|
|
||||||
<span @click="upload">更换图片</span>
|
|
||||||
</div>
|
|
||||||
<div class="form-info">
|
|
||||||
<h2>文本选项</h2>
|
|
||||||
<div class="form-info__wrapper">
|
|
||||||
<textarea class="title" placeholder="请输入标题 (必填)" :maxlength="30" :auto-height="true" v-model="form.title"></textarea>
|
|
||||||
<u-input class="content" :clearable="false" type="textarea" v-model="form.tableExplain" placeholder="请输入表单描述 (选填)" :height="80" :auto-height="true" :maxlength="255"></u-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<draggable
|
|
||||||
class="components-list"
|
|
||||||
v-model="targetList"
|
|
||||||
:animation="340"
|
|
||||||
scroll
|
|
||||||
element="div"
|
|
||||||
:options="{
|
|
||||||
animation: 340,
|
|
||||||
handle: '.components-item__title'
|
|
||||||
}"
|
|
||||||
draggable=".components-item"
|
|
||||||
:sort="true">
|
|
||||||
<div class="components-item" v-for="(item, index) in targetList" :key="index" @click="toFiledSetting(item, index)">
|
|
||||||
<div class="components-item__title">
|
|
||||||
<div class="components-item__title--left">
|
|
||||||
<em :style="{opacity: item.required ? 1 : 0}">*</em>
|
|
||||||
<i>{{ index + 1 }}.</i>
|
|
||||||
<h2>{{ item.label }}</h2>
|
|
||||||
</div>
|
|
||||||
<image :src="`${$cdn}askform/sc1.png`" @click.stop="removeComponent(index)" @touchstart.stop="removeComponent(index)" />
|
|
||||||
</div>
|
|
||||||
<div class="components-item__filed">
|
|
||||||
<template v-if="(item.type === 'radio')">
|
|
||||||
<u-radio-group v-model="item.value" wrap>
|
|
||||||
<u-radio disabled :name="field.label" v-for="(field, i) in item.options" :key="i">
|
|
||||||
<image :src="field.img[0].url" v-if="field.img.length"/>
|
|
||||||
<span>{{ field.label }}</span>
|
|
||||||
</u-radio>
|
|
||||||
</u-radio-group>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'checkbox')">
|
|
||||||
<u-checkbox-group v-model="item.value" wrap>
|
|
||||||
<u-checkbox disabled :name="field.label" v-for="(field, i) in item.options" :key="i">
|
|
||||||
<image :src="field.img[0].url" v-if="field.img.length"/>
|
|
||||||
<span>{{ field.label }}</span>
|
|
||||||
</u-checkbox>
|
|
||||||
</u-checkbox-group>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'select')">
|
|
||||||
<div class="components-item__select">
|
|
||||||
<span>{{ item.placeholder }}</span>
|
|
||||||
<u-icon name="arrow-down" color="#DEDFDF" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'upload')">
|
|
||||||
<div class="components-item__select components-item__textarea components-item__upload">
|
|
||||||
<image :src="`${$cdn}askform/upload.png`" />
|
|
||||||
<span>选择图片(2M以内)</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'input')">
|
|
||||||
<div class="components-item__select">
|
|
||||||
<span>{{ item.placeholder }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'textarea')">
|
|
||||||
<div class="components-item__select components-item__textarea">
|
|
||||||
<span>{{ item.placeholder }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</draggable>
|
|
||||||
<div class="add-form__btn" @click="isShow = true">
|
|
||||||
<image :src="`${$cdn}askform/add.png`" />
|
|
||||||
<span>添加问题</span>
|
|
||||||
</div>
|
|
||||||
<div class="add-form__footer">
|
|
||||||
<div>
|
|
||||||
<span @click="toPreview">预览</span>
|
|
||||||
<span @click="toSetting">设置</span>
|
|
||||||
</div>
|
|
||||||
<div @click="onConfirm">立即发布</div>
|
|
||||||
</div>
|
|
||||||
<u-popup v-model="isShow" :closeable="false" mode="bottom">
|
|
||||||
<div class="add-popup">
|
|
||||||
<div class="add-popup__title">
|
|
||||||
<h2>添加问题</h2>
|
|
||||||
<image :src="`${$cdn}askform/zk.png`" mode="aspectFit" @click="isShow = false" />
|
|
||||||
</div>
|
|
||||||
<div class="add-popup__list">
|
|
||||||
<span @click="toFiledSetting('radio')">单选题</span>
|
|
||||||
<span @click="toFiledSetting('checkbox')">多选题</span>
|
|
||||||
<span @click="toFiledSetting('select')">单下拉框</span>
|
|
||||||
<span @click="toFiledSetting('input')">单行填空</span>
|
|
||||||
<span @click="toFiledSetting('textarea')">多行填空</span>
|
|
||||||
<span @click="toFiledSetting('upload')">上传图片</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</u-popup>
|
|
||||||
<AiBack></AiBack>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import AiBack from "@/components/AiBack";
|
|
||||||
import draggable from 'vuedraggable'
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
pageShow: false,
|
|
||||||
form: {
|
|
||||||
tableExplain: '详细描述',
|
|
||||||
title: '问卷调查',
|
|
||||||
isShowheadPicture: true,
|
|
||||||
isShowTableExplain: true,
|
|
||||||
isShowBtn: true,
|
|
||||||
headPicture: '',
|
|
||||||
commitType: '1',
|
|
||||||
periodValidityType: '0',
|
|
||||||
actionNotice: '1',
|
|
||||||
dynamicNotice: '1',
|
|
||||||
periodValidityEndTime: '',
|
|
||||||
shareStatus: '0',
|
|
||||||
count: 0,
|
|
||||||
wechatId: '0',
|
|
||||||
type: 0,
|
|
||||||
buttonExplain: '提交',
|
|
||||||
tips: true
|
|
||||||
},
|
|
||||||
templateType: 0,
|
|
||||||
targetList: [],
|
|
||||||
isShow: false,
|
|
||||||
type: 0,
|
|
||||||
id: '',
|
|
||||||
isQuote: false,
|
|
||||||
touchStart: 0,
|
|
||||||
formConfig: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
AiBack,
|
|
||||||
draggable
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad (query) {
|
|
||||||
this.type = Number(query.type)
|
|
||||||
|
|
||||||
if (query.isQuote) {
|
|
||||||
this.isQuote = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.id) {
|
|
||||||
this.id = query.id
|
|
||||||
this.getInfo(query.id)
|
|
||||||
} else {
|
|
||||||
this.pageShow = true
|
|
||||||
}
|
|
||||||
this.init()
|
|
||||||
|
|
||||||
uni.$on('setting', res => {
|
|
||||||
this.form = {
|
|
||||||
...this.form,
|
|
||||||
...res
|
|
||||||
}
|
|
||||||
this.formConfig = res
|
|
||||||
})
|
|
||||||
|
|
||||||
uni.$on('filedConfig', res => {
|
|
||||||
if (res.index === '-1') {
|
|
||||||
this.targetList.push(res.config)
|
|
||||||
} else {
|
|
||||||
this.$set(this.targetList, [res.index], res.config)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
toSetting () {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/askForm/formSetting?id=${this.id}&formConfig=${JSON.stringify(this.formConfig)}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
removeComponent (index) {
|
|
||||||
this.targetList.splice(index, 1)
|
|
||||||
},
|
|
||||||
|
|
||||||
toPreview () {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/askForm/previewForm?targetList=${JSON.stringify(this.targetList)}&form=${JSON.stringify(this.form)}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
upload() {
|
|
||||||
let params = {
|
|
||||||
count: 1,
|
|
||||||
sizeType: ['compressed'],
|
|
||||||
sourceType: ['album', 'camera'],
|
|
||||||
success: (res) => {
|
|
||||||
let count = this.fileList?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0)
|
|
||||||
if (count > 1) {
|
|
||||||
return this.$u.toast(`不能超过1个`)
|
|
||||||
}
|
|
||||||
if (res.tempFiles) {
|
|
||||||
res.tempFiles.map((item) => {
|
|
||||||
this.uploadFile(item)
|
|
||||||
})
|
|
||||||
} else if (res?.tempFile) {
|
|
||||||
this.uploadFile(res.tempFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uni.chooseImage(params)
|
|
||||||
},
|
|
||||||
|
|
||||||
uploadFile (img) {
|
|
||||||
uni.showLoading({title: '上传中'})
|
|
||||||
let formData = new FormData()
|
|
||||||
formData.append('file', img)
|
|
||||||
this.$http.post('/admin/file/add2', formData).then((res) => {
|
|
||||||
uni.hideLoading()
|
|
||||||
if (res?.data) {
|
|
||||||
this.$u.toast('上传成功!')
|
|
||||||
this.form.headPicture = res.data.url
|
|
||||||
}
|
|
||||||
}).catch(res => {
|
|
||||||
this.$u.toast(res)
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onConfirm () {
|
|
||||||
for (let item of this.targetList) {
|
|
||||||
if (item.isShowPoints) {
|
|
||||||
if (item.pointType === '0') {
|
|
||||||
if (!item.answer || JSON.stringify(item.answer) === '[]') {
|
|
||||||
return this.$u.toast(`请输入${item.label}正确答案`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item.points) {
|
|
||||||
return this.$u.toast(`请输入${item.label}的分值`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.pointType === '1') {
|
|
||||||
for (let option of item.options) {
|
|
||||||
if (!option.point) {
|
|
||||||
return this.$u.toast(`请输入${item.label}${option.label}的分值`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.pointType === '2') {
|
|
||||||
for (let option of item.options) {
|
|
||||||
if (!option.point) {
|
|
||||||
return this.$u.toast(`请输入${item.label}${option.label}的分值`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item.points) {
|
|
||||||
return this.$u.toast(`请输入${item.label}全部答对分值`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fields = this.targetList.map(item => {
|
|
||||||
return {
|
|
||||||
fieldType: item.type,
|
|
||||||
fieldName: item.label,
|
|
||||||
fieldInfo: JSON.stringify(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/addOrUpdate`, {
|
|
||||||
...this.form,
|
|
||||||
fields,
|
|
||||||
status: 1,
|
|
||||||
id: this.isQuote ? '' : this.id,
|
|
||||||
headPicture: this.form.headPicture,
|
|
||||||
type: this.type,
|
|
||||||
templateType: 0
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.$u.toast('提交成功')
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.$emit('reload')
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
}, 600)
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
this.$u.toast(e)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
getInfo (id) {
|
|
||||||
uni.showLoading()
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.form = {
|
|
||||||
...res.data,
|
|
||||||
headPicture: res.data.headPicture
|
|
||||||
}
|
|
||||||
|
|
||||||
this.type = res.data.type
|
|
||||||
|
|
||||||
this.targetList = res.data.fields.map(item => {
|
|
||||||
return JSON.parse(item.fieldInfo)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.pageShow = true
|
|
||||||
} else {
|
|
||||||
this.$u.toast(res.msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.hideLoading()
|
|
||||||
}).catch(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
toFiledSetting (type, index) {
|
|
||||||
if (index != undefined) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/askForm/filedConfig?config=${JSON.stringify(type)}&index=${index}`
|
|
||||||
})
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isShow = false
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/askForm/filedConfig?type=${type}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
init () {
|
|
||||||
if (this.type == 0) {
|
|
||||||
this.form.headPicture = 'https://cdn.cunwuyun.cn/dvcp/h5/form/interview.png'
|
|
||||||
}
|
|
||||||
if (this.type == 1) {
|
|
||||||
this.form.title = '考试测评'
|
|
||||||
this.form.headPicture = 'https://cdn.cunwuyun.cn/dvcp/h5/form/exam.png'
|
|
||||||
}
|
|
||||||
if (this.type == 2) {
|
|
||||||
this.form.title = '报名登记'
|
|
||||||
this.form.headPicture = 'https://cdn.cunwuyun.cn/dvcp/h5/form/apply.png'
|
|
||||||
}
|
|
||||||
if (this.type == 3) {
|
|
||||||
this.form.title = '满意调查'
|
|
||||||
this.form.headPicture = 'https://cdn.cunwuyun.cn/dvcp/h5/form/satisfaction.png'
|
|
||||||
}
|
|
||||||
if (this.type == 4) {
|
|
||||||
this.form.title = '投票评选'
|
|
||||||
this.form.headPicture = 'https://cdn.cunwuyun.cn/dvcp/h5/form/vote.png'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.add-form {
|
|
||||||
min-height: 100vh;
|
|
||||||
padding-bottom: 140px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background: #F3F6F9;
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-drawer-bottom {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-list {
|
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
.components-item {
|
|
||||||
margin-top: 24px;
|
|
||||||
padding: 32px;
|
|
||||||
box-shadow: 0 4px 8px 4px rgba(233, 233, 233, 0.39);
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
border: 1px solid #EEEFF0;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
::v-deep .u-radio, ::v-deep .u-checkbox {
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.u-checkbox__icon-wrap, .u-radio__icon-wrap {
|
|
||||||
position: absolute;
|
|
||||||
top: 4rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.u-radio__label, .u-checkbox__label {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-right: 0;
|
|
||||||
margin-left: 40px;
|
|
||||||
text-align: justify;
|
|
||||||
|
|
||||||
span {
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100px;
|
|
||||||
height: 100px;
|
|
||||||
margin: 0 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
flex: 1;
|
|
||||||
color: #666;
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-item__select {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: 100%;
|
|
||||||
height: 80px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
padding: 0 26px;
|
|
||||||
border: 1px solid #DEDFDF;
|
|
||||||
|
|
||||||
&.components-item__textarea {
|
|
||||||
align-items: flex-start;
|
|
||||||
height: 160px;
|
|
||||||
padding-top: 20px;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 46px;
|
|
||||||
height: 34px;
|
|
||||||
margin-right: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #666;
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.components-item__upload {
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-item__title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 32px;
|
|
||||||
|
|
||||||
em {
|
|
||||||
margin-right: 4px;
|
|
||||||
font-style: normal;
|
|
||||||
color: rgb(226, 33, 32);;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
position: relative;
|
|
||||||
flex-shrink: 1;
|
|
||||||
right: -20px;
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
box-sizing: content-box;
|
|
||||||
padding: 30px 20px 30px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
max-width: 550px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-popup {
|
|
||||||
height: 440px;
|
|
||||||
border-radius: 20px 20px 0 0;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.add-popup__title {
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 96px;
|
|
||||||
border-bottom: 1px solid #E4E5E6;
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
position: absolute;
|
|
||||||
right: 32px;
|
|
||||||
top: 50%;
|
|
||||||
width: 30px;
|
|
||||||
height: 20px;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-popup__list {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 0 34px;
|
|
||||||
|
|
||||||
span {
|
|
||||||
width: calc((100% - 64px) / 3);
|
|
||||||
height: 78px;
|
|
||||||
line-height: 78px;
|
|
||||||
margin-top: 32px;
|
|
||||||
margin-right: 32px;
|
|
||||||
text-align: center;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 28px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #E4E5E6;
|
|
||||||
|
|
||||||
&:nth-of-type(3n) {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-form__footer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 112px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 36px;
|
|
||||||
background: #3192F4;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
line-height: 112px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-form__btn {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 214px;
|
|
||||||
height: 66px;
|
|
||||||
line-height: 66px;
|
|
||||||
margin: 64px auto 0;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 34px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
margin-left: 16px;
|
|
||||||
color: #4392E6;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-info {
|
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
& > h2 {
|
|
||||||
height: 76px;
|
|
||||||
line-height: 76px;
|
|
||||||
color: #999999;
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-info__wrapper {
|
|
||||||
padding: 0 18px;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.title {
|
|
||||||
width: 100%;
|
|
||||||
padding: 22px 0;
|
|
||||||
font-size: 36px;
|
|
||||||
border-bottom: 1px solid #F1F2F3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
padding: 30px 0!important;
|
|
||||||
font-size: 28px;
|
|
||||||
|
|
||||||
::v-deep textarea {
|
|
||||||
color: #333;
|
|
||||||
font-size: 28px!important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-pic {
|
|
||||||
position: relative;
|
|
||||||
font-size: 0;
|
|
||||||
|
|
||||||
span {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 16px;
|
|
||||||
right: 16px;
|
|
||||||
z-index: 1;
|
|
||||||
width: 148px;
|
|
||||||
height: 56px;
|
|
||||||
line-height: 56px;
|
|
||||||
text-align: center;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 26px;
|
|
||||||
background: rgba(0, 0, 0, 0.16);
|
|
||||||
border-radius: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100%;
|
|
||||||
height: 320px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-radio, ::v-deep .u-checkbox {
|
|
||||||
align-items: baseline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section class="askForm">
|
|
||||||
<template v-if="showDetail&&!isManager">
|
|
||||||
<form-detail/>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="isManager">
|
|
||||||
<form-list ref="FormList"/>
|
|
||||||
</template>
|
|
||||||
<ai-loading v-else :tips="errMsg"/>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import AiLoading from "../../components/AiLoading";
|
|
||||||
import {mapState} from "vuex";
|
|
||||||
import FormDetail from "./formDetail";
|
|
||||||
import FormList from "./formList";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "askForm",
|
|
||||||
components: {FormList, FormDetail, AiLoading},
|
|
||||||
computed: {
|
|
||||||
...mapState(['openUser', 'user']),
|
|
||||||
showDetail() {
|
|
||||||
return !!this.$route.query?.id
|
|
||||||
},
|
|
||||||
isManager() {
|
|
||||||
let {hash, query: {preview}} = this.$route
|
|
||||||
if (preview) return false
|
|
||||||
else if (hash == "#dev") return true
|
|
||||||
else return hash != '#form' && !!this.user.id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
errMsg: "加载表单中..."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onReachBottom() {
|
|
||||||
this.$refs?.FormList?.reachBottom()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.askForm {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,182 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form">
|
|
||||||
<div class="form-list">
|
|
||||||
<div
|
|
||||||
class="form-list__item"
|
|
||||||
@click="toAdd(`/pages/askForm/addForm?type=${index}`)"
|
|
||||||
:style="{'background-image': `url(${$cdn}askform/${index + 1}.png)`}"
|
|
||||||
v-for="(item, index) in itemList"
|
|
||||||
:key="index">
|
|
||||||
<h2>{{ item.name }}</h2>
|
|
||||||
<div>立即创建</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="template" v-if="list.length">
|
|
||||||
<h2>共享模板</h2>
|
|
||||||
<div class="template-list">
|
|
||||||
<div class="template-item" v-for="(item, index) in list" :key="index" hover-class="bg-hover" @click="quote(item.id)">
|
|
||||||
<image :src="`${$cdn}askform/6.png`" />
|
|
||||||
<h2>{{ item.title }}</h2>
|
|
||||||
<u-icon name="arrow-right" color="#E1E2E3" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'addList',
|
|
||||||
label: '新建项目',
|
|
||||||
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
itemList: [{
|
|
||||||
name: '调查问卷'
|
|
||||||
}, {
|
|
||||||
name: '考试测评'
|
|
||||||
}, {
|
|
||||||
name: '报名登记'
|
|
||||||
}, {
|
|
||||||
name: '满意调查'
|
|
||||||
}, {
|
|
||||||
name: '投票评选'
|
|
||||||
}],
|
|
||||||
list: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted () {
|
|
||||||
this.getList()
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
toAdd (url) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
quote (id) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/askForm/addForm?isQuote=1&id=${id}`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
getList () {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/list`, null, {
|
|
||||||
params: {
|
|
||||||
current: 1,
|
|
||||||
templateType: 1,
|
|
||||||
size: 10000
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.list = res.data.records
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.template {
|
|
||||||
margin: 32px 32px 0;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
& > h2 {
|
|
||||||
height: 88px;
|
|
||||||
line-height: 88px;
|
|
||||||
padding: 0 24px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.template-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: 104px;
|
|
||||||
padding: 0 24px;
|
|
||||||
border-bottom: 1px solid #D8DDE6;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background-color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 36px;
|
|
||||||
height: 42px;
|
|
||||||
}
|
|
||||||
|
|
||||||
i {
|
|
||||||
font-size: 30px;
|
|
||||||
color: #E1E2E3;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
flex: 1;
|
|
||||||
padding: 0 18px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: normal;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow:ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-list {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 0 32px 0;
|
|
||||||
|
|
||||||
div {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-list__item {
|
|
||||||
width: calc(50% - 13px);
|
|
||||||
height: 216px;
|
|
||||||
margin: 32px 24px 0 0;
|
|
||||||
padding: 40px 20px 52px;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border-radius: 8px;
|
|
||||||
background-size: 100% 100%;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background-color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:nth-of-type(2n) {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
width: 148px;
|
|
||||||
height: 48px;
|
|
||||||
line-height: 48px;
|
|
||||||
text-align: center;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 28px;
|
|
||||||
background: #6BA1F9;
|
|
||||||
border-radius: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
margin-bottom: 32px;
|
|
||||||
padding-left: 10px;
|
|
||||||
color: #333333;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,497 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form">
|
|
||||||
<ai-top-fixed>
|
|
||||||
<u-search placeholder="请输入标题" :show-action="false" search-icon-color="#ccc" v-model="search.title"
|
|
||||||
@search="isMore = false, search.current = 1, getList()"/>
|
|
||||||
</ai-top-fixed>
|
|
||||||
<div class="form-list">
|
|
||||||
<div class="form-item" v-for="(item, index) in list" :key="index"
|
|
||||||
@click="info = item, id = item.id, isShow = true">
|
|
||||||
<div class="form-item__top">
|
|
||||||
<div class="form-item__left">
|
|
||||||
<h2>{{ item.title }}</h2>
|
|
||||||
<div class="form-item__left--info">
|
|
||||||
<span>{{ item.createUserName }}</span>
|
|
||||||
<span>{{ item.createUnitName }}</span>
|
|
||||||
<span>{{ item.createTime.substr(0, item.createTime.length - 3) }}</span>
|
|
||||||
<span>{{ $dict.getLabel('questionnaireType', item.type) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-item__right">
|
|
||||||
<h2>{{ item.dataCount }}</h2>
|
|
||||||
<span>答卷数量</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-item__bottom form-item__bottom--active">
|
|
||||||
<i :style="{background: $dict.getColor('questionnaireStatus', item.status)}"></i>
|
|
||||||
<span>{{ $dict.getLabel('questionnaireStatus', item.status) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ai-empty v-if="!list.length && isMore"></ai-empty>
|
|
||||||
</div>
|
|
||||||
<u-popup v-model="isShow" :closeable="false" mode="bottom" :z-index="11">
|
|
||||||
<div class="popup">
|
|
||||||
<h2>{{ info.title }}</h2>
|
|
||||||
<div class="operate-list">
|
|
||||||
<div class="operate-item" @click="toEdit">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/bj.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>编辑</h3>
|
|
||||||
</div>
|
|
||||||
<div class="operate-item" @click="linkTo('/pages/askForm/askForm?preview=1&id=' + id)">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/yl.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>预览</h3>
|
|
||||||
</div>
|
|
||||||
<div class="operate-item" @click="publish" v-if="info.status !== '1'">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/fb.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>发布</h3>
|
|
||||||
</div>
|
|
||||||
<div class="operate-item" @click="toStop" v-if="info.status === '1'">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/stop.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>停止</h3>
|
|
||||||
</div>
|
|
||||||
<div class="operate-item" @click="showShare">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/fx.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>分享</h3>
|
|
||||||
</div>
|
|
||||||
<div class="operate-item" @click="share(id)">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/mb.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>共享为模板</h3>
|
|
||||||
</div>
|
|
||||||
<div class="operate-item" @click="remove(id)">
|
|
||||||
<div>
|
|
||||||
<image :src="`${$cdn}askform/sc.png`"/>
|
|
||||||
</div>
|
|
||||||
<h3>删除</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="popup-btn" @click="isShow = false">关闭</div>
|
|
||||||
</div>
|
|
||||||
</u-popup>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import AiTopFixed from '@/components/AiTopFixed'
|
|
||||||
import AiEmpty from '@/components/AiEmpty/AiEmpty'
|
|
||||||
import {mapActions} from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'formList',
|
|
||||||
label: '表单列表',
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
search: {
|
|
||||||
current: 1,
|
|
||||||
templateType: 0,
|
|
||||||
title: ''
|
|
||||||
},
|
|
||||||
id: '',
|
|
||||||
info: {},
|
|
||||||
isMore: false,
|
|
||||||
list: [],
|
|
||||||
isShow: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
AiEmpty,
|
|
||||||
AiTopFixed
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact'])
|
|
||||||
this.$dict.load(['questionnaireStatus', 'questionnaireType', 'questionnaireFieldType']).then(() => {
|
|
||||||
this.getList()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
...mapActions(['injectJWeixin', 'wxInvoke']),
|
|
||||||
|
|
||||||
linkTo(url) {
|
|
||||||
this.isShow = false
|
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
toStop() {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/stopRelease?id=${this.info.id}`).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.$u.toast('停止成功')
|
|
||||||
this.search.current = 1
|
|
||||||
this.isShow = false
|
|
||||||
this.isMore = false
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
showShare() {
|
|
||||||
if (this.info.status !== '1') {
|
|
||||||
this.isShow = false
|
|
||||||
return this.$u.toast(`该表单${this.info.status === '0' ? '未发布' : '已截止'},无法分享!`)
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showActionSheet({
|
|
||||||
itemList: ['分享', '微信分享', '获取链接'],
|
|
||||||
success: data => {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/queryQrCode?id=${this.info.id}`).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
if (data.tapIndex === 2) {
|
|
||||||
this.copy(res.data.linkUrl)
|
|
||||||
this.isShow = false
|
|
||||||
}
|
|
||||||
if (data.tapIndex === 0 || data.tapIndex === 1) {
|
|
||||||
this.injectJWeixin(['shareAppMessage', 'shareWechatMessage']).then(() => {
|
|
||||||
if (data.tapIndex === 0) {
|
|
||||||
this.wxInvoke(['shareAppMessage', {
|
|
||||||
title: this.info.title,
|
|
||||||
desc: this.info.tableExplain,
|
|
||||||
link: res.data.linkUrl,
|
|
||||||
imgUrl: this.info.headPicture
|
|
||||||
}, () => {
|
|
||||||
this.isShow = false
|
|
||||||
}])
|
|
||||||
} else {
|
|
||||||
this.wxInvoke(['shareWechatMessage', {
|
|
||||||
title: this.info.title,
|
|
||||||
desc: this.info.tableExplain,
|
|
||||||
link: res.data.linkUrl,
|
|
||||||
imgUrl: this.info.headPicture
|
|
||||||
}, () => {
|
|
||||||
this.isShow = false
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
copy(link) {
|
|
||||||
let oInput = document.createElement('input')
|
|
||||||
oInput.value = link
|
|
||||||
document.body.appendChild(oInput)
|
|
||||||
oInput.select()
|
|
||||||
document.execCommand('Copy')
|
|
||||||
this.$u.toast('已复制')
|
|
||||||
oInput.remove()
|
|
||||||
},
|
|
||||||
|
|
||||||
publish() {
|
|
||||||
if (this.info.status === '1') {
|
|
||||||
return this.$u.toast('该表单已发布')
|
|
||||||
}
|
|
||||||
|
|
||||||
this.linkTo(`/pages/askForm/formSetting?id=${this.info.id}&type=edit`)
|
|
||||||
this.isShow = false
|
|
||||||
},
|
|
||||||
|
|
||||||
toEdit() {
|
|
||||||
if (this.info.dataCount !== 0) {
|
|
||||||
return this.$u.toast('该表单已有数据,无法编辑!')
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/askForm/addForm?id=${this.id}`
|
|
||||||
})
|
|
||||||
|
|
||||||
this.isShow = false
|
|
||||||
},
|
|
||||||
|
|
||||||
share(id) {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/share?id=${id}`).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.$confirm('调查表单共享成功,其他成员可在新建项目时直接使用!', '', {
|
|
||||||
showCancel: false
|
|
||||||
})
|
|
||||||
this.isShow = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
remove(id) {
|
|
||||||
if (this.info.dataCount !== 0) {
|
|
||||||
return this.$u.toast('该表单已有数据,无法删除!')
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$confirm('确定删除该数据?').then(() => {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/delete?id=${id}`).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.$u.toast('删除成功')
|
|
||||||
this.isShow = false
|
|
||||||
this.search.current = 1
|
|
||||||
this.isMore = false
|
|
||||||
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}).catch(() => {
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
this.isMore = false
|
|
||||||
this.search.current = 1
|
|
||||||
|
|
||||||
this.getList()
|
|
||||||
},
|
|
||||||
|
|
||||||
getList() {
|
|
||||||
if (this.isMore) return
|
|
||||||
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/list`, null, {
|
|
||||||
params: {
|
|
||||||
...this.search,
|
|
||||||
size: 10
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
if (this.search.current > 1) {
|
|
||||||
this.list = [...this.list, ...res.data.records]
|
|
||||||
} else {
|
|
||||||
this.list = res.data.records
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.hideLoading()
|
|
||||||
|
|
||||||
if (res.data.records.length < 10) {
|
|
||||||
this.isMore = true
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.search.current = this.search.current + 1
|
|
||||||
} else {
|
|
||||||
uni.hideLoading()
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.form {
|
|
||||||
::v-deep .u-search {
|
|
||||||
margin-bottom: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup {
|
|
||||||
background: #F7F7F7;
|
|
||||||
|
|
||||||
& > h2 {
|
|
||||||
height: 72px;
|
|
||||||
line-height: 72px;
|
|
||||||
padding: 0 20px;
|
|
||||||
color: #999999;
|
|
||||||
font-size: 22px;
|
|
||||||
text-align: center;
|
|
||||||
border-bottom: 2px solid #D7D8DA;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-btn {
|
|
||||||
height: 96px;
|
|
||||||
line-height: 96px;
|
|
||||||
text-align: center;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 30px;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.operate-list {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
text-align: center;
|
|
||||||
padding-bottom: 26px;
|
|
||||||
|
|
||||||
.operate-item {
|
|
||||||
width: 25%;
|
|
||||||
font-size: 0;
|
|
||||||
margin-top: 28px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
margin-top: 20px;
|
|
||||||
color: #666666;
|
|
||||||
font-size: 26px;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100px;
|
|
||||||
height: 100px;
|
|
||||||
border-radius: 16px;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-item {
|
|
||||||
margin: 24px 25px 0;
|
|
||||||
padding: 32px;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 16px;
|
|
||||||
|
|
||||||
.form-item__bottom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: 28px;
|
|
||||||
color: #999999;
|
|
||||||
|
|
||||||
i {
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
margin-right: 6px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.form-item__bottom--active i {
|
|
||||||
background: #3CB300;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-item__top {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.form-item__right {
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
line-height: 40px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #1EA0FA;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #999999;
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-item__left {
|
|
||||||
flex: 1;
|
|
||||||
max-width: 80%;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
position: absolute;
|
|
||||||
right: -15px;
|
|
||||||
top: 50%;
|
|
||||||
width: 2px;
|
|
||||||
height: 96px;
|
|
||||||
background: #F5F5F5;
|
|
||||||
content: '';
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
line-height: 44px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
color: #333;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 700;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-item__left--info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
color: #999;
|
|
||||||
font-size: 20px;
|
|
||||||
|
|
||||||
span {
|
|
||||||
position: relative;
|
|
||||||
margin-right: 24px;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
position: absolute;
|
|
||||||
right: -12px;
|
|
||||||
top: 50%;
|
|
||||||
width: 2px;
|
|
||||||
height: 20px;
|
|
||||||
background: #D1D2D5;
|
|
||||||
content: '';
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-right: 0;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.type-0 {
|
|
||||||
background: #2266FF !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.type-1 {
|
|
||||||
background: rgba(34, 170, 153, 1) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.type-2 {
|
|
||||||
background: rgba(248, 180, 37, 1) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.type-3 {
|
|
||||||
background: rgba(102, 119, 187, 1) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.type-4 {
|
|
||||||
background: rgba(236, 68, 97, 1) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
export const components = [
|
|
||||||
{
|
|
||||||
type: 'radio',
|
|
||||||
label: '单选',
|
|
||||||
fixedLabel: '单选',
|
|
||||||
value: '',
|
|
||||||
points: '',
|
|
||||||
icon: 'iconradio',
|
|
||||||
isShowPoints: false,
|
|
||||||
required: true,
|
|
||||||
hasAnswer: false,
|
|
||||||
answer: '',
|
|
||||||
pointType: '0',
|
|
||||||
pointDict: [
|
|
||||||
{
|
|
||||||
dictName: '此题有唯一答案和分值',
|
|
||||||
dictValue: '0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dictName: '每个选项都有对应分值',
|
|
||||||
dictValue: '1'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: '选项1',
|
|
||||||
value: '',
|
|
||||||
point: '',
|
|
||||||
img: []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '选项2',
|
|
||||||
value: '',
|
|
||||||
point: '',
|
|
||||||
img: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
title: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'checkbox',
|
|
||||||
label: '多选',
|
|
||||||
fixedLabel: '多选',
|
|
||||||
points: '',
|
|
||||||
icon: 'iconcheck_box',
|
|
||||||
isShowPoints: false,
|
|
||||||
required: true,
|
|
||||||
hasAnswer: false,
|
|
||||||
answer: [],
|
|
||||||
value: [],
|
|
||||||
pointType: '0',
|
|
||||||
pointDict: [
|
|
||||||
{
|
|
||||||
dictName: '此题有唯一答案和分值',
|
|
||||||
dictValue: '0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dictName: '每个选项都有对应分值',
|
|
||||||
dictValue: '1'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dictName: '答对几项得几分,答错不得分',
|
|
||||||
dictValue: '2'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: '选项1',
|
|
||||||
value: '',
|
|
||||||
point: '',
|
|
||||||
img: [],
|
|
||||||
checked: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '选项2',
|
|
||||||
point: '',
|
|
||||||
value: '',
|
|
||||||
img: [],
|
|
||||||
checked: false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
title: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'select',
|
|
||||||
label: '单下拉框',
|
|
||||||
fixedLabel: '单下拉框',
|
|
||||||
value: '',
|
|
||||||
points: '',
|
|
||||||
icon: 'iconSelect',
|
|
||||||
isShowPoints: false,
|
|
||||||
required: true,
|
|
||||||
hasAnswer: false,
|
|
||||||
answer: '',
|
|
||||||
pointType: '0',
|
|
||||||
placeholder: '请选择',
|
|
||||||
pointDict: [
|
|
||||||
{
|
|
||||||
dictName: '此题有唯一答案和分值',
|
|
||||||
dictValue: '0'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dictName: '每个选项都有对应分值',
|
|
||||||
dictValue: '1'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: '选项1',
|
|
||||||
value: '',
|
|
||||||
point: '',
|
|
||||||
img: []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '选项2',
|
|
||||||
value: '',
|
|
||||||
point: '',
|
|
||||||
img: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
title: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'input',
|
|
||||||
label: '单行填空',
|
|
||||||
fixedLabel: '单行填空',
|
|
||||||
value: '',
|
|
||||||
pointType: '0',
|
|
||||||
icon: 'icontext_box',
|
|
||||||
isShowPoints: false,
|
|
||||||
points: '',
|
|
||||||
required: true,
|
|
||||||
hasAnswer: false,
|
|
||||||
placeholder: '请输入...',
|
|
||||||
answer: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'textarea',
|
|
||||||
label: '多行填空',
|
|
||||||
fixedLabel: '多行填空',
|
|
||||||
pointType: '0',
|
|
||||||
icon: 'icontext_area',
|
|
||||||
points: '',
|
|
||||||
isShowPoints: false,
|
|
||||||
required: true,
|
|
||||||
hasAnswer: false,
|
|
||||||
answer: '',
|
|
||||||
placeholder: '请输入...',
|
|
||||||
value: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'upload',
|
|
||||||
label: '上传图片',
|
|
||||||
fixedLabel: '上传图片',
|
|
||||||
value: '',
|
|
||||||
icon: 'iconpic',
|
|
||||||
isShowPoints: false,
|
|
||||||
points: '',
|
|
||||||
required: true,
|
|
||||||
hasAnswer: false,
|
|
||||||
answer: ''
|
|
||||||
}
|
|
||||||
];
|
|
||||||
@@ -1,535 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form-config">
|
|
||||||
<div class="config-group">
|
|
||||||
<div class="config-item">
|
|
||||||
<u-input class="form-maintitle" :maxlength="200" v-model="config.label" :placeholder="`请输入${config.fixedLabel}标题 ${config.required ? '(必填)' : ''}`" placeholder-style="color: #999999; font-weight: 600" />
|
|
||||||
</div>
|
|
||||||
<div class="config-item__select--wrapper" v-if="['radio', 'select', 'checkbox'].includes(config.type)">
|
|
||||||
<div class="config-item__select" v-for="(item, index) in config.options" :key="index">
|
|
||||||
<image class="config-icon" :src="`${$cdn}askform/del.png`" @click="removeOptions(index)" />
|
|
||||||
<div class="config-item__upload" v-if="config.type !== 'select'" @click="upload(index)">
|
|
||||||
<u-icon color="#8c9dc3" name="plus" v-if="!item.img.length"></u-icon>
|
|
||||||
<image v-else :src="item.img[0].url" />
|
|
||||||
</div>
|
|
||||||
<div class="textarea">
|
|
||||||
<textarea type="textarea" placeholder-style="color: #CDCDCF" :auto-height="true" v-model="item.label" :maxlength="100" placeholder="请输入选项" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__select config-item__select--add" @click="addOptions">
|
|
||||||
<image class="config-icon" :src="`${$cdn}askform/zj.png`" />
|
|
||||||
<span>添加选项</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-group">
|
|
||||||
<div class="config-item" v-if="!['radio', 'upload', 'checkbox', 'select'].includes(config.type)">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>说明文字</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-input v-model="config.placeholder" placeholder="请输入说明文字" input-align="right" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>是否必填</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-switch v-model="config.required" active-value="1" inactive-value="0" :size="40" active-color="#1088F9"></u-switch>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item" v-if="!['upload'].includes(config.type)">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>答案与分值</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-switch v-model="config.isShowPoints" :size="40" active-color="#1088F9"></u-switch>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item" v-if="['input', 'textarea'].includes(config.type) && config.isShowPoints">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>正确答案</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-input v-model="config.answer" placeholder="请输入正确答案" input-align="right" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item" v-if="['radio', 'select'].includes(config.type) && config.isShowPoints && config.pointType === '0'">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>正确答案</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right config-item__text" @click="isShowAnswer = true">
|
|
||||||
<span>{{ config.answer ? config.answer : '请选择正确答案' }}</span>
|
|
||||||
<u-icon name="arrow-down-fill" color="#c0c4cc" size="24"></u-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item config-item__checkbox" v-if="config.isShowPoints && ['radio', 'select', 'checkbox'].includes(config.type)">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>计分方式</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right" @click="isShowType = true">
|
|
||||||
<span>{{ pointTypeName ? pointTypeName : '请选择' }}</span>
|
|
||||||
<u-icon name="arrow-right" color="#E1E2E3" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item config-item__answer config-item__checkbox" v-if="['checkbox'].includes(config.type) && config.isShowPoints && config.pointType === '0'">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>正确答案</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-checkbox-group wrap @change="onCheckboxChange">
|
|
||||||
<u-checkbox v-model="field.checked" :name="field.label" v-if="field.label" v-for="(field, i) in config.options" :key="i">
|
|
||||||
<span>{{ field.label }}</span>
|
|
||||||
</u-checkbox>
|
|
||||||
</u-checkbox-group>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item" v-if="config.isShowPoints && config.pointType === '0'">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>本题分值</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-input v-model="config.points" type="number" placeholder="请输入本题分值" input-align="right" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="config.isShowPoints && config.pointType === '1'">
|
|
||||||
<div class="config-item" v-for="(item, index) in config.options" :key="index">
|
|
||||||
<div class="config-item__left">
|
|
||||||
<span>{{ item.label }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-input v-model="item.point" placeholder="请输入分值" input-align="right" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="config-item config-item__point" v-if="config.isShowPoints && config.pointType === '2'">
|
|
||||||
<u-checkbox-group wrap @change="onCheckboxChange">
|
|
||||||
<u-checkbox v-model="field.checked" :name="field.label" v-if="field.label" v-for="(field, i) in config.options" :key="i">
|
|
||||||
<span>{{ field.label }}</span>
|
|
||||||
<u-input v-model="field.point" type="number" placeholder="请输入分值" input-align="right" />
|
|
||||||
</u-checkbox>
|
|
||||||
</u-checkbox-group>
|
|
||||||
</div>
|
|
||||||
<div class="config-item" v-if="config.isShowPoints && config.pointType === '2'">
|
|
||||||
<div class="config-item__left" style="padding-left: 20px">
|
|
||||||
<span>全部答对</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item__right">
|
|
||||||
<u-input v-model="config.points" type="number" placeholder="请输入全部答对分值" input-align="right" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<u-select :list="config.options" :default-value="defaultAnswer" value-name="value" label-name="label" v-model="isShowAnswer" @confirm="answerChange"></u-select>
|
|
||||||
<u-select :list="config.pointDict" :default-value="defaultType" value-name="dictValue" label-name="dictName" v-model="isShowType" @confirm="pointTypeChange"></u-select>
|
|
||||||
<div class="add-form__footer">
|
|
||||||
<div @click="back">
|
|
||||||
<span>取消</span>
|
|
||||||
</div>
|
|
||||||
<div @click="confirm">确定</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { components } from './config'
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
index: '',
|
|
||||||
isShowType: false,
|
|
||||||
isShowAnswer: false,
|
|
||||||
config: {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad (query) {
|
|
||||||
if (query.type) {
|
|
||||||
this.config = JSON.parse(JSON.stringify(components.filter(v => v.type === query.type)[0]))
|
|
||||||
} else {
|
|
||||||
this.config = JSON.parse(query.config)
|
|
||||||
this.index = query.index
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
pointTypeName () {
|
|
||||||
if (!this.config.pointDict) return ''
|
|
||||||
|
|
||||||
return this.config.pointDict.filter(v => v.dictValue === this.config.pointType)[0].dictName
|
|
||||||
},
|
|
||||||
|
|
||||||
defaultType () {
|
|
||||||
if (!this.config.pointType) return [0]
|
|
||||||
|
|
||||||
return [Number(this.config.pointType)]
|
|
||||||
},
|
|
||||||
|
|
||||||
defaultAnswer () {
|
|
||||||
if (!this.config.answer) return [0]
|
|
||||||
|
|
||||||
let index = 0
|
|
||||||
if (this.config.answer) {
|
|
||||||
this.config.options.forEach((v, i) => {
|
|
||||||
if (v.label === this.config.answer) {
|
|
||||||
index = i
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return [index]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
answerChange (e) {
|
|
||||||
this.config.answer = e[0].label
|
|
||||||
},
|
|
||||||
|
|
||||||
pointTypeChange (e) {
|
|
||||||
console.log(e)
|
|
||||||
this.config.pointType = e[0].value
|
|
||||||
},
|
|
||||||
|
|
||||||
onCheckboxChange (e) {
|
|
||||||
this.config.answer = e
|
|
||||||
},
|
|
||||||
|
|
||||||
upload (index) {
|
|
||||||
let params = {
|
|
||||||
count: 1,
|
|
||||||
sizeType: ['compressed'],
|
|
||||||
sourceType: ['album', 'camera'],
|
|
||||||
success: (res) => {
|
|
||||||
let count = this.fileList?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0)
|
|
||||||
if (count > 1) {
|
|
||||||
return this.$u.toast(`不能超过1个`)
|
|
||||||
}
|
|
||||||
if (res.tempFiles) {
|
|
||||||
res.tempFiles.map((item) => {
|
|
||||||
this.uploadFile(item, index)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uni.chooseImage(params)
|
|
||||||
},
|
|
||||||
|
|
||||||
uploadFile (img, index) {
|
|
||||||
uni.showLoading({title: '上传中'})
|
|
||||||
let formData = new FormData()
|
|
||||||
formData.append('file', img)
|
|
||||||
this.$http.post('/admin/file/add2', formData).then((res) => {
|
|
||||||
uni.hideLoading()
|
|
||||||
if (res?.data) {
|
|
||||||
this.$u.toast('上传成功!')
|
|
||||||
this.$set(this.config.options[index], 'img', [res.data])
|
|
||||||
}
|
|
||||||
}).catch(res => {
|
|
||||||
this.$u.toast(res)
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
removeOptions (index) {
|
|
||||||
const len = this.config.options.length
|
|
||||||
const label = this.config.options[index].label
|
|
||||||
if (len === 2) {
|
|
||||||
return this.$u.toast('选项不能少于2个')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.config.type === 'checkbox') {
|
|
||||||
const answerIndex = this.config.answer.indexOf(label)
|
|
||||||
if (answerIndex > -1) {
|
|
||||||
this.config.answer.splice(answerIndex, 1)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (label === this.config.answer) {
|
|
||||||
this.config.answer = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.config.options.splice(index, 1)
|
|
||||||
},
|
|
||||||
|
|
||||||
back () {
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
confirm () {
|
|
||||||
uni.$emit('filedConfig', {
|
|
||||||
config: this.config,
|
|
||||||
index: this.index === '' ? '-1' : this.index
|
|
||||||
})
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
addOptions () {
|
|
||||||
const len = this.config.options.length
|
|
||||||
let label = `选项${len + 1}`
|
|
||||||
|
|
||||||
const index= this.config.options.findIndex(v => label === v.label)
|
|
||||||
if (index > -1) {
|
|
||||||
label = `新选项${len + 1}`
|
|
||||||
}
|
|
||||||
|
|
||||||
this.config.options.push({
|
|
||||||
label: label,
|
|
||||||
value: '',
|
|
||||||
point: '',
|
|
||||||
img: '',
|
|
||||||
checked: false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.form-config {
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding-bottom: 130px;
|
|
||||||
|
|
||||||
.form-maintitle {
|
|
||||||
::v-deep .uni-input-input {
|
|
||||||
font-size: 36px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item__select--wrapper {
|
|
||||||
.config-item__select {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
::v-deep .u-input__input {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.textarea {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 104px;
|
|
||||||
padding: 16px 0;
|
|
||||||
font-size: 28px;
|
|
||||||
border-bottom: 1px solid #dfe8f8;
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-icon {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
margin-right: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item__select--add {
|
|
||||||
height: 120px;
|
|
||||||
|
|
||||||
.config-icon {
|
|
||||||
margin-right: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #1D74F4;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-group {
|
|
||||||
margin-bottom: 32px;
|
|
||||||
padding: 0 32px;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.config-item__upload {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 60px;
|
|
||||||
height: 60px;
|
|
||||||
margin-right: 20px;
|
|
||||||
border: 1px solid rgb(208, 212, 220);
|
|
||||||
background-color: #fbfdff;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
min-height: 100px;
|
|
||||||
padding: 16px 0;
|
|
||||||
border-bottom: 1px solid #dfe8f8;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-radio__label, ::v-deep .u-checkbox__label {
|
|
||||||
margin-right: 0;
|
|
||||||
font-size: 28px;
|
|
||||||
|
|
||||||
span {
|
|
||||||
max-width: 400rpx;
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item__left {
|
|
||||||
max-width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item__right {
|
|
||||||
flex: 1;
|
|
||||||
text-align: right;
|
|
||||||
padding-left: 30px;
|
|
||||||
|
|
||||||
&.config-item__text {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
|
|
||||||
span {
|
|
||||||
max-width: 400px;
|
|
||||||
margin-right: 10px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
word-break: keep-all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.text {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.config-item__answer {
|
|
||||||
display: block;
|
|
||||||
padding: 20px 0;
|
|
||||||
|
|
||||||
.config-item__left {
|
|
||||||
margin-bottom: 32rpx;
|
|
||||||
span {
|
|
||||||
word-break: break-all;
|
|
||||||
color: #333;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item__right {
|
|
||||||
width: 100%;
|
|
||||||
padding-left: 0;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-checkbox {
|
|
||||||
align-items: baseline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.config-item__checkbox {
|
|
||||||
height: auto;
|
|
||||||
padding: 14px 0;
|
|
||||||
|
|
||||||
::v-deep .u-checkbox, ::v-deep .u-radio {
|
|
||||||
// justify-content: flex-end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.config-item__point {
|
|
||||||
height: auto;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
::v-deep .u-checkbox {
|
|
||||||
justify-content: inherit;
|
|
||||||
min-height: 100px;
|
|
||||||
padding: 14px 0;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.u-checkbox__label {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
flex: 1;
|
|
||||||
margin-right: 0;
|
|
||||||
|
|
||||||
.u-input {
|
|
||||||
flex: 1;
|
|
||||||
max-width: 400px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-form__footer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 112px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
&:first-child:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 36px;
|
|
||||||
background: #3192F4;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
line-height: 112px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,405 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section class="formDetail">
|
|
||||||
<ai-result v-if="result.tips" v-bind="result">
|
|
||||||
<template v-if="isExam" #extra>
|
|
||||||
<div flex class="scorePane">
|
|
||||||
<div>成绩</div>
|
|
||||||
<div class="fill"><em v-html="score"/> 分</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</ai-result>
|
|
||||||
<template v-else-if="form.id">
|
|
||||||
<image v-if="form.headPicture" class="headPicture" :src="form.headPicture"/>
|
|
||||||
<b class="title">{{ form.title || "标题" }}</b>
|
|
||||||
<div class="tableExplain">{{ form.tableExplain }}</div>
|
|
||||||
<u-form class="content" label-position="top">
|
|
||||||
<u-form-item class="item" v-for="(op,i) in fields" :key="i" :label="(i+1)+'.'+op.fieldName"
|
|
||||||
:required="op.fieldInfo.required==1">
|
|
||||||
<template v-if="op.fieldType=='input'">
|
|
||||||
<input v-model="op.fieldValue" :placeholder="op.fieldInfo.placeholder" :disabled="isResult"/>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="op.fieldType=='textarea'">
|
|
||||||
<textarea v-model="op.fieldValue" :disabled="isResult" :placeholder="op.fieldInfo.placeholder"/>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="op.fieldType=='upload'">
|
|
||||||
<ai-uploader @list="v=>op.fieldValue=v.map(e=>e.url)" :def="op.fieldValue" :disabled="isResult"
|
|
||||||
preview/>
|
|
||||||
</template>
|
|
||||||
<u-row v-else-if="op.fieldType=='radio'">
|
|
||||||
<radio-group @change="({detail})=>op.fieldValue=detail.value">
|
|
||||||
<div class="option" flex v-for="option in op.fieldInfo.options" :key="option.label">
|
|
||||||
<radio :value="option.label" :disabled="isResult" :checked="op.fieldValue==option.label"/>
|
|
||||||
<ai-image v-if="option.img" :src="option.img" preview/>
|
|
||||||
<div class="label fill">{{ option.label }}</div>
|
|
||||||
</div>
|
|
||||||
</radio-group>
|
|
||||||
</u-row>
|
|
||||||
<u-row v-else-if="op.fieldType=='checkbox'">
|
|
||||||
<checkbox-group @change="({detail})=>op.fieldValue=detail.value">
|
|
||||||
<div class="option" flex v-for="option in op.fieldInfo.options" :key="option.label">
|
|
||||||
<checkbox :value="option.label" :disabled="isResult"
|
|
||||||
:checked="option.checked"/>
|
|
||||||
<ai-image v-if="option.img" :src="option.img" preview/>
|
|
||||||
<div class="label fill">{{ option.label }}</div>
|
|
||||||
</div>
|
|
||||||
</checkbox-group>
|
|
||||||
</u-row>
|
|
||||||
<template v-else-if="op.fieldType=='select'">
|
|
||||||
<ai-select @data="v=>op.fieldValue=v.map(e=>e.value)" :list="op.fieldInfo.options" :disabled="isResult">
|
|
||||||
<div class="option" flex>
|
|
||||||
<div class="label fill" v-if="op.fieldValue">{{ op.fieldValue.toString() }}</div>
|
|
||||||
<i class="fill" v-else>请选择</i>
|
|
||||||
<u-icon name="arrow-right" color="#ddd"/>
|
|
||||||
</div>
|
|
||||||
</ai-select>
|
|
||||||
</template>
|
|
||||||
</u-form-item>
|
|
||||||
</u-form>
|
|
||||||
<div class="bottom" v-if="!(isPreview||isResult)">
|
|
||||||
<div class="bottomBtn" @tap="handleSubmit">提交</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<ai-loading v-else tips="调查问卷加载中..."/>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import UForm from "../../uview/components/u-form/u-form";
|
|
||||||
import UFormItem from "../../uview/components/u-form-item/u-form-item";
|
|
||||||
import {mapActions, mapState} from "vuex";
|
|
||||||
import UInput from "../../uview/components/u-input/u-input";
|
|
||||||
import AiTextarea from "../../components/AiTextarea";
|
|
||||||
import AiUploader from "../../components/AiUploader";
|
|
||||||
import AiSelect from "../../components/AiSelect";
|
|
||||||
import URadio from "../../uview/components/u-radio/u-radio";
|
|
||||||
import AiLoading from "../../components/AiLoading";
|
|
||||||
import AiResult from "../../components/AiResult";
|
|
||||||
import AiImage from "../../components/AiImage";
|
|
||||||
import AiBack from "../../components/AiBack";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "formDetail",
|
|
||||||
components: {
|
|
||||||
AiBack,
|
|
||||||
AiImage,
|
|
||||||
AiResult,
|
|
||||||
AiLoading,
|
|
||||||
URadio,
|
|
||||||
AiSelect,
|
|
||||||
AiUploader,
|
|
||||||
AiTextarea,
|
|
||||||
UInput,
|
|
||||||
UFormItem,
|
|
||||||
UForm
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState(['openUser', 'token']),
|
|
||||||
isExam() {
|
|
||||||
return this.form?.type == 1
|
|
||||||
},
|
|
||||||
isPreview() {
|
|
||||||
return !!this.$route.query?.preview
|
|
||||||
},
|
|
||||||
isResult() {
|
|
||||||
return !!this.$route.query?.result
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
form: {},
|
|
||||||
fields: [],
|
|
||||||
checkUser: false,
|
|
||||||
result: {},
|
|
||||||
score: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
form: {
|
|
||||||
deep: true,
|
|
||||||
handler(v) {
|
|
||||||
this.fields = v?.fields?.map(e => {
|
|
||||||
let fieldInfo = JSON.parse(e.fieldInfo)
|
|
||||||
fieldInfo?.options?.map(op => {
|
|
||||||
op.img = op?.img?.[0]?.url
|
|
||||||
op.checked = !!e.fieldValue?.split(",")?.includes(op.label)
|
|
||||||
})
|
|
||||||
if (e.fieldType == 'select') {
|
|
||||||
fieldInfo.options = fieldInfo.options.map(e => ({...e, value: e.label, label: e.label}))
|
|
||||||
}
|
|
||||||
return {...e, fieldInfo}
|
|
||||||
}) || []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapActions(['getUserInfo']),
|
|
||||||
getForm() {
|
|
||||||
let {id} = this.$route.query
|
|
||||||
this.$http.post("/app/appquestionnairetemplate/queryDetailById", null, {
|
|
||||||
params: {id}
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.data) {
|
|
||||||
this.form = res.data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
validateForm() {
|
|
||||||
return !this.fields.some(e => {
|
|
||||||
if (!!e?.fieldInfo?.required && !e.fieldValue?.toString()) {
|
|
||||||
this.$u.toast(e.fieldName + "不能为空!")
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleSubmit() {
|
|
||||||
if (this.validateForm()) {
|
|
||||||
this.handleScore()
|
|
||||||
let {avatar: avatarUrl, openId, name: nickName, type: userType, unionId, corpName} = this.openUser
|
|
||||||
this.$http.post("/app/appquestionnairetemplate/commit", {
|
|
||||||
fields: this.fields.map(e => ({
|
|
||||||
...e,
|
|
||||||
fieldInfo: JSON.stringify(e.fieldInfo),
|
|
||||||
fieldValue: e.fieldValue?.toString()
|
|
||||||
})),
|
|
||||||
avatarUrl, openId, nickName, userType, unionId, corpName,
|
|
||||||
totalScore: this.score,
|
|
||||||
questionnaireTemplateId: this.$route.query.id
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.code == 0) {
|
|
||||||
this.result = {
|
|
||||||
tips: "提交成功!感谢参与",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleScore() {
|
|
||||||
this.score = 0
|
|
||||||
this.isExam && this.fields.map(field => {
|
|
||||||
let item = field?.fieldInfo || {}
|
|
||||||
let current = 0
|
|
||||||
const calcScore = point => (current += (Number(point) || 0))
|
|
||||||
if (item?.pointType == 0) {//此题有唯一答案和分值
|
|
||||||
field.fieldValue?.toString() == item.answer?.toString() && calcScore(item?.points)
|
|
||||||
} else if (item?.pointType == 1) {//每个选项都有对应分值
|
|
||||||
item?.options?.map(op => {
|
|
||||||
if (typeof field.fieldValue == "object") {
|
|
||||||
if (field.fieldValue?.includes(op.label)) {
|
|
||||||
calcScore(op.point)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
op.label == field.fieldValue && calcScore(op.point)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (item?.pointType == 2) {//答对几项得几分,答错不得分
|
|
||||||
item?.options?.some(op => {
|
|
||||||
if (typeof field.fieldValue == "object") {
|
|
||||||
if (field.fieldValue?.includes(op.label)) {
|
|
||||||
if (item.answer?.includes(op.label)) calcScore(op.point)
|
|
||||||
else return current = 0
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
op.label == field.fieldValue && calcScore(op.point)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.score += current
|
|
||||||
//打印每题打分
|
|
||||||
if (!!field.fieldValue) {
|
|
||||||
const typeResult = (reply, answer) => {
|
|
||||||
console.log("题目:%s,回答:%s,得分:%s,总分:%s \n 答案:%s", field.fieldName,
|
|
||||||
reply, current, this.score, answer)
|
|
||||||
}
|
|
||||||
typeResult(field.fieldValue?.toString(), item.answer?.toString())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
checkForm() {
|
|
||||||
if (this.isPreview) {
|
|
||||||
this.checkUser = true
|
|
||||||
return Promise.resolve()
|
|
||||||
}
|
|
||||||
let {query: {id}, hash} = this.$route,
|
|
||||||
{openId} = this.openUser
|
|
||||||
if (hash != "#form") {
|
|
||||||
this.result = {
|
|
||||||
tips: "非法的调查问卷链接",
|
|
||||||
status: "error"
|
|
||||||
}
|
|
||||||
} else if (openId) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
|
||||||
params: {id, openId}
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.code == 0) {
|
|
||||||
this.checkUser = true
|
|
||||||
if (this.isResult && res?.data) {
|
|
||||||
this.form = res?.data
|
|
||||||
} else resolve()
|
|
||||||
} else this.result = {
|
|
||||||
tips: "调查问卷加载失败",
|
|
||||||
status: "error",
|
|
||||||
btn: "重新加载",
|
|
||||||
btnTap() {
|
|
||||||
location.reload()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
this.result = {
|
|
||||||
tips: err || "调查问卷加载失败",
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.getUserInfo().then(() => {
|
|
||||||
if (!!this.openUser?.openId) {
|
|
||||||
this.checkForm()?.then(() => this.checkUser && this.getForm())
|
|
||||||
} else {
|
|
||||||
this.result = {
|
|
||||||
tips: "您的信息获取失败",
|
|
||||||
status: "error",
|
|
||||||
btn: "重新加载",
|
|
||||||
btnTap() {
|
|
||||||
location.reload()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.checkForm()?.then(() => this.checkUser && this.getForm())
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
document.title = this.form.title || "调查问卷"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.formDetail {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.headPicture {
|
|
||||||
width: 100%;
|
|
||||||
height: 320px;
|
|
||||||
|
|
||||||
.img {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 32px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: 34px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
line-height: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottom {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
padding: 32px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background: #fff;
|
|
||||||
z-index: 99;
|
|
||||||
|
|
||||||
.bottomBtn {
|
|
||||||
width: 100%;
|
|
||||||
line-height: 96px;
|
|
||||||
background: #287DE1;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
height: 96px;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: bold;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tableExplain {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 400;
|
|
||||||
color: #666;
|
|
||||||
padding: 32px 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-form-item {
|
|
||||||
.u-form-item--left {
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.u-form-item--right__content__slot > * {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.display {
|
|
||||||
justify-content: space-between;
|
|
||||||
min-height: 58px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-radio-input, .uni-checkbox-input {
|
|
||||||
height: 32px;
|
|
||||||
width: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
flex-shrink: 0;
|
|
||||||
|
|
||||||
* + & {
|
|
||||||
margin-left: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.option {
|
|
||||||
width: 100%;
|
|
||||||
margin-right: 16px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
padding: 64px 32px 200px;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .scorePane {
|
|
||||||
width: calc(100% - 40px);
|
|
||||||
padding: 0 32px;
|
|
||||||
height: 124px;
|
|
||||||
background: #E9F2FF;
|
|
||||||
border-radius: 16px;
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333333;
|
|
||||||
margin-top: 48px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
.fill {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
em {
|
|
||||||
font-size: 48px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #2C72FE;
|
|
||||||
font-style: normal;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section class="formList">
|
|
||||||
<ai-top-fixed>
|
|
||||||
<u-search placeholder="请输入标题" :show-action="false" search-icon-color="#ccc"
|
|
||||||
v-model="search.title" @search="page.current=1,getList()"/>
|
|
||||||
|
|
||||||
</ai-top-fixed>
|
|
||||||
<div class="mainPane">
|
|
||||||
<div class="formBox column" flex v-for="op in list" :key="op.id">
|
|
||||||
<div flex>
|
|
||||||
<div class="fill column" flex>
|
|
||||||
<b class="title">{{ op.title }}</b>
|
|
||||||
<div class="info wrap" flex>
|
|
||||||
<span v-html="op.createUserName"/>
|
|
||||||
<span v-html="op.createUnitName"/>
|
|
||||||
<span v-html="op.createTime"/>
|
|
||||||
<span v-html="$dict.getLabel('questionnaireType',op.type)"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="split"/>
|
|
||||||
<div flex class="column submitCount">
|
|
||||||
<b>{{ op.dataCount }}</b>
|
|
||||||
<div>答卷数量</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div flex class="bottom">
|
|
||||||
<div class="dot" :style="{background:$dict.getColor('questionnaireStatus',op.status)}"/>
|
|
||||||
<div>{{ $dict.getLabel("questionnaireStatus", op.status) }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import AiTopFixed from "../../components/AiTopFixed";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "formList",
|
|
||||||
components: {AiTopFixed},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
page: {current: 1, size: 10, total: 0},
|
|
||||||
search: {title: ""},
|
|
||||||
list: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getList() {
|
|
||||||
this.$http.post("/app/appquestionnairetemplate/list", null, {
|
|
||||||
params: {...this.page, ...this.search}
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.data) {
|
|
||||||
if (this.page.current > 1) {
|
|
||||||
this.list = [...this.list, ...res.data.records]
|
|
||||||
} else this.list = res.data.records
|
|
||||||
this.page.total = res.data.total
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
reachBottom() {
|
|
||||||
if (this.page.total > this.list.length) {
|
|
||||||
this.page.current++
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.$dict.load("questionnaireStatus", 'questionnaireType')
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.formList {
|
|
||||||
min-height: 100%;
|
|
||||||
background: #F3F6F9;
|
|
||||||
|
|
||||||
::v-deep .mainPane {
|
|
||||||
padding: 24px 24px 126px;
|
|
||||||
|
|
||||||
.formBox {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 220px;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 24px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
text-align: center;
|
|
||||||
color: #999;
|
|
||||||
font-size: 20px;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
|
|
||||||
& > div {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
b {
|
|
||||||
width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
font-size: 32px;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
text-align: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
span {
|
|
||||||
white-space: nowrap;
|
|
||||||
padding: 0 16px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-left: 1px solid #D1D2D5;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
|
|
||||||
&:first-of-type {
|
|
||||||
border-left: none;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottom {
|
|
||||||
margin-top: 30px;
|
|
||||||
font-size: 26px;
|
|
||||||
|
|
||||||
.dot {
|
|
||||||
width: 11px;
|
|
||||||
height: 11px;
|
|
||||||
background: #3CB300;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.submitCount {
|
|
||||||
width: 118px;
|
|
||||||
|
|
||||||
b {
|
|
||||||
color: #1EA0FA;
|
|
||||||
}
|
|
||||||
|
|
||||||
& > div {
|
|
||||||
font-size: 22px;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.split {
|
|
||||||
width: 2px;
|
|
||||||
background: #f5f5f5;
|
|
||||||
margin: 0 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,314 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form-setting">
|
|
||||||
<h2>表单设置</h2>
|
|
||||||
<div class="form-setting__list">
|
|
||||||
<div class="setting-item">
|
|
||||||
<div class="setting-item__left">
|
|
||||||
<span>截止时间</span>
|
|
||||||
<image :src="`${$cdn}askform/bz.png`" @click="tips = '表单截止后,用户打开表单会提示此表单已结束' , isShowModal = true" />
|
|
||||||
</div>
|
|
||||||
<div class="setting-item__right">
|
|
||||||
<u-radio-group v-model="periodValidityType" active-color="#1088F9">
|
|
||||||
<u-radio name="0">永久有效</u-radio>
|
|
||||||
<u-radio name="1">自定义时间</u-radio>
|
|
||||||
</u-radio-group>
|
|
||||||
<u-icon name="arrow-right" color="#E1E2E3" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item" v-if="periodValidityType === '1'" @click="isShowTime = true">
|
|
||||||
<div class="setting-item__left">
|
|
||||||
<span>截至时间</span>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item__right">
|
|
||||||
<span>{{ periodValidityEndTime }}</span>
|
|
||||||
<u-icon name="arrow-right" color="#E1E2E3" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item">
|
|
||||||
<div class="setting-item__left">
|
|
||||||
<span>匹配客户方式</span>
|
|
||||||
<image :src="`${$cdn}askform/bz.png`" @click="tips = '将参与活动的微信客户和企业微信客户匹配' , isShowModal = true" />
|
|
||||||
</div>
|
|
||||||
<div class="setting-item__right">
|
|
||||||
<span>客户微信ID匹配</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item">
|
|
||||||
<div class="setting-item__left">
|
|
||||||
<span>提交次数</span>
|
|
||||||
<image :src="`${$cdn}askform/bz.png`" @click="tips = '此功能发布后不可修改' , isShowModal = true" />
|
|
||||||
</div>
|
|
||||||
<div class="setting-item__right">
|
|
||||||
<u-radio-group v-model="commitType" active-color="#1088F9">
|
|
||||||
<u-radio name="0">不限次数</u-radio>
|
|
||||||
<u-radio name="1">限提交一次</u-radio>
|
|
||||||
</u-radio-group>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item">
|
|
||||||
<div class="setting-item__left">
|
|
||||||
<span>行为通知</span>
|
|
||||||
<image :src="`${$cdn}askform/bz.png`" @click="tips = '当客户点击或者发布表单时,发送表单的员工将会受到消息提醒' , isShowModal = true" />
|
|
||||||
</div>
|
|
||||||
<div class="setting-item__right">
|
|
||||||
<u-switch v-model="actionNotice" active-value="1" inactive-value="0" :size="40" active-color="#1088F9"></u-switch>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="setting-item">
|
|
||||||
<div class="setting-item__left">
|
|
||||||
<span>动态通知</span>
|
|
||||||
<image :src="`${$cdn}askform/bz.png`" @click="tips = '当客户点击或者发布表单时,会将客户的打开行为记录在客户动态里' , isShowModal = true" />
|
|
||||||
</div>
|
|
||||||
<div class="setting-item__right">
|
|
||||||
<u-switch v-model="dynamicNotice" active-value="1" inactive-value="0" :size="40" active-color="#1088F9"></u-switch>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="add-form__footer">
|
|
||||||
<div @click="back">
|
|
||||||
<span>取消</span>
|
|
||||||
</div>
|
|
||||||
<div @click="confirm">{{ type === 'edit' ? '发布' : '确定' }}</div>
|
|
||||||
</div>
|
|
||||||
<u-modal v-model="isShowModal" :content="tips"></u-modal>
|
|
||||||
<u-picker mode="time" v-model="isShowTime" :show-time-tag="true" @confirm="onTimeChange" :params="params"></u-picker>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
params: {
|
|
||||||
year: true,
|
|
||||||
month: true,
|
|
||||||
day: true,
|
|
||||||
hour: true,
|
|
||||||
minute: true,
|
|
||||||
second: true
|
|
||||||
},
|
|
||||||
tips: '',
|
|
||||||
isShowModal: false,
|
|
||||||
actionNotice: true,
|
|
||||||
dynamicNotice: true,
|
|
||||||
commitType: '1',
|
|
||||||
wechatId: '0',
|
|
||||||
periodValidityEndTime: '',
|
|
||||||
isShowTime: false,
|
|
||||||
periodValidityType: '0',
|
|
||||||
type: '',
|
|
||||||
id: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad (query) {
|
|
||||||
if (query.id) {
|
|
||||||
this.id = query.id
|
|
||||||
this.getInfo(query.id)
|
|
||||||
this.type = query.type
|
|
||||||
} else if (query.formConfig && query.formConfig !== '{}') {
|
|
||||||
const res = JSON.parse(query.formConfig)
|
|
||||||
this.periodValidityType = res.periodValidityType
|
|
||||||
this.commitType = res.commitType
|
|
||||||
this.actionNotice = res.actionNotice === '1'
|
|
||||||
this.dynamicNotice = res.dynamicNotice === '1'
|
|
||||||
|
|
||||||
if (res.periodValidityType === '1') {
|
|
||||||
this.periodValidityEndTime = res.periodValidityEndTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onTimeChange (e) {
|
|
||||||
this.periodValidityEndTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`
|
|
||||||
},
|
|
||||||
|
|
||||||
back () {
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
getInfo (id) {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.periodValidityType = res.data.periodValidityType
|
|
||||||
this.commitType = res.data.commitType
|
|
||||||
this.actionNotice = res.data.actionNotice === '1'
|
|
||||||
this.dynamicNotice = res.data.dynamicNotice === '1'
|
|
||||||
|
|
||||||
if (res.data.periodValidityType === '1') {
|
|
||||||
this.periodValidityEndTime = res.data.periodValidityEndTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(msg => {
|
|
||||||
this.$u.toast(msg)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
publish () {
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/release`, null, {
|
|
||||||
params: {
|
|
||||||
commitType: this.commitType,
|
|
||||||
periodValidityType: this.periodValidityType,
|
|
||||||
actionNotice: this.actionNotice ? '1' : '0',
|
|
||||||
dynamicNotice: this.dynamicNotice ? '1' : '0',
|
|
||||||
shareStatus: '0',
|
|
||||||
wechatId: '0',
|
|
||||||
id: this.id,
|
|
||||||
periodValidityEndTime: this.periodValidityType === '1' ? this.periodValidityEndTime : ''
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
uni.$emit('reload')
|
|
||||||
this.$u.toast('发布成功')
|
|
||||||
|
|
||||||
this.back()
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
this.$u.toast(e)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
confirm () {
|
|
||||||
if (this.type === 'edit') {
|
|
||||||
this.publish()
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.$emit('setting', {
|
|
||||||
periodValidityType: this.periodValidityType,
|
|
||||||
commitType: this.commitType,
|
|
||||||
actionNotice: this.actionNotice ? '1' : '0',
|
|
||||||
dynamicNotice: this.dynamicNotice ? '1' : '0',
|
|
||||||
periodValidityEndTime: this.periodValidityEndTime ? this.periodValidityEndTime : ''
|
|
||||||
})
|
|
||||||
|
|
||||||
this.back()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.form-setting {
|
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
.add-form__footer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 112px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
&:first-child:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 36px;
|
|
||||||
background: #3192F4;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
line-height: 112px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
& > h2 {
|
|
||||||
height: 80px;
|
|
||||||
padding-top: 24px;
|
|
||||||
font-size: 28px;
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-setting__list {
|
|
||||||
padding: 0 20px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
|
|
||||||
.setting-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
height: 104px;
|
|
||||||
border-bottom: 1px solid #D8DDE6;
|
|
||||||
|
|
||||||
.setting-item__right {
|
|
||||||
color: #999;
|
|
||||||
font-size: 28px;
|
|
||||||
|
|
||||||
span {
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-radio__label {
|
|
||||||
color: #999;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-radio {
|
|
||||||
&:last-child {
|
|
||||||
.u-radio__label {
|
|
||||||
margin-right: 6px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
& > div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.setting-item__left {
|
|
||||||
color: #666666;
|
|
||||||
font-size: 30px;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
margin-left: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="form">
|
|
||||||
<div class="form-content">
|
|
||||||
<add-list ref="addList" v-if="currIndex === 1"></add-list>
|
|
||||||
<list ref="list" v-if="currIndex === 0"></list>
|
|
||||||
</div>
|
|
||||||
<ai-tabbar :active.sync="currIndex" :list="tabBar"/>
|
|
||||||
<div class="form-footer"></div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import addList from './components/addList.vue'
|
|
||||||
import list from './components/list.vue'
|
|
||||||
import AiTabbar from '../../components/AiTabbar'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'formIndex',
|
|
||||||
label: '问卷表单',
|
|
||||||
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
currIndex: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
addList,
|
|
||||||
AiTabbar,
|
|
||||||
list
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
tabBar () {
|
|
||||||
const link = icon => `${this.$cdn}askform/${icon}.png`
|
|
||||||
return [
|
|
||||||
{text: "表单列表", iconPath: "bdlb1", selectedIconPath: "bdlb2" },
|
|
||||||
{text: "新建项目", iconPath: "xjxm1", selectedIconPath: "xjxm2" }
|
|
||||||
].map(e => ({
|
|
||||||
...e,
|
|
||||||
iconPath: link(e.iconPath),
|
|
||||||
selectedIconPath: link(e.selectedIconPath)
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad () {
|
|
||||||
uni.$on('reload', () => {
|
|
||||||
if (this.currIndex === 0) {
|
|
||||||
this.$refs.list.reload()
|
|
||||||
} else {
|
|
||||||
this.$refs.addList.getList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onReachBottom() {
|
|
||||||
if (this.currIndex === 0) {
|
|
||||||
this.$refs.list.getList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.form {
|
|
||||||
padding-bottom: 98px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,457 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="add-form">
|
|
||||||
<div class="header-pic">
|
|
||||||
<image v-if="form.headPicture" :src="form.headPicture" />
|
|
||||||
</div>
|
|
||||||
<div class="form-info">
|
|
||||||
<div class="form-info__wrapper">
|
|
||||||
<textarea class="title" :auto-height="true" disabled placeholder="请输入标题 (必填)" v-model="form.title"></textarea>
|
|
||||||
<u-input class="content" disabled :clearable="false" type="textarea" v-model="form.tableExplain" placeholder="请输入表单描述 (选填)" :height="80" :auto-height="true" :maxlength="255"></u-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="components-list">
|
|
||||||
<div class="components-item" v-for="(item, index) in targetList" :key="index">
|
|
||||||
<div class="components-item__title">
|
|
||||||
<div class="components-item__title--left">
|
|
||||||
<em :style="{opacity: item.required ? 1 : 0}">*</em>
|
|
||||||
<i>{{ index + 1 }}.</i>
|
|
||||||
<h2>{{ item.label }}</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="components-item__filed">
|
|
||||||
<template v-if="(item.type === 'radio')">
|
|
||||||
<u-radio-group v-model="item.value" wrap>
|
|
||||||
<u-radio :name="field.label" v-for="(field, i) in item.options" :key="i">
|
|
||||||
<image :src="field.img[0].url" v-if="field.img.length"/>
|
|
||||||
<span>{{ field.label }}</span>
|
|
||||||
</u-radio>
|
|
||||||
</u-radio-group>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'checkbox')">
|
|
||||||
<u-checkbox-group wrap>
|
|
||||||
<u-checkbox :name="field.label" v-model="field.checked1" v-for="(field, i) in item.options" :key="i">
|
|
||||||
<image :src="field.img[0].url" v-if="field.img.length"/>
|
|
||||||
<span>{{ field.label }}</span>
|
|
||||||
</u-checkbox>
|
|
||||||
</u-checkbox-group>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'select')">
|
|
||||||
<div class="components-item__select">
|
|
||||||
<span>{{ item.placeholder }}</span>
|
|
||||||
<u-icon name="arrow-down" color="#DEDFDF" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'upload')">
|
|
||||||
<div class="components-item__select components-item__textarea components-item__upload">
|
|
||||||
<image :src="`${$cdn}askform/upload.png`" />
|
|
||||||
<span>选择图片(2M以内)</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'input')">
|
|
||||||
<div class="components-item__select">
|
|
||||||
<span>{{ item.placeholder }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-if="(item.type === 'textarea')">
|
|
||||||
<div class="components-item__select components-item__textarea">
|
|
||||||
<span>{{ item.placeholder }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<AiBack></AiBack>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import AiBack from "@/components/AiBack";
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
form: {
|
|
||||||
tableExplain: '详细描述',
|
|
||||||
title: '问卷调查',
|
|
||||||
isShowheadPicture: true,
|
|
||||||
isShowTableExplain: true,
|
|
||||||
isShowBtn: true,
|
|
||||||
headPicture: '',
|
|
||||||
commitType: '1',
|
|
||||||
periodValidityType: '0',
|
|
||||||
actionNotice: '1',
|
|
||||||
dynamicNotice: '1',
|
|
||||||
periodValidityEndTime: '',
|
|
||||||
shareStatus: '0',
|
|
||||||
count: 0,
|
|
||||||
wechatId: '0',
|
|
||||||
type: 0,
|
|
||||||
buttonExplain: '提交',
|
|
||||||
tips: true
|
|
||||||
},
|
|
||||||
templateType: 0,
|
|
||||||
targetList: [],
|
|
||||||
isShow: false,
|
|
||||||
type: 0,
|
|
||||||
id: '',
|
|
||||||
touchStart: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad (query) {
|
|
||||||
this.form = JSON.parse(query.form)
|
|
||||||
this.targetList = JSON.parse(query.targetList)
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
AiBack
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
getInfo (id) {
|
|
||||||
uni.showLoading()
|
|
||||||
this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.form = {
|
|
||||||
...res.data,
|
|
||||||
headPicture: res.data.headPicture
|
|
||||||
}
|
|
||||||
|
|
||||||
this.type = res.data.type
|
|
||||||
|
|
||||||
this.targetList = res.data.fields.map(item => {
|
|
||||||
return JSON.parse(item.fieldInfo)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.pageShow = true
|
|
||||||
} else {
|
|
||||||
this.$u.toast(res.msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.hideLoading()
|
|
||||||
}).catch(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.add-form {
|
|
||||||
min-height: 100vh;
|
|
||||||
padding-bottom: 60px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background: #F3F6F9;
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .u-drawer-bottom {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-list {
|
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
.components-item {
|
|
||||||
margin-top: 24px;
|
|
||||||
padding: 32px;
|
|
||||||
box-shadow: 0 4px 8px 4px rgba(233, 233, 233, 0.39);
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
border: 1px solid #EEEFF0;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
::v-deep .u-radio, ::v-deep .u-checkbox {
|
|
||||||
position: relative;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.u-checkbox__icon-wrap, .u-radio__icon-wrap {
|
|
||||||
position: absolute;
|
|
||||||
top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.u-radio__label, .u-checkbox__label {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-right: 0;
|
|
||||||
margin-left: 40px;
|
|
||||||
line-height: 1.5;
|
|
||||||
text-align: justify;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100px;
|
|
||||||
height: 100px;
|
|
||||||
margin: 0 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
flex: 1;
|
|
||||||
color: #666;
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-item__select {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: 100%;
|
|
||||||
height: 80px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
padding: 0 26px;
|
|
||||||
border: 1px solid #DEDFDF;
|
|
||||||
|
|
||||||
&.components-item__textarea {
|
|
||||||
align-items: flex-start;
|
|
||||||
height: 160px;
|
|
||||||
padding-top: 20px;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 46px;
|
|
||||||
height: 34px;
|
|
||||||
margin-right: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: #666;
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.components-item__upload {
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.components-item__title {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 32px;
|
|
||||||
|
|
||||||
em {
|
|
||||||
margin-right: 4px;
|
|
||||||
font-style: normal;
|
|
||||||
color: rgb(226, 33, 32);;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
box-sizing: content-box;
|
|
||||||
padding: 20px 0 20px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-popup {
|
|
||||||
height: 440px;
|
|
||||||
border-radius: 20px 20px 0 0;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.add-popup__title {
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 96px;
|
|
||||||
border-bottom: 1px solid #E4E5E6;
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
position: absolute;
|
|
||||||
right: 32px;
|
|
||||||
top: 50%;
|
|
||||||
width: 30px;
|
|
||||||
height: 20px;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-popup__list {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: 0 34px;
|
|
||||||
|
|
||||||
span {
|
|
||||||
width: calc((100% - 64px) / 3);
|
|
||||||
height: 78px;
|
|
||||||
line-height: 78px;
|
|
||||||
margin-top: 32px;
|
|
||||||
margin-right: 32px;
|
|
||||||
text-align: center;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 28px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #E4E5E6;
|
|
||||||
|
|
||||||
&:nth-of-type(3n) {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-form__footer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 112px;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 36px;
|
|
||||||
background: #3192F4;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
flex: 1;
|
|
||||||
height: 100%;
|
|
||||||
line-height: 112px;
|
|
||||||
color: #333333;
|
|
||||||
font-size: 32px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-form__btn {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 214px;
|
|
||||||
height: 66px;
|
|
||||||
line-height: 66px;
|
|
||||||
margin: 64px auto 0;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 34px;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
margin-left: 16px;
|
|
||||||
color: #4392E6;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-info {
|
|
||||||
margin-top: 26px;
|
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
& > h2 {
|
|
||||||
height: 76px;
|
|
||||||
line-height: 76px;
|
|
||||||
color: #999999;
|
|
||||||
font-weight: normal;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-info__wrapper {
|
|
||||||
padding: 0 18px;
|
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
.title {
|
|
||||||
width: 100%;
|
|
||||||
padding: 22px 0;
|
|
||||||
font-size: 36px;
|
|
||||||
border-bottom: 1px solid #F1F2F3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
padding: 30px 0!important;
|
|
||||||
font-size: 28px;
|
|
||||||
|
|
||||||
::v-deep textarea {
|
|
||||||
color: #333;
|
|
||||||
font-size: 28px!important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-pic {
|
|
||||||
position: relative;
|
|
||||||
font-size: 0;
|
|
||||||
|
|
||||||
span {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 16px;
|
|
||||||
right: 16px;
|
|
||||||
z-index: 1;
|
|
||||||
width: 148px;
|
|
||||||
height: 56px;
|
|
||||||
line-height: 56px;
|
|
||||||
text-align: center;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 26px;
|
|
||||||
background: rgba(0, 0, 0, 0.16);
|
|
||||||
border-radius: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100%;
|
|
||||||
height: 320px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user