flat: 暂存
This commit is contained in:
@@ -3,42 +3,10 @@
|
||||
<view class="app-container">
|
||||
<!-- 主体内容区域 -->
|
||||
<view class="container-main">
|
||||
<swiper class="swiper" :current="state.current" @change="changeSwiperType">
|
||||
<swiper-item class="swiper-item" v-for="(_, index) in 2" :key="index">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<component
|
||||
:is="components[index]"
|
||||
@onShowTabbar="changeShowTabbar"
|
||||
:ref="(el) => handelComponentsRef(el, index)"
|
||||
/>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<IndexOne
|
||||
v-show="currentIndex === 0"
|
||||
@onShowTabbar="changeShowTabbar"
|
||||
:ref="(el) => handelComponentsRef(el, index)"
|
||||
/>
|
||||
<IndexTwo
|
||||
v-show="currentIndex === 1"
|
||||
@onShowTabbar="changeShowTabbar"
|
||||
:ref="(el) => handelComponentsRef(el, index)"
|
||||
/>
|
||||
<!-- #endif -->
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<IndexOne @onShowTabbar="changeShowTabbar" />
|
||||
</view>
|
||||
|
||||
<Tabbar v-show="showTabbar" :currentpage="0"></Tabbar>
|
||||
|
||||
<!-- maskFristEntry -->
|
||||
<view class="maskFristEntry" v-if="maskFristEntry">
|
||||
<view class="entry-content">
|
||||
<text class="text1">左滑查看视频</text>
|
||||
<text class="text2">快去体验吧~</text>
|
||||
<view class="goExperience" @click="goExperience">去体验</view>
|
||||
<view class="maskFristEntry-Close" @click="closeFristEntry">1</view>
|
||||
</view>
|
||||
</view>
|
||||
<Tabbar :currentpage="0"></Tabbar>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -48,79 +16,14 @@ import { reactive, inject, watch, ref, onMounted } from 'vue';
|
||||
import Tabbar from '@/components/tabbar/midell-box.vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import IndexOne from './components/index-one.vue';
|
||||
import IndexTwo from './components/index-two.vue';
|
||||
const loadedMap = reactive([false, false]);
|
||||
const swiperRefs = [ref(null), ref(null)];
|
||||
const components = [IndexOne, IndexTwo];
|
||||
// import IndexTwo from './components/index-two.vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useReadMsg } from '@/stores/useReadMsg';
|
||||
const { unreadCount } = storeToRefs(useReadMsg());
|
||||
const showTabbar = ref(true);
|
||||
const maskFristEntry = ref(false);
|
||||
|
||||
onLoad(() => {
|
||||
// 判断浏览器是否有 fristEntry 第一次进入
|
||||
let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读
|
||||
maskFristEntry.value = fristEntry;
|
||||
// maskFristEntry.value = true;
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
// 获取消息列表
|
||||
useReadMsg().fetchMessages();
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
current: 0,
|
||||
all: [{}],
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
handleTabChange(state.current);
|
||||
});
|
||||
|
||||
const handelComponentsRef = (el, index) => {
|
||||
if (el) {
|
||||
swiperRefs[index].value = el;
|
||||
}
|
||||
};
|
||||
|
||||
function changeShowTabbar(val) {
|
||||
showTabbar.value = val;
|
||||
}
|
||||
|
||||
//1 查看消息类型
|
||||
function changeSwiperType(e) {
|
||||
const index = e.detail.current;
|
||||
state.current = index;
|
||||
handleTabChange(index);
|
||||
}
|
||||
function changeType(index) {
|
||||
state.current = index;
|
||||
handleTabChange(index);
|
||||
}
|
||||
|
||||
function handleTabChange(index) {
|
||||
if (!loadedMap[index]) {
|
||||
swiperRefs[index].value?.loadData();
|
||||
loadedMap[index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function changeSwiperMsgType(e) {
|
||||
const currented = e.detail.current;
|
||||
state.current = currented;
|
||||
}
|
||||
// mask
|
||||
function closeFristEntry() {
|
||||
uni.setStorageSync('fristEntry', false);
|
||||
maskFristEntry.value = false;
|
||||
}
|
||||
|
||||
function goExperience() {
|
||||
closeFristEntry();
|
||||
state.current = 1;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
|
Reference in New Issue
Block a user