Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

form-builder.vue 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. <template>
  2. <!-- 通用表单 modify by ht
  3. @submit="formSubmit"-->
  4. <form>
  5. <view v-for="(item, index) in formData" :key="index">
  6. <view v-show="!item.hide">
  7. <!-- 是否显示-->
  8. <view style="min-height: 80rpx" :class="
  9. item.vertical === 2 ? 'as-layout-vertical' : 'as-layout-horizontal'
  10. ">
  11. <!-- 标题 -->
  12. <view class="as-gravity-center-start" :style="{
  13. minWidth: config.titleWidth + 'rpx',
  14. marginTop: `${item.bg || item.vertical === 2 ? '30rpx' : ''}`,
  15. }" style="
  16. margin-left: 20rpx;
  17. flex-direction: row;
  18. display: flex;
  19. flex-direction: row;
  20. ">
  21. <!-- <image class="img-size" mode="aspectFill" :src="item.required ? '../must.png' : ''"></image> -->
  22. <!-- :class="item.vertical === 2 ? 'text-left' : 'text-justify'" -->
  23. <span v-if="item.star" style="color: red">*</span>
  24. <view class="text-title" :style="{
  25. color: `#${item.labelColor ?item.labelColor:'333333'}`,
  26. width: '100%',
  27. }">
  28. {{ item.title }}
  29. </view>
  30. </view>
  31. <!-- 内容 -->
  32. <view class="as-weight as-gravity-center-start">
  33. <!-- 文本内容 -->
  34. <view v-if="item.type === 1" :class="item.bg ? 'bg' : 'notbg'" class="text-hint"
  35. :style="item.style">{{ item[item.value] }}</view>
  36. <!-- 输入框 -->
  37. <view v-if="item.type === 2" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  38. <view class="as-layout-horizontal" style="align-items: center">
  39. <input :disabled="item.disabled" v-model="item[item.value]" :type="item.inputType"
  40. :placeholder="item.hint ? item.hint : '请输入' + item.title"
  41. placeholder-class="text-hint" class="text" :maxlength="item.maxlength"
  42. :style="item.style" style="min-height: 80rpx; word-break: break-all; flex: 1"
  43. @input="inputChange($event, item)" />
  44. <view v-if="item.btn" class="as-gravity-center">
  45. <!-- 验证码 -->
  46. <verification-code v-if="item.btnType === 'code'"
  47. :mobile="item.codeValue"></verification-code>
  48. <button v-else size="mini" style="background-color: #2ce242; color: #fff"
  49. @click="inputBtnClickHandle(item)">
  50. {{ item.btnTitle }}
  51. </button>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 多项选择器 -->
  56. <view v-if="item.type === 3" :class="item.bg ? 'bg' : 'notbg'">
  57. <checkbox-group @change="checkboxChange($event, item)" :disabled="item.disabled">
  58. <view class="as-layout-horizontal" style="justify-content: right">
  59. <label style="
  60. display: flex;
  61. flex-direction: row;
  62. margin-right: 30rpx;
  63. " v-for="(itemData, index) in item.itemData" :key="index">
  64. <checkbox style="transform: scale(0.7)" :value="itemData.value"
  65. :checked="itemData.checked" />
  66. <view>{{ itemData.name }}</view>
  67. </label>
  68. </view>
  69. </checkbox-group>
  70. </view>
  71. <!-- 普通选择器 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容 :range-key="item[item.value]"-->
  72. <view v-if="item.type === 4" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  73. <!-- range[范围] value[初始选择]-->
  74. <view class="as-layout-horizontal" style="align-items: center">
  75. <view v-if="item.mode === 'custom'" :class="item[item.value] ? 'text' : 'text-hint'"
  76. style="flex: 1" @click="emit('pickerCustom', item)">
  77. {{
  78. item[item.value]
  79. ? item.itemKey
  80. ? item[item.value][item.itemKey]
  81. : item[item.value]
  82. : item.hint
  83. ? item.hint
  84. : "请选择" + item.title
  85. }}
  86. </view>
  87. <template v-else-if="item.mode === 'search'">
  88. <view :disabled="item.disabled" :class="item[item.value] ? 'text' : 'text-hint'"
  89. style="flex: 1" @click="item.searchPickerVisible = true">
  90. {{
  91. item[item.value]
  92. ? item.itemKey
  93. ? item[item.value][item.itemKey]
  94. : item[item.value]
  95. : item.hint
  96. ? item.hint
  97. : "请选择" + item.title
  98. }}
  99. </view>
  100. <search-picker :visible="item.searchPickerVisible" :dataSource="item.itemData"
  101. v-model="item[item.value]"
  102. @hidePicker="item.searchPickerVisible = false"></search-picker>
  103. </template>
  104. <picker v-else :disabled="item.disabled" :range-key="item.itemKey"
  105. :mode="item.mode ? item.mode : 'selector'" @change="bindPickerChange($event, item)"
  106. :range="item.itemData" style="flex: 1">
  107. <view :class="item[item.value] ? 'text' : 'text-hint'">
  108. {{
  109. item[item.value]
  110. ? item.itemKey
  111. ? item[item.value][item.itemKey]
  112. : item[item.value]
  113. : item.hint
  114. ? item.hint
  115. : "请选择" + item.title
  116. }}
  117. </view>
  118. </picker>
  119. <image class="arror" mode="aspectFill" :src="`${$imgUrl}common/arror-right.png`">
  120. </image>
  121. </view>
  122. </view>
  123. <!-- 富文本框 -->
  124. <view v-if="item.type === 5" style="width: 100%; margin: 30rpx 25rpx 0rpx">
  125. <view>
  126. <textarea :disabled="item.disabled" v-model="item[item.value]"
  127. @input="textareaInput($event, item)" :class="item.bg ? 'textarea-bg' : 'notbg'"
  128. placeholder-class="text-hint" style="width: 100%" :maxlength="item.maxlength"
  129. :placeholder="item.hint ? item.hint : '请输入' + item.title">
  130. </textarea>
  131. <!-- <view v-if="item.maxlength" class="as-gravity-center-end"
  132. style="display: flex;flex-direction: row;margin-top:120rpx;">
  133. <view class="text-hint">{{!item.num ? '0' : item.num}}</view>
  134. <view class="text-hint">/{{item.maxlength ? item.maxlength : 100}}</view>
  135. </view> -->
  136. </view>
  137. </view>
  138. <!-- 图片选择器 :imgWidth="imgWidth ? imgWidth : 0"-->
  139. <view v-if="item.type === 6" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  140. <form-image @backImg="backImg($event, item)" style="width: 100%" :retract="40"></form-image>
  141. </view>
  142. <!-- 单向选择器 -->
  143. <view v-if="item.type === 7" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  144. <radio-group @change="radioChange($event, item)">
  145. <view class="as-layout-horizontal" style="justify-content: right">
  146. <view style="flex: 1"></view>
  147. <label style="
  148. display: flex;
  149. flex-direction: row;
  150. margin-left: 30rpx;
  151. " v-for="(itemData, index) in item.itemData" :key="index">
  152. <radio style="transform: scale(0.7)" :value="itemData.value"
  153. :checked="itemData.checked" color="#2CE242" />
  154. <view>{{ itemData.name }}</view>
  155. </label>
  156. </view>
  157. </radio-group>
  158. </view>
  159. <!-- 证件照上传 -->
  160. <view v-if="item.type === 8" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  161. <view style="margin: 0 40rpx">
  162. <view class="text-error">{{ item.hint }}</view>
  163. <view class="as-layout-horizontal as-gravity-center"
  164. style="height: 250rpx; margin-top: 20rpx">
  165. <view class="as-layout-vertical" style="width: 90%; height: 100%">
  166. <image :src="
  167. item.placeholderImg1
  168. ? item.placeholderImg1
  169. : `${$imgUrl}license2.png`
  170. " style="width: 100%; height: 80%" @tap="ImageSelection(item, 1)" mode="aspectFill"></image>
  171. <view class="as-gravity-center text-hint" style="margin-top: 5rpx">
  172. {{ item.hint1 }}
  173. </view>
  174. </view>
  175. <view style="width: 40rpx"></view>
  176. <view class="as-layout-vertical" style="width: 90%; height: 100%">
  177. <image :src="
  178. item.placeholderImg2
  179. ? item.placeholderImg2
  180. : `${$imgUrl}license2.png`
  181. " style="width: 100%; height: 80%" @tap="ImageSelection(item, 2)" mode="aspectFill"></image>
  182. <view class="as-gravity-center text-hint" style="margin-top: 5rpx">
  183. {{ item.hint2 }}
  184. </view>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. <!-- 车牌号输入 -->
  190. <view v-if="item.type === 9" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  191. <view style="margin: 20rpx -20rpx 10rpx">
  192. <car-num-ber-input @numberInputResult="numberInputResult($event, item)">
  193. </car-num-ber-input>
  194. </view>
  195. </view>
  196. <!-- 省市区选择 -->
  197. <view v-if="item.type === 10" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  198. <view class="as-layout-horizontal" style="align-items: center">
  199. <!-- <pick-regions :defaultRegionCode="defaultRegionCode"
  200. @getRegion="handleGetRegion($event, item)" style="flex: 1">
  201. <view :class="item[item.value] ? 'text' : 'text-hint'">
  202. {{
  203. item[item.value]
  204. ? item.itemKey
  205. ? item[item.value][item.itemKey]
  206. : item[item.value]
  207. : item.hint
  208. ? item.hint
  209. : "请选择" + item.title
  210. }}
  211. </view>
  212. </pick-regions> -->
  213. <picker mode="region" @change="handleGetRegion($event, item)" :value="item.region">
  214. <view class="uni-input">
  215. {{item.region?item.region[0]+item.region[1]+item.region[2]:""}}
  216. </view>
  217. </picker>
  218. <image class="arror" :src="`${$imgUrl}common/arror-right.png`" mode="aspectFill">
  219. </image>
  220. </view>
  221. </view>
  222. <!-- 车辆图片上传 -->
  223. <view v-if="item.type === 11" style="width: 100%" :class="item.bg ? 'bg' : 'notbg'">
  224. <view class="imgs-box as-layout-horizontal">
  225. <view class="img-box" v-for="(img, index) in item.imgList">
  226. <form-image @backImg="backImg2($event, img, item)" style="width: 100%"
  227. :imgWidth="120" :retract="-10" :showTxt="false" :count="1"
  228. @removeImg="removeImg2($event, img, item)"></form-image>
  229. <view class="img-hint">{{ img.hint }}</view>
  230. </view>
  231. </view>
  232. </view>
  233. </view>
  234. </view>
  235. <view v-show="index !== formData.length - 1 && !item.underline" class="as-line3"
  236. style="margin: 0rpx 20rpx 0rpx 20rpx"></view>
  237. <view class="divider" v-if="item.divider"></view>
  238. </view>
  239. </view>
  240. <view class="subBtn">
  241. <submit-button :title="config ? config.submitName : '提交'" form-type="submit"
  242. @submit="formSubmit"></submit-button>
  243. </view>
  244. </form>
  245. </template>
  246. <script setup lang="ts">
  247. import { TypeData, ImgData } from "./tools";
  248. import { request } from "@/utils/network/request.js";
  249. import carNumBerInput from "@/components/car-number-input/car-number-input";
  250. import { pathToBase64 } from "@/utils/util/imageTool.js";
  251. import pickRegions from "@/login/pick-regions/pick-regions.vue";
  252. import { onMounted, ref } from "vue";
  253. import { reactive } from "vue";
  254. const defaultRegionCode = "520115";
  255. const props = defineProps({
  256. formData: {
  257. type: Array as () => Array<TypeData>,
  258. default: () => [],
  259. },
  260. config: {
  261. type: Object,
  262. default: function () {
  263. return {
  264. submitName: "提交", //提交按钮名称
  265. titleWidth: 120, //标题宽度
  266. };
  267. },
  268. },
  269. });
  270. const state = reactive({
  271. multiIndex: [0, 0, 0]
  272. })
  273. //defineEmits
  274. const emit = defineEmits<{
  275. (e : "submit", content : any) : void;
  276. (e : "uploadImg", content : any, item : TypeData, index : Number) : void;
  277. (e : "radioChange", event : any, item : TypeData) : void;
  278. (e : "addressInfo", content : any) : void;
  279. (e : "inputChange", event : any, item : TypeData) : void;
  280. (e : "pickerCustom", item : TypeData) : void;
  281. (e : "handleGetRegion", event : any, item : TypeData) : void;
  282. }>();
  283. //defineExpose 可宏来显式指定在 <script setup> 组件中要暴露出去的属性。
  284. //普通选择器
  285. function bindPickerChange(e : any, item : TypeData) {
  286. let select = e.target.value;
  287. // #ifdef H5
  288. select = e.detail.value;
  289. // #endif
  290. if (item.mode === "date" || item.mode === "time") {
  291. /* 日期选择器*/
  292. item[item.value] = select;
  293. } else {
  294. /* 普通选择器*/
  295. item[item.value] = item.itemData[select];
  296. }
  297. }
  298. //输入框后按钮点击
  299. const inputBtnClickHandle = (item : TypeData) => {
  300. if (item.btnType === "address") {
  301. //#ifdef MP-WEIXIN
  302. uni.chooseAddress({
  303. success: (res) => {
  304. console.log("addressInfo", res)
  305. emit("addressInfo", res);
  306. },
  307. fail: (err) => {
  308. showToast("获取失败!");
  309. },
  310. });
  311. //#endif
  312. //#ifdef MP-ALIPAY
  313. my.getAddress({
  314. success: (res) => {
  315. console.log("addressInfo", res.result)
  316. emit("addressInfo", res.result);
  317. },
  318. fail: (err) => {
  319. showToast("获取失败!");
  320. },
  321. });
  322. //#endif
  323. } else if (item.btnType === "code") {
  324. //获取验证码
  325. showToast("获取验证码");
  326. }
  327. };
  328. // 获取选择的地区
  329. function handleGetRegion(e : any, item : TypeData) {
  330. console.log("获取选择的地区", e)
  331. // item[item.value] = e[0].name + "/" + e[1].name + "/" + e[2].name;
  332. item[item.value] = e.detail.value;
  333. emit("handleGetRegion", e, item);
  334. console.log("获取选择的地区", item)
  335. }
  336. //多项选择器
  337. function checkboxChange(e : any, item : TypeData) {
  338. item[item.value] = e.detail.value; /* 赋值*/
  339. }
  340. //单项选择器
  341. function radioChange(e : any, item : TypeData) {
  342. item[item.value] = e.detail.value; /* 赋值*/
  343. emit("radioChange", e, item);
  344. }
  345. //文本输入框
  346. function inputChange(e : Event, item : TypeData) {
  347. emit("inputChange", e, item);
  348. }
  349. //富文本框输入内容
  350. function textareaInput(e : Event, item : TypeData) {
  351. item.num = item[item.value].length;
  352. }
  353. //点击图片按钮
  354. function backImg(e : Event, item : TypeData) {
  355. item[item.value] = e;
  356. }
  357. //点击图片按钮2
  358. function backImg2(e : Event, imgItem : ImgData, item : TypeData) {
  359. imgItem[imgItem.value] = e;
  360. let all = true;
  361. let srcUrl = "";
  362. item.imgList.map((temp) => {
  363. if (!temp[temp.value]) {
  364. all = false;
  365. return;
  366. } else {
  367. srcUrl = srcUrl + temp[temp.value] + ",";
  368. }
  369. });
  370. if (all) {
  371. item[item.value] = srcUrl;
  372. // console.log('--------总图片路径------------');
  373. // console.log(item[item.value])
  374. }
  375. }
  376. //删除图片
  377. const removeImg2 = (e : Event, imgItem : ImgData, item : TypeData) => {
  378. imgItem[imgItem.value] = "";
  379. item[item.value] = "";
  380. };
  381. //车牌输入
  382. function numberInputResult(e : Event, item : TypeData) {
  383. item[item.value] = e;
  384. }
  385. //选择图片按钮
  386. function ImageSelection(item : TypeData, index : number) {
  387. uni.chooseImage({
  388. count: 1, //最多可以选择的文件个数
  389. sourceType: ["camera"], //album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
  390. success(res : any) {
  391. if (res.tempFiles[0].size > 2000000) {
  392. uni.showToast({
  393. title: "图片大于2M,请重新上传",
  394. icon: "none",
  395. duration: 1500,
  396. });
  397. return;
  398. }
  399. // #ifdef MP-WEIXIN
  400. uni.getFileSystemManager().readFile({
  401. filePath: res.tempFiles[0].tempFilePath, //要读取的文件的路径
  402. encoding: "base64", //编码格式
  403. success: (res) => {
  404. let imgBase64 = res.data;
  405. let reqData = {
  406. imageBase: imgBase64,
  407. accountNum: "qtzl_xcx",
  408. secretKey: "4DE47302-EDC7-41D4-888F-59A79DF4EA46",
  409. };
  410. //上传给服务器
  411. uni.showLoading({
  412. title: "正在加载中...",
  413. mask: true,
  414. });
  415. //文件上传
  416. request("", {
  417. baseUrl: "https://etcfile.etcjz.cn/v1/file/uploadImageBaseFile",
  418. data: reqData,
  419. }).then((content) => {
  420. uni.hideLoading();
  421. if (content.rc != "00") {
  422. uni.showModal({
  423. title: "请求错误",
  424. content: "图片上传失败",
  425. showCancel: false,
  426. confirmText: "取消",
  427. });
  428. }
  429. //处理后的 Data
  430. let data = {
  431. source: 2, //来源
  432. imageBase64: imgBase64,
  433. imageType: index,
  434. imageUrl: content.data.fileUrl,
  435. };
  436. emit("uploadImg", data, item, index);
  437. });
  438. },
  439. fail: (err) => {
  440. console.log("错误提示", err);
  441. },
  442. });
  443. // #endif
  444. // #ifdef H5
  445. pathToBase64(res.tempFilePaths[0]).then((data) => {
  446. let base64 = data.replaceAll("data:image/jpeg;base64,", "");
  447. base64 = base64.replaceAll("data:image/png;base64,", "");
  448. base64 = base64.replaceAll("data:image/jpg;base64,", "");
  449. let reqData = {
  450. imageBase: base64,
  451. accountNum: "qtzl_xcx",
  452. secretKey: "4DE47302-EDC7-41D4-888F-59A79DF4EA46",
  453. };
  454. //上传给服务器
  455. uni.showLoading({
  456. title: "文件上传中...",
  457. mask: true,
  458. });
  459. //文件上传
  460. request("", {
  461. baseUrl: "https://etcfile.etcjz.cn/v1/file/uploadImageBaseFile",
  462. data: reqData,
  463. })
  464. .then((content) => {
  465. console.log("上传结果", content);
  466. uni.hideLoading();
  467. if (content.rc != "00" && content.rc != 0) {
  468. uni.showModal({
  469. title: "请求错误",
  470. content: "图片上传失败",
  471. showCancel: false,
  472. confirmText: "取消",
  473. });
  474. }
  475. //展示缩略图
  476. if (index % 2 != 0) {
  477. //奇数第一张 偶数第二张
  478. item.placeholderImg1 = content.data.fileUrl;
  479. item[item.value.split(",")[0]] = content.data.fileUrl;
  480. } else {
  481. item.placeholderImg2 = content.data.fileUrl;
  482. item[item.value.split(",")[1]] = content.data.fileUrl;
  483. }
  484. //只展示缩略图
  485. if (!item.inputType) {
  486. emit("uploadImg", data, item, index);
  487. } else {
  488. //if(item.type === 1)
  489. //证件OCR识别
  490. uni.showLoading({
  491. title: "证件识别中...",
  492. mask: true,
  493. });
  494. let reqData2 = {
  495. imageDriveBase: "",
  496. imageBase64: base64,
  497. imageType: index % 2 != 0 ? 1 : 2, //1代表身份证正面,2代表反面
  498. imageUrl: content.data.fileUrl,
  499. };
  500. //默认身份证
  501. let code = "IF010012019070410001";
  502. if (item.inputType == "2") {
  503. //2为行驶证
  504. code = "IF010012019070410002";
  505. reqData2.imageBase64 = "";
  506. reqData2.imageDriveBase = base64;
  507. }
  508. request(code, {
  509. data: reqData2,
  510. }).then((ocr) => {
  511. uni.hideLoading();
  512. if (ocr.rc !== "00") {
  513. uni.showModal({
  514. title: "请求错误",
  515. content: "证件识别失败",
  516. showCancel: false,
  517. confirmText: "取消",
  518. });
  519. }
  520. let data = ocr.rd;
  521. //[身份证正面]姓名(name) 住址(address) 出生日期(birthday) 身份证号(idno) 民族(nation)
  522. //[身份证反面]证件机关(agency) 有效起始日期(begindate) 有效结束日期(enddate)
  523. emit("uploadImg", data, item, index);
  524. });
  525. }
  526. })
  527. .catch((e) => {
  528. console.log(">>>>", e);
  529. });
  530. });
  531. // #endif
  532. },
  533. fail(res : any) {
  534. if (!res.authSetting["scope.album"]) {
  535. uni.showModal({
  536. title: "授权失败",
  537. content: "需要从您的相机或相册获取图片,请在设置界面打开相关权限",
  538. success: (res) => {
  539. if (res.confirm) {
  540. uni.openSetting();
  541. }
  542. },
  543. });
  544. }
  545. },
  546. });
  547. }
  548. function showToast(hint : string) {
  549. uni.showToast({
  550. icon: "none",
  551. title: hint,
  552. });
  553. }
  554. //内容提交
  555. const formSubmit = () => {
  556. let content = {};
  557. /* 整理数据对象返回内容 */
  558. for (var i = 0; i < props.formData.length; i++) {
  559. let data = props.formData[i];
  560. /* 时间另外判断 */
  561. if (data.required && !data.hide) {
  562. //隐藏的不用进行判断
  563. let reg = new RegExp(":", "g"); //g代表全部
  564. let newMsg = data.title.replace(reg, "");
  565. if (data.value.indexOf(",") != -1 && data.type === 8) {
  566. if (!data[data.value.split(",")[0]]) {
  567. showToast(data.emptyHint ? data.emptyHint : `${data.hint1}不能为空`);
  568. return;
  569. } else if (!data[data.value.split(",")[1]]) {
  570. showToast(data.emptyHint ? data.emptyHint : `${data.hint2}不能为空`);
  571. return;
  572. }
  573. } else if (!data[data.value]) {
  574. showToast(data.emptyHint ? data.emptyHint : `${newMsg}不能为空`);
  575. return;
  576. }
  577. }
  578. if (data.value.indexOf(",") != -1 && data.type === 8) {
  579. if (data[data.value.split(",")[0]]) {
  580. content[data.value.split(",")[0]] = data[data.value.split(",")[0]];
  581. }
  582. if (data[data.value.split(",")[1]]) {
  583. content[data.value.split(",")[1]] = data[data.value.split(",")[1]];
  584. }
  585. } else if (data.type === 10) {
  586. // for (var i = 0; i < data.value.split(',').length; i++) {
  587. // content[data.value.split(',')[i]] = data[data.value].split('-')[i]
  588. // }
  589. content[data.value] = data[data.value];
  590. } else {
  591. if (data.type === 4 && data.name) {
  592. content[data.value] = data[data.value][data.name];
  593. } else {
  594. content[data.value] = data[data.value];
  595. }
  596. }
  597. }
  598. emit("submit", content);
  599. };
  600. </script>
  601. <style lang="scss" scoped>
  602. .img-size {
  603. width: 30rpx;
  604. height: 30rpx;
  605. }
  606. .notbg {
  607. background-color: #ffffff;
  608. border-radius: 20rpx;
  609. min-height: 80rpx;
  610. line-height: 80rpx;
  611. padding: 8rpx 28rpx;
  612. }
  613. .bg {
  614. background-color: #f1f1f1;
  615. border-radius: 20rpx;
  616. min-height: 80rpx;
  617. line-height: 80rpx;
  618. padding: 0 28rpx;
  619. margin-right: 29rpx;
  620. margin-left: 25rpx;
  621. margin-top: 30rpx;
  622. }
  623. .textarea-bg {
  624. background-color: #f1f1f1;
  625. border-radius: 20rpx;
  626. height: 245rpx;
  627. padding: 30rpx;
  628. box-sizing: border-box;
  629. -moz-box-sizing: border-box;
  630. /*Firefox*/
  631. -webkit-box-sizing: border-box;
  632. /*Safari*/
  633. }
  634. .text-hint {
  635. font-size: 28rpx;
  636. color: #999999;
  637. }
  638. .text-title {
  639. font-size: 28rpx;
  640. color: #333333;
  641. }
  642. .subBtn {
  643. margin: 112rpx 30rpx 30rpx;
  644. }
  645. .divider {
  646. border-bottom: 1px solid #dcdcdc;
  647. }
  648. .arror {
  649. width: 35rpx;
  650. height: 35rpx;
  651. }
  652. .imgs-box {
  653. flex-wrap: wrap;
  654. margin-top: 20rpx;
  655. margin-bottom: -35rpx;
  656. padding-right: 110rpx;
  657. justify-content: space-between;
  658. .img-box {
  659. margin-bottom: 35rpx;
  660. }
  661. .img-hint {
  662. font-size: 24rpx;
  663. color: #333333;
  664. text-align: center;
  665. }
  666. }
  667. .uni-input {
  668. color: #646464;
  669. font-size: 28rpx;
  670. }
  671. </style>