同步3.0
This commit is contained in:
		| @@ -1,155 +1,134 @@ | |||||||
| <template> | <template> | ||||||
|   <div class="add-form" v-if="pageShow"> |   <div class="add-form" v-if="pageShow"> | ||||||
|     <div v-show="!isShowConfig"> |     <div class="header-pic"> | ||||||
|       <div class="header-pic"> |       <image v-if="form.headPicture" :src="form.headPicture"/> | ||||||
|         <image v-if="form.headPicture" :src="form.headPicture"/> |       <span @click="upload">更换图片</span> | ||||||
|         <span @click="upload">更换图片</span> |     </div> | ||||||
|       </div> |     <div class="form-info"> | ||||||
|       <div class="form-info"> |       <h2>文本选项</h2> | ||||||
|         <h2>文本选项</h2> |       <div class="form-info__wrapper"> | ||||||
|         <div class="form-info__wrapper"> |  | ||||||
|           <textarea class="title" placeholder="请输入标题 (必填)" :maxlength="30" :auto-height="true" |           <textarea class="title" placeholder="请输入标题 (必填)" :maxlength="30" :auto-height="true" | ||||||
|                     v-model="form.title"></textarea> |                     v-model="form.title"></textarea> | ||||||
|           <textarea |         <textarea | ||||||
|               class="content" |             class="content" | ||||||
|               border="none" |             border="none" | ||||||
|               :clearable="false" |             :clearable="false" | ||||||
|               type="textarea" |             type="textarea" | ||||||
|               v-model="form.tableExplain" |             v-model="form.tableExplain" | ||||||
|               placeholder="请输入表单描述 (选填)" |             placeholder="请输入表单描述 (选填)" | ||||||
|               :maxlength="255"> |             :maxlength="255"> | ||||||
|           </textarea> |           </textarea> | ||||||
|         </div> |  | ||||||
|       </div> |       </div> | ||||||
|       <draggable |     </div> | ||||||
|           class="components-list" |     <draggable | ||||||
|           v-model="targetList" |         class="components-list" | ||||||
|           :animation="340" |         v-model="targetList" | ||||||
|           scroll |         :animation="340" | ||||||
|           element="div" |         scroll | ||||||
|           :options="{ |         element="div" | ||||||
|  |         :options="{ | ||||||
|           animation: 340, |           animation: 340, | ||||||
|           handle: '.components-item__title' |           handle: '.components-item__title' | ||||||
|         }" |         }" | ||||||
|           draggable=".components-item" |         draggable=".components-item" | ||||||
|           :sort="true"> |         :sort="true"> | ||||||
|         <div class="components-item" v-for="(item, index) in targetList" :key="index" |       <div class="components-item" v-for="(item, index) in targetList" :key="index" | ||||||
|              @click="toFiledSetting(item, index)"> |            @click="toFiledSetting(item, index)"> | ||||||
|           <div class="components-item__title"> |         <div class="components-item__title"> | ||||||
|             <div class="components-item__title--left"> |           <div class="components-item__title--left"> | ||||||
|               <em :style="{opacity: item.required ? 1 : 0}">*</em> |             <em :style="{opacity: item.required ? 1 : 0}">*</em> | ||||||
|               <i>{{ index + 1 }}.</i> |             <i>{{ index + 1 }}.</i> | ||||||
|               <h2>{{ item.label }}</h2> |             <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 class="u-radio" disabled style="display: block;" 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 class="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> |             </div> | ||||||
|             <image :src="`${$cdn}askform/sc1.png`" @click.stop="removeComponent(index)" |           </template> | ||||||
|                    @touchstart.stop="removeComponent(index)"/> |           <template v-if="(item.type === 'upload')"> | ||||||
|           </div> |             <div class="components-item__select components-item__textarea components-item__upload"> | ||||||
|           <div class="components-item__filed"> |               <image :src="`${$cdn}askform/upload.png`"/> | ||||||
|             <template v-if="(item.type === 'radio')"> |               <span>选择图片(10M以内)</span> | ||||||
|               <u-radio-group v-model="item.value" wrap> |             </div> | ||||||
|                 <u-radio class="u-radio" disabled style="display: block;" v-for="(field, i) in item.options" :key="i"> |           </template> | ||||||
|                   <image :src="field.img[0].url" v-if="field.img.length"/> |           <template v-if="(item.type === 'input')"> | ||||||
|                   <span>{{ field.label }}</span> |             <div class="components-item__select"> | ||||||
|                 </u-radio> |               <span>{{ item.placeholder }}</span> | ||||||
|               </u-radio-group> |             </div> | ||||||
|             </template> |           </template> | ||||||
|             <template v-if="(item.type === 'checkbox')"> |           <template v-if="(item.type === 'textarea')"> | ||||||
|               <u-checkbox-group v-model="item.value" wrap> |             <div class="components-item__select components-item__textarea"> | ||||||
|                 <u-checkbox class="u-checkbox" disabled :name="field.label" v-for="(field, i) in item.options" :key="i"> |               <span>{{ item.placeholder }}</span> | ||||||
|                   <image :src="field.img[0].url" v-if="field.img.length"/> |             </div> | ||||||
|                   <span>{{ field.label }}</span> |           </template> | ||||||
|                 </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>选择图片(10M以内)</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> | ||||||
|       </draggable> |  | ||||||
|       <div class="add-form__btn" @click="isShow = true"> |  | ||||||
|         <image :src="`${$cdn}askform/add.png`"/> |  | ||||||
|         <span>添加问题</span> |  | ||||||
|       </div> |       </div> | ||||||
|       <div class="add-form__footer"> |     </draggable> | ||||||
|         <div class="add-form__footer--item-wrapper"> |     <div class="add-form__btn" @click="isShow = true"> | ||||||
|           <div class="add-form__footer--item" @click="toPreview"> |       <image :src="`${$cdn}askform/add.png`"/> | ||||||
|             <image :src="`${$cdn}sass/preview.png`"/> |       <span>添加问题</span> | ||||||
|             <span>预览</span> |     </div> | ||||||
|           </div> |     <div class="add-form__footer"> | ||||||
|           <div class="add-form__footer--item" @click="toSetting"> |       <div class="add-form__footer--item-wrapper"> | ||||||
|             <image :src="`${$cdn}sass/setting.png`"/> |         <div class="add-form__footer--item" @click="toPreview"> | ||||||
|             <span>设置</span> |           <image :src="`${$cdn}sass/preview.png`"/> | ||||||
|           </div> |           <span>预览</span> | ||||||
|  |         </div> | ||||||
|  |         <div class="add-form__footer--item" @click="toSetting"> | ||||||
|  |           <image :src="`${$cdn}sass/setting.png`"/> | ||||||
|  |           <span>设置</span> | ||||||
|         </div> |         </div> | ||||||
|         <div @click="onConfirm">立即发布</div> |  | ||||||
|       </div> |       </div> | ||||||
|       <u-popup v-model="isShow" :closeable="false" mode="bottom" @close="isShow = false"> |       <div @click="onConfirm">立即发布</div> | ||||||
|         <div class="add-popup"> |     </div> | ||||||
|           <div class="add-popup__title"> |     <u-popup v-model="isShow" :closeable="false" mode="bottom" @close="isShow = false"> | ||||||
|             <h2>添加问题</h2> |       <div class="add-popup"> | ||||||
|             <image :src="`${$cdn}askform/zk.png`" mode="aspectFit" @click="isShow = false"/> |         <div class="add-popup__title"> | ||||||
|           </div> |           <h2>添加问题</h2> | ||||||
|           <div class="add-popup__list"> |           <image :src="`${$cdn}askform/zk.png`" mode="aspectFit" @click="isShow = false"/> | ||||||
|             <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> |         </div> | ||||||
|       </u-popup> |         <div class="add-popup__list"> | ||||||
|     </div> |           <span @click="toFiledSetting('radio')">单选题</span> | ||||||
|     <div class="detail" v-if="isShowConfig"> |           <span @click="toFiledSetting('checkbox')">多选题</span> | ||||||
|       <component |           <span @click="toFiledSetting('select')">单下拉框</span> | ||||||
|           :is="component" |           <span @click="toFiledSetting('input')">单行填空</span> | ||||||
|           :index="filedIndex" |           <span @click="toFiledSetting('textarea')">多行填空</span> | ||||||
|           :filed="filed" |           <span @click="toFiledSetting('upload')">上传图片</span> | ||||||
|           @change="onChange" |         </div> | ||||||
|           :targetListData="targetList" |       </div> | ||||||
|           :formData="form" |     </u-popup> | ||||||
|           :filedType="filedType" |  | ||||||
|           @back="isShowConfig = false" |  | ||||||
|           :id="id" |  | ||||||
|           :formConfig="formConfig"> |  | ||||||
|       </component> |  | ||||||
|     </div> |  | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import draggable from 'vuedraggable' | import draggable from 'vuedraggable' | ||||||
| import FiledConfig from './FiledConfig' | import qs from "query-string" | ||||||
| import FormSetting from '../FormSetting' |  | ||||||
| import PreviewForm from './PreviewForm' |  | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   props: ['params'], |  | ||||||
| 
 |  | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       pageShow: false, |       pageShow: false, | ||||||
