Showing
5 changed files
with
236 additions
and
52 deletions
| ... | @@ -26,10 +26,15 @@ declare module '@vue/runtime-core' { | ... | @@ -26,10 +26,15 @@ declare module '@vue/runtime-core' { |
| 26 | NameField: typeof import('./src/components/NameField/index.vue')['default'] | 26 | NameField: typeof import('./src/components/NameField/index.vue')['default'] |
| 27 | NoteField: typeof import('./src/components/NoteField/index.vue')['default'] | 27 | NoteField: typeof import('./src/components/NoteField/index.vue')['default'] |
| 28 | NumberField: typeof import('./src/components/NumberField/index.vue')['default'] | 28 | NumberField: typeof import('./src/components/NumberField/index.vue')['default'] |
| 29 | + NutButton: typeof import('@nutui/nutui-taro')['Button'] | ||
| 29 | NutConfigProvider: typeof import('@nutui/nutui-taro')['ConfigProvider'] | 30 | NutConfigProvider: typeof import('@nutui/nutui-taro')['ConfigProvider'] |
| 30 | NutDialog: typeof import('@nutui/nutui-taro')['Dialog'] | 31 | NutDialog: typeof import('@nutui/nutui-taro')['Dialog'] |
| 32 | + NutForm: typeof import('@nutui/nutui-taro')['Form'] | ||
| 33 | + NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] | ||
| 31 | NutInput: typeof import('@nutui/nutui-taro')['Input'] | 34 | NutInput: typeof import('@nutui/nutui-taro')['Input'] |
| 32 | NutNoticebar: typeof import('@nutui/nutui-taro')['Noticebar'] | 35 | NutNoticebar: typeof import('@nutui/nutui-taro')['Noticebar'] |
| 36 | + NutSwiper: typeof import('@nutui/nutui-taro')['Swiper'] | ||
| 37 | + NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem'] | ||
| 33 | PhoneField: typeof import('./src/components/PhoneField/index.vue')['default'] | 38 | PhoneField: typeof import('./src/components/PhoneField/index.vue')['default'] |
| 34 | PickerField: typeof import('./src/components/PickerField/index.vue')['default'] | 39 | PickerField: typeof import('./src/components/PickerField/index.vue')['default'] |
| 35 | RadioField: typeof import('./src/components/RadioField/index.vue')['default'] | 40 | RadioField: typeof import('./src/components/RadioField/index.vue')['default'] | ... | ... |
| ... | @@ -38,7 +38,7 @@ | ... | @@ -38,7 +38,7 @@ |
| 38 | "dependencies": { | 38 | "dependencies": { |
| 39 | "@babel/runtime": "^7.7.7", | 39 | "@babel/runtime": "^7.7.7", |
| 40 | "@nutui/icons-vue-taro": "^0.0.9", | 40 | "@nutui/icons-vue-taro": "^0.0.9", |
| 41 | - "@nutui/nutui-taro": "^4.0.0", | 41 | + "@nutui/nutui-taro": "^4.0.4", |
| 42 | "@tarojs/components": "3.6.2", | 42 | "@tarojs/components": "3.6.2", |
| 43 | "@tarojs/extend": "^3.6.2", | 43 | "@tarojs/extend": "^3.6.2", |
| 44 | "@tarojs/helper": "3.6.2", | 44 | "@tarojs/helper": "3.6.2", | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-08-29 14:31:20 | 2 | * @Date: 2022-08-29 14:31:20 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-03-24 15:04:18 | 4 | + * @LastEditTime: 2023-03-31 17:57:13 |
| 5 | * @FilePath: /custom_form/src/components/TextField/index.vue | 5 | * @FilePath: /custom_form/src/components/TextField/index.vue |
| 6 | * @Description: 单行文本输入框(微信扫描功能) | 6 | * @Description: 单行文本输入框(微信扫描功能) |
| 7 | --> | 7 | --> |
| ... | @@ -11,19 +11,37 @@ | ... | @@ -11,19 +11,37 @@ |
| 11 | <span v-if="item.component_props.required"> *</span> | 11 | <span v-if="item.component_props.required"> *</span> |
| 12 | {{ item.component_props.label }} | 12 | {{ item.component_props.label }} |
| 13 | </div> | 13 | </div> |
| 14 | - <div class="note-wrapper" v-if="item.component_props.note" v-html="item.component_props.note" /> | 14 | + <!-- <div class="note-wrapper" v-if="item.component_props.note" v-html="item.component_props.note" /> --> |
| 15 | - <nut-input v-model="item.value" :name="item.name" :type="item.type" | 15 | + <nut-form-item :required="item.required"> |
| 16 | - :placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'" :rules="item.rules" | 16 | + <nut-input |
| 17 | - :required="item.required" | 17 | + v-model="input_value" |
| 18 | - :readonly="item.component_props.readonly || (item.component_props.is_camera_scan && !item.component_props.is_edit_camera_scan_result)" | 18 | + :type="item.type" |
| 19 | - :disabled="item.component_props.disabled" :input-align="item.component_props.align" | 19 | + :border="false" |
| 20 | - :right-icon="item.component_props.is_camera_scan ? 'scan' : ''" @click-right-icon="clickRightIcon" /> | 20 | + :placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'" |
| 21 | + :readonly="item.component_props.readonly || (item.component_props.is_camera_scan && !item.component_props.is_edit_camera_scan_result)" | ||
| 22 | + :disabled="item.component_props.disabled" | ||
| 23 | + :input-align="item.component_props.align" | ||
| 24 | + style="border: 1px solid #eaeaea; border-radius: 0.25rem; padding: 0.25rem 0.5rem;" | ||
| 25 | + > | ||
| 26 | + <template #right v-if="item.component_props.is_camera_scan"><Scan @click="clickRightIcon()"></Scan></template> | ||
| 27 | + </nut-input> | ||
| 28 | + <div | ||
| 29 | + v-if="show_error" | ||
| 30 | + style="padding: 5px; color: red; font-size: 12px;" | ||
| 31 | + > | ||
| 32 | + {{ error_msg }} | ||
| 33 | + </div> | ||
| 34 | + </nut-form-item> | ||
| 21 | </div> | 35 | </div> |
| 22 | </template> | 36 | </template> |
| 23 | 37 | ||
| 24 | <script setup> | 38 | <script setup> |
| 25 | import { getUrlParams } from "@/utils/tools"; | 39 | import { getUrlParams } from "@/utils/tools"; |
| 26 | import Taro from '@tarojs/taro' | 40 | import Taro from '@tarojs/taro' |
| 41 | +import { ref, computed, watch, onMounted, reactive } from "vue"; | ||
| 42 | +import { Scan } from '@nutui/icons-vue-taro'; | ||
| 43 | +// 初始化WX环境 | ||
| 44 | +import wx from 'weixin-js-sdk' | ||
| 27 | 45 | ||
| 28 | const props = defineProps({ | 46 | const props = defineProps({ |
| 29 | item: Object, | 47 | item: Object, |
| ... | @@ -33,6 +51,13 @@ const HideShow = computed(() => { | ... | @@ -33,6 +51,13 @@ const HideShow = computed(() => { |
| 33 | return !props.item.component_props.disabled | 51 | return !props.item.component_props.disabled |
| 34 | }) | 52 | }) |
| 35 | 53 | ||
| 54 | +const emit = defineEmits(["active"]); | ||
| 55 | +const input_value = ref(''); | ||
| 56 | + | ||
| 57 | +// 错误提示 | ||
| 58 | +const show_error = ref(false); | ||
| 59 | +const error_msg = ref(''); | ||
| 60 | + | ||
| 36 | // 默认识别类型 | 61 | // 默认识别类型 |
| 37 | const scan_type_code = ref('ALL_CODE'); | 62 | const scan_type_code = ref('ALL_CODE'); |
| 38 | // 微信二维码扫描功能判断 | 63 | // 微信二维码扫描功能判断 |
| ... | @@ -49,18 +74,50 @@ const scanType = (scan_type_code) => { | ... | @@ -49,18 +74,50 @@ const scanType = (scan_type_code) => { |
| 49 | 74 | ||
| 50 | // 预览模式 | 75 | // 预览模式 |
| 51 | const model = getUrlParams(location.href) ? getUrlParams(location.href).model : ''; | 76 | const model = getUrlParams(location.href) ? getUrlParams(location.href).model : ''; |
| 52 | -const clickRightIcon = async () => { | 77 | +const clickRightIcon = () => { |
| 53 | // 预览模式屏蔽微信功能 | 78 | // 预览模式屏蔽微信功能 |
| 54 | if (model === 'preview') return false; | 79 | if (model === 'preview') return false; |
| 55 | - Taro.ready(() => { | 80 | + if (process.env.TARO_ENV === 'h5') { |
| 56 | - Taro.scanQRCode({ | 81 | + wx.ready(() => { |
| 82 | + wx.scanQRCode({ | ||
| 83 | + needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, | ||
| 84 | + scanType: scanType(props.item.camera_scan_type), // 可以指定扫二维码还是一维码,默认二者都有 | ||
| 85 | + success: function (res) { | ||
| 86 | + if (res.errMsg === 'scanQRCode:ok') { | ||
| 87 | + let code = res.resultStr; | ||
| 88 | + let code_arr = code.split(","); | ||
| 89 | + props.item.value = code_arr[1]; | ||
| 90 | + Taro.showToast({ | ||
| 91 | + title: '扫描成功', | ||
| 92 | + icon: 'success', | ||
| 93 | + duration: 2000 | ||
| 94 | + }) | ||
| 95 | + } else { | ||
| 96 | + console.warn(res); | ||
| 97 | + Taro.showToast({ | ||
| 98 | + title: '扫描失败', | ||
| 99 | + icon: 'error', | ||
| 100 | + duration: 2000 | ||
| 101 | + }) | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + error: function (res) { | ||
| 105 | + if (res.errMsg.indexOf('function_not_exist') > 0) { | ||
| 106 | + alert('版本过低请升级') | ||
| 107 | + } | ||
| 108 | + alert(res.errMsg); | ||
| 109 | + }, | ||
| 110 | + }); | ||
| 111 | + }); | ||
| 112 | + } | ||
| 113 | + if (process.env.TARO_ENV === 'weapp') { | ||
| 114 | + Taro.scanCode({ | ||
| 57 | needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, | 115 | needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, |
| 58 | scanType: scanType(props.item.camera_scan_type), // 可以指定扫二维码还是一维码,默认二者都有 | 116 | scanType: scanType(props.item.camera_scan_type), // 可以指定扫二维码还是一维码,默认二者都有 |
| 59 | success: function (res) { | 117 | success: function (res) { |
| 60 | - if (res.errMsg === 'scanQRCode:ok') { | 118 | + if (res.errMsg === 'scanCode:ok') { |
| 61 | - let code = res.resultStr; | 119 | + let code = res.result; |
| 62 | - let code_arr = code.split(","); | 120 | + input_value.value = code; |
| 63 | - props.item.value = code_arr[1]; | ||
| 64 | Taro.showToast({ | 121 | Taro.showToast({ |
| 65 | title: '扫描成功', | 122 | title: '扫描成功', |
| 66 | icon: 'success', | 123 | icon: 'success', |
| ... | @@ -82,15 +139,56 @@ const clickRightIcon = async () => { | ... | @@ -82,15 +139,56 @@ const clickRightIcon = async () => { |
| 82 | alert(res.errMsg); | 139 | alert(res.errMsg); |
| 83 | }, | 140 | }, |
| 84 | }); | 141 | }); |
| 85 | - }); | 142 | + } |
| 86 | } | 143 | } |
| 144 | + | ||
| 145 | +// watch( | ||
| 146 | +// () => input_value.value, | ||
| 147 | +// (newValue, oldValue) => { | ||
| 148 | +// console.warn(newValue); | ||
| 149 | +// // props.item.value = { | ||
| 150 | +// // key: "input", | ||
| 151 | +// // filed_name: props.item.key, | ||
| 152 | +// // value: newValue, | ||
| 153 | +// // }; | ||
| 154 | +// // emit("active", props.item.value); | ||
| 155 | +// }, | ||
| 156 | +// { immediate: true } | ||
| 157 | +// ); | ||
| 158 | + | ||
| 159 | +onMounted(() => { | ||
| 160 | +}) | ||
| 161 | +const changeInput = (val) => { | ||
| 162 | + // props.item.value = { | ||
| 163 | + // key: "input", | ||
| 164 | + // filed_name: props.item.key, | ||
| 165 | + // value: val, | ||
| 166 | + // }; | ||
| 167 | + // emit("active", props.item.value); | ||
| 168 | + // validInput(); | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +// 校验模块 | ||
| 172 | +const validInput = () => { | ||
| 173 | + // 必填项 | ||
| 174 | + if (props.item.component_props.required && !input_value.value) { | ||
| 175 | + show_error.value = true; | ||
| 176 | + error_msg.value = '必填项不能为空' | ||
| 177 | + } else { | ||
| 178 | + show_error.value = false; | ||
| 179 | + error_msg.value = '' | ||
| 180 | + } | ||
| 181 | + return !show_error.value; | ||
| 182 | +}; | ||
| 183 | + | ||
| 184 | +defineExpose({ validInput }); | ||
| 87 | </script> | 185 | </script> |
| 88 | 186 | ||
| 89 | -<style lang="less" scoped> | 187 | +<style lang="less"> |
| 90 | .text-field-page { | 188 | .text-field-page { |
| 91 | .label { | 189 | .label { |
| 92 | - padding: 1rem 1rem 0 1rem; | 190 | + padding: 30px 30px 0 30px; |
| 93 | - font-size: 0.9rem; | 191 | + font-size: 26px; |
| 94 | font-weight: bold; | 192 | font-weight: bold; |
| 95 | 193 | ||
| 96 | span { | 194 | span { |
| ... | @@ -98,19 +196,30 @@ const clickRightIcon = async () => { | ... | @@ -98,19 +196,30 @@ const clickRightIcon = async () => { |
| 98 | } | 196 | } |
| 99 | 197 | ||
| 100 | .note-wrapper { | 198 | .note-wrapper { |
| 101 | - font-size: 0.9rem; | 199 | + font-size: 24px; |
| 102 | - margin-left: 1rem; | 200 | + margin-left: 30px; |
| 103 | color: gray; | 201 | color: gray; |
| 104 | - padding-bottom: 0.5rem; | 202 | + padding-bottom: 15px; |
| 105 | - padding-top: 0.25rem; | 203 | + padding-top: 7px; |
| 106 | white-space: pre-wrap; | 204 | white-space: pre-wrap; |
| 107 | } | 205 | } |
| 108 | } | 206 | } |
| 109 | } | 207 | } |
| 110 | 208 | ||
| 111 | -:deep(.van-field__body) { | 209 | +// :deep(.nut-input) { |
| 112 | - border: 1px solid #eaeaea; | 210 | +// border: 1px solid #eaeaea; |
| 113 | - border-radius: 0.25rem; | 211 | +// border-radius: 0.25rem; |
| 114 | - padding: 0.25rem 0.5rem; | 212 | +// padding: 0.25rem 0.5rem; |
| 213 | +// } | ||
| 214 | + | ||
| 215 | +// .nut-input--border { | ||
| 216 | +// border: 1px solid #eaeaea; | ||
| 217 | +// border-radius: 7px; | ||
| 218 | +// padding: 7px 14px !important; | ||
| 219 | +// } | ||
| 220 | + | ||
| 221 | + | ||
| 222 | +input { | ||
| 223 | + color: #000 !important; | ||
| 115 | } | 224 | } |
| 116 | </style> | 225 | </style> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-03-24 09:19:27 | 2 | * @Date: 2023-03-24 09:19:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-03-24 15:55:18 | 4 | + * @LastEditTime: 2023-03-31 18:02:51 |
| 5 | - * @FilePath: /custom_form/src/pages/index/index.vue | 5 | + * @FilePath: /custom_form/src/pages/table/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="table-page"> | 9 | <div class="table-page"> |
| 10 | <nut-noticebar v-if="formSetting.sjsj_is_count_down" :text="notice_text" :scrollable="true" | 10 | <nut-noticebar v-if="formSetting.sjsj_is_count_down" :text="notice_text" :scrollable="true" |
| 11 | - :closeMode="true" right-icon="circle-close" />{{ formSetting }} | 11 | + :closeMode="true" right-icon="circle-close" /> |
| 12 | + <div class="table-box" :style="{ margin: is_pc ? '1rem 0' : '1rem', overflow: 'auto' }"> | ||
| 13 | + <template v-if="PHeader.visible"> | ||
| 14 | + <image v-if="PHeader.type === 'image'" :src="PHeader.cover" mode="widthFix" style="width: 100%;" /> | ||
| 15 | + <template v-if="PHeader.type === 'carousel'"> | ||
| 16 | + <nut-swiper class="my-swipe" pagination-color="#fff" auto-play="3000"> | ||
| 17 | + <nut-swiper-item v-for="(image, index) in PHeader.cover" :key="index"> | ||
| 18 | + <img :src="image" style="height: 12rem; width: 100%; object-fit: cover" /> | ||
| 19 | + </nut-swiper-item> | ||
| 20 | + </nut-swiper> | ||
| 21 | + </template> | ||
| 22 | + <div v-if="PHeader.type === 'text'" class="PHeader-Text taro_html" v-html="PHeader.banner" /> | ||
| 23 | + </template> | ||
| 24 | + <view v-if="PHeader.label" class="table-title taro_html" v-html="PHeader.label" /> | ||
| 25 | + <div v-if="PHeader.description" class="table-desc taro_html" v-html="PHeader.description" /> | ||
| 26 | + <nut-config-provider :theme-vars="themeVars"> | ||
| 27 | + <nut-form ref="ruleForm"> | ||
| 28 | + <component v-for="(item, index) in formData" | ||
| 29 | + :id="item.key" | ||
| 30 | + :ref="(el) => setRefMap(el, item)" | ||
| 31 | + :key="index" | ||
| 32 | + :is="{...item.component}" | ||
| 33 | + :item="item" | ||
| 34 | + @active="onActive" /> | ||
| 35 | + <!-- <template v-for="(item, index) in formData" :id="item.key"> | ||
| 36 | + <nut-form-item v-if="index === 0" :prop="item.name" :required="item.required" :rules="item.rules"> | ||
| 37 | + <nut-input v-model="item.value" :type="item.type" | ||
| 38 | + :placeholder="item.component_props.placeholder ? item.component_props.placeholder : '请输入'" | ||
| 39 | + :readonly="item.component_props.readonly || (item.component_props.is_camera_scan && !item.component_props.is_edit_camera_scan_result)" | ||
| 40 | + :disabled="item.component_props.disabled" :input-align="item.component_props.align"> | ||
| 41 | + </nut-input> | ||
| 42 | + </nut-form-item> | ||
| 43 | + </template> --> | ||
| 44 | + <div v-if="formData.length && PCommit.visible" style="margin: 16px"> | ||
| 45 | + <!-- <nut-button round block type="primary" onclick="onSubmit"> --> | ||
| 46 | + <nut-button round block type="primary" @click="onSubmit"> | ||
| 47 | + {{ PCommit.text ? PCommit.text : '提交' }} | ||
| 48 | + </nut-button> | ||
| 49 | + </div> | ||
| 50 | + </nut-form> | ||
| 51 | + </nut-config-provider> | ||
| 52 | + </div> | ||
| 12 | </div> | 53 | </div> |
| 13 | </template> | 54 | </template> |
| 14 | 55 | ||
| ... | @@ -16,7 +57,7 @@ | ... | @@ -16,7 +57,7 @@ |
| 16 | import Taro, { useLoad } from '@tarojs/taro' | 57 | import Taro, { useLoad } from '@tarojs/taro' |
| 17 | import { $ } from '@tarojs/extend' | 58 | import { $ } from '@tarojs/extend' |
| 18 | import { createComponentType } from "@/hooks/useComponentType"; | 59 | import { createComponentType } from "@/hooks/useComponentType"; |
| 19 | -import { ref, computed, watchEffect, onMounted } from "vue"; | 60 | +import { ref, computed, watchEffect, onMounted, reactive } from "vue"; |
| 20 | import _ from "@/utils/lodash"; | 61 | import _ from "@/utils/lodash"; |
| 21 | import { storeToRefs } from 'pinia' | 62 | import { storeToRefs } from 'pinia' |
| 22 | import { mainStore } from '@/stores' | 63 | import { mainStore } from '@/stores' |
| ... | @@ -25,6 +66,10 @@ import { addFormDataAPI } from "@/api/data.js"; | ... | @@ -25,6 +66,10 @@ import { addFormDataAPI } from "@/api/data.js"; |
| 25 | import { wxInfo, getUrlParams } from "@/utils/tools"; | 66 | import { wxInfo, getUrlParams } from "@/utils/tools"; |
| 26 | import { styleColor } from "@/constant.js"; | 67 | import { styleColor } from "@/constant.js"; |
| 27 | import { sharePage } from '@/composables/useShare.js' | 68 | import { sharePage } from '@/composables/useShare.js' |
| 69 | +// 初始化WX环境 | ||
| 70 | +import wx from 'weixin-js-sdk' | ||
| 71 | + | ||
| 72 | +const ruleForm = ref(null); | ||
| 28 | 73 | ||
| 29 | // // 获取表单设置 | 74 | // // 获取表单设置 |
| 30 | const store = mainStore(); | 75 | const store = mainStore(); |
| ... | @@ -42,8 +87,9 @@ const PHeaderHeight = computed(() => { | ... | @@ -42,8 +87,9 @@ const PHeaderHeight = computed(() => { |
| 42 | }); | 87 | }); |
| 43 | // TAG: 自定义主题颜色 | 88 | // TAG: 自定义主题颜色 |
| 44 | const themeVars = { | 89 | const themeVars = { |
| 45 | - buttonPrimaryBackground: styleColor.baseColor, | 90 | + // buttonPrimaryBackground: styleColor.baseColor, |
| 46 | - buttonPrimaryBorderColor: styleColor.baseColor, | 91 | + // buttonPrimaryBorderColor: styleColor.baseColor, |
| 92 | + primaryColor: styleColor.baseColor, | ||
| 47 | }; | 93 | }; |
| 48 | 94 | ||
| 49 | const PHeader = ref({}); | 95 | const PHeader = ref({}); |
| ... | @@ -80,6 +126,7 @@ const formatData = (data) => { | ... | @@ -80,6 +126,7 @@ const formatData = (data) => { |
| 80 | 126 | ||
| 81 | // 处理没有绑定值的组件的赋值 | 127 | // 处理没有绑定值的组件的赋值 |
| 82 | // 省市区选择,图片上传,文件上传,电子签名,评分组件 | 128 | // 省市区选择,图片上传,文件上传,电子签名,评分组件 |
| 129 | +const input = ref([]); | ||
| 83 | const area_picker = ref([]); | 130 | const area_picker = ref([]); |
| 84 | const image_uploader = ref([]); | 131 | const image_uploader = ref([]); |
| 85 | const file_uploader = ref([]); | 132 | const file_uploader = ref([]); |
| ... | @@ -88,6 +135,9 @@ const rate_picker = ref([]); | ... | @@ -88,6 +135,9 @@ const rate_picker = ref([]); |
| 88 | // 动态绑定ref数据 | 135 | // 动态绑定ref数据 |
| 89 | const setRefMap = (el, item) => { | 136 | const setRefMap = (el, item) => { |
| 90 | if (el) { | 137 | if (el) { |
| 138 | + if (item.component_props.tag === "input") { | ||
| 139 | + input.value.push(el); | ||
| 140 | + } | ||
| 91 | if (item.component_props.tag === "area_picker") { | 141 | if (item.component_props.tag === "area_picker") { |
| 92 | area_picker.value.push(el); | 142 | area_picker.value.push(el); |
| 93 | } | 143 | } |
| ... | @@ -123,13 +173,13 @@ const onSubmitPwd = async () => { | ... | @@ -123,13 +173,13 @@ const onSubmitPwd = async () => { |
| 123 | 173 | ||
| 124 | onMounted(async () => { | 174 | onMounted(async () => { |
| 125 | // TAG: 全局背景色 | 175 | // TAG: 全局背景色 |
| 126 | - $('body').css('background-color', styleColor.backgroundColor) | 176 | + // $('body').css('background-color', styleColor.backgroundColor) |
| 127 | const { data } = await queryFormAPI({ form_code }); | 177 | const { data } = await queryFormAPI({ form_code }); |
| 128 | 178 | ||
| 129 | const form_data = data; | 179 | const form_data = data; |
| 130 | // 动态修改标题 | 180 | // 动态修改标题 |
| 131 | Taro.setNavigationBarTitle({ | 181 | Taro.setNavigationBarTitle({ |
| 132 | - title: form_data.name | 182 | + title: form_data.name ? form_data.name : '' |
| 133 | }); | 183 | }); |
| 134 | form_name.value = form_data.name; | 184 | form_name.value = form_data.name; |
| 135 | // 重构数据结构 | 185 | // 重构数据结构 |
| ... | @@ -212,7 +262,7 @@ onMounted(async () => { | ... | @@ -212,7 +262,7 @@ onMounted(async () => { |
| 212 | checkUserPassword(); | 262 | checkUserPassword(); |
| 213 | // 启用分享功能,非预览模式 | 263 | // 启用分享功能,非预览模式 |
| 214 | if (formSetting.value.wxzq_is_share && model !== 'preview') { | 264 | if (formSetting.value.wxzq_is_share && model !== 'preview') { |
| 215 | - Taro.ready(() => { | 265 | + wx.ready(() => { |
| 216 | /** | 266 | /** |
| 217 | * 微信分享卡片标题模式 | 267 | * 微信分享卡片标题模式 |
| 218 | * form_name=使用表单名称作为分享标题,customize=自定义分享标题 | 268 | * form_name=使用表单名称作为分享标题,customize=自定义分享标题 |
| ... | @@ -311,6 +361,9 @@ const checkRules = () => { | ... | @@ -311,6 +361,9 @@ const checkRules = () => { |
| 311 | 361 | ||
| 312 | // 操作绑定自定义字段回调 | 362 | // 操作绑定自定义字段回调 |
| 313 | const onActive = (item) => { | 363 | const onActive = (item) => { |
| 364 | + if (item.key === "input") { | ||
| 365 | + postData.value[item.filed_name] = item.value; | ||
| 366 | + } | ||
| 314 | if (item.key === "area_picker") { | 367 | if (item.key === "area_picker") { |
| 315 | postData.value[item.filed_name] = item.value; | 368 | postData.value[item.filed_name] = item.value; |
| 316 | } | 369 | } |
| ... | @@ -347,12 +400,24 @@ const onActive = (item) => { | ... | @@ -347,12 +400,24 @@ const onActive = (item) => { |
| 347 | checkRules(); | 400 | checkRules(); |
| 348 | }; | 401 | }; |
| 349 | 402 | ||
| 350 | -// 检验没有绑定name的输入项 | 403 | +// 检验输入项控件的Rules |
| 351 | const validOther = () => { | 404 | const validOther = () => { |
| 352 | let valid = { | 405 | let valid = { |
| 353 | status: true, | 406 | status: true, |
| 354 | key: "", | 407 | key: "", |
| 355 | }; | 408 | }; |
| 409 | + if (input.value) { | ||
| 410 | + // 单行文本 | ||
| 411 | + input.value.forEach((item, index) => { | ||
| 412 | + if (!input.value[index].validInput()) { | ||
| 413 | + valid = { | ||
| 414 | + status: input.value[index].validInput(), | ||
| 415 | + key: "input", | ||
| 416 | + }; | ||
| 417 | + return false; | ||
| 418 | + } | ||
| 419 | + }); | ||
| 420 | + } | ||
| 356 | if (area_picker.value) { | 421 | if (area_picker.value) { |
| 357 | // 省市区地址 | 422 | // 省市区地址 |
| 358 | area_picker.value.forEach((item, index) => { | 423 | area_picker.value.forEach((item, index) => { |
| ... | @@ -426,7 +491,7 @@ const preValidData = (values) => { | ... | @@ -426,7 +491,7 @@ const preValidData = (values) => { |
| 426 | 491 | ||
| 427 | const onSubmit = async (values) => { | 492 | const onSubmit = async (values) => { |
| 428 | // 表单数据处理 | 493 | // 表单数据处理 |
| 429 | - postData.value = preValidData(values); | 494 | + // postData.value = preValidData(values); |
| 430 | // 合并扩展字段 | 495 | // 合并扩展字段 |
| 431 | postData.value = { ...postData.value, x_field_1, x_cycle }; | 496 | postData.value = { ...postData.value, x_field_1, x_cycle }; |
| 432 | // 检查非表单输入项 | 497 | // 检查非表单输入项 |
| ... | @@ -469,18 +534,23 @@ const onSubmit = async (values) => { | ... | @@ -469,18 +534,23 @@ const onSubmit = async (values) => { |
| 469 | }; | 534 | }; |
| 470 | </script> | 535 | </script> |
| 471 | 536 | ||
| 472 | -<style lang="less" scoped> | 537 | +<style lang="less"> |
| 538 | +.table-page { | ||
| 539 | + background-color: #FAF9DC; | ||
| 540 | + min-height: calc(100vh); | ||
| 541 | + position: relative; | ||
| 542 | +} | ||
| 473 | .table-title { | 543 | .table-title { |
| 474 | - padding: 1rem; | 544 | + padding: 30px; |
| 475 | - font-size: 1.15rem; | 545 | + font-size: 30px; |
| 476 | text-align: center; | 546 | text-align: center; |
| 477 | white-space: pre-wrap; | 547 | white-space: pre-wrap; |
| 478 | } | 548 | } |
| 479 | 549 | ||
| 480 | .table-desc { | 550 | .table-desc { |
| 481 | - padding: 0rem 1rem; | 551 | + padding: 0rem 30px; |
| 482 | color: #666; | 552 | color: #666; |
| 483 | - font-size: 0.9rem; | 553 | + font-size: 26px; |
| 484 | white-space: pre-wrap; | 554 | white-space: pre-wrap; |
| 485 | 555 | ||
| 486 | img { | 556 | img { |
| ... | @@ -490,7 +560,7 @@ const onSubmit = async (values) => { | ... | @@ -490,7 +560,7 @@ const onSubmit = async (values) => { |
| 490 | 560 | ||
| 491 | .table-box { | 561 | .table-box { |
| 492 | background-color: #ffffff; | 562 | background-color: #ffffff; |
| 493 | - padding-bottom: 1rem; | 563 | + padding-bottom: 30px; |
| 494 | } | 564 | } |
| 495 | 565 | ||
| 496 | .wrapper { | 566 | .wrapper { |
| ... | @@ -501,7 +571,7 @@ const onSubmit = async (values) => { | ... | @@ -501,7 +571,7 @@ const onSubmit = async (values) => { |
| 501 | } | 571 | } |
| 502 | 572 | ||
| 503 | .block { | 573 | .block { |
| 504 | - width: 10rem; | 574 | + width: 300px; |
| 505 | // height: 10rem; | 575 | // height: 10rem; |
| 506 | background-color: #fff; | 576 | background-color: #fff; |
| 507 | } | 577 | } |
| ... | @@ -515,13 +585,13 @@ const onSubmit = async (values) => { | ... | @@ -515,13 +585,13 @@ const onSubmit = async (values) => { |
| 515 | .block { | 585 | .block { |
| 516 | width: 80vw; | 586 | width: 80vw; |
| 517 | background-color: #fff; | 587 | background-color: #fff; |
| 518 | - padding: 1rem; | 588 | + padding: 30px; |
| 519 | border-radius: 5px; | 589 | border-radius: 5px; |
| 520 | } | 590 | } |
| 521 | } | 591 | } |
| 522 | 592 | ||
| 523 | .PHeader-Text { | 593 | .PHeader-Text { |
| 524 | - padding: 1rem; | 594 | + padding: 30px; |
| 525 | font-weight: bold; | 595 | font-weight: bold; |
| 526 | white-space: pre; | 596 | white-space: pre; |
| 527 | } | 597 | } | ... | ... |
| ... | @@ -1359,10 +1359,10 @@ | ... | @@ -1359,10 +1359,10 @@ |
| 1359 | resolved "https://mirrors.cloud.tencent.com/npm/@nutui/icons-vue-taro/-/icons-vue-taro-0.0.9.tgz#b5223eb01e2b987fdbe460e5d0439a66481e54f1" | 1359 | resolved "https://mirrors.cloud.tencent.com/npm/@nutui/icons-vue-taro/-/icons-vue-taro-0.0.9.tgz#b5223eb01e2b987fdbe460e5d0439a66481e54f1" |
| 1360 | integrity sha512-10VYAtFC+o1X0anGs+y2PgF1NWMeLFz2JVMRw4BWLg6wbtVbYy9wukLxyGhZC6Yf6t39DcwaGVda8paV7K6/Ew== | 1360 | integrity sha512-10VYAtFC+o1X0anGs+y2PgF1NWMeLFz2JVMRw4BWLg6wbtVbYy9wukLxyGhZC6Yf6t39DcwaGVda8paV7K6/Ew== |
| 1361 | 1361 | ||
| 1362 | -"@nutui/nutui-taro@^4.0.0": | 1362 | +"@nutui/nutui-taro@^4.0.4": |
| 1363 | - version "4.0.3" | 1363 | + version "4.0.4" |
| 1364 | - resolved "https://mirrors.cloud.tencent.com/npm/@nutui/nutui-taro/-/nutui-taro-4.0.3.tgz#a77f644832b4c98f1e4a3cf93b9498057f7ccb5f" | 1364 | + resolved "https://mirrors.cloud.tencent.com/npm/@nutui/nutui-taro/-/nutui-taro-4.0.4.tgz#c5b65431ece527e3e531bc7923ad0a7b499daeeb" |
| 1365 | - integrity sha512-/+xCfUBRE8DcBQpQirgU3GgsaaRmnGu46olvwhjNm5WpJ+SmhloTYrG7Y0aqwnmI3Z9HRVsW8mEUW/ypzPviHQ== | 1365 | + integrity sha512-v9XyXidgiRgZTH5JofgjhJTGGvQDXhOqkLb/uRjlR2c9eQBSU653rlTO82VjUWOpCterYDxtqXswUZIf+PRbfQ== |
| 1366 | dependencies: | 1366 | dependencies: |
| 1367 | "@nutui/icons-vue-taro" "^0.0.9" | 1367 | "@nutui/icons-vue-taro" "^0.0.9" |
| 1368 | sass "^1.50.0" | 1368 | sass "^1.50.0" | ... | ... |
-
Please register or login to post a comment