hookehuyr

✨ feat(创建的活动): 时间过滤器控件调整

...@@ -97,7 +97,11 @@ VantComponent({ ...@@ -97,7 +97,11 @@ VantComponent({
97 return this.picker; 97 return this.picker;
98 }, 98 },
99 updateColumns() { 99 updateColumns() {
100 - const { formatter = defaultFormatter } = this.data; 100 + // const { formatter = defaultFormatter } = this.data;
101 + let { formatter } = this.data;
102 + if (defaultFormatter) {
103 + formatter = defaultFormatter;
104 + }
101 const results = this.getOriginColumns().map((column) => ({ 105 const results = this.getOriginColumns().map((column) => ({
102 values: column.values.map((value) => formatter(column.type, value)), 106 values: column.values.map((value) => formatter(column.type, value)),
103 })); 107 }));
......
...@@ -54,3 +54,30 @@ ...@@ -54,3 +54,30 @@
54 /* 调整下划线的起始位置 左侧是0 上边是1.15em */ 54 /* 调整下划线的起始位置 左侧是0 上边是1.15em */
55 background-position: 0 1.1rem; 55 background-position: 0 1.1rem;
56 } 56 }
57 +
58 +.time-wrapper {
59 + .border {
60 + overflow: auto;
61 + border-bottom: 1px solid #F2F2F2;
62 + .fix {
63 + float: left;
64 + padding-top: 0.6rem;
65 + }
66 + }
67 +}
68 +.time-button-wrapper {
69 + padding: 1rem 0;
70 + margin: 1rem;
71 + text-align: center;
72 + .button {
73 + padding: 0.5rem 1rem; border-radius: 1rem;
74 + }
75 + .cancel {
76 + color: #199A74;
77 + border: 1px solid #199A74;
78 + }
79 + .confirm {
80 + color: #FFFFFF;
81 + background-color: #199A74;
82 + }
83 +}
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-01 17:50:59 4 + * @LastEditTime: 2022-11-03 15:35:34
5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue 5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue
6 * @Description: 创建的活动页面 6 * @Description: 创建的活动页面
7 --> 7 -->
...@@ -57,13 +57,13 @@ ...@@ -57,13 +57,13 @@
57 </view> 57 </view>
58 </view> 58 </view>
59 <view style="padding: 0 1rem;"> 59 <view style="padding: 0 1rem;">
60 - <view id="navbar-page" style="background-color: white; border-radius: 0.65rem; padding: 1rem;overflow: auto; margin-bottom: 1px;"> 60 + <view id="navbar-page" style="background-color: white; border-radius: 0.65rem; padding: 0.5rem 1rem;overflow: auto; margin-bottom: 1px;">
61 - <view @tap="show_status_popup=true" style="float: left; color: #666666; font-size: 0.9rem; border: 1px solid #DBDBDB; border-radius: 1rem; padding: 0.3rem 1rem 0.3rem 1rem;"> 61 + <view @tap="show_time_popup=true" style="float: left; color: #666666; font-size: 0.8rem; border: 1px solid #DBDBDB; border-radius: 1rem; padding: 0.3rem 1rem 0.3rem 1rem; margin-top: 0.85rem;">
62 - &nbsp;{{ status_type === '' ? '全部' : status_type }}&nbsp;&nbsp; 62 + &nbsp;{{ filter_status_time === '' ? '全部' : filter_status_time }}&nbsp;&nbsp;
63 <van-icon :name="icon_sel2" size="0.8rem" color="" style="vertical-align: middle;" /> 63 <van-icon :name="icon_sel2" size="0.8rem" color="" style="vertical-align: middle;" />
64 </view> 64 </view>
65 <view style="float: right; margin-top: 0.25rem;"> 65 <view style="float: right; margin-top: 0.25rem;">
66 - <text style="font-size: 1rem; color: #999999; vertical-align: super;">仅看进行中</text>&nbsp; 66 + <view style="font-size: 0.85rem; color: #999999; vertical-align: super;">仅看进行中</view>&nbsp;
67 <van-switch :checked="check_status" @change="onChange" size="22px" active-color="#199A74" /> 67 <van-switch :checked="check_status" @change="onChange" size="22px" active-color="#199A74" />
68 </view> 68 </view>
69 </view> 69 </view>
...@@ -88,8 +88,75 @@ ...@@ -88,8 +88,75 @@
88 :default-index="defaultIndex" 88 :default-index="defaultIndex"
89 toolbar-class="picker-toolbar" @confirm="onStatusTypeConfirm" @cancel="onStatusTypeCancel"/> 89 toolbar-class="picker-toolbar" @confirm="onStatusTypeConfirm" @cancel="onStatusTypeCancel"/>
90 </van-popup> 90 </van-popup>
91 - <van-toast id="van-toast" /> 91 + <!-- 选择时间控件弹出框 -->
92 + <van-popup :show="show_time_popup" position="bottom" custom-style="height: 30%;" :lock-scroll="true">
93 + <view class="time-wrapper">
94 + <view class="form-item border" style="padding: 0.25rem 0.25rem 0.25rem 1rem;">
95 + <van-row>
96 + <van-col span="10" offset="0">
97 + <view class="form-item-title fix">
98 + 活动开始时间
99 + <!-- <van-icon name="question-o" size="1rem" color="" class="vip-icon" /> -->
100 + </view>
101 + </van-col>
102 + <van-col span="14" offset="0">
103 + <!-- 报名开始时间 -->
104 + <van-field @tap="showBeginTime" :value="filter_begin_time" label-class="label-class-super" input-class="input-class" label=""
105 + :right-icon="icon_sel" input-align="right" placeholder="请选择时间" placeholder-style="color: #999;" customStyle=""
106 + maxlength="" type="" :border="false" :required="false" :disabled="true" />
107 + </van-col>
108 + </van-row>
109 + </view>
110 + <view class="form-item border" style="padding: 0.25rem 0.25rem 0.25rem 1rem;">
111 + <van-row>
112 + <van-col span="10" offset="0">
113 + <view class="form-item-title fix">
114 + 活动结束时间
115 + <!-- <van-icon name="question-o" size="1rem" color="" class="vip-icon" /> -->
116 + </view>
117 + </van-col>
118 + <van-col span="14" offset="0">
119 + <!-- 活动结束时间 -->
120 + <van-field @tap="showEndTime" :value="filter_end_time" label-class="label-class-super" input-class="input-class" label=""
121 + :right-icon="icon_sel" input-align="right" placeholder="请选择时间" placeholder-style="color: #999;" customStyle=""
122 + maxlength="" type="" :border="false" :required="false" :disabled="true" />
123 + </van-col>
124 + </van-row>
125 + </view>
126 + </view>
127 + <van-row>
128 + <van-col span="12" offset="0">
129 + <view class="time-button-wrapper">
130 + <view class="button cancel" @tap="closeTime">重置</view>
131 + </view>
132 + </van-col>
133 + <van-col span="12" offset="0">
134 + <view class="time-button-wrapper">
135 + <view class="button confirm" @tap="confirmTime">确定</view>
136 + </view>
137 + </van-col>
138 + </van-row>
139 + </van-popup>
140 + <van-popup :show="show_begin_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
141 + <van-datetime-picker
142 + type="date"
143 + :value="currentBeginDate"
144 + :formatter="formatter"
145 + @confirm="onBeginConfirm"
146 + @cancel="onBeginCancel"
147 + />
148 + </van-popup>
149 + <van-popup :show="show_end_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
150 + <van-datetime-picker
151 + type="date"
152 + :value="currentEndDate"
153 + :formatter="formatter"
154 + @confirm="onEndConfirm"
155 + @cancel="onEndCancel"
156 + />
157 + </van-popup>
92 158
159 + <van-toast id="van-toast" />
93 <van-dialog title="温馨提示" :show="copy_show" :show-cancel-button="true" message="是否确认复制活动?" confirm-button-color="#199A74" @confirm="onCopyConfirm" @cancel="onCopyCancel"></van-dialog> 160 <van-dialog title="温馨提示" :show="copy_show" :show-cancel-button="true" message="是否确认复制活动?" confirm-button-color="#199A74" @confirm="onCopyConfirm" @cancel="onCopyCancel"></van-dialog>
94 <van-dialog title="温馨提示" :show="edit_show" :show-cancel-button="true" message="是否确认编辑活动?" confirm-button-color="#199A74" @confirm="onEditConfirm" @cancel="onEditCancel"></van-dialog> 161 <van-dialog title="温馨提示" :show="edit_show" :show-cancel-button="true" message="是否确认编辑活动?" confirm-button-color="#199A74" @confirm="onEditConfirm" @cancel="onEditCancel"></van-dialog>
95 <van-dialog title="温馨提示" :show="finish_show" :show-cancel-button="true" message="是否确认结束活动?" confirm-button-color="#199A74" @confirm="onFinishConfirm" @cancel="onFinishCancel"></van-dialog> 162 <van-dialog title="温馨提示" :show="finish_show" :show-cancel-button="true" message="是否确认结束活动?" confirm-button-color="#199A74" @confirm="onFinishConfirm" @cancel="onFinishCancel"></van-dialog>
...@@ -122,6 +189,7 @@ import { hostListAPI } from '@/api/Host/index' ...@@ -122,6 +189,7 @@ import { hostListAPI } from '@/api/Host/index'
122 import { addListAPI, endActivityAPI, delActivityAPI, copyActivityAPI } from '@/api/Activity/index'; 189 import { addListAPI, endActivityAPI, delActivityAPI, copyActivityAPI } from '@/api/Activity/index';
123 import { hostStore } from '@/stores/host' 190 import { hostStore } from '@/stores/host'
124 import { formatDate } from '@/utils/tools.js' 191 import { formatDate } from '@/utils/tools.js'
192 +import icon_sel from '@/images/icon/sel@2x.png'
125 193
126 export default { 194 export default {
127 name: "myCreateActivityPage", 195 name: "myCreateActivityPage",
...@@ -217,6 +285,13 @@ export default { ...@@ -217,6 +285,13 @@ export default {
217 copy_show: false, 285 copy_show: false,
218 finish_show: false, 286 finish_show: false,
219 delete_show: false, 287 delete_show: false,
288 + show_time_popup: false,
289 + filter_begin_time: '',
290 + filter_end_time: '',
291 + currentBeginDate: new Date().getTime(),
292 + currentEndDate: new Date().getTime(),
293 + minDate: new Date().getTime(),
294 + filter_status_time: ''
220 }; 295 };
221 }, 296 },
222 methods: { 297 methods: {
...@@ -408,7 +483,78 @@ export default { ...@@ -408,7 +483,78 @@ export default {
408 onCopyCancel () { 483 onCopyCancel () {
409 this.activity_id = ''; 484 this.activity_id = '';
410 this.copy_show = false; 485 this.copy_show = false;
486 + },
487 + closeTime () { // 重置查询时间
488 + // this.show_time_popup = false;
489 + this.filter_begin_time = '';
490 + this.filter_end_time = '';
491 + this.currentBeginDate = new Date().getTime();
492 + this.currentEndDate = new Date().getTime();
493 + },
494 + confirmTime () { // 确认时间区间
495 + if (+new Date(this.filter_begin_time) > +new Date(this.filter_end_time)) {
496 + Toast('开始时间不能大于结束时间')
497 + } else {
498 + this.show_time_popup = false;
499 + if (this.filter_begin_time && this.filter_end_time) {
500 + this.filter_status_time = `${this.filter_begin_time} ~ ${this.filter_end_time}`;
501 + } else {
502 + this.filter_status_time = '';
503 + }
504 + this.time_begin = this.filter_begin_time;
505 + this.time_end = this.filter_end_time;
506 + // 查询数据
507 + this.activity_list = [];
508 + this.flag = true;
509 + this.page = 0;
510 + this.getList();
511 + }
512 + },
513 + formatter (type, value) {
514 + if (type === 'year') {
515 + return `${value}年`;
411 } 516 }
517 + if (type === 'month') {
518 + return `${value}月`;
519 + }
520 + return value;
521 + },
522 + // onBeginInput(event) {
523 + // this.currentBeginDate = event.detail;
524 + // this.filter_begin_time = moment(event.detail).format('YYYY-MM-DD')
525 + // },
526 + // onEndInput(event) {
527 + // this.currentEndDate = event.detail;
528 + // this.filter_end_time = moment(event.detail).format('YYYY-MM-DD')
529 + // },
530 + showBeginTime () {
531 + this.show_time_popup = false;
532 + this.show_begin_time = true;
533 + },
534 + showEndTime () {
535 + this.show_time_popup = false;
536 + this.show_end_time = true;
537 + },
538 + onBeginConfirm ({ detail }) {
539 + this.show_time_popup = true;
540 + this.show_begin_time = false;
541 + this.currentBeginDate = detail;
542 + this.filter_begin_time = moment(detail).format('YYYY-MM-DD')
543 + },
544 + onBeginCancel () {
545 + this.show_time_popup = true;
546 + this.show_begin_time = false;
547 + },
548 + onEndConfirm({ detail }) {
549 + this.show_time_popup = true;
550 + this.show_end_time = false;
551 + this.currentEndDate = detail;
552 + this.filter_end_time = moment(detail).format('YYYY-MM-DD')
553 + },
554 + onEndCancel () {
555 + this.show_time_popup = true;
556 + this.show_end_time = false;
557 + },
412 }, 558 },
413 }; 559 };
414 </script> 560 </script>
......
1 /* 1 /*
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-21 10:05:55 4 + * @LastEditTime: 2022-11-03 14:15:39
5 * @FilePath: /swx/vantComponentConf.js 5 * @FilePath: /swx/vantComponentConf.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -37,6 +37,7 @@ const vantComponentNames = [ ...@@ -37,6 +37,7 @@ const vantComponentNames = [
37 "radio", 37 "radio",
38 "radio-group", 38 "radio-group",
39 "tag", 39 "tag",
40 + "datetime-picker",
40 ]; 41 ];
41 42
42 module.exports = vantComponentNames; 43 module.exports = vantComponentNames;
......