From dea04f6c5daecdefd1cdc77611e66e8b53b43dea Mon Sep 17 00:00:00 2001 From: wangqing <250543222@qq.com> Date: Sun, 30 May 2021 21:54:38 +0800 Subject: [PATCH] add public write result --- .../styles/resources/element-variables.scss | 2 + src/assets/styles/resources/variables.scss | 24 +-- src/components/generator/config.js | 9 +- src/components/parser/Parser.vue | 12 +- src/components/render/slots/el-carousel.js | 2 +- src/router/modules/project.js | 5 + src/utils/convert.js | 4 + src/views/form/setting/index.vue | 17 +- src/views/form/statistics/index.vue | 33 ++-- src/views/form/statistics/item.vue | 55 ++++++ src/views/form/statistics/public.vue | 185 ++++++++++++++++++ src/views/form/write/index.vue | 24 ++- 12 files changed, 321 insertions(+), 51 deletions(-) create mode 100644 src/views/form/statistics/item.vue create mode 100644 src/views/form/statistics/public.vue diff --git a/src/assets/styles/resources/element-variables.scss b/src/assets/styles/resources/element-variables.scss index e114288..a123c0d 100644 --- a/src/assets/styles/resources/element-variables.scss +++ b/src/assets/styles/resources/element-variables.scss @@ -19,6 +19,8 @@ $--border-color-lighter: #e6ebf5; $--table-border: 1px solid #dfe6ec; +$--box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + /* icon font path, required */ $--font-path: "~element-ui/lib/theme-chalk/fonts"; @import "../../../../node_modules/element-ui/packages/theme-chalk/src/index"; diff --git a/src/assets/styles/resources/variables.scss b/src/assets/styles/resources/variables.scss index eff6f98..decb04a 100644 --- a/src/assets/styles/resources/variables.scss +++ b/src/assets/styles/resources/variables.scss @@ -1,23 +1,23 @@ // base color -$blue:#324157; -$light-blue:#3a71a8; -$red:#c03639; +$blue: #324157; +$light-blue: #3a71a8; +$red: #c03639; $pink: #e65d6e; $green: #30b08f; $tiffany: #4ab7bd; -$yellow:#fec171; +$yellow: #fec171; $panGreen: #30b08f; - +$backgroundColor: rgba(247, 247, 247, 90); // sidebar -$menuText:#bfcbd9; -$menuActiveText:#409eff; -$subMenuActiveText:#f4f4f5; // https://github.com/ElemeFE/element/issues/12951 +$menuText: #bfcbd9; +$menuActiveText: #409eff; +$subMenuActiveText: #f4f4f5; // https://github.com/ElemeFE/element/issues/12951 -$menuBg:#304156; -$menuHover:#263445; +$menuBg: #304156; +$menuHover: #263445; -$subMenuBg:#1f2d3d; -$subMenuHover:#001528; +$subMenuBg: #1f2d3d; +$subMenuHover: #001528; $sideBarWidth: 210px; diff --git a/src/components/generator/config.js b/src/components/generator/config.js index 56a03f8..9a20785 100644 --- a/src/components/generator/config.js +++ b/src/components/generator/config.js @@ -496,6 +496,7 @@ export const imageComponents = [ __config__: { label: '图片展示', showLabel: false, + displayType: true, labelWidth: null, showDefaultValue: false, showRequired: false, @@ -505,7 +506,7 @@ export const imageComponents = [ tagIcon: 'image', layout: 'colFormItem', span: 24, - required: true, + required: false, regList: [], changeTag: true }, @@ -522,6 +523,7 @@ export const imageComponents = [ __config__: { label: '图片轮播', showLabel: false, + displayType: true, labelWidth: null, defaultValue: null, showDefaultValue: false, @@ -579,6 +581,7 @@ export const assistComponents = [ __config__: { label: '文字描述', defaultValue: '描述文字', + displayType: true, showDefaultValue: true, showRequired: false, showClearable: false, @@ -600,6 +603,7 @@ export const assistComponents = [ __config__: { label: '分割线', defaultValue: '分割线', + displayType: true, showLabel: false, showDefaultValue: false, showRequired: false, @@ -644,6 +648,7 @@ export const assistComponents = [ __config__: { label: '分页', defaultValue: '分页', + displayType: true, showLabel: false, showDefaultValue: false, showRequired: false, @@ -667,7 +672,7 @@ export const assistComponents = [ ] // 个人信息组件 -export const personalInfoComponents = [ +export const personalInfoComponents = [ { typeId: 'INPUT', __config__: { diff --git a/src/components/parser/Parser.vue b/src/components/parser/Parser.vue index 32f2bf4..fd8af7c 100644 --- a/src/components/parser/Parser.vue +++ b/src/components/parser/Parser.vue @@ -150,9 +150,9 @@ function setUpload(config, scheme, response, file, fileList) { newValue = [] } newValue.push({fileName: file.name, url: response.data}) - this.$set(config, 'defaultValue', JSON.stringify(newValue)) - this.$set(this[this.formConf.formModel], scheme.__vModel__, JSON.stringify(newValue)) - setValueLabel.call(this, {type: 'file', files: JSON.stringify(newValue)}, config, scheme) + this.$set(config, 'defaultValue', newValue) + this.$set(this[this.formConf.formModel], scheme.__vModel__, newValue) + setValueLabel.call(this, {type: 'file', files: newValue}, config, scheme) } function deleteUpload(config, scheme, file, fileList) { @@ -160,9 +160,9 @@ function deleteUpload(config, scheme, file, fileList) { fileList.forEach(element => { newValue.push({fileName: element.name, url: element.url}) }) - this.$set(config, 'defaultValue', JSON.stringify(newValue)) - this.$set(this[this.formConf.formModel], scheme.__vModel__, JSON.stringify(newValue)) - setValueLabel.call(this, {type: 'file', files: JSON.stringify(newValue)}, config, scheme) + this.$set(config, 'defaultValue', newValue) + this.$set(this[this.formConf.formModel], scheme.__vModel__, newValue) + setValueLabel.call(this, {type: 'file', files: newValue}, config, scheme) } function setValue(event, config, scheme) { diff --git a/src/components/render/slots/el-carousel.js b/src/components/render/slots/el-carousel.js index 54ba8ae..ca65f03 100644 --- a/src/components/render/slots/el-carousel.js +++ b/src/components/render/slots/el-carousel.js @@ -4,7 +4,7 @@ export default { let style = 'height: 100%;' conf.__slot__.options.forEach(item => { list.push( - {item.label} +

