index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <view>
  3. <form>
  4. <view class='personal-data' :style="viewColor">
  5. <view v-if="activityData" class='list'>
  6. <view class='wrapper'>
  7. <view class="page-title">
  8. <image :src="`${domain}/static/images/page_title.png`" mode="widthFix"></image>
  9. <view class="activity-name">{{activityData.name}}</view>
  10. </view>
  11. <block v-if="formData.length">
  12. <view class='item acea-row row-between-wrapper' :class="{on:(item.name=='radios' || item.name=='checkboxs'),on2:item.name == 'dateranges',on3:item.name == 'citys'}" v-for="(item,index) in formData" :key="index">
  13. <view class="name">
  14. {{ item.titleConfig.value }}
  15. <span class="asterisk" v-if="item.titleShow.val">*</span>
  16. </view>
  17. <!-- radio -->
  18. <view v-if="item.name=='radios'" class="discount">
  19. <radio-group disabled class="acea-row row-middle row-right item-select" :class="disabled == 1 ? 'disabled' : ''">
  20. <label class="radio" v-for="(j,jindex) in item.wordsConfig.list" :key="jindex">
  21. <view class="acea-row row-middle">
  22. <!-- #ifndef MP -->
  23. <radio :value="jindex.toString()" :checked='j.show'/>
  24. <!-- #endif -->
  25. <!-- #ifdef MP -->
  26. <radio :value="jindex" :checked='j.show'/>
  27. <!-- #endif -->
  28. <view>{{j.val}}</view>
  29. </view>
  30. </label>
  31. </radio-group>
  32. </view>
  33. <!-- checkbox -->
  34. <view v-if="item.name=='checkboxs'" class="discount">
  35. <checkbox-group class="acea-row row-middle row-right item-select" disabled>
  36. <label class="radio" v-for="(j,jindex) in item.wordsConfig.list" :key="jindex">
  37. <view class="acea-row row-middle">
  38. <!-- #ifndef MP -->
  39. <checkbox :value="jindex.toString()" :checked="j.show" style="transform:scale(0.9)" />
  40. <!-- #endif -->
  41. <!-- #ifdef MP -->
  42. <checkbox :value="jindex" :checked="j.show" style="transform:scale(0.9)" />
  43. <!-- #endif -->
  44. <view>{{j.val}}</view>
  45. </view>
  46. </label>
  47. </checkbox-group>
  48. </view>
  49. <!-- text -->
  50. <view v-if="item.name=='texts' && item.valConfig.tabVal == 0" class="discount">
  51. <input type="text" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" disabled/>
  52. </view>
  53. <!-- number -->
  54. <view v-if="item.name=='texts' && item.valConfig.tabVal == 4" class="discount">
  55. <input type="number" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" disabled/>
  56. </view>
  57. <!-- email -->
  58. <view v-if="item.name=='texts' && item.valConfig.tabVal == 3" class="discount">
  59. <input type="text" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" disabled/>
  60. </view>
  61. <!-- data -->
  62. <view v-if="item.name=='dates'" class="discount" :class="item.value.length ? '' : 'placeholder'">
  63. <picker mode="date" :value="item.value" disabled>
  64. <view class="acea-row row-between-wrapper">
  65. <view v-if="item.value == ''">{{item.tipConfig.value}}</view>
  66. <view v-else>{{item.value}}</view>
  67. <text class='iconfont icon-jiantou'></text>
  68. </view>
  69. </picker>
  70. </view>
  71. <!-- dateranges -->
  72. <view v-if="item.name=='dateranges'" class="discount" :class="item.value.length ? '' : 'placeholder'">
  73. <uni-datetime-picker v-model="item.value" type="daterange" disabled>
  74. {{item.value.length?item.value[0]+' - '+item.value[1]:item.tipConfig.value}}
  75. <text class='iconfont icon-jiantou'></text>
  76. </uni-datetime-picker>
  77. </view>
  78. <!-- time -->
  79. <view v-if="item.name=='times'" class="discount" :class="item.value.length ? '' : 'placeholder'">
  80. <picker mode="time" :value="item.value"
  81. :placeholder="item.tipConfig.value" disabled>
  82. <view class="acea-row row-between-wrapper">
  83. <view v-if="item.value == ''">{{item.tipConfig.value}}</view>
  84. <view v-else>{{item.value}}</view>
  85. <text class='iconfont icon-jiantou'></text>
  86. </view>
  87. </picker>
  88. </view>
  89. <!-- timeranges -->
  90. <view v-if="item.name=='timeranges'" class="discount acea-row row-between-wrapper" :class="item.value.length ? '' : 'placeholder'">
  91. <view v-if="item.value">{{item.value}}</view>
  92. <view v-else>{{item.tipConfig.value}}</view>
  93. <text class='iconfont icon-jiantou'></text>
  94. </view>
  95. <!-- select -->
  96. <view v-if="item.name=='selects'" class="discount">
  97. <picker :value="item.value" :range="item.wordsConfig.list" range-key="val" >
  98. <view class="acea-row row-between-wrapper">
  99. <view v-if="item.value">{{item.value}}</view>
  100. <view v-else class="placeholder">请选择</view>
  101. <text class='iconfont icon-jiantou'></text>
  102. </view>
  103. </picker>
  104. </view>
  105. <!-- city -->
  106. <view v-if="item.name=='citys'" class="discount" disabled>
  107. <view class="acea-row row-middle row-right">
  108. <view class="city" v-if="item.value == ''">{{item.tipConfig.value}}</view>
  109. <view class="city item-select" v-else>{{item.value}}</view>
  110. <text class='iconfont icon-jiantou'></text>
  111. </view>
  112. </view>
  113. <!-- id -->
  114. <view v-if="item.name=='texts' && item.valConfig.tabVal == 2" class="discount">
  115. <input type="idcard" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" disabled />
  116. </view>
  117. <!-- phone -->
  118. <view v-if="item.name=='texts' && item.valConfig.tabVal == 1" class="discount">
  119. <input type="number" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" disabled />
  120. </view>
  121. <!-- img -->
  122. <view v-if="item.name=='uploadPicture'" class="confirmImg" style="padding-bottom: 0;">
  123. <view class='upload acea-row row-middle'>
  124. <view class='pictrue' v-for="(items,indexs) in item.value" :key="indexs">
  125. <image :src='items' mode="aspectFill"></image>
  126. <view class="close acea-row row-center-wrapper">
  127. <view class="iconfont icon-guanbi5"></view>
  128. </view>
  129. </view>
  130. <view class='pictrue acea-row row-center-wrapper row-column'
  131. v-if="item.value.length < item.numConfig.val">
  132. <text class='iconfont icon-icon25201'></text>
  133. <view>上传图片</view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. </block>
  139. </view>
  140. </view>
  141. </view>
  142. </form>
  143. </view>
  144. </template>
  145. <script>
  146. // +----------------------------------------------------------------------
  147. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  148. // +----------------------------------------------------------------------
  149. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  150. // +----------------------------------------------------------------------
  151. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  152. // +----------------------------------------------------------------------
  153. // | Author: CRMEB Team <admin@crmeb.com>
  154. // +----------------------------------------------------------------------
  155. import { systemFormData } from '@/api/user.js';
  156. import { mapGetters } from "vuex";
  157. import { HTTP_REQUEST_URL } from '@/config/app';
  158. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  159. export default {
  160. data() {
  161. return {
  162. domain: HTTP_REQUEST_URL,
  163. activityData: {},
  164. formData: {},
  165. form_id: "",
  166. disabled: false,
  167. };
  168. },
  169. components: {},
  170. computed:{
  171. ...mapGetters(['viewColor','keyColor']),
  172. },
  173. watch: {
  174. },
  175. onLoad(option) {
  176. this.form_id = option.form_id
  177. },
  178. onShow() {
  179. this.formDetail();
  180. },
  181. methods: {
  182. /**
  183. * 获取表单数据详情
  184. */
  185. formDetail: function() {
  186. let that = this;
  187. uni.showLoading()
  188. systemFormData(that.form_id).then(res => {
  189. uni.hideLoading()
  190. let data = res.data;
  191. that.$set(that, 'activityData', data);
  192. let formData = that.objToArr(data.value)
  193. that.filterData(formData)
  194. }).catch(err => {
  195. uni.hideLoading();
  196. })
  197. },
  198. filterData(formData){
  199. let that = this;
  200. formData.forEach((item, index, arr)=>{
  201. that.$set(item, 'value', "");
  202. if(item.name == 'texts'){
  203. if(item.defaultValConfig.value){
  204. item.value = item.defaultValConfig.value
  205. }else{
  206. item.value = ''
  207. }
  208. }else if(item.name == 'radios'){
  209. item.value = item.wordsConfig.list[0].val
  210. }else if(item.name == 'uploadPicture'){
  211. item.value = [];
  212. }else if(item.name == 'dateranges'){
  213. if(item.valConfig.tabVal==0){
  214. if(item.valConfig.tabData==0){
  215. let obj = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  216. item.value = [obj,obj]
  217. }else{
  218. let data1 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[0]).getTime()))).format('YYYY-MM-DD');
  219. let data2 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[1]).getTime()))).format('YYYY-MM-DD');
  220. item.value = [data1,data2];
  221. }
  222. }else{
  223. item.value = [];
  224. }
  225. }else{
  226. if(['times','dates','timeranges'].indexOf(item.name) != -1){
  227. if(item.valConfig.tabVal==0){
  228. if(item.valConfig.tabData==0){
  229. if(item.name == 'times'){
  230. item.value = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  231. }else if(item.name == 'dates'){
  232. item.value = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  233. }else{
  234. let current = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  235. item.value = current+' - '+current;
  236. }
  237. }else{
  238. if(item.name == 'times' || item.name == 'dates'){
  239. item.value = item.valConfig.specifyDate;
  240. }else{
  241. item.value = item.valConfig.specifyDate[0]+' - '+item.valConfig.specifyDate[1];
  242. }
  243. }
  244. }else{
  245. item.value = '';
  246. }
  247. }else if(item.name == 'city'){
  248. item.value = '';
  249. }else{
  250. item.value = '';
  251. }
  252. }
  253. })
  254. function sortNumber(a, b) {
  255. return a.timestamp - b.timestamp;
  256. }
  257. formData.sort(sortNumber);
  258. that.$set(that, 'formData', formData);
  259. },
  260. // 对象转数组
  261. objToArr(data) {
  262. let obj = Object.keys(data);
  263. let m = obj.map(key => data[key]);
  264. return m;
  265. },
  266. }
  267. }
  268. </script>
  269. <style scoped lang="scss">
  270. /deep/radio .wx-radio-input.wx-radio-input-checked,
  271. /deep/uni-radio .uni-radio-input.uni-radio-input-checked {
  272. border: 1px solid var(--view-theme)!important;
  273. background-color: var(--view-theme)!important;
  274. }
  275. /deep/checkbox .uni-checkbox-input.uni-checkbox-input-checked,
  276. /deep/checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  277. border: 1px solid var(--view-theme)!important;
  278. background-color: var(--view-theme)!important;
  279. color: #fff!important;
  280. }
  281. .personal-data{
  282. pointer-events: none;
  283. padding-bottom: 150rpx;
  284. padding-bottom: calc(150rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  285. padding-bottom: calc(150rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  286. min-height: 100vh;
  287. }
  288. .personal-data .wrapper {
  289. background-color: #fff;
  290. border-radius: 16rpx;
  291. margin: 20rpx 20rpx 0;
  292. +.wrapper{
  293. margin-top: 20rpx;
  294. }
  295. }
  296. .page-title{
  297. image{
  298. width: 100%;
  299. }
  300. .activity-name{
  301. text-align: center;
  302. color: #333333;
  303. font-weight: bold;
  304. font-size: 30rpx;
  305. padding: 30rpx 0 20rpx;
  306. border-bottom: 1px solid #eee;
  307. }
  308. }
  309. .personal-data .wrapper .text-info{
  310. padding: 30rpx;
  311. >view{
  312. +view{
  313. margin-top: 30rpx;
  314. }
  315. }
  316. .activity-name{
  317. justify-content: space-between;
  318. .title{
  319. width: 580rpx;
  320. color: #282828;
  321. font-size: 32rpx;
  322. font-weight: bold;
  323. }
  324. }
  325. .share{
  326. text-align: center;
  327. color: #666666;
  328. font-size: 18rpx;
  329. cursor: pointer;
  330. .icon-fenxiang4{
  331. display: block;
  332. color: #282828;
  333. font-size: 34rpx;
  334. margin: 0 0 3rpx 0;
  335. }
  336. }
  337. .iconfont{
  338. margin-right: 17rpx;
  339. }
  340. .activity-item{
  341. display: flex;
  342. align-items: center;
  343. }
  344. }
  345. .personal-data .wrapper .text-info .iconfont{
  346. color: #666666;
  347. }
  348. .personal-data .wrapper .text-info .info{
  349. color: #282828;
  350. &.info-theme{
  351. color: var(--view-theme);
  352. }
  353. }
  354. .personal-data .wrapper .text-info .acea-info{
  355. width: 600rpx;
  356. text-align: justify;
  357. word-break: break-all;
  358. }
  359. .personal-data .wrapper .item .name {
  360. position: relative;
  361. width: 190rpx;
  362. }
  363. .personal-data .wrapper .item {
  364. padding: 27rpx 30rpx;
  365. font-size: 28rpx;
  366. color: #282828;
  367. position: relative;
  368. &::after{
  369. content: "";
  370. width: 670rpx;
  371. border-bottom: 1px solid #eee;
  372. position: absolute;
  373. bottom: 0;
  374. }
  375. }
  376. .personal-data .wrapper .item.on{
  377. padding: 16rpx 30rpx;
  378. align-items: baseline;
  379. }
  380. .personal-data .wrapper .item.on3{
  381. align-items: baseline;
  382. }
  383. .personal-data .wrapper .item .discount {
  384. color: #282828;
  385. font-size: 30rpx;
  386. }
  387. .personal-data .wrapper .item .item-select{
  388. color: #282828;
  389. }
  390. .personal-data .wrapper .item.on .discount,
  391. .personal-data .wrapper .item.on3 .discount{
  392. width: 460rpx;
  393. text-align: right;
  394. }
  395. .personal-data .wrapper .item.on3 .discount .city{
  396. width: 400rpx;
  397. color: #ccc;
  398. &.item-select{
  399. color: #282828;
  400. }
  401. }
  402. .personal-data .wrapper .item .discount input {
  403. text-align: right;
  404. font-size: 30rpx;
  405. width: 450rpx;
  406. color: #282828;
  407. }
  408. .personal-data .wrapper .item .discount .iconfont {
  409. color: #BBBBBB;
  410. font-size: 28rpx;
  411. margin-left: 15rpx;
  412. }
  413. .personal-data .wrapper .item .discount .num {
  414. font-size: 32rpx;
  415. margin-right: 20rpx;
  416. }
  417. .personal-data .wrapper .item .discount .radio{
  418. margin: 0 22rpx 0 22rpx;
  419. padding: 10rpx 0;
  420. }
  421. .personal-data .wrapper .item .discount .radio /deep/uni-checkbox .uni-checkbox-input{
  422. border-radius: 0;
  423. }
  424. .personal-data .wrapper .item textarea {
  425. background-color: #f9f9f9;
  426. width: 650rpx;
  427. height: 140rpx;
  428. border-radius: 3rpx;
  429. margin-top: 30rpx;
  430. padding: 25rpx 28rpx;
  431. box-sizing: border-box;
  432. }
  433. .personal-data .wrapper .item .placeholder {
  434. color: #ccc;
  435. font-size: 30rpx;
  436. }
  437. .asterisk{
  438. color: red;
  439. }
  440. </style>