12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214 |
- <template>
- <view>
- <view class="requiredFieldOnly-head" v-if="requiredFieldOnly">
- <view class="label"> 基本信息 </view>
- <view class="content">
- 仅显示必填信息<text style="padding: 0 2.5px" />
- <u-switch activeColor="#C40C24" v-model="unShowAll" />
- </view>
- </view>
- <slot name="head" />
- <block v-for="(item, index) in list" :key="item.key">
- <block v-if="item.isMust || !unShowAll">
- <!-- 文本输入 -->
- <view
- class="input-box"
- v-if="item.type == 'text'"
- :style="{
- marginTop: tovw(item.marginTop || 0),
- opacity: item.disabled ? 0.7 : 1,
- }"
- @click="focusLabel = item.label"
- >
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <view class="content-box" style="flex: 1">
- <view
- class="content"
- style="display: flex; flex: 1; box-sizing: border-box"
- >
- <input
- v-if="item.inputmode == 'number'"
- type="number"
- :disabled="item.disabled"
- placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
- :focus="focusLabel == item.label"
- :placeholder="item.placeholder || '请填写' + item.label"
- :value="item.value"
- style="flex: 1"
- @input="onInput($event, index)"
- :maxlength="item.maxlength || '499'"
- confirm-type="done"
- />
- <input
- v-else-if="item.inputmode == 'digit'"
- type="digit"
- :disabled="item.disabled"
- placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
- :focus="focusLabel == item.label"
- :placeholder="item.placeholder || '请填写' + item.label"
- :value="item.value"
- style="flex: 1"
- @input="onInput($event, index)"
- :maxlength="item.maxlength || '499'"
- confirm-type="done"
- />
- <textarea
- v-else
- :disabled="item.disabled"
- placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
- auto-height
- type="text"
- :focus="focusLabel == item.label"
- :placeholder="item.placeholder || '请填写' + item.label"
- :value="item.value"
- style="flex: 1; width: 0; box-sizing: border-box"
- @input="onInput($event, index)"
- :maxlength="item.maxlength || '499'"
- confirm-type="done"
- />
- <icon
- v-if="item.value && !item.disabled"
- class="icon"
- type="clear"
- size="3.733vw"
- @click="onClearInput(index)"
- />
- <view style="margin-left: 6px" v-if="item.getPhoneNumber">
- <u-button
- color="#C30D23"
- size="small"
- open-type="getPhoneNumber"
- @click.stop=""
- @getphonenumber="butGetphonenumber($event, index)"
- >
- 获取微信
- <text
- class="iconfont icon-dianhua-hui"
- style="font-size: 12px; margin-left: 3px"
- />
- </u-button>
- </view>
- </view>
- <view v-if="item.errText" class="err-text">
- <icon
- class="icon"
- color="#E3041F"
- type="clear"
- size="2.733vw"
- />
- {{ item.errText }}
- </view>
- </view>
- </view>
- </view>
- <!-- 文本域 -->
- <view class="textarea-box" v-else-if="item.type == 'textarea'">
- <textarea
- class="textarea"
- :class="item.unBorBot ? '' : 'borBot'"
- :disabled="item.disabled"
- placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
- type="text"
- :placeholder="item.placeholder || '请填写' + item.label"
- :value="item.value"
- @input="onInput($event, index)"
- :maxlength="item.maxlength || '499'"
- confirm-type="done"
- />
- </view>
- <!-- 显示标题文本域 参考意见反馈 -->
- <view
- class="textarea-box2"
- v-else-if="item.type == 'textarea2'"
- :style="{ marginTop: tovw(item.marginTop || 0) }"
- >
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <textarea
- class="textarea"
- :class="item.unBorBot ? '' : 'borBot'"
- :disabled="item.disabled"
- placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
- type="text"
- :placeholder="item.placeholder || '请填写' + item.label"
- :value="item.value"
- @input="onInput($event, index)"
- :maxlength="item.maxlength || '499'"
- confirm-type="done"
- />
- </view>
- <!-- 自定义选项分类 -->
- <view
- class="custom-class-box"
- v-else-if="item.type == 'customClass'"
- :style="{ marginTop: tovw(item.marginTop || 0) }"
- >
- <view class="head">
- <view class="label">
- <text class="must" style="color: #e3041f" v-if="item.isMust"
- >*</text
- >
- {{ item.label }}
- </view>
- <view class="state">
- {{ item.isMultipleChoice ? "可多选" : "仅单选" }}
- </view>
- </view>
- <view class="options">
- <view
- class="option"
- :class="
- item.isMultipleChoice
- ? item.value.includes(option.value)
- ? 'active'
- : ''
- : item.value == option.value
- ? 'active'
- : ''
- "
- v-for="option in item.list"
- :key="option.value"
- hover-class="navigator-hover"
- @click="changOptions(option.value, index)"
- >
- {{ option.remarks }}
- </view>
- </view>
- </view>
- <!-- 选择所在地区 -->
- <picker
- class="region"
- @change="selectRegion($event, index)"
- mode="region"
- :disabled="item.disabled"
- :value="item.value"
- v-else-if="item.type == 'region'"
- :style="{
- marginTop: tovw(item.marginTop || 0),
- opacity: item.disabled ? 0.7 : 1,
- }"
- >
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <view class="content-box">
- <view class="value" v-if="item.value.length">
- {{ item.value.join(",") }}
- </view>
- <view v-else class="placeholder" hover-class="none">
- {{ item.placeholder || "请选择" + item.label }}
- </view>
- <view
- v-if="!item.disabled"
- class="iconfont icon-a-wodetiaozhuan"
- />
- </view>
- </view>
- </picker>
- <!-- 日期 -->
- <picker
- class="region"
- @change="selectRegion($event, index)"
- mode="date"
- :disabled="item.disabled"
- :value="item.value"
- v-else-if="item.type == 'date'"
- :style="{
- marginTop: tovw(item.marginTop || 0),
- opacity: item.disabled ? 0.7 : 1,
- }"
- >
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <view class="content-box">
- <view class="value" v-if="item.value">
- {{ item.value }}
- </view>
- <view v-else class="placeholder" hover-class="none">
- {{ item.placeholder || "请选择" + item.label }}
- </view>
- <view
- v-if="!item.disabled"
- class="iconfont icon-a-wodetiaozhuan"
- />
- </view>
- </view>
- </picker>
- <!-- 上传附件 -->
- <view
- class="custom-class-box"
- v-else-if="item.type == 'upload'"
- :style="{ marginTop: tovw(item.marginTop || 0) }"
- >
- <view class="head">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}
- </view>
- <view class="state">
- {{ item.placeholder }}
- </view>
- </view>
- <view class="content">
- <view
- class="file-box"
- v-for="file in item.value"
- :key="file.attachmentid"
- >
- <image
- class="image"
- v-if="file.fileType == 'image'"
- :src="file.url"
- mode="aspectFill"
- lazy-load="true"
- @click="previewImg(file)"
- />
- <video
- v-else-if="file.fileType == 'video'"
- class="video"
- :poster="file.subfiles[0].url"
- :src="file.url"
- />
- <image
- class="delete"
- @click.stop="deleteFile(file, index)"
- src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404241713944430197B47af9b2f.png"
- mode="widthFix"
- />
- </view>
- <My_upload
- v-if="item.allowUpload"
- :showLoading="false"
- :maxCount="item.maxCount || 99"
- :accept="item.accept"
- @uploadCallback="uploadCallback($event, index)"
- @onLoading="onUploadLoading($event, index)"
- >
- <view
- class="upload-box"
- v-if="
- item.maxCount
- ? item.value.length != item.maxCount
- : item.value.length != 99
- "
- hover-class="navigator-hover"
- >
- <u-loading-icon v-if="item.loading" />
- <text v-else class="iconfont icon-xiazai" />
- <text style="margin-left: 5px">上传</text>
- </view>
- </My_upload>
- </view>
- </view>
- <!-- 开关 -->
- <view class="region" v-else-if="item.type == 'switch'">
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <view class="content-box">
- <view />
- <u-switch
- activeColor="#70D95D"
- v-model="item.value"
- :disabled="item.disabled"
- @change="switchChange($event, index)"
- />
- </view>
- </view>
- </view>
- <!-- 性别 -->
- <view class="region" v-else-if="item.type == 'sex'">
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <u-radio-group
- v-model="item.value"
- placement="row"
- @change="groupChange($event, index)"
- >
- <u-radio
- :customStyle="{ marginRight: tovw(60) }"
- label="男"
- name="男"
- />
- <u-radio label="女" name="女" />
- </u-radio-group>
- </view>
- </view>
- <!-- 单选 -->
- <view class="region" v-else-if="item.type == 'radio'">
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <u-radio-group
- v-model="item.value"
- :placement="item.placement || 'row'"
- @change="groupChange($event, index)"
- >
- <u-radio
- v-for="option in item.options"
- :customStyle="{
- marginRight: tovw(
- option.marginRight || item.marginRight || 0
- ),
- marginTop: tovw(option.marginTop || item.marginTop || 0),
- }"
- :key="option.label"
- :label="option.label"
- :name="option.name"
- />
- </u-radio-group>
- </view>
- </view>
- <!-- 路由选择器 -->
- <view
- class="region"
- v-else-if="item.type == 'route'"
- :style="{
- marginTop: tovw(item.marginTop || 0),
- opacity: item.disabled ? 0.7 : 1,
- }"
- @click="item.disabled ? '' : toRoute(item, index)"
- >
- <view class="box" :class="item.unBorBot ? '' : 'borBot'">
- <view class="label">
- <text class="must" v-if="item.isMust">*</text>
- {{ item.label }}:
- </view>
- <view class="content-box">
- <view class="value" v-if="item.showValue.length">
- {{ item.showValue.join(",") }}
- </view>
- <view v-else class="placeholder" hover-class="none">
- {{ item.placeholder || "请选择" + item.label }}
- </view>
- <view
- v-if="!item.disabled"
- class="iconfont icon-a-wodetiaozhuan"
- />
- </view>
- </view>
- </view>
- <!-- 标签 -->
- <view
- class="tag-box custom-class-box"
- v-else-if="item.type == 'tag'"
- :style="{ marginTop: tovw(item.marginTop || 0) }"
- >
- <text class="label">{{ item.label }}</text>
- <view class="tag-list">
- <view class="tag" v-for="tag in item.value" :key="tag">
- <text>{{ tag }}</text>
- <view @click="delTag(tag, index)" class="del">x</view>
- </view>
- <view>
- <u-modal
- :title="item.label"
- :show="showTagModal"
- style="flex: 0 !important"
- confirmColor="#C30D23"
- ref="uModal"
- showCancelButton
- :asyncClose="false"
- @confirm="addTagSend(index)"
- @cancel="showTagModal = false"
- >
- <view class="slot-content">
- <view
- v-if="item.errText"
- class="err-text"
- style="margin-bottom: 10px"
- >
- <icon
- class="icon"
- color="#E3041F"
- type="clear"
- size="2.733vw"
- />
- {{ item.errText }}
- </view>
- <u--input
- :maxlength="item.maxlength ? item.maxlength : '99999'"
- :focus="showUModal"
- @input="onTagInput($event, index)"
- :placeholder="item.placeholder || '请输入'"
- v-model="tagValue"
- border="bottom"
- clearable
- />
- </view>
- </u-modal>
- <view class="add-tag" @click="showTagModal = true">+ 添加</view>
- </view>
- </view>
- </view>
- </block>
- </block>
- </view>
- </template>
- <script>
- import { formattedFiles, viewImage } from "../utils/settleFiles.js";
- export default {
- name: "my_form",
- props: {
- form: {
- type: Array,
- default: [],
- },
- isUncomplete: {
- type: Function,
- },
- onUploading: {
- type: Function,
- },
- requiredFieldOnly: {
- type: Boolean,
- },
- isShowAll: {
- type: Function,
- },
- interrupt: {
- type: Function,
- },
- },
- data() {
- return {
- list: [],
- focusLabel: "",
- unShowAll: false,
- showTagModal: false,
- tagValue: "",
- };
- },
- watch: {
- form: {
- handler: function (newVal) {
- if (newVal) {
- this.list = JSON.parse(JSON.stringify(newVal));
- setTimeout(() => {
- this.verify();
- }, 200);
- }
- },
- immediate: true,
- },
- unShowAll: function (newVal) {
- this.$emit("isShowAll", newVal);
- },
- },
- async created() {
- /* let list = [{
- key: "name",
- type: "text",
- label: "标题",
- isMust: true,//是否必填
- value: "",
- inputmode:"", //https://uniapp.dcloud.net.cn/component/input.html#type
- marginTop: 10,
- verify:[],
- }, {
- key: "Class",
- type: "customClass",
- label: "标题",
- isMust: false,//是否必填
- isMultipleChoice: true,//是否多选
- value: [],// 多选[] 单选 ""
- isMust: true,//是否必填
- list: await this.getCustomClass('picturespace'),
- marginTop: 10
- },{
- key: "attachmentids",
- type: "upload",
- label: "图片/视频",
- accept:"all",
- placeholder: "可上传多个视频或图片",
- ownertable: "temporary",
- ownerid: 999,
- usetype: 'default',
- allowUpload: true,
- allowDelete: true,
- value:[],
- marginTop: 10
- }, {
- key: "region",
- type: "region",
- label: "所在地区",
- isMust: true,//是否必填
- value: [],
- }, {
- key: "address",
- type: "textarea",
- label: "详细地址",
- isMust: true,//是否必填
- value: '',
- }, {
- key: "isdefault",
- type: "switch",
- label: "设为默认地址",
- isMust: false,//是否必填
- value: false,
- isNum: true,
- unBorBot: true
- }] */
- },
- methods: {
- delTag(tag, index) {
- let item = this.list[index];
- console.log(tag);
- item.value.splice(item.value.indexOf(tag), 1);
- this.$set(this.list[index], "value", item.value);
- },
- addTagSend(index) {
- let item = this.list[index];
- if (!item.errText) {
- item.value.push(this.tagValue);
- this.$set(this.list[index], "value", item.value);
- this.tagValue = "";
- this.showTagModal = false;
- }
- },
- toRoute(item, index) {
- let url = item.path;
- if (item.showValue.length) {
- let obj = JSON.stringify({
- value: item.value,
- showValue: item.showValue,
- });
- url +=
- (url.indexOf("?") == -1
- ? "?alreadySelecteds="
- : "&alreadySelecteds=") + obj;
- }
- uni.navigateTo({
- url,
- });
- this.$Http.routeSelected = function (selected) {
- this.$emit("interrupt", item, selected, index);
- delete this.$Http.routeSelected;
- }.bind(this);
- },
- onTagInput(e, index) {
- let item = this.list[index];
- item.errText = "";
- if (item.verify && item.verify.length && this.tagValue != "") {
- let err = item.verify.find(
- (r) => !new RegExp(r.reg).test(this.tagValue)
- );
- if (err) this.$set(this.list[index], "errText", err.errText);
- }
- this.verify();
- },
- butGetphonenumber(e, index) {
- if (e.detail.code) {
- this.$Http
- .basic({
- id: 20240520110702,
- content: {
- systemclient: getApp().globalData.systemclient,
- code: e.detail.code,
- },
- })
- .then((res) => {
- console.log("获取手机号", res);
- if (this.cutoff(res.msg)) return;
- this.$set(this.list[index], "value", res.data.phoneNumber);
- this.verify();
- });
- }
- },
- onInput(e, index) {
- let item = this.list[index];
- item.errText = "";
- this.$set(this.list[index], "value", e.detail.value);
- if (item.verify && item.verify.length && item.value != "") {
- let err = item.verify.find((r) => !new RegExp(r.reg).test(item.value));
- if (err) this.$set(this.list[index], "errText", err.errText);
- }
- this.verify();
- },
- setItem(index, item, back = false) {
- this.$set(this.list, index, item);
- this.verify();
- if (back) uni.navigateBack();
- },
- setValue(index, value, back = false) {
- this.$set(this.list[index], "value", value);
- this.verify();
- if (back) uni.navigateBack();
- },
- onClearInput(index) {
- let item = this.list[index];
- item.errText = "";
- this.$set(this.list[index], "value", "");
- this.verify();
- },
- switchChange(e, index) {
- this.$set(this.list[index], "value", e);
- this.verify();
- },
- changOptions(value, index) {
- let item = this.list[index];
- if (item.isMultipleChoice) {
- let i = -1;
- try {
- i = item.value.findIndex((v) => v == value);
- } catch (error) {}
- if (i == -1) {
- item.value.push(value);
- } else {
- item.value.splice(i, 1);
- }
- this.$set(this.list[index], "value", item.value);
- } else {
- this.$set(this.list[index], "value", value);
- }
- this.verify();
- },
- verify() {
- let list = this.list.filter((v) => v.isMust);
- let Uncomplete = false;
- if (list.length)
- Uncomplete = list.some((v) => {
- let res = false;
- if (v.type == "customClass") {
- if (v.isMultipleChoice) {
- res = v.value.length == 0;
- } else {
- res = v.value == "";
- }
- } else if (v.type == "upload") {
- res = v.value.length == 0;
- } else if (v.type == "text") {
- res = v.value == "";
- if (v.errText) res = true;
- } else if (v.type == "route") {
- res = v.showValue.length == 0;
- } else {
- res = v.value == "";
- }
- return res;
- });
- if (!Uncomplete)
- Uncomplete = this.list.filter((v) => !v.isMust).some((v) => v.errText);
- this.$emit("isUncomplete", Uncomplete);
- },
- previewImg(item) {
- viewImage(item.url);
- },
- uploadCallback(attachmentids, index) {
- let item = this.list[index];
- this.$Http
- .basic({
- classname: "system.attachment.Attachment",
- method: "createFileLink",
- content: {
- ownertable: item.ownertable,
- ownerid: item.ownerid,
- usetype: item.usetype,
- attachmentids,
- },
- })
- .then((res) => {
- console.log("绑定附件", res);
- if (this.cutoff(res.msg)) return;
- res.data = formattedFiles(res.data);
- item.value.push(res.data[0]);
- //临时文件
- if (res.data[0].ownertable == "temporary")
- try {
- item.temporarys.push(attachmentids[0]);
- } catch (error) {
- item.temporarys = [attachmentids[0]];
- }
- this.$set(this.list[index], "value", item.value);
- this.verify();
- });
- },
- deleteFiles() {
- this.list.forEach((v) => {
- if (v.type == "upload") {
- let linksids = v.value
- .filter((v) => v.ownertable == "temporary")
- .map((v) => v.linksid);
- if (linksids.length)
- this.$Http
- .basic({
- classname: "system.attachment.Attachment",
- method: "deleteFileLink",
- content: {
- linksids,
- },
- })
- .then((res) => {
- console.log("处理删除附件", res);
- if (this.cutoff(res.msg)) return;
- });
- }
- });
- },
- onUploadLoading(e, index) {
- this.$set(this.list[index], "loading", e);
- this.$emit("onUploading", e);
- },
- groupChange(e, index) {
- this.$set(this.list[index], "loading", e);
- this.verify();
- },
- selectRegion({ detail }, index) {
- this.$set(this.list[index], "value", detail.value);
- this.verify();
- },
- deleteFile(flie, index) {
- let item = this.list[index];
- item.value = item.value.filter(
- (v) => v.attachmentid != flie.attachmentid
- );
- //临时文件
- if (flie.ownertable == "temporary") {
- item.temporarys = item.temporarys.filter((v) => v != flie.attachmentid);
- this.$Http
- .basic({
- classname: "system.attachment.Attachment",
- method: "deleteFileLink",
- content: {
- linksids: [flie.linksid],
- },
- })
- .then((res) => {
- console.log("处理删除附件", res);
- if (this.cutoff(res.msg)) return;
- });
- } else {
- try {
- item.linksids.push(flie.linksid);
- } catch (error) {
- item.linksids = [flie.linksid];
- }
- }
- this.$set(this.list[index], "value", item.value);
- this.verify();
- },
- submit() {
- return new Promise((resolve, reject) => {
- let res = {};
- this.list.forEach((v) => {
- if (v.type == "upload") {
- res.files = {
- temporarys: [],
- linksids: [],
- };
- try {
- res.files.temporarys = v.temporarys || [];
- } catch (error) {}
- try {
- res.files.linksids = v.linksids || [];
- } catch (error) {}
- } else if (v.type == "region") {
- if (v.value.length) {
- res.province = v.value[0];
- res.city = v.value[1];
- res.county = v.value[2];
- } else {
- res.province = "";
- res.city = "";
- res.county = "";
- }
- } else if (v.type == "switch") {
- if (v.isNum) {
- res[v.key] = v.value ? 1 : 0;
- } else {
- res[v.key] = v.value;
- }
- } else if (v.type == "route") {
- if (v.isRadio) {
- const routeValue =
- typeof v.value.length == "number"
- ? v.value.length
- ? v.value[0]
- : ""
- : v.value || {};
- if (v.keys) {
- v.keys.forEach((e) => {
- res[e] = routeValue ? routeValue[e] || "" : "";
- });
- } else {
- res[v.key] = {
- name: v.showValue[0] || "",
- value: routeValue,
- };
- }
- } else {
- res[v.key] = {
- name: v.showValue || [],
- value: v.value || [],
- };
- }
- } else {
- try {
- res[v.key] = v.value.trim();
- } catch (error) {
- res[v.key] = v.value;
- }
- }
- });
- resolve(res);
- });
- },
- },
- };
- </script>
- <style lang="scss">
- .requiredFieldOnly-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100vw;
- height: 45px;
- background: #f7f7f7;
- padding: 0 10px;
- box-sizing: border-box;
- .label {
- font-family: PingFang SC, PingFang SC;
- font-weight: bold;
- font-size: 15px;
- color: #333333;
- line-height: 22px;
- }
- .content {
- display: flex;
- align-items: center;
- font-family: PingFang SC, PingFang SC;
- font-size: 14px;
- color: #999999;
- }
- }
- .borBot {
- border-bottom: 1px #dddddd solid;
- }
- .custom-class-box {
- width: 100%;
- background: #fff;
- padding: 15px 0 15px 10px;
- box-sizing: border-box;
- .head {
- width: 355px;
- height: 20px;
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- .label {
- font-size: 14px;
- color: #333333;
- line-height: 20px;
- }
- .state {
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 12px;
- color: #999999;
- }
- }
- .options {
- display: flex;
- flex-wrap: wrap;
- .option {
- padding: 6px 10px;
- text-align: center;
- min-width: 81px;
- font-family: PingFang SC, PingFang SC;
- font-size: 14px;
- color: #333333;
- border-radius: 5px;
- background: #f2f2f2;
- margin-top: 10px;
- margin-right: 10px;
- box-sizing: border-box;
- }
- .active {
- background: #c30d23;
- color: #fff;
- }
- }
- .content {
- .file-box {
- position: relative;
- width: 355px;
- height: 240px;
- margin-top: 10px;
- .video,
- .image {
- width: 355px;
- height: 240px;
- border-radius: 5px;
- }
- .delete {
- position: absolute;
- width: 30px;
- top: 0;
- right: 0;
- z-index: 1;
- }
- }
- .upload-box {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 355px;
- height: 45px;
- background: #ffffff;
- border-radius: 5px;
- border: 1px dashed #c30d23;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #c30d23;
- margin-top: 10px;
- }
- }
- }
- .textarea-box {
- width: 100%;
- .textarea {
- width: 355px;
- height: 160px;
- padding: 15px 10px;
- box-sizing: border-box;
- margin: 0 auto;
- }
- }
- .textarea-box2 {
- width: 100%;
- display: flex;
- flex-direction: column;
- background: #ffffff;
- padding: 15px 0 15px 10px;
- .label {
- width: 100px;
- margin-right: 10px;
- line-height: 20px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #666666;
- flex-shrink: 0;
- .must {
- color: #e3041f;
- margin-right: 5px;
- }
- }
- .textarea {
- width: 355px;
- height: 160px;
- padding: 15px 10px;
- box-sizing: border-box;
- margin: 0 auto;
- }
- }
- .input-box {
- width: 100vw;
- background: #fff;
- box-sizing: border-box;
- padding-left: 10px;
- .box {
- display: flex;
- width: 100%;
- min-height: 54.4px;
- padding: 15px 0;
- box-sizing: border-box;
- align-items: center;
- }
- .label {
- width: 100px;
- margin-right: 10px;
- line-height: 20px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #666666;
- flex-shrink: 0;
- .must {
- color: #e3041f;
- margin-right: 5px;
- }
- }
- .content-box {
- padding-right: 10px;
- .content {
- flex: 1;
- display: flex;
- align-items: center;
- box-sizing: border-box;
- .icon {
- padding: 5px;
- }
- }
- .err-text {
- font-size: 12px;
- color: #e3041f;
- margin-bottom: -12px;
- .icon {
- margin-right: 2px;
- }
- }
- }
- }
- .region {
- width: 100vw;
- background: #fff;
- box-sizing: border-box;
- padding: 15px 0 0 10px;
- .box {
- display: flex;
- padding-bottom: 15px;
- padding-right: 10px;
- box-sizing: border-box;
- .label {
- width: 100px;
- margin-right: 10px;
- line-height: 20px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #666666;
- flex-shrink: 0;
- .must {
- color: #e3041f;
- margin-right: 5px;
- }
- }
- .content-box {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 20px;
- line-height: 20px;
- .placeholder {
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #bbbbbb;
- }
- }
- }
- }
- .tag-box {
- .label {
- width: 100px;
- margin-right: 10px;
- line-height: 20px;
- font-family: Source Han Sans SC, Source Han Sans SC;
- font-size: 14px;
- color: #666666;
- flex-shrink: 0;
- .must {
- color: #e3041f;
- margin-right: 5px;
- }
- }
- .tag-list {
- display: flex;
- align-content: center;
- align-items: center;
- flex-wrap: wrap;
- font-family: PingFang SC, PingFang SC;
- margin-top: 10px;
- .err-text {
- font-size: 12px;
- color: #e3041f;
- margin-bottom: -12px;
- .icon {
- margin-right: 2px;
- }
- }
- .tag {
- padding: 6px 10px;
- background: #f2f2f2;
- border-radius: 5px 5px 5px 5px;
- margin-right: 10px;
- margin-bottom: 10px;
- font-weight: 400;
- font-size: 14px;
- color: #333333;
- display: flex;
- align-items: center;
- align-content: center;
- text-align: center;
- &:last-child {
- margin-right: 0 !important;
- }
- .del {
- margin-left: 10px;
- padding: 2px;
- }
- }
- .add-tag {
- border-radius: 5px 5px 5px 5px;
- border: 1px dashed #c30d23;
- padding: 6px 20px;
- color: #c30d23;
- font-weight: 400;
- margin-bottom: 10px;
- font-size: 14px;
- }
- }
- }
- </style>
|