feat: 一体机适配
This commit is contained in:
@@ -63,6 +63,12 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import IndexRefactor from './components/index-refactor.vue';
|
||||
import IndexOne from './components/index-one.vue';
|
||||
import IndexTwo from './components/index-two.vue';
|
||||
import useScreenStore from '@/stores/useScreenStore'
|
||||
|
||||
const screenStore = useScreenStore()
|
||||
const {isWideScreen} = screenStore
|
||||
|
||||
|
||||
const loadedMap = reactive([false, false]);
|
||||
const swiperRefs = [ref(null), ref(null)];
|
||||
// const components = [IndexOne, IndexTwo];
|
||||
@@ -70,7 +76,7 @@ const components = [IndexRefactor, IndexTwo];
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useReadMsg } from '@/stores/useReadMsg';
|
||||
const { unreadCount } = storeToRefs(useReadMsg());
|
||||
const showTabbar = ref(true);
|
||||
const showTabbar = ref(false);
|
||||
const maskFristEntry = ref(false);
|
||||
|
||||
const disableTouch = ref(false);
|
||||
@@ -78,14 +84,25 @@ const startPointX = ref(0);
|
||||
const totalPage = 2;
|
||||
const THRESHOLD = 5;
|
||||
|
||||
watch(
|
||||
() => screenStore.isWideScreen,
|
||||
(newVal) => {
|
||||
showTabbar.value = newVal
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
|
||||
onLoad(() => {
|
||||
// 判断浏览器是否有 fristEntry 第一次进入
|
||||
let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
|
||||
maskFristEntry.value = fristEntry
|
||||
// if (fristEntry) {
|
||||
// uni.hideTabBar();
|
||||
// }
|
||||
|
||||
if (fristEntry) {
|
||||
if(!isWideScreen)uni.hideTabBar();
|
||||
else showTabbar.value = false
|
||||
}else{
|
||||
if(isWideScreen)showTabbar.value = true
|
||||
}
|
||||
// 预加载较重页面
|
||||
setTimeout(() => {
|
||||
uni.preloadPage({ url: '/packageA/pages/post/post' });
|
||||
@@ -146,7 +163,12 @@ function handleTouchMove(e) {
|
||||
}
|
||||
|
||||
function changeShowTabbar(val) {
|
||||
showTabbar.value = val;
|
||||
if(isWideScreen){
|
||||
showTabbar.value=val
|
||||
}else{
|
||||
if(val)uni.showTabBar()
|
||||
else uni.hideTabBar()
|
||||
}
|
||||
}
|
||||
|
||||
//1 查看消息类型
|
||||
@@ -201,12 +223,14 @@ function changeSwiperMsgType(e) {
|
||||
function closeFristEntry() {
|
||||
uni.setStorageSync('fristEntry', false);
|
||||
maskFristEntry.value = false;
|
||||
uni.showTabBar();
|
||||
if(!isWideScreen)uni.showTabBar();
|
||||
else showTabbar.value=true
|
||||
}
|
||||
|
||||
function goExperience() {
|
||||
closeFristEntry();
|
||||
uni.showTabBar();
|
||||
if(!isWideScreen)uni.showTabBar();
|
||||
else showTabbar.value = true
|
||||
state.current = 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user