首页修改强制更新时禁止tabbar切换

This commit is contained in:
2025-01-14 11:47:12 +08:00
parent 62e75846a6
commit 8a5658681c

View File

@@ -45,42 +45,54 @@
<image v-if="datas.isExamine == 0" @click="goMsg()" src="@/static/index/red-pack-new.gif" <image v-if="datas.isExamine == 0" @click="goMsg()" src="@/static/index/red-pack-new.gif"
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;" mode=""></image> style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;" mode=""></image>
<up-modal :show="datas.version.show" :confirm-text="datas.version.confirmText" :showCancelButton="datas.version.cancelText!=''" @confirm='confirmUpdateVersion' <up-modal :show="datas.version.show" :confirm-text="datas.version.confirmText"
:title="datas.version.title" :title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)" @cancel="datas.version.show = false"> :showCancelButton="datas.version.cancelText!=''" @confirm='confirmUpdateVersion' :title="datas.version.title"
:title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)" @cancel="datas.version.show = false">
<view class="" style="padding-top: 30rpx;text-align: left;"> <view class="" style="padding-top: 30rpx;text-align: left;">
<scroll-view scroll-y="true" style="max-height: 50vh;"> <scroll-view scroll-y="true" style="max-height: 50vh;">
<rich-text style="color:#666" :nodes="datas.version.content"></rich-text> <rich-text style="color:#666" :nodes="datas.version.content"></rich-text>
</scroll-view> </scroll-view>
</view> </view>
</up-modal> </up-modal>
<up-modal :show="datas.ruleShow" v-if="datas.isExamine == 0&&!datas.version.show" confirm-text="知道了" title="规则说明" :title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="ruleConfirm" confirm-color="rgb(255, 117, 129)"> <up-modal :show="datas.ruleShow" v-if="datas.isExamine == 0&&!datas.version.show" confirm-text="知道了" title="规则说明"
:title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="ruleConfirm"
confirm-color="rgb(255, 117, 129)">
<view class="u-p-30 u-text-left"> <view class="u-p-30 u-text-left">
<scroll-view scroll-y="true" style="max-height: 50vh;" > <scroll-view scroll-y="true" style="max-height: 50vh;">
<rich-text style="text-align: justify;font-size: 18px;color: #666;" :nodes="datas.rule_content"></rich-text> <rich-text style="text-align: justify;font-size: 18px;color: #666;"
:nodes="datas.rule_content"></rich-text>
</scroll-view> </scroll-view>
</view> </view>
</up-modal> </up-modal>
</template> </template>
<script setup> <script setup>
import { import {
reactive reactive
} from 'vue'; } from 'vue';
import { announcement, messageselectMessage, courseselectCourse } from '@/api/index/index.js' import {
import { announcement,
messageselectMessage,
courseselectCourse
} from '@/api/index/index.js'
import {
onLoad, onLoad,
onReady, onReady,
onReachBottom onReachBottom
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import contentlist from './components/contentlist.vue' import contentlist from './components/contentlist.vue'
import { selectNewApp } from '@/api/user/user.js'; import {
import config from '@/commons/config.js'; selectNewApp
import { linkTo } from '@/utils/app.js'; } from '@/api/user/user.js';
import { import config from '@/commons/config.js';
import {
linkTo
} from '@/utils/app.js';
import {
useCommonStore useCommonStore
} from '@/store/common.js' } from '@/store/common.js'
const $common = useCommonStore() const $common = useCommonStore()
let datas = reactive({ let datas = reactive({
noticeList: [], //公告列表 noticeList: [], //公告列表
active: 1, // 最新、最热。。。切换顶部导航栏 active: 1, // 最新、最热。。。切换顶部导航栏
@@ -104,24 +116,27 @@ let datas = reactive({
confirmText: "", confirmText: "",
cancelText: "", cancelText: "",
} }
}) })
onLoad(() => { onLoad(() => {
versionUpdate() versionUpdate()
getMsg() getMsg()
getrecomVideo() getrecomVideo()
}) })
onReady(() => { onReady(() => {
announcement({type: 0}).then(res=>{ announcement({
type: 0
}).then(res => {
datas.ruleList = res datas.ruleList = res
ruleInit() ruleInit()
datas.ruleShow = true datas.ruleShow = true
}) })
}) })
onReachBottom(() => { onReachBottom(() => {
++datas.page ++datas.page
getrecomVideo() getrecomVideo()
}) })
function versionUpdate(){
function versionUpdate() {
//#ifdef APP-PLUS //#ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //竖屏正方向锁定 plus.screen.lockOrientation('portrait-primary'); //竖屏正方向锁定
//获取当前系统版本信息 //获取当前系统版本信息
@@ -136,7 +151,7 @@ function versionUpdate(){
if (uni.getSystemInfoSync().platform == 'ios') { if (uni.getSystemInfoSync().platform == 'ios') {
version = res.iosVersion version = res.iosVersion
} }
console.log(widgetInfo.version+'---'+version) console.log(widgetInfo.version + '---' + version)
version = res.version version = res.version
// && uni.getSystemInfoSync().platform == 'android' // && uni.getSystemInfoSync().platform == 'android'
if (widgetInfo.version < version) { if (widgetInfo.version < version) {
@@ -148,6 +163,9 @@ function versionUpdate(){
datas.version.content = res.des; datas.version.content = res.des;
if (res.method == "true") { if (res.method == "true") {
datas.version.confirmText = "立即更新" datas.version.confirmText = "立即更新"
uni.switchTab = () => {
}
} else { } else {
datas.version.confirmText = "立即更新" datas.version.confirmText = "立即更新"
datas.version.cancelText = "下次更新" datas.version.cancelText = "下次更新"
@@ -157,8 +175,9 @@ function versionUpdate(){
}); });
}); });
//#endif //#endif
} }
function confirmUpdateVersion(){
function confirmUpdateVersion() {
// plus.runtime.openURL(config.baseUrl + '/pages/login/appEq') // plus.runtime.openURL(config.baseUrl + '/pages/login/appEq')
linkTo('/pages/login/download') linkTo('/pages/login/download')
return return
@@ -172,7 +191,7 @@ function confirmUpdateVersion(){
success: downloadResult => { success: downloadResult => {
console.log(downloadResult) console.log(downloadResult)
if (downloadResult.statusCode === 200) { if (downloadResult.statusCode === 200) {
plus.runtime .install( plus.runtime.install(
downloadResult.tempFilePath, { downloadResult.tempFilePath, {
force: false force: false
}, },
@@ -193,47 +212,48 @@ function confirmUpdateVersion(){
if (uni.getSystemInfoSync().platform == 'ios') { if (uni.getSystemInfoSync().platform == 'ios') {
plus.runtime.openURL(iosLink, function(res) {}); plus.runtime.openURL(iosLink, function(res) {});
} }
} }
function ruleInit(){
function ruleInit() {
datas.rule_title = datas.ruleList[datas.ruleIndex].title datas.rule_title = datas.ruleList[datas.ruleIndex].title
datas.rule_content = datas.ruleList[datas.ruleIndex].content datas.rule_content = datas.ruleList[datas.ruleIndex].content
} }
/** /**
* 规则确认 * 规则确认
*/ */
function ruleConfirm() { function ruleConfirm() {
datas.ruleShow = false datas.ruleShow = false
datas.ruleIndex++ datas.ruleIndex++
if( datas.ruleIndex >= datas.ruleList.length) { if (datas.ruleIndex >= datas.ruleList.length) {
datas.ruleIndex = 0 datas.ruleIndex = 0
return return
} }
setTimeout(res=>{ setTimeout(res => {
ruleInit() ruleInit()
datas.ruleShow = true datas.ruleShow = true
},300) }, 300)
} }
// 跳转公告链接 // 跳转公告链接
function goMsg(url) { function goMsg(url) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/me/prizeDraw' url: '/pages/me/prizeDraw'
}); });
} }
// 搜索跳转 // 搜索跳转
function moreVideo() { function moreVideo() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/search/index' url: '/pages/index/search/index'
}); });
} }
// 公告 // 公告
async function getMsg() { async function getMsg() {
let res = await messageselectMessage() let res = await messageselectMessage()
datas.noticeList = res.list datas.noticeList = res.list
} }
//获取推荐视频 //获取推荐视频
async function getrecomVideo(sort, active = 1) { async function getrecomVideo(sort, active = 1) {
datas.active = active datas.active = active
if (sort) { if (sort) {
datas.page = 1 datas.page = 1
@@ -250,11 +270,11 @@ async function getrecomVideo(sort, active = 1) {
} else { } else {
datas.list = [...datas.list, ...res.list] datas.list = [...datas.list, ...res.list]
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.indexStyle { .indexStyle {
height: 555rpx; height: 555rpx;
position: relative; position: relative;
@@ -320,13 +340,13 @@ async function getrecomVideo(sort, active = 1) {
} }
} }
} }
.navTop-active { .navTop-active {
color: #cb5d68; color: #cb5d68;
} }
.navTop { .navTop {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -337,5 +357,5 @@ async function getrecomVideo(sort, active = 1) {
margin-left: 20rpx; margin-left: 20rpx;
padding: 6rpx 20rpx padding: 6rpx 20rpx
} }
} }
</style> </style>