|
@@ -1,6 +1,6 @@
|
|
|
import ColSticky from '@/components/col-sticky'
|
|
|
import request from '@/helpers/request'
|
|
|
-import { Button, Cell, CellGroup, Image, Popup } from 'vant'
|
|
|
+import { Button, Cell, CellGroup, Dialog, Image, Popup } from 'vant'
|
|
|
import { defineComponent } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import dayjs from 'dayjs'
|
|
@@ -31,7 +31,10 @@ export default defineComponent({
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
|
- this.getMusicInfo()
|
|
|
+ await this.getMusicInfo()
|
|
|
+
|
|
|
+ // 判断活动状态的活动时间
|
|
|
+ this.checkActivityTime()
|
|
|
},
|
|
|
methods: {
|
|
|
async getMusicInfo() {
|
|
@@ -48,6 +51,44 @@ export default defineComponent({
|
|
|
} catch {
|
|
|
//
|
|
|
}
|
|
|
+ },
|
|
|
+ checkActivityTime() {
|
|
|
+ // 判断活动状态的活动时间
|
|
|
+ try {
|
|
|
+ const activeInfo = this.activeInfo
|
|
|
+ if (activeInfo.activityState === 0) {
|
|
|
+ Dialog.alert({
|
|
|
+ message: '活动已结束,感谢你的关注!',
|
|
|
+ theme: 'round-button',
|
|
|
+ confirmButtonColor: '#2dc7aa'
|
|
|
+ })
|
|
|
+ this.onBackDialog('活动已结束,感谢你的关注!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ const nowTime = dayjs()
|
|
|
+ const startTime = dayjs(activeInfo.activityStart)
|
|
|
+ const endTime = dayjs(activeInfo.activityEnd)
|
|
|
+ if (dayjs(nowTime).isBefore(dayjs(startTime))) {
|
|
|
+ this.onBackDialog('活动尚未开始,请您耐心等待!')
|
|
|
+ return false
|
|
|
+ } else if (!dayjs(nowTime).isBefore(dayjs(endTime))) {
|
|
|
+ this.onBackDialog('活动已结束,感谢你的关注!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onBackDialog(str: string) {
|
|
|
+ Dialog.alert({
|
|
|
+ message: str,
|
|
|
+ theme: 'round-button',
|
|
|
+ confirmButtonColor: '#2dc7aa'
|
|
|
+ }).then(() => {
|
|
|
+ postMessage({ api: 'back' })
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
render() {
|
|
@@ -235,7 +276,12 @@ export default defineComponent({
|
|
|
round
|
|
|
class={styles.submit}
|
|
|
block
|
|
|
- onClick={() => (this.shareStatus = true)}
|
|
|
+ onClick={() => {
|
|
|
+ if (!this.checkActivityTime()) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.shareStatus = true
|
|
|
+ }}
|
|
|
>
|
|
|
立即分享
|
|
|
</Button>
|