|       isShowConfig: false, |  | ||||||
|       form: { |       form: { | ||||||
|         tableExplain: '详细描述', |         tableExplain: '详细描述', | ||||||
|         title: '问卷调查', |         title: '问卷调查', | ||||||
| @@ -179,34 +158,23 @@ export default { | |||||||
|       filedIndex: '', |       filedIndex: '', | ||||||
|       isQuote: false, |       isQuote: false, | ||||||
|       touchStart: 0, |       touchStart: 0, | ||||||
|       component: '', |  | ||||||
|       formConfig: {} |       formConfig: {} | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| 
 |  | ||||||
|   components: { |   components: { | ||||||
|     draggable, |     draggable, | ||||||
|     PreviewForm, |  | ||||||
|     FormSetting, |  | ||||||
|     FiledConfig |  | ||||||
|   }, |   }, | ||||||
| 
 |   created() { | ||||||
|   mounted() { |     let {type, isQuote, id} = this.$route.query | ||||||
|     this.type = Number(this.params.type) |     this.type = type | ||||||
| 
 |     this.isQuote = !!isQuote | ||||||
|     if (this.params.isQuote) { |     if (id) { | ||||||
|       this.isQuote = true |       this.id = id | ||||||
|     } |       this.getInfo(id) | ||||||
| 
 |  | ||||||
|     if (this.params.id) { |  | ||||||
|       this.id = this.params.id |  | ||||||
|       this.getInfo(this.params.id) |  | ||||||
|     } else { |     } else { | ||||||
|       this.pageShow = true |       this.pageShow = true | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     this.init() |     this.init() | ||||||
| 
 |  | ||||||
|     uni.$on('setting', res => { |     uni.$on('setting', res => { | ||||||
|       this.form = { |       this.form = { | ||||||
|         ...this.form, |         ...this.form, | ||||||
| @@ -216,28 +184,29 @@ export default { | |||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     uni.$on('filedConfig', res => { |     uni.$on('filedConfig', res => { | ||||||
|       if (res.index === '-1') { |       console.log(res) | ||||||
|  |       if (res.index < 0) { | ||||||
|         this.targetList.push(res.config) |         this.targetList.push(res.config) | ||||||
|       } else { |       } else { | ||||||
|         this.$set(this.targetList, [res.index], res.config) |         this.targetList.splice(res.index, 1, res.config) | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|  |   onShow () { | ||||||
|  |     localStorage.removeItem("toFiledConfig") | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|   methods: { |   methods: { | ||||||
|     toSetting() { |     toSetting() { | ||||||
|       this.component = 'FormSetting' |       let {formConfig} = this | ||||||
|       this.isShowConfig = true |       localStorage.setItem("toFormSetting", JSON.stringify(formConfig)) | ||||||
|  |       uni.navigateTo({url: `./FormSetting`}) | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     back() { |     back() { | ||||||
|       this.$emit('change', { |       uni.navigateBack({}) | ||||||
|         type: 'Tabbar' |  | ||||||
|       }) |  | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     onChange(e) { |     onChange(e) { | ||||||
| 
 |  | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     removeComponent(index) { |     removeComponent(index) { | ||||||
| @@ -245,8 +214,9 @@ export default { | |||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     toPreview() { |     toPreview() { | ||||||
|       this.component = 'PreviewForm' |       let {form, targetList} = this | ||||||
|       this.isShowConfig = true |       localStorage.setItem("toPreviewForm", JSON.stringify({form, targetList})) | ||||||
|  |       uni.navigateTo({url: `./PreviewForm`}) | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     upload() { |     upload() { | ||||||
| @@ -339,18 +309,15 @@ export default { | |||||||
|         type: this.type, |         type: this.type, | ||||||
|         templateType: 0 |         templateType: 0 | ||||||
|       }).then(res => { |       }).then(res => { | ||||||
|         if (res.code == 0) { |         if (res?.code == 0) { | ||||||
|           setTimeout(() => { |           uni.navigateTo({ | ||||||
|             this.$emit('change', { |             url: `./Result?${qs.stringify({ | ||||||
|               type: 'Result', |               linkUrl: res.data.linkUrl, | ||||||
|               params: { |               title: this.form.title, | ||||||
|                 linkUrl: res.data.linkUrl, |               tableExplain: this.form.tableExplain, | ||||||
|                 title: this.form.title, |               headPicture: this.form.headPicture | ||||||
|                 tableExplain: this.form.tableExplain, |             })}` | ||||||
|                 headPicture: this.form.headPicture |           }) | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|           }, 600) |  | ||||||
|         } |         } | ||||||
|       }).catch(e => { |       }).catch(e => { | ||||||
|         this.$u.toast(e) |         this.$u.toast(e) | ||||||
| @@ -376,7 +343,6 @@ export default { | |||||||
|         } else { |         } else { | ||||||
|           this.$u.toast(res.msg) |           this.$u.toast(res.msg) | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         uni.hideLoading() |         uni.hideLoading() | ||||||
|       }).catch(() => { |       }).catch(() => { | ||||||
|         uni.hideLoading() |         uni.hideLoading() | ||||||
| @@ -388,16 +354,12 @@ export default { | |||||||
|       if (index > -1) { |       if (index > -1) { | ||||||
|         this.filed = type |         this.filed = type | ||||||
|         this.filedIndex = index |         this.filedIndex = index | ||||||
|         this.component = 'FiledConfig' |         localStorage.setItem("toFiledConfig", JSON.stringify({index, filed: type, filedType: type.type})) | ||||||
|         this.isShowConfig = true |       } else { | ||||||
| 
 |         this.filedIndex = '' | ||||||
|         return false |         localStorage.setItem("toFiledConfig", JSON.stringify({filed: '', filedType: type, index: -1})) | ||||||
|       } |       } | ||||||
| 
 |       uni.navigateTo({url: `./FiledConfig`}) | ||||||
|       this.filedIndex = '' |  | ||||||
|       this.filedType = type |  | ||||||
|       this.component = 'FiledConfig' |  | ||||||
|       this.isShowConfig = true |  | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     init() { |     init() { | ||||||
| @@ -1,17 +1,13 @@ | |||||||
| <template> | <template> | ||||||
|   <div class="form"> |   <div class="form"> | ||||||
|     <component |     <component ref="TabPage" :is="component" @change="onChange" :params="params"/> | ||||||
|         :is="component" |  | ||||||
|         @change="onChange" |  | ||||||
|         :params="params"> |  | ||||||
|     </component> |  | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| import Tabbar from './components/Tabbar.vue' | import Tabbar from './components/Tabbar.vue' | ||||||
| import AddForm from './components/AddForm.vue' | import AddForm from './AddForm.vue' | ||||||
| import Result from './components/Result.vue' | import Result from './Result.vue' | ||||||
| import {mapActions} from "vuex"; | import {mapActions} from "vuex"; | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
| @@ -21,7 +17,8 @@ export default { | |||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       component: 'Tabbar', |       component: 'Tabbar', | ||||||
|       params: {} |       params: {}, | ||||||
|  |       refresh: true | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
| @@ -40,8 +37,11 @@ export default { | |||||||
|   }, |   }, | ||||||
|   onShow() { |   onShow() { | ||||||
|     document.title = "问卷表单" |     document.title = "问卷表单" | ||||||
|     this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact', 'shareAppMessage', 'shareWechatMessage']).then(() => { |     this.$refs?.TabPage?.show() | ||||||
|       this.$dict.load(['questionnaireStatus', 'questionnaireType', 'questionnaireFieldType']) |     this.$nextTick(() => { | ||||||
|  |       this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact', 'shareAppMessage', 'shareWechatMessage']).then(() => { | ||||||
|  |         this.$dict.load(['questionnaireStatus', 'questionnaireType', 'questionnaireFieldType']) | ||||||
|  |       }) | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -69,7 +69,8 @@ export default { | |||||||
|     this.checkAccess() |     this.checkAccess() | ||||||
|   }, |   }, | ||||||
|   onShow() { |   onShow() { | ||||||
|     document.title = "问卷调查" |     document.title = '问卷调查' | ||||||
|  |     wx.hideOptionMenu() | ||||||
|   }, |   }, | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
|   | |||||||
| @@ -142,45 +142,32 @@ | |||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import {components} from './config' | import {components} from './components/config' | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   props: ['filed', 'index', 'filedType'], |  | ||||||
| 
 |  | ||||||
|   data() { |   data() { | ||||||
|  |     let params = localStorage.getItem("toFiledConfig") | ||||||
|  |     params && (params = JSON.parse(params)) | ||||||
|  |     params.config = params.index > -1 ? params.filed : components.filter(v => v.type === params.filedType)[0] | ||||||
|     return { |     return { | ||||||
|  |       ...params, | ||||||
|       isShowType: false, |       isShowType: false, | ||||||
|       isShowAnswer: false, |       isShowAnswer: false | ||||||
|       config: {} |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| 
 |  | ||||||
|   mounted() { |  | ||||||
|     if (this.index !== '') { |  | ||||||
|       this.config = this.filed |  | ||||||
|       return false |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     console.log(components) |  | ||||||
|     this.config = JSON.parse(JSON.stringify(components.filter(v => v.type === this.filedType)[0])) |  | ||||||
|   }, |  | ||||||
| 
 |  | ||||||
|   computed: { |   computed: { | ||||||
|     pointTypeName() { |     pointTypeName() { | ||||||
|       if (!this.config.pointDict) return '' |       if (!this.config.pointDict) return '' | ||||||
| 
 | 
 | ||||||
|       return this.config.pointDict.filter(v => v.dictValue === this.config.pointType)[0].dictName |       return this.config.pointDict.filter(v => v.dictValue === this.config.pointType)[0].dictName | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     defaultType() { |     defaultType() { | ||||||
|       if (!this.config.pointType) return [0] |       if (!this.config.pointType) return [0] | ||||||
| 
 | 
 | ||||||
|       return [Number(this.config.pointType)] |       return [Number(this.config.pointType)] | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     defaultAnswer() { |     defaultAnswer() { | ||||||
|       if (!this.config.answer) return [0] |       if (!this.config.answer) return [0] | ||||||
| 
 |  | ||||||
|       let index = 0 |       let index = 0 | ||||||
|       if (this.config.answer) { |       if (this.config.answer) { | ||||||
|         this.config.options?.forEach((v, i) => { |         this.config.options?.forEach((v, i) => { | ||||||
| @@ -193,14 +180,12 @@ export default { | |||||||
|       return [index] |       return [index] | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| 
 |  | ||||||
|   methods: { |   methods: { | ||||||
|     answerChange(e) { |     answerChange(e) { | ||||||
|       this.config.answer = e[0].label |       this.config.answer = e[0].label | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     pointTypeChange(e) { |     pointTypeChange(e) { | ||||||
|       console.log(e) |  | ||||||
|       this.config.pointType = e[0].value |       this.config.pointType = e[0].value | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
| @@ -265,8 +250,8 @@ export default { | |||||||
|       this.config.options.splice(index, 1) |       this.config.options.splice(index, 1) | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     back() { |     back() {   | ||||||
|       this.$emit('back') |       uni.navigateBack({}) | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     confirm() { |     confirm() { | ||||||
| @@ -274,7 +259,6 @@ export default { | |||||||
|         config: this.config, |         config: this.config, | ||||||
|         index: this.index === '' ? '-1' : this.index |         index: this.index === '' ? '-1' : this.index | ||||||
|       }) |       }) | ||||||
| 
 |  | ||||||
|       this.back() |       this.back() | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
| @@ -68,7 +68,7 @@ | |||||||
|       <div @click="back"> |       <div @click="back"> | ||||||
|         <span>取消</span> |         <span>取消</span> | ||||||
|       </div> |       </div> | ||||||
|       <div @click="confirm">{{ type === 'edit' ? '发布' : '确定' }}</div> |       <div @click="confirm">{{ isEdit ? '发布' : '确定' }}</div> | ||||||
|     </div> |     </div> | ||||||
|     <u-modal v-model="isShowModal" :content="tips"></u-modal> |     <u-modal v-model="isShowModal" :content="tips"></u-modal> | ||||||
|     <u-picker mode="time" v-model="isShowTime" :show-time-tag="true" @close="isShowTime = false" @confirm="onTimeChange" |     <u-picker mode="time" v-model="isShowTime" :show-time-tag="true" @close="isShowTime = false" @confirm="onTimeChange" | ||||||
| @@ -77,11 +77,17 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| export default { |  | ||||||
|   props: ['id', 'formConfig', 'type'], |  | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |   computed: { | ||||||
|  |     isEdit() { | ||||||
|  |       return this.$route.query.type == 'edit' | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|   data() { |   data() { | ||||||
|  |     let {id} = this.$route.query | ||||||
|     return { |     return { | ||||||
|  |       id, | ||||||
|       params: { |       params: { | ||||||
|         year: true, |         year: true, | ||||||
|         month: true, |         month: true, | ||||||
| @@ -98,38 +104,38 @@ export default { | |||||||
|       wechatId: '0', |       wechatId: '0', | ||||||
|       periodValidityEndTime: '', |       periodValidityEndTime: '', | ||||||
|       isShowTime: false, |       isShowTime: false, | ||||||
|       periodValidityType: '0' |       periodValidityType: '0', | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |   created() { | ||||||
|   mounted() { |  | ||||||
|     if (this.id) { |     if (this.id) { | ||||||
|       this.getInfo(this.id) |       this.getInfo(this.id) | ||||||
|     } else if (this.formConfig) { |     } else this.getFormSetting() | ||||||
|       const res = this.formConfig |   }, | ||||||
|  |   methods: { | ||||||
|  |     getFormSetting() { | ||||||
|  |       let params = localStorage.getItem("toFormSetting"), res = {} | ||||||
|  |       params && (res = JSON.parse(params)) | ||||||
|  |       localStorage.removeItem("toFormSetting") | ||||||
|       this.periodValidityType = res.periodValidityType || '0' |       this.periodValidityType = res.periodValidityType || '0' | ||||||
|       this.commitType = res.commitType || '1' |       this.commitType = res.commitType || "1" | ||||||
|       this.actionNotice = res.actionNotice === '1' |       this.actionNotice = res.actionNotice === '1' | ||||||
|       this.dynamicNotice = res.dynamicNotice === '1' |       this.dynamicNotice = res.dynamicNotice === '1' | ||||||
|  |  | ||||||
|       if (res.periodValidityType === '1') { |       if (res.periodValidityType === '1') { | ||||||
|         this.periodValidityEndTime = res.periodValidityEndTime |         this.periodValidityEndTime = res.periodValidityEndTime | ||||||
|       } |       } | ||||||
|     } |     }, | ||||||
|   }, |  | ||||||
|  |  | ||||||
|   methods: { |  | ||||||
|     onTimeChange(e) { |     onTimeChange(e) { | ||||||
|       this.periodValidityEndTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}` |       this.periodValidityEndTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}` | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     back() { |     back() { | ||||||
|       this.$emit('back') |       uni.navigateBack({}) | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     getInfo(id) { |     getInfo(id) { | ||||||
|       this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => { |       this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => { | ||||||
|         if (res.code == 0) { |         if (res?.data) { | ||||||
|           this.periodValidityType = res.data.periodValidityType |           this.periodValidityType = res.data.periodValidityType | ||||||
|           this.commitType = res.data.commitType |           this.commitType = res.data.commitType | ||||||
|           this.actionNotice = res.data.actionNotice === '1' |           this.actionNotice = res.data.actionNotice === '1' | ||||||
| @@ -158,9 +164,7 @@ export default { | |||||||
|         } |         } | ||||||
|       }).then(res => { |       }).then(res => { | ||||||
|         if (res.code == 0) { |         if (res.code == 0) { | ||||||
|           uni.$emit('reload') |  | ||||||
|           this.$u.toast('发布成功') |           this.$u.toast('发布成功') | ||||||
|  |  | ||||||
|           this.back() |           this.back() | ||||||
|         } |         } | ||||||
|       }).catch(e => { |       }).catch(e => { | ||||||
| @@ -169,12 +173,10 @@ export default { | |||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     confirm() { |     confirm() { | ||||||
|       if (this.type === 'edit') { |       if (this.isEdit) { | ||||||
|         this.publish() |         this.publish() | ||||||
|  |  | ||||||
|         return false |         return false | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       uni.$emit('setting', { |       uni.$emit('setting', { | ||||||
|         periodValidityType: this.periodValidityType, |         periodValidityType: this.periodValidityType, | ||||||
|         commitType: this.commitType, |         commitType: this.commitType, | ||||||
| @@ -182,7 +184,6 @@ export default { | |||||||
|         dynamicNotice: this.dynamicNotice ? '1' : '0', |         dynamicNotice: this.dynamicNotice ? '1' : '0', | ||||||
|         periodValidityEndTime: this.periodValidityEndTime ? this.periodValidityEndTime : '' |         periodValidityEndTime: this.periodValidityEndTime ? this.periodValidityEndTime : '' | ||||||
|       }) |       }) | ||||||
|  |  | ||||||
|       this.back() |       this.back() | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -193,10 +194,6 @@ export default { | |||||||
| .form-setting { | .form-setting { | ||||||
|   padding: 0 20px; |   padding: 0 20px; | ||||||
|  |  | ||||||
|   u-radio + u-radio { |  | ||||||
|     margin-left: 20px; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .add-form__footer { |   .add-form__footer { | ||||||
|     display: flex; |     display: flex; | ||||||
|     align-items: center; |     align-items: center; | ||||||
|   | |||||||
| @@ -67,8 +67,10 @@ | |||||||
| <script> | <script> | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   props: ['formData', 'targetListData'], |  | ||||||
|   data() { |   data() { | ||||||
|  |     let params = localStorage.getItem("toPreviewForm") | ||||||
|  |     params && (params = JSON.parse(params)) | ||||||
|  |     localStorage.removeItem("toPreviewForm") | ||||||
|     return { |     return { | ||||||
|       form: { |       form: { | ||||||
|         tableExplain: '详细描述', |         tableExplain: '详细描述', | ||||||
| @@ -94,15 +96,10 @@ export default { | |||||||
|       isShow: false, |       isShow: false, | ||||||
|       type: 0, |       type: 0, | ||||||
|       id: '', |       id: '', | ||||||
|       touchStart: 0 |       touchStart: 0, | ||||||
|  |       ...params | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| 
 |  | ||||||
|   mounted() { |  | ||||||
|     this.form = this.formData |  | ||||||
|     this.targetList = this.targetListData |  | ||||||
|   }, |  | ||||||
| 
 |  | ||||||
|   methods: { |   methods: { | ||||||
|     getInfo(id) { |     getInfo(id) { | ||||||
|       uni.showLoading() |       uni.showLoading() | ||||||
| @@ -29,18 +29,21 @@ | |||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import {mapActions} from 'vuex' | import {mapActions} from 'vuex' | ||||||
|  | import qs from "query-string" | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   name: 'Result', |   name: 'Result', | ||||||
| 
 | 
 | ||||||
|   props: ['params'], |   computed: { | ||||||
| 
 |     params() { | ||||||
|  |       return qs.parse(decodeURIComponent(location.search)) | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|   mounted() { |   mounted() { | ||||||
|     this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact']) |     this.injectJWeixin(['sendChatMessage', 'selectEnterpriseContact']) | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     ...mapActions(['injectJWeixin', 'wxInvoke']), |     ...mapActions(['injectJWeixin', 'wxInvoke']), | ||||||
| 
 |  | ||||||
|     copy() { |     copy() { | ||||||
|       let oInput = document.createElement('input') |       let oInput = document.createElement('input') | ||||||
|       oInput.value = this.params.linkUrl |       oInput.value = this.params.linkUrl | ||||||
| @@ -50,7 +53,6 @@ export default { | |||||||
|       this.$u.toast('已复制') |       this.$u.toast('已复制') | ||||||
|       oInput.remove() |       oInput.remove() | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     share() { |     share() { | ||||||
|       this.injectJWeixin(['shareAppMessage', 'shareWechatMessage']).then(() => { |       this.injectJWeixin(['shareAppMessage', 'shareWechatMessage']).then(() => { | ||||||
|         this.wxInvoke(['shareAppMessage', { |         this.wxInvoke(['shareAppMessage', { | ||||||
| @@ -61,7 +63,6 @@ export default { | |||||||
|         }]) |         }]) | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     shareWechat() { |     shareWechat() { | ||||||
|       this.injectJWeixin(['shareAppMessage', 'shareWechatMessage']).then(() => { |       this.injectJWeixin(['shareAppMessage', 'shareWechatMessage']).then(() => { | ||||||
|         this.wxInvoke(['shareWechatMessage', { |         this.wxInvoke(['shareWechatMessage', { | ||||||
| @@ -72,10 +73,9 @@ export default { | |||||||
|         }]) |         }]) | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
| 
 |  | ||||||
|     confirm() { |     confirm() { | ||||||
|       this.$emit('change', { |       uni.navigateBack({ | ||||||
|         type: 'Tabbar' |         delta: 2 | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| @@ -26,6 +26,8 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|  | import qs from "query-string" | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|   name: 'addList', |   name: 'addList', | ||||||
|   label: '新建项目', |   label: '新建项目', | ||||||
| @@ -47,30 +49,16 @@ export default { | |||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   mounted() { |   created() { | ||||||
|     this.getList() |     this.getList() | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   methods: { |   methods: { | ||||||
|     toAdd(type) { |     toAdd(type) { | ||||||
|       this.$emit('change', { |       uni.navigateTo({url: `./AddForm?${qs.stringify({type})}`}) | ||||||
|         type: 'AddForm', |  | ||||||
|         params: { |  | ||||||
|           type |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     quote(id) { |     quote(id) { | ||||||
|       this.$emit('change', { |       uni.navigateTo({url: `./AddForm?${qs.stringify({id, isQuote: 1})}`}) | ||||||
|         type: 'AddForm', |  | ||||||
|         params: { |  | ||||||
|           id, |  | ||||||
|           isQuote: 1 |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     getList() { |     getList() { | ||||||
|       this.$http.post(`/app/appquestionnairetemplate/list`, null, { |       this.$http.post(`/app/appquestionnairetemplate/list`, null, { | ||||||
|         params: { |         params: { | ||||||
| @@ -79,7 +67,7 @@ export default { | |||||||
|           size: 10000 |           size: 10000 | ||||||
|         } |         } | ||||||
|       }).then(res => { |       }).then(res => { | ||||||
|         if (res.code == 0) { |         if (res?.code == 0) { | ||||||
|           this.list = res.data.records |           this.list = res.data.records | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
| @@ -90,7 +78,7 @@ export default { | |||||||
|  |  | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
| .template-wrapper { | .template-wrapper { | ||||||
|   padding-bottom: 120 rpx; |   padding-bottom: 120px; | ||||||
|  |  | ||||||
|   .template { |   .template { | ||||||
|     margin: 32px 32px 0; |     margin: 32px 32px 0; | ||||||
|   | |||||||
| @@ -11,8 +11,8 @@ | |||||||
|           <div class="form-item__left"> |           <div class="form-item__left"> | ||||||
|             <h2>{{ item.title }}</h2> |             <h2>{{ item.title }}</h2> | ||||||
|             <div class="form-item__left--info"> |             <div class="form-item__left--info"> | ||||||
| <!--              <AiOpenData v-if="item.createUnitName" type="departmentName" :openid="item.createUnitName"/>--> |               <span v-text="item.createUnitName"/> | ||||||
|               <AiOpenData v-if="item.createUserName" type="userName" :openid="item.createUserName"/> |               <span v-text="item.createUserName"/> | ||||||
|               <span>{{ item.createTime.substr(0, item.createTime.length - 3) }}</span> |               <span>{{ item.createTime.substr(0, item.createTime.length - 3) }}</span> | ||||||
|               <span>{{ $dict.getLabel('questionnaireType', item.type) }}</span> |               <span>{{ $dict.getLabel('questionnaireType', item.type) }}</span> | ||||||
|             </div> |             </div> | ||||||
| @@ -124,13 +124,13 @@ export default { | |||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     showPopup(item) { |     showPopup(item) { | ||||||
|       if (item.status === '2') { |       // if (item.status === '2') { | ||||||
|         this.$confirm('表单已停止发布,请在后台管理系统中查看调查结果', '', { |       //   this.$confirm('表单已停止发布,请在后台管理系统中查看调查结果', '', { | ||||||
|           showCancel: false |       //     showCancel: false | ||||||
|         }) |       //   }) | ||||||
|  |       // | ||||||
|         return false |       //   return false | ||||||
|       } |       // } | ||||||
|  |  | ||||||
|       this.info = item |       this.info = item | ||||||
|       this.id = item.id |       this.id = item.id | ||||||
| @@ -205,24 +205,17 @@ export default { | |||||||
|       if (this.info.status === '1') { |       if (this.info.status === '1') { | ||||||
|         return this.$u.toast('该表单已发布') |         return this.$u.toast('该表单已发布') | ||||||
|       } |       } | ||||||
|  |       this.linkTo(`./FormSetting?id=${this.info.id}&type=edit`) | ||||||
|       this.linkTo(`./formSetting?id=${this.info.id}&type=edit`) |  | ||||||
|       this.isShow = false |       this.isShow = false | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     toEdit() { |     toEdit() { | ||||||
|       if (this.info.dataCount !== 0) { |       if (this.info.dataCount !== 0) { | ||||||
|         return this.$u.toast('该表单已有数据,无法编辑!') |         return this.$u.toast('该表单已有数据,无法编辑!') | ||||||
|  |       } else { | ||||||
|  |         let {id} = this | ||||||
|  |         this.isShow = false | ||||||
|  |         uni.navigateTo({url: `./AddForm?id=${id}`}) | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       this.$emit('change', { |  | ||||||
|         type: 'AddForm', |  | ||||||
|         params: { |  | ||||||
|           id: this.id |  | ||||||
|         } |  | ||||||
|       }) |  | ||||||
|  |  | ||||||
|       this.isShow = false |  | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|     share(id) { |     share(id) { | ||||||
| @@ -303,6 +296,10 @@ export default { | |||||||
|   height: 100vh; |   height: 100vh; | ||||||
|   overflow: hidden; |   overflow: hidden; | ||||||
|  |  | ||||||
|  |   u-radio + u-radio { | ||||||
|  |     margin-left: 20px; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   ::v-deep .u-search { |   ::v-deep .u-search { | ||||||
|     margin-bottom: 0 !important; |     margin-bottom: 0 !important; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| <template> | <template> | ||||||
|   <div class="form-wrapper"> |   <div class="form-wrapper"> | ||||||
|     <div class="form-content"> |     <div class="form-content"> | ||||||
|       <add-list ref="addList" v-if="currIndex === 1" @change="onChange"></add-list> |       <list ref="list" v-if="currIndex === 0" @change="onChange"/> | ||||||
|       <list ref="list" v-if="currIndex === 0" @change="onChange"></list> |       <add-list ref="addList" v-if="currIndex === 1" @change="onChange"/> | ||||||
|     </div> |     </div> | ||||||
|     <AiTabbar :active.sync="currIndex" :list="tabBar"/> |     <AiTabbar :active.sync="currIndex" :list="tabBar"/> | ||||||
|   </div> |   </div> | ||||||
| @@ -26,7 +26,6 @@ export default { | |||||||
|     AddList, |     AddList, | ||||||
|     List |     List | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   computed: { |   computed: { | ||||||
|     tabBar() { |     tabBar() { | ||||||
|       const link = icon => `${this.$cdn}askform/${icon}.png` |       const link = icon => `${this.$cdn}askform/${icon}.png` | ||||||
| @@ -40,13 +39,19 @@ export default { | |||||||
|       })) |       })) | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   methods: { |   methods: { | ||||||
|     onChange(e) { |     onChange(e) { | ||||||
|       this.$emit('change', e) |       this.$emit('change', e) | ||||||
|  |     }, | ||||||
|  |     show() { | ||||||
|  |       if (this.currIndex == 0) { | ||||||
|  |         this.currIndex = -1 | ||||||
|  |         this.$nextTick(() => { | ||||||
|  |           this.currIndex = 0 | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   onReachBottom() { |   onReachBottom() { | ||||||
|     if (this.currIndex === 0) { |     if (this.currIndex === 0) { | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ | |||||||
|                 </label> |                 </label> | ||||||
|                 <u-gap height="16"></u-gap> |                 <u-gap height="16"></u-gap> | ||||||
|                 <span class="info"> |                 <span class="info"> | ||||||
|                 <AiOpenData type="userName" :openid="item.releaseUserId"></AiOpenData> |                 <AiOpenData type="userName" :openid="item.releaseUserId"/> | ||||||
|                 <text>{{ item.releaseTime }}</text> |                 <text>{{ item.releaseTime }}</text> | ||||||
|               </span> |               </span> | ||||||
|               </div> |               </div> | ||||||
| @@ -301,7 +301,6 @@ export default { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       & > .has-pic { |       & > .has-pic { | ||||||
|         height: 100%; |  | ||||||
|         display: flex; |         display: flex; | ||||||
|         justify-content: space-between; |         justify-content: space-between; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
|  |  | ||||||
|       <div class="card"> |       <div class="card"> | ||||||
|         <header><em>*</em>公告内容</header> |         <header><em>*</em>公告内容</header> | ||||||
|         <textarea v-model="form.content" placeholder="请输入" :maxlength="500"></textarea> |         <AiEditor v-model="form.content" placeholder="请输入,最多500字" :maxlength="500"/> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|       <div class="card"> |       <div class="card"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user