|
|
@@ -24,21 +24,21 @@
|
|
|
class="tutorial-btn animate__animated animate__heartBeat animate__infinite"
|
|
|
alt=""
|
|
|
srcset=""
|
|
|
- @click="agreement"
|
|
|
+ @click="showIntroVideo"
|
|
|
/>
|
|
|
<img
|
|
|
src="@/assets/OPNAVI.png"
|
|
|
class="tutorial-btn animate__animated animate__heartBeat animate__infinite"
|
|
|
alt=""
|
|
|
srcset=""
|
|
|
- @click="showTutorial"
|
|
|
+ @click="showTutorialVideo"
|
|
|
/>
|
|
|
<img
|
|
|
src="@/assets/TUTORIAL.png"
|
|
|
class="tutorial-btn animate__animated animate__heartBeat animate__infinite"
|
|
|
alt=""
|
|
|
srcset=""
|
|
|
- @click="tutorial"
|
|
|
+ @click="showGraphicTutorial"
|
|
|
/>
|
|
|
</div>
|
|
|
<!-- 通知 -->
|
|
|
@@ -49,7 +49,7 @@
|
|
|
dot
|
|
|
:offset="[-4, 4]"
|
|
|
class="animate__animated animate__rubberBand animate__infinite"
|
|
|
- v-if="hasNews"
|
|
|
+ v-if="recentNews"
|
|
|
>
|
|
|
<img class="bar-icon" src="../assets/home_icon_redian.png" alt="" @click="showConsoleEve" />
|
|
|
</van-badge>
|
|
|
@@ -70,7 +70,11 @@
|
|
|
:touchable="false"
|
|
|
:show-indicators="false"
|
|
|
>
|
|
|
- <van-swipe-item v-for="(item, index) in news" :key="index" @click="goNews">
|
|
|
+ <van-swipe-item
|
|
|
+ v-for="(item, index) in news"
|
|
|
+ :key="index"
|
|
|
+ @click="router.push({ name: 'news' })"
|
|
|
+ >
|
|
|
<div class="notic-news">
|
|
|
<span class="van-ellipsis">{{ item.title }}</span>
|
|
|
<ion-icon class="right-icon" :icon="intoIcon"></ion-icon>
|
|
|
@@ -82,9 +86,9 @@
|
|
|
|
|
|
<div class="rank-content">
|
|
|
<img class="rank-bg" src="../assets/png-kuang.png" alt="" />
|
|
|
- <div class="rank-box" @click="goRank">
|
|
|
+ <div class="rank-box" @click="router.push({ name: 'rank' })">
|
|
|
<div class="rank-list">
|
|
|
- <div class="rank-info" v-for="(item, index) in profitList" :key="index">
|
|
|
+ <div class="rank-info" v-for="(item, index) in recentWidthdraw" :key="index">
|
|
|
<div class="rank-info-left">
|
|
|
<div class="name">{{ item.nickname }}</div>
|
|
|
<!-- <div class="text">
|
|
|
@@ -99,7 +103,7 @@
|
|
|
|
|
|
<ion-icon class="right-icon" :icon="intoIcon"></ion-icon>
|
|
|
</div>
|
|
|
- <div class="rank-info" v-for="(item, index) in profitList" :key="index">
|
|
|
+ <div class="rank-info" v-for="(item, index) in recentWidthdraw" :key="index">
|
|
|
<div class="rank-info-left">
|
|
|
<div class="name">{{ item.nickname }}</div>
|
|
|
<!-- <div class="text">
|
|
|
@@ -167,16 +171,13 @@
|
|
|
<img src="../assets/home_icon_liucheng.png" alt="" />
|
|
|
<span>{{ $t('common.guide') }}</span>
|
|
|
</div> -->
|
|
|
- <div class="tool-info" @click="showTutorial">
|
|
|
+ <div class="tool-info" @click="showTutorialVideo">
|
|
|
<img src="../assets/png-TUTORIAL.png" alt="" />
|
|
|
</div>
|
|
|
- <div class="tool-info" @click="agreement">
|
|
|
+ <div class="tool-info" @click="showIntroVideo">
|
|
|
<img src="../assets/png-AGREEMENT.png" alt="" />
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <tutorial-modal ref="tutorialModalRef"></tutorial-modal>
|
|
|
- <introduction-modal ref="introductionModalRef"></introduction-modal>
|
|
|
</ion-content>
|
|
|
</ion-page>
|
|
|
</template>
|
|
|
@@ -186,23 +187,23 @@ import '@/styles/animate.css'
|
|
|
import 'swiper/swiper.min.css'
|
|
|
import 'swiper/swiper-bundle.min.css'
|
|
|
import intoIcon from '@/assets/svgs/icon_inter.svg'
|
|
|
-import { useRoute, useRouter } from 'vue-router'
|
|
|
-import { ref, watch, computed } from 'vue'
|
|
|
-import { useIonRouter, onIonViewWillEnter } from '@ionic/vue'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
+import { ref, computed, onMounted, inject } from 'vue'
|
|
|
+import { modalController } from '@ionic/vue'
|
|
|
import { isAfter, isBefore, parse, getYear, getMonth, getDate, addDays, getTime, format } from 'date-fns'
|
|
|
import { http } from '@/plugins/http'
|
|
|
import toast from '@/utils/toast'
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
-import TutorialModal from '../components/TutorialModal.vue'
|
|
|
-import IntroductionModal from '../components/IntroductionModal.vue'
|
|
|
-import { useStorage } from '@vueuse/core'
|
|
|
+import { useStorage, until, promiseTimeout } from '@vueuse/core'
|
|
|
import { init as initEruda } from '@/utils/console'
|
|
|
import { emitter } from '@/utils/eventBus'
|
|
|
import { getUtcTime } from '@/plugins/time'
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
+import { showVideoModal } from '@/components/videoModal'
|
|
|
+import NewsModal from '@/components/NewsModal.vue'
|
|
|
|
|
|
const router = useRouter()
|
|
|
-
|
|
|
+const i18n = useI18n()
|
|
|
|
|
|
const topBanners = ref([])
|
|
|
function getBanner() {
|
|
|
@@ -248,7 +249,69 @@ function getSaleBatch() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const i18n = useI18n()
|
|
|
+const recentWidthdraw = ref([])
|
|
|
+function getRecentWidthdraw() {
|
|
|
+ http.get('/withdrawApply/recentWithdraw').then(res => {
|
|
|
+ recentWidthdraw.value = res
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const news = ref([])
|
|
|
+function getNews() {
|
|
|
+ http.post(
|
|
|
+ '/article/all',
|
|
|
+ {
|
|
|
+ query: {
|
|
|
+ del: false
|
|
|
+ },
|
|
|
+ sort: 'createdAt,desc',
|
|
|
+ size: 1,
|
|
|
+ page: 0
|
|
|
+ },
|
|
|
+ { body: 'json' }
|
|
|
+ ).then(res => {
|
|
|
+ news.value = res.content
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const recentNews = computed(() => {
|
|
|
+ return news.value.find(item => {
|
|
|
+ return isAfter(addDays(parse(item.createdAt, 'yyyy-MM-dd HH:mm:ss', 0), 1), new Date()) || null
|
|
|
+ })
|
|
|
+})
|
|
|
+const refresh = () => {
|
|
|
+ getRecentWidthdraw()
|
|
|
+ getBanner()
|
|
|
+ getSaleBatch()
|
|
|
+ getNews()
|
|
|
+}
|
|
|
+const turtorialShown = useStorage('turtorialShown', false)
|
|
|
+const newsShown = useStorage('newsShown', null)
|
|
|
+const packageSynced = inject('packageSynced', false)
|
|
|
+async function showNewsModal(news) {
|
|
|
+ const modal = await modalController.create({
|
|
|
+ component: NewsModal,
|
|
|
+ componentProps: { detail: news }
|
|
|
+ })
|
|
|
+ modal.present()
|
|
|
+ return await modal.onWillDismiss()
|
|
|
+}
|
|
|
+onMounted(async () => {
|
|
|
+ refresh()
|
|
|
+ await until(packageSynced).toBe(true)
|
|
|
+ if (turtorialShown.value == false) {
|
|
|
+ await until(turtorialVideoSrc).not.toBeNull()
|
|
|
+ await showVideoModal({ src: turtorialVideoSrc.value, skip: true })
|
|
|
+ turtorialShown.value = true
|
|
|
+ await promiseTimeout(500)
|
|
|
+ }
|
|
|
+ await until(recentNews).toMatch(v => !!v)
|
|
|
+ if (newsShown.value != `${recentNews.value.id}`) {
|
|
|
+ await showNewsModal(recentNews.value)
|
|
|
+ newsShown.value = `${recentNews.value.id}`
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
const goList = info => {
|
|
|
if (info.id == 11547) {
|
|
|
const { user } = useUserStore()
|
|
|
@@ -268,94 +331,23 @@ const goList = info => {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
- if (getStatus(info) === '抢购中') {
|
|
|
- router.push({
|
|
|
- name: 'productList',
|
|
|
- query: {
|
|
|
- batchId: info.id
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- toast(i18n.t('common.wait') + '...')
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function goNews() {
|
|
|
router.push({
|
|
|
- name: 'news'
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-onIonViewWillEnter(() => {
|
|
|
- // toast.loading({
|
|
|
- // message: '加载中...',
|
|
|
- // forbidClick: true
|
|
|
- // })
|
|
|
- getRank()
|
|
|
- getBanner()
|
|
|
- getSaleBatch()
|
|
|
- // Promise.all([]).then(() => {
|
|
|
- // toast.dismiss()
|
|
|
- // })
|
|
|
- getNotice()
|
|
|
-})
|
|
|
-
|
|
|
-const news = ref([])
|
|
|
-let first = true
|
|
|
-function getNotice() {
|
|
|
- http.post(
|
|
|
- '/article/all',
|
|
|
- {
|
|
|
- query: {
|
|
|
- del: false
|
|
|
- },
|
|
|
- sort: 'id,desc',
|
|
|
- size: 5,
|
|
|
- page: 0
|
|
|
- },
|
|
|
- { body: 'json' }
|
|
|
- ).then(res => {
|
|
|
- news.value = res.content
|
|
|
- if (first) {
|
|
|
- let newsStorages = window.localStorage.getItem('newsStorage')
|
|
|
- ? JSON.parse(window.localStorage.getItem('newsStorage'))
|
|
|
- : []
|
|
|
- first = false
|
|
|
- let info = news.value.find(item => {
|
|
|
- let date1 = addDays(new Date(item.createdAt), 1)
|
|
|
- return isAfter(date1, new Date())
|
|
|
- })
|
|
|
- if (info && !newsStorages.includes(info.id.toString())) {
|
|
|
- newsStorages.push(info.id.toString())
|
|
|
- window.localStorage.setItem('newsStorage', JSON.stringify(newsStorages))
|
|
|
- router.push({
|
|
|
- name: 'newsDetail',
|
|
|
- state: {
|
|
|
- ...info
|
|
|
- },
|
|
|
- query: {
|
|
|
- id: info.id
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ name: 'productList',
|
|
|
+ query: {
|
|
|
+ batchId: info.id
|
|
|
}
|
|
|
})
|
|
|
+ // if (getStatus(info) === '抢购中') {
|
|
|
+ // router.push({
|
|
|
+ // name: 'productList',
|
|
|
+ // query: {
|
|
|
+ // batchId: info.id
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // toast(i18n.t('common.wait') + '...')
|
|
|
+ // }
|
|
|
}
|
|
|
-const hasNews = computed(() => {
|
|
|
- let info = news.value.find(item => {
|
|
|
- let date1 = addDays(new Date(item.createdAt), 1)
|
|
|
- return isAfter(date1, new Date())
|
|
|
- })
|
|
|
- return !!info
|
|
|
-})
|
|
|
-
|
|
|
-const noticeBarRef = ref(null)
|
|
|
-const route = useRoute()
|
|
|
-watch(route, value => {
|
|
|
- if (value.name === 'home' && noticeBarRef.value) {
|
|
|
- noticeBarRef.value.reset()
|
|
|
- }
|
|
|
-})
|
|
|
|
|
|
const getStatus = info => {
|
|
|
let date1 = getYear(new Date()) + '/' + (getMonth(new Date()) + 1) + '/' + getDate(new Date())
|
|
|
@@ -368,75 +360,31 @@ const getStatus = info => {
|
|
|
return getTime(startDate, 1) - getTime(new Date())
|
|
|
} else if (info.empty && isBefore(new Date(), endDate)) {
|
|
|
return '已抢光'
|
|
|
- }
|
|
|
- {
|
|
|
+ } else {
|
|
|
return getTime(addDays(startDate, 1)) - getTime(new Date())
|
|
|
}
|
|
|
}
|
|
|
return ''
|
|
|
}
|
|
|
|
|
|
-const profitList = ref([])
|
|
|
-function randomS() {
|
|
|
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
|
- return chars[Math.floor(Math.random() * chars.length)]
|
|
|
-}
|
|
|
-function getRank() {
|
|
|
- http.get('/withdrawApply/recentWithdraw').then(res => {
|
|
|
- profitList.value = res
|
|
|
- })
|
|
|
- // let profitListJson = localStorage.getItem('profitList')
|
|
|
- // if (profitListJson) {
|
|
|
- // profitListJson = JSON.parse(profitListJson)
|
|
|
- // if (new Date().getTime() < profitListJson.expire) {
|
|
|
- // profitList.value = profitListJson.data
|
|
|
- // return
|
|
|
- // }
|
|
|
- // }
|
|
|
- // profitList.value = Array.from({ length: 10 }, (v, i) => {
|
|
|
- // return {
|
|
|
- // nickname: randomS() + '***' + randomS(),
|
|
|
- // val: randomNum(100, 1000)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // localStorage.setItem(
|
|
|
- // 'profitList',
|
|
|
- // JSON.stringify({
|
|
|
- // data: profitList.value,
|
|
|
- // expire: new Date().getTime() + 1000 * 60 * 60 * 24
|
|
|
- // })
|
|
|
- // )
|
|
|
-}
|
|
|
-
|
|
|
-function randomNum(minNum, maxNum) {
|
|
|
- switch (arguments.length) {
|
|
|
- case 1:
|
|
|
- return parseInt(Math.random() * minNum + 1, 10)
|
|
|
- case 2:
|
|
|
- return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10)
|
|
|
- default:
|
|
|
- return 0
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function goRank() {
|
|
|
- router.push({ name: 'rank' })
|
|
|
-}
|
|
|
-
|
|
|
-const introductionModalRef = ref(null)
|
|
|
-function agreement() {
|
|
|
- introductionModalRef.value.init()
|
|
|
+const turtorialVideoSrc = ref(null)
|
|
|
+const introVideoSrc = ref(null)
|
|
|
+http.post('/sysConfig/multipleGet', ['tutorial_video', 'introduce_video'], {
|
|
|
+ body: 'json'
|
|
|
+}).then(res => {
|
|
|
+ turtorialVideoSrc.value = res.find(item => item.name === 'tutorial_video')?.value
|
|
|
+ introVideoSrc.value = res.find(item => item.name === 'introduce_video')?.value
|
|
|
+})
|
|
|
+async function showIntroVideo() {
|
|
|
+ await showVideoModal({ src: introVideoSrc.value })
|
|
|
}
|
|
|
|
|
|
-function tutorial() {
|
|
|
+function showGraphicTutorial() {
|
|
|
router.push({ name: 'turtorial' })
|
|
|
- // Browser.open({ url: `${location.origin}/static/PrivacyPolicy.html` })
|
|
|
}
|
|
|
|
|
|
-const tutorialModalRef = ref(null)
|
|
|
-function showTutorial() {
|
|
|
- console.log(tutorialModalRef.value)
|
|
|
- tutorialModalRef.value.init()
|
|
|
+async function showTutorialVideo() {
|
|
|
+ await showVideoModal({ src: turtorialVideoSrc.value })
|
|
|
}
|
|
|
|
|
|
let clickNum = 0
|