Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

form-builder.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  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. emit("addressInfo", res);
  305. },
  306. fail: (err) => {
  307. showToast("获取失败!");
  308. },
  309. });
  310. //#endif
  311. } else if (item.btnType === "code") {
  312. //获取验证码
  313. showToast("获取验证码");
  314. }
  315. };
  316. // 获取选择的地区
  317. function handleGetRegion(e : any, item : TypeData) {
  318. console.log("获取选择的地区", e)
  319. // item[item.value] = e[0].name + "/" + e[1].name + "/" + e[2].name;
  320. item[item.value] = e.detail.value;
  321. emit("handleGetRegion", e, item);
  322. console.log("获取选择的地区", item)
  323. }
  324. //多项选择器
  325. function checkboxChange(e : any, item : TypeData) {
  326. item[item.value] = e.detail.value; /* 赋值*/
  327. }
  328. //单项选择器
  329. function radioChange(e : any, item : TypeData) {
  330. item[item.value] = e.detail.value; /* 赋值*/
  331. emit("radioChange", e, item);
  332. }
  333. //文本输入框
  334. function inputChange(e : Event, item : TypeData) {
  335. emit("inputChange", e, item);
  336. }
  337. //富文本框输入内容
  338. function textareaInput(e : Event, item : TypeData) {
  339. item.num = item[item.value].length;
  340. }
  341. //点击图片按钮
  342. function backImg(e : Event, item : TypeData) {
  343. item[item.value] = e;
  344. }
  345. //点击图片按钮2
  346. function backImg2(e : Event, imgItem : ImgData, item : TypeData) {
  347. imgItem[imgItem.value] = e;
  348. let all = true;
  349. let srcUrl = "";
  350. item.imgList.map((temp) => {
  351. if (!temp[temp.value]) {
  352. all = false;
  353. return;
  354. } else {
  355. srcUrl = srcUrl + temp[temp.value] + ",";
  356. }
  357. });
  358. if (all) {
  359. item[item.value] = srcUrl;
  360. // console.log('--------总图片路径------------');
  361. // console.log(item[item.value])
  362. }
  363. }
  364. //删除图片
  365. const removeImg2 = (e : Event, imgItem : ImgData, item : TypeData) => {
  366. imgItem[imgItem.value] = "";
  367. item[item.value] = "";
  368. };
  369. //车牌输入
  370. function numberInputResult(e : Event, item : TypeData) {
  371. item[item.value] = e;
  372. }
  373. //选择图片按钮
  374. function ImageSelection(item : TypeData, index : number) {
  375. uni.chooseImage({
  376. count: 1, //最多可以选择的文件个数
  377. sourceType: ["camera"], //album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
  378. success(res : any) {
  379. if (res.tempFiles[0].size > 2000000) {
  380. uni.showToast({
  381. title: "图片大于2M,请重新上传",
  382. icon: "none",
  383. duration: 1500,
  384. });
  385. return;
  386. }
  387. // #ifdef MP-WEIXIN
  388. uni.getFileSystemManager().readFile({
  389. filePath: res.tempFiles[0].tempFilePath, //要读取的文件的路径
  390. encoding: "base64", //编码格式
  391. success: (res) => {
  392. let imgBase64 = res.data;
  393. let reqData = {
  394. imageBase: imgBase64,
  395. accountNum: "qtzl_xcx",
  396. secretKey: "4DE47302-EDC7-41D4-888F-59A79DF4EA46",
  397. };
  398. //上传给服务器
  399. uni.showLoading({
  400. title: "正在加载中...",
  401. mask: true,
  402. });
  403. //文件上传
  404. request("", {
  405. baseUrl: "https://etcfile.etcjz.cn/v1/file/uploadImageBaseFile",
  406. data: reqData,
  407. }).then((content) => {
  408. uni.hideLoading();
  409. if (content.rc != "00") {
  410. uni.showModal({
  411. title: "请求错误",
  412. content: "图片上传失败",
  413. showCancel: false,
  414. confirmText: "取消",
  415. });
  416. }
  417. //处理后的 Data
  418. let data = {
  419. source: 2, //来源
  420. imageBase64: imgBase64,
  421. imageType: index,
  422. imageUrl: content.data.fileUrl,
  423. };
  424. emit("uploadImg", data, item, index);
  425. });
  426. },
  427. fail: (err) => {
  428. console.log("错误提示", err);
  429. },
  430. });
  431. // #endif
  432. // #ifdef H5
  433. pathToBase64(res.tempFilePaths[0]).then((data) => {
  434. let base64 = data.replaceAll("data:image/jpeg;base64,", "");
  435. base64 = base64.replaceAll("data:image/png;base64,", "");
  436. base64 = base64.replaceAll("data:image/jpg;base64,", "");
  437. let reqData = {
  438. imageBase: base64,
  439. accountNum: "qtzl_xcx",
  440. secretKey: "4DE47302-EDC7-41D4-888F-59A79DF4EA46",
  441. };
  442. //上传给服务器
  443. uni.showLoading({
  444. title: "文件上传中...",
  445. mask: true,
  446. });
  447. //文件上传
  448. request("", {
  449. baseUrl: "https://etcfile.etcjz.cn/v1/file/uploadImageBaseFile",
  450. data: reqData,
  451. })
  452. .then((content) => {
  453. console.log("上传结果", content);
  454. uni.hideLoading();
  455. if (content.rc != "00" && content.rc != 0) {
  456. uni.showModal({
  457. title: "请求错误",
  458. content: "图片上传失败",
  459. showCancel: false,
  460. confirmText: "取消",
  461. });
  462. }
  463. //展示缩略图
  464. if (index % 2 != 0) {
  465. //奇数第一张 偶数第二张
  466. item.placeholderImg1 = content.data.fileUrl;
  467. item[item.value.split(",")[0]] = content.data.fileUrl;
  468. } else {
  469. item.placeholderImg2 = content.data.fileUrl;
  470. item[item.value.split(",")[1]] = content.data.fileUrl;
  471. }
  472. //只展示缩略图
  473. if (!item.inputType) {
  474. emit("uploadImg", data, item, index);
  475. } else {
  476. //if(item.type === 1)
  477. //证件OCR识别
  478. uni.showLoading({
  479. title: "证件识别中...",
  480. mask: true,
  481. });
  482. let reqData2 = {
  483. imageDriveBase: "",
  484. imageBase64: base64,
  485. imageType: index % 2 != 0 ? 1 : 2, //1代表身份证正面,2代表反面
  486. imageUrl: content.data.fileUrl,
  487. };
  488. //默认身份证
  489. let code = "IF010012019070410001";
  490. if (item.inputType == "2") {
  491. //2为行驶证
  492. code = "IF010012019070410002";
  493. reqData2.imageBase64 = "";
  494. reqData2.imageDriveBase = base64;
  495. }
  496. request(code, {
  497. data: reqData2,
  498. }).then((ocr) => {
  499. uni.hideLoading();
  500. if (ocr.rc !== "00") {
  501. uni.showModal({
  502. title: "请求错误",
  503. content: "证件识别失败",
  504. showCancel: false,
  505. confirmText: "取消",
  506. });
  507. }
  508. let data = ocr.rd;
  509. //[身份证正面]姓名(name) 住址(address) 出生日期(birthday) 身份证号(idno) 民族(nation)
  510. //[身份证反面]证件机关(agency) 有效起始日期(begindate) 有效结束日期(enddate)
  511. emit("uploadImg", data, item, index);
  512. });
  513. }
  514. })
  515. .catch((e) => {
  516. console.log(">>>>", e);
  517. });
  518. });
  519. // #endif
  520. },
  521. fail(res : any) {
  522. if (!res.authSetting["scope.album"]) {
  523. uni.showModal({
  524. title: "授权失败",
  525. content: "需要从您的相机或相册获取图片,请在设置界面打开相关权限",
  526. success: (res) => {
  527. if (res.confirm) {
  528. uni.openSetting();
  529. }
  530. },
  531. });
  532. }
  533. },
  534. });
  535. }
  536. function showToast(hint : string) {
  537. uni.showToast({
  538. icon: "none",
  539. title: hint,
  540. });
  541. }
  542. //内容提交
  543. const formSubmit = () => {
  544. let content = {};
  545. /* 整理数据对象返回内容 */
  546. for (var i = 0; i < props.formData.length; i++) {
  547. let data = props.formData[i];
  548. /* 时间另外判断 */
  549. if (data.required && !data.hide) {
  550. //隐藏的不用进行判断
  551. let reg = new RegExp(":", "g"); //g代表全部
  552. let newMsg = data.title.replace(reg, "");
  553. if (data.value.indexOf(",") != -1 && data.type === 8) {
  554. if (!data[data.value.split(",")[0]]) {
  555. showToast(data.emptyHint ? data.emptyHint : `${data.hint1}不能为空`);
  556. return;
  557. } else if (!data[data.value.split(",")[1]]) {
  558. showToast(data.emptyHint ? data.emptyHint : `${data.hint2}不能为空`);
  559. return;
  560. }
  561. } else if (!data[data.value]) {
  562. showToast(data.emptyHint ? data.emptyHint : `${newMsg}不能为空`);
  563. return;
  564. }
  565. }
  566. if (data.value.indexOf(",") != -1 && data.type === 8) {
  567. if (data[data.value.split(",")[0]]) {
  568. content[data.value.split(",")[0]] = data[data.value.split(",")[0]];
  569. }
  570. if (data[data.value.split(",")[1]]) {
  571. content[data.value.split(",")[1]] = data[data.value.split(",")[1]];
  572. }
  573. } else if (data.type === 10) {
  574. // for (var i = 0; i < data.value.split(',').length; i++) {
  575. // content[data.value.split(',')[i]] = data[data.value].split('-')[i]
  576. // }
  577. content[data.value] = data[data.value];
  578. } else {
  579. if (data.type === 4 && data.name) {
  580. content[data.value] = data[data.value][data.name];
  581. } else {
  582. content[data.value] = data[data.value];
  583. }
  584. }
  585. }
  586. emit("submit", content);
  587. };
  588. </script>
  589. <style lang="scss" scoped>
  590. .img-size {
  591. width: 30rpx;
  592. height: 30rpx;
  593. }
  594. .notbg {
  595. background-color: #ffffff;
  596. border-radius: 20rpx;
  597. min-height: 80rpx;
  598. line-height: 80rpx;
  599. padding: 8rpx 28rpx;
  600. }
  601. .bg {
  602. background-color: #f1f1f1;
  603. border-radius: 20rpx;
  604. min-height: 80rpx;
  605. line-height: 80rpx;
  606. padding: 0 28rpx;
  607. margin-right: 29rpx;
  608. margin-left: 25rpx;
  609. margin-top: 30rpx;
  610. }
  611. .textarea-bg {
  612. background-color: #f1f1f1;
  613. border-radius: 20rpx;
  614. height: 245rpx;
  615. padding: 30rpx;
  616. box-sizing: border-box;
  617. -moz-box-sizing: border-box;
  618. /*Firefox*/
  619. -webkit-box-sizing: border-box;
  620. /*Safari*/
  621. }
  622. .text-hint {
  623. font-size: 28rpx;
  624. color: #999999;
  625. }
  626. .text-title {
  627. font-size: 28rpx;
  628. color: #333333;
  629. }
  630. .subBtn {
  631. margin: 112rpx 30rpx 30rpx;
  632. }
  633. .divider {
  634. border-bottom: 1px solid #dcdcdc;
  635. }
  636. .arror {
  637. width: 35rpx;
  638. height: 35rpx;
  639. }
  640. .imgs-box {
  641. flex-wrap: wrap;
  642. margin-top: 20rpx;
  643. margin-bottom: -35rpx;
  644. padding-right: 110rpx;
  645. justify-content: space-between;
  646. .img-box {
  647. margin-bottom: 35rpx;
  648. }
  649. .img-hint {
  650. font-size: 24rpx;
  651. color: #333333;
  652. text-align: center;
  653. }
  654. }
  655. .uni-input {
  656. color: #646464;
  657. font-size: 28rpx;
  658. }
  659. </style>