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

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