hookehuyr

修复新增活动时日期控件电脑端微信选择不显示问题

1 <!-- 1 <!--
2 * @Date: 2022-09-21 16:04:10 2 * @Date: 2022-09-21 16:04:10
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-15 16:57:27 4 + * @LastEditTime: 2022-12-08 10:21:46
5 * @FilePath: /swx/src/pages/createActivity/index.vue 5 * @FilePath: /swx/src/pages/createActivity/index.vue
6 * @Description: 创建活动页面 6 * @Description: 创建活动页面
7 --> 7 -->
...@@ -63,11 +63,14 @@ ...@@ -63,11 +63,14 @@
63 </van-col> 63 </van-col>
64 <van-col span="14" offset="0"> 64 <van-col span="14" offset="0">
65 <!-- 活动时间 --> 65 <!-- 活动时间 -->
66 - <timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultActivityTime" @result="onActivityTime"> 66 + <!-- <timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultActivityTime" @result="onActivityTime">
67 <van-field :value="activity_time" label-class="label-class-super" input-class="input-class" label="" 67 <van-field :value="activity_time" label-class="label-class-super" input-class="input-class" label=""
68 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" 68 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
69 maxlength="" type="" :border="false" :required="false" :disabled="true" /> 69 maxlength="" type="" :border="false" :required="false" :disabled="true" />
70 - </timePickerData> 70 + </timePickerData> -->
71 + <van-field @tap="show_activity_time = true" :value="activity_time" label-class="label-class-super" input-class="input-class" label=""
72 + :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
73 + maxlength="" type="" :border="false" :required="false" :disabled="true" />
71 </van-col> 74 </van-col>
72 </van-row> 75 </van-row>
73 </view> 76 </view>
...@@ -83,21 +86,27 @@ ...@@ -83,21 +86,27 @@
83 </van-col> 86 </van-col>
84 <van-col span="14" offset="0"> 87 <van-col span="14" offset="0">
85 <!-- 报名开始时间 --> 88 <!-- 报名开始时间 -->
86 - <timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultStartTime" @result="onBeginTime"> 89 + <!-- <timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultStartTime" @result="onBeginTime">
87 <van-field :value="reg_begin_time" label-class="label-class-super" input-class="input-class" label="" 90 <van-field :value="reg_begin_time" label-class="label-class-super" input-class="input-class" label=""
88 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" 91 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
89 maxlength="" type="" :border="false" :required="false" :disabled="true" /> 92 maxlength="" type="" :border="false" :required="false" :disabled="true" />
90 - </timePickerData> 93 + </timePickerData> -->
94 + <van-field @tap="show_reg_begin_time = true" :value="reg_begin_time" label-class="label-class-super" input-class="input-class" label=""
95 + :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
96 + maxlength="" type="" :border="false" :required="false" :disabled="true" />
91 </van-col> 97 </van-col>
92 </van-row> 98 </van-row>
93 </view> 99 </view>
94 </view> 100 </view>
95 <!-- 报名截止时间 --> 101 <!-- 报名截止时间 -->
96 - <timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultEndTime" @result="onEndTime"> 102 + <!-- <timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultEndTime" @result="onEndTime">
97 <van-field :value="reg_end_time" label-class="label-class-super" input-class="input-class" label="报名截止时间" 103 <van-field :value="reg_end_time" label-class="label-class-super" input-class="input-class" label="报名截止时间"
98 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" 104 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
99 maxlength="" type="" :border="true" :required="false" :disabled="true" /> 105 maxlength="" type="" :border="true" :required="false" :disabled="true" />
100 - </timePickerData> 106 + </timePickerData> -->
107 + <van-field @tap="show_reg_end_time = true" :value="reg_end_time" label-class="label-class-super" input-class="input-class" label="报名截止时间"
108 + :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
109 + maxlength="" type="" :border="true" :required="false" :disabled="true" />
101 <!-- 人数限制 --> 110 <!-- 人数限制 -->
102 <van-field :value="reg_max" label-class="label-class-super" input-class="input-class" label="人数限制" 111 <van-field :value="reg_max" label-class="label-class-super" input-class="input-class" label="人数限制"
103 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" 112 :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
...@@ -284,6 +293,36 @@ ...@@ -284,6 +293,36 @@
284 toolbar-class="picker-toolbar" @confirm="onPublicTypeConfirm" @cancel="onPublicTypeCancel" 293 toolbar-class="picker-toolbar" @confirm="onPublicTypeConfirm" @cancel="onPublicTypeCancel"
285 @change="onPublicTypeChange" /> 294 @change="onPublicTypeChange" />
286 </van-popup> 295 </van-popup>
296 + <!-- 活动时间弹出框 -->
297 + <van-popup :show="show_activity_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
298 + <van-datetime-picker
299 + title="活动时间"
300 + type="datetime"
301 + :value="currentActivityDate"
302 + @confirm="onActivityConfirm"
303 + @cancel="onActivityCancel"
304 + />
305 + </van-popup>
306 + <!-- 报名开始时间弹出框 -->
307 + <van-popup :show="show_reg_begin_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
308 + <van-datetime-picker
309 + title="报名开始时间"
310 + type="datetime"
311 + :value="currentBeginDate"
312 + @confirm="onBeginConfirm"
313 + @cancel="onBeginCancel"
314 + />
315 + </van-popup>
316 + <!-- 报名截止时间弹出框 -->
317 + <van-popup :show="show_reg_end_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
318 + <van-datetime-picker
319 + title="报名截止时间"
320 + type="datetime"
321 + :value="currentEndDate"
322 + @confirm="onEndConfirm"
323 + @cancel="onEndCancel"
324 + />
325 + </van-popup>
287 326
288 <van-toast id="van-toast" /> 327 <van-toast id="van-toast" />
289 <van-dialog title="温馨提示" :show="create_show" :show-cancel-button="true" message="是否确认提交?" confirm-button-color="#199A74" @confirm="onCreateConfirm" @cancel="onCreateCancel"></van-dialog> 328 <van-dialog title="温馨提示" :show="create_show" :show-cancel-button="true" message="是否确认提交?" confirm-button-color="#199A74" @confirm="onCreateConfirm" @cancel="onCreateCancel"></van-dialog>
...@@ -303,7 +342,7 @@ import Taro from '@tarojs/taro' ...@@ -303,7 +342,7 @@ import Taro from '@tarojs/taro'
303 import mixin from '@/utils/mixin'; 342 import mixin from '@/utils/mixin';
304 import BASE_URL from '@/utils/config'; 343 import BASE_URL from '@/utils/config';
305 import Toast from '@/components/vant-weapp/toast/toast'; 344 import Toast from '@/components/vant-weapp/toast/toast';
306 -import { randomId } from '@/utils/tools' 345 +import { randomId, wxInfo } from '@/utils/tools'
307 import moment from '@/utils/moment.min.js' 346 import moment from '@/utils/moment.min.js'
308 import { activityInfoAPI } from '@/api/Host/index'; 347 import { activityInfoAPI } from '@/api/Host/index';
309 348
...@@ -376,6 +415,7 @@ let endTime = new Date() ...@@ -376,6 +415,7 @@ let endTime = new Date()
376 let defaultActivityTime = new Date() 415 let defaultActivityTime = new Date()
377 let defaultStartTime = new Date() 416 let defaultStartTime = new Date()
378 let defaultEndTime = new Date() 417 let defaultEndTime = new Date()
418 +let isWxPc = wxInfo().isWxPc; // 是否为PC端微信
379 onMounted(async () => { 419 onMounted(async () => {
380 // 日期控件 420 // 日期控件
381 startTime = getTime("min", 0); 421 startTime = getTime("min", 0);
...@@ -525,6 +565,39 @@ const addSign = () => { // 新增-报名信息弹框 ...@@ -525,6 +565,39 @@ const addSign = () => { // 新增-报名信息弹框
525 const activity_time = ref(''); 565 const activity_time = ref('');
526 const reg_begin_time = ref(''); 566 const reg_begin_time = ref('');
527 const reg_end_time = ref(''); 567 const reg_end_time = ref('');
568 +const show_activity_time = ref(false);
569 +const show_reg_begin_time = ref(false);
570 +const show_reg_end_time = ref(false);
571 +let currentActivityDate = new Date().getTime()
572 +let currentBeginDate = new Date().getTime()
573 +let currentEndDate = new Date().getTime()
574 +
575 +const onActivityConfirm = ({ detail }) => {
576 + currentActivityDate = detail;
577 + activity_time.value = moment(detail).format('YYYY-MM-DD HH:mm')
578 + show_activity_time.value = false;
579 +}
580 +const onActivityCancel = () => {
581 + show_activity_time.value = false;
582 +}
583 +
584 +const onBeginConfirm = ({ detail }) => {
585 + currentBeginDate = detail;
586 + reg_begin_time.value = moment(detail).format('YYYY-MM-DD HH:mm')
587 + show_reg_begin_time.value = false;
588 +}
589 +const onBeginCancel = () => {
590 + show_reg_begin_time.value = false;
591 +}
592 +
593 +const onEndConfirm = ({ detail }) => {
594 + currentEndDate = detail;
595 + reg_end_time.value = moment(detail).format('YYYY-MM-DD HH:mm')
596 + show_reg_end_time.value = false;
597 +}
598 +const onEndCancel = () => {
599 + show_reg_end_time.value = false;
600 +}
528 601
529 const getTime = (key, number, date) => { 602 const getTime = (key, number, date) => {
530 let _date = date ? new Date(date) : new Date(); 603 let _date = date ? new Date(date) : new Date();
......
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-15 15:42:52 4 + * @LastEditTime: 2022-12-08 09:44:01
5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue 5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue
6 * @Description: 创建的活动页面 6 * @Description: 创建的活动页面
7 --> 7 -->
......
1 /* 1 /*
2 * @Date: 2022-04-18 15:59:42 2 * @Date: 2022-04-18 15:59:42
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-01 16:01:31 4 + * @LastEditTime: 2022-12-07 22:09:30
5 * @FilePath: /swx/src/utils/tools.js 5 * @FilePath: /swx/src/utils/tools.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -23,10 +23,14 @@ const wxInfo = () => { ...@@ -23,10 +23,14 @@ const wxInfo = () => {
23 let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 23 let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
24 let uAgent = navigator.userAgent.toLowerCase(); 24 let uAgent = navigator.userAgent.toLowerCase();
25 let isTable = (uAgent.match(/MicroMessenger/i) == 'micromessenger') ? true : false; 25 let isTable = (uAgent.match(/MicroMessenger/i) == 'micromessenger') ? true : false;
26 + let isMobile = window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i); // 是否手机端
27 + let isWx = /micromessenger/i.test(navigator.userAgent); // 是否微信
28 + let isWxPc = isWx && !isMobile; // PC端微信
26 return { 29 return {
27 isAndroid, 30 isAndroid,
28 isiOS, 31 isiOS,
29 - isTable 32 + isTable,
33 + isWxPc
30 }; 34 };
31 }; 35 };
32 36
......