You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

form-builder.vue 22KB

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