Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-12-08 10:26:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a41fde18c58d41cbb08aecfb629538f71f98c7e4
a41fde18
1 parent
475856df
修复新增活动时日期控件电脑端微信选择不显示问题
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
11 deletions
src/pages/createActivity/index.vue
src/pages/myCreateActivity/index.vue
src/utils/tools.js
src/pages/createActivity/index.vue
View file @
a41fde1
<!--
* @Date: 2022-09-21 16:04:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-1
1-15 16:57:27
* @LastEditTime: 2022-1
2-08 10:21:46
* @FilePath: /swx/src/pages/createActivity/index.vue
* @Description: 创建活动页面
-->
...
...
@@ -63,11 +63,14 @@
</van-col>
<van-col span="14" offset="0">
<!-- 活动时间 -->
<timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultActivityTime" @result="onActivityTime">
<
!-- <
timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultActivityTime" @result="onActivityTime">
<van-field :value="activity_time" label-class="label-class-super" input-class="input-class" label=""
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
maxlength="" type="" :border="false" :required="false" :disabled="true" />
</timePickerData>
</timePickerData> -->
<van-field @tap="show_activity_time = true" :value="activity_time" label-class="label-class-super" input-class="input-class" label=""
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
maxlength="" type="" :border="false" :required="false" :disabled="true" />
</van-col>
</van-row>
</view>
...
...
@@ -83,21 +86,27 @@
</van-col>
<van-col span="14" offset="0">
<!-- 报名开始时间 -->
<timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultStartTime" @result="onBeginTime">
<
!-- <
timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultStartTime" @result="onBeginTime">
<van-field :value="reg_begin_time" label-class="label-class-super" input-class="input-class" label=""
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
maxlength="" type="" :border="false" :required="false" :disabled="true" />
</timePickerData>
</timePickerData> -->
<van-field @tap="show_reg_begin_time = true" :value="reg_begin_time" label-class="label-class-super" input-class="input-class" label=""
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
maxlength="" type="" :border="false" :required="false" :disabled="true" />
</van-col>
</van-row>
</view>
</view>
<!-- 报名截止时间 -->
<timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultEndTime" @result="onEndTime">
<
!-- <
timePickerData :start-time="startTime" :end-time="endTime" :default-time="defaultEndTime" @result="onEndTime">
<van-field :value="reg_end_time" label-class="label-class-super" input-class="input-class" label="报名截止时间"
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
maxlength="" type="" :border="true" :required="false" :disabled="true" />
</timePickerData>
</timePickerData> -->
<van-field @tap="show_reg_end_time = true" :value="reg_end_time" label-class="label-class-super" input-class="input-class" label="报名截止时间"
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
maxlength="" type="" :border="true" :required="false" :disabled="true" />
<!-- 人数限制 -->
<van-field :value="reg_max" label-class="label-class-super" input-class="input-class" label="人数限制"
:right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle=""
...
...
@@ -284,6 +293,36 @@
toolbar-class="picker-toolbar" @confirm="onPublicTypeConfirm" @cancel="onPublicTypeCancel"
@change="onPublicTypeChange" />
</van-popup>
<!-- 活动时间弹出框 -->
<van-popup :show="show_activity_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
<van-datetime-picker
title="活动时间"
type="datetime"
:value="currentActivityDate"
@confirm="onActivityConfirm"
@cancel="onActivityCancel"
/>
</van-popup>
<!-- 报名开始时间弹出框 -->
<van-popup :show="show_reg_begin_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
<van-datetime-picker
title="报名开始时间"
type="datetime"
:value="currentBeginDate"
@confirm="onBeginConfirm"
@cancel="onBeginCancel"
/>
</van-popup>
<!-- 报名截止时间弹出框 -->
<van-popup :show="show_reg_end_time" position="bottom" custom-style="height: 50%;" :lock-scroll="true">
<van-datetime-picker
title="报名截止时间"
type="datetime"
:value="currentEndDate"
@confirm="onEndConfirm"
@cancel="onEndCancel"
/>
</van-popup>
<van-toast id="van-toast" />
<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'
import mixin from '@/utils/mixin';
import BASE_URL from '@/utils/config';
import Toast from '@/components/vant-weapp/toast/toast';
import { randomId } from '@/utils/tools'
import { randomId
, wxInfo
} from '@/utils/tools'
import moment from '@/utils/moment.min.js'
import { activityInfoAPI } from '@/api/Host/index';
...
...
@@ -376,6 +415,7 @@ let endTime = new Date()
let defaultActivityTime = new Date()
let defaultStartTime = new Date()
let defaultEndTime = new Date()
let isWxPc = wxInfo().isWxPc; // 是否为PC端微信
onMounted(async () => {
// 日期控件
startTime = getTime("min", 0);
...
...
@@ -525,6 +565,39 @@ const addSign = () => { // 新增-报名信息弹框
const activity_time = ref('');
const reg_begin_time = ref('');
const reg_end_time = ref('');
const show_activity_time = ref(false);
const show_reg_begin_time = ref(false);
const show_reg_end_time = ref(false);
let currentActivityDate = new Date().getTime()
let currentBeginDate = new Date().getTime()
let currentEndDate = new Date().getTime()
const onActivityConfirm = ({ detail }) => {
currentActivityDate = detail;
activity_time.value = moment(detail).format('YYYY-MM-DD HH:mm')
show_activity_time.value = false;
}
const onActivityCancel = () => {
show_activity_time.value = false;
}
const onBeginConfirm = ({ detail }) => {
currentBeginDate = detail;
reg_begin_time.value = moment(detail).format('YYYY-MM-DD HH:mm')
show_reg_begin_time.value = false;
}
const onBeginCancel = () => {
show_reg_begin_time.value = false;
}
const onEndConfirm = ({ detail }) => {
currentEndDate = detail;
reg_end_time.value = moment(detail).format('YYYY-MM-DD HH:mm')
show_reg_end_time.value = false;
}
const onEndCancel = () => {
show_reg_end_time.value = false;
}
const getTime = (key, number, date) => {
let _date = date ? new Date(date) : new Date();
...
...
src/pages/myCreateActivity/index.vue
View file @
a41fde1
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-1
1-15 15:42:52
* @LastEditTime: 2022-1
2-08 09:44:01
* @FilePath: /swx/src/pages/myCreateActivity/index.vue
* @Description: 创建的活动页面
-->
...
...
src/utils/tools.js
View file @
a41fde1
/*
* @Date: 2022-04-18 15:59:42
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-1
1-01 16:01:31
* @LastEditTime: 2022-1
2-07 22:09:30
* @FilePath: /swx/src/utils/tools.js
* @Description: 文件描述
*/
...
...
@@ -23,10 +23,14 @@ const wxInfo = () => {
let
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
);
//ios终端
let
uAgent
=
navigator
.
userAgent
.
toLowerCase
();
let
isTable
=
(
uAgent
.
match
(
/MicroMessenger/i
)
==
'micromessenger'
)
?
true
:
false
;
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
);
// 是否手机端
let
isWx
=
/micromessenger/i
.
test
(
navigator
.
userAgent
);
// 是否微信
let
isWxPc
=
isWx
&&
!
isMobile
;
// PC端微信
return
{
isAndroid
,
isiOS
,
isTable
isTable
,
isWxPc
};
};
...
...
Please
register
or
login
to post a comment