chore: dialog browser

dialog if not edge or chrome
This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-01-13 09:26:35 +08:00
parent 6e8340c300
commit 05086935a6
4 changed files with 31 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: 'npm' cache: 'pnpm'
- run: pnpm install - run: pnpm install
- run: npnpm builld - run: npnpm builld
- name: Deploy to gh-pages - name: Deploy to gh-pages

View File

@@ -12,6 +12,10 @@
log-lottery是一个可配置可定制化的抽奖应用炫酷3D球体可用于年会抽奖等活动支持奖品、人员、界面、图片音乐配置。 log-lottery是一个可配置可定制化的抽奖应用炫酷3D球体可用于年会抽奖等活动支持奖品、人员、界面、图片音乐配置。
## 要求
使用PC端最新版Chrome或Edge浏览器。
## 功能描述 ## 功能描述
- 🕍 炫酷3D球体年会抽奖必备开箱即用 - 🕍 炫酷3D球体年会抽奖必备开箱即用

View File

@@ -40,15 +40,26 @@ const judgeMobile=()=>{
const isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1 const isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1
const isIOS =!!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) const isIOS =!!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
if(isAndroid||isIOS){
tipDialog.value.showModal()
}
system.setIsMobile(isAndroid||isIOS) system.setIsMobile(isAndroid||isIOS)
return isAndroid||isIOS
}
// 判断是否chrome或者edge访问
const judgeChromeOrEdge=()=>{
const ua = navigator.userAgent
const isChrome = ua.indexOf('Chrome') > -1
const isEdge = ua.indexOf('Edg') > -1
system.setIsChrome(isChrome)
return isChrome||isEdge
} }
onMounted(() => { onMounted(() => {
setLocalTheme(localTheme.value) setLocalTheme(localTheme.value)
setCurrentPrize() setCurrentPrize()
judgeMobile() if(judgeMobile()||!judgeChromeOrEdge()){
tipDialog.value.showModal()
}
}) })
</script> </script>
@@ -56,9 +67,10 @@ onMounted(() => {
<dialog id="my_modal_1" ref="tipDialog" class="border-none modal"> <dialog id="my_modal_1" ref="tipDialog" class="border-none modal">
<div class="modal-box"> <div class="modal-box">
<h3 class="text-lg font-bold">提示!</h3> <h3 class="text-lg font-bold">提示!</h3>
<p class="py-4">请使用PC进行访问以获得最佳显示效果</p> <p class="py-4" v-if="judgeMobile()">请使用PC进行访问以获得最佳显示效果</p>
<p class="py-4" v-if=" !judgeChromeOrEdge()">请使用最新版Chrome或者Edge浏览器</p>
<div class="modal-action"> <div class="modal-action">
<form method="dialog" class="flex gap-3 justify-start w-full"> <form method="dialog" class="flex justify-start w-full gap-3">
<!-- if there is a button in form, it will close the modal --> <!-- if there is a button in form, it will close the modal -->
<button class="btn">确定</button> <button class="btn">确定</button>
</form> </form>

View File

@@ -3,18 +3,25 @@ import { defineStore } from 'pinia';
export const useSystem = defineStore('system', { export const useSystem = defineStore('system', {
state() { state() {
return { return {
isMobile:false isMobile:false,
isChrome:true
}; };
}, },
getters: { getters: {
getIsMobile(state) { getIsMobile(state) {
return state.isMobile; return state.isMobile;
}, },
getIsChrome(state) {
return state.isChrome;
},
}, },
actions: { actions: {
setIsMobile(isMobile: boolean) { setIsMobile(isMobile: boolean) {
this.isMobile = isMobile; this.isMobile = isMobile;
}, },
setIsChrome(isChrome: boolean) {
this.isChrome = isChrome;
},
}, },
persist: { persist: {
enabled: true, enabled: true,