{item.label}

) }) diff --git a/src/router/modules/project.js b/src/router/modules/project.js index 1fea48a..1879a47 100644 --- a/src/router/modules/project.js +++ b/src/router/modules/project.js @@ -32,6 +32,11 @@ export default [ meta: {requireLogin: false}, component: () => import(/* webpackChunkName: 'root' */ '@/views/form/preview/ProjectForm.vue') }, + { + path: '/project/public/result', + meta: {requireLogin: false}, + component: () => import(/* webpackChunkName: 'root' */ '@/views/form/statistics/public') + }, { path: '/s/:key', meta: {requireLogin: false}, diff --git a/src/utils/convert.js b/src/utils/convert.js index c28d0e4..43a5a39 100644 --- a/src/utils/convert.js +++ b/src/utils/convert.js @@ -20,6 +20,7 @@ export function formItemConvertData(item, projectKey) { 'regList': item.__config__.regList, 'showLabel': item.__config__.showLabel, 'span': item.__config__.span, + 'displayType': item.displayType, 'projectKey': projectKey } let expand = {} @@ -64,6 +65,7 @@ export function dbDataConvertForItemJson(data) { jsonItem.dId = data.id jsonItem.sort = data.sort jsonItem.typeId = data.type + jsonItem.displayType = data.displayType jsonItem.__config__.span = data.span jsonItem.__config__.formId = data.formItemId jsonItem.__config__.label = data.label @@ -97,7 +99,9 @@ const dataParams = { // 单行文本 'INPUT': { 'prepend': '__slot__.prepend', + 'prefixIcon': 'prefix-icon', 'maxlength': 'maxlength', + 'showWordLimit': 'show-word-limit', 'append': '__slot__.append' }, // 多行文本 diff --git a/src/views/form/setting/index.vue b/src/views/form/setting/index.vue index 7557006..12b7585 100644 --- a/src/views/form/setting/index.vue +++ b/src/views/form/setting/index.vue @@ -5,7 +5,6 @@

提交设置

-

提交后

显示提示图片

@@ -87,8 +86,21 @@ />
+ + +

公开反馈结果

+
+ + + +
- +

回收设置

@@ -572,6 +584,7 @@ export default { submitPromptText: '提交成功 !', submitJumpUrl: '', wxWrite: false, + publicResult: false, timedNotEnabledPromptText: '填写尚未启用', timedDeactivatePromptText: '填写尚已经停用', timedQuantitativeQuantity: null, diff --git a/src/views/form/statistics/index.vue b/src/views/form/statistics/index.vue index 7c1df23..6730d28 100644 --- a/src/views/form/statistics/index.vue +++ b/src/views/form/statistics/index.vue @@ -65,6 +65,7 @@ @@ -76,25 +77,10 @@

{{ item.label }}

- -
- - {{ file.fileName }} - -
- - {{ - activeResultRow ? - activeResultRow['processData'][`field${item.formItemId}`] : '' - }} - + +
@@ -146,7 +132,7 @@ + diff --git a/src/views/form/statistics/public.vue b/src/views/form/statistics/public.vue new file mode 100644 index 0000000..71d43ec --- /dev/null +++ b/src/views/form/statistics/public.vue @@ -0,0 +1,185 @@ + + + + diff --git a/src/views/form/write/index.vue b/src/views/form/write/index.vue index c1d58d1..7e5c8cf 100644 --- a/src/views/form/write/index.vue +++ b/src/views/form/write/index.vue @@ -31,6 +31,9 @@ fit="cover" /> + + 查看数据 + @@ -39,7 +42,7 @@ import ProjectForm from '../preview/ProjectForm' import loadWXJs from '@/utils/loadWxSdk' import defaultValue from '@/utils/defaultValue' -import { getQueryString} from '@/utils' +import {getQueryString} from '@/utils' import constants from '@/utils/constants' const uaParser = require('ua-parser-js') @@ -73,11 +76,13 @@ export default { wxSignature: {} } }, - beforeCreate() { - let meta = document.createElement('meta') - meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' - meta.name = 'viewport' - document.getElementsByTagName('head')[0].appendChild(meta) + metaInfo: { + meta: [ + { + name: 'viewport', + content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' + } + ] }, created() { let key = this.$route.query.key || this.$route.params.key @@ -237,6 +242,9 @@ export default { } }) }, + /** + * 仅在微信打开 + */ onlyWxOpenHandle() { let wxUa = navigator.userAgent.toLowerCase() let isWeixin = wxUa.indexOf('micromessenger') != -1 @@ -245,6 +253,10 @@ export default { document.body.innerHTML = '

请在微信客户端打开链接

' } }, + openPublicResultHandle() { + let projectKey = this.projectConfig.projectKey + this.$router.replace({path: '/project/public/result', query: {projectKey}}) + }, submitForm(data) { // 完成时间 let inActiveTime = document.getElementById('inActiveTime').innerText