首页公告弹窗功能

This commit is contained in:
duan
2025-03-01 18:35:25 +08:00
parent 15c83db6f7
commit 46b0576abc
2 changed files with 40 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
//打包时修改env的值即可 //打包时修改env的值即可
const env='production' //test , production,local const env='test' //test , production,local
export const encryptKey='1234567890123456' // http数据加解密的key export const encryptKey='1234567890123456' // http数据加解密的key

View File

@@ -54,25 +54,29 @@
</scroll-view> </scroll-view>
</view> </view>
</up-modal> </up-modal>
<!-- h5关闭通知 --> <!-- h5关闭通知 -->
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<up-modal :show="datas.stopShow" <up-modal :show="datas.stopShow" cancel-text="知道了" show-cancel-button confirm-text="去下载" title="重要通知"
cancel-text="知道了" @cancel="stopCancel" :title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="stopConfirm"
show-cancel-button
confirm-text="去下载" title="重要通知"
@cancel="stopCancel"
:title="datas.rule_title" :title-style="{fontWeight:'700'}" @confirm="stopConfirm"
confirm-color="rgb(255, 117, 129)"> confirm-color="rgb(255, 117, 129)">
<view class="color-red u-text-left"> <view class="color-red u-text-left">
<text>2025年2月8日将关闭网页访问请及时下载最新APP</text> <text>2025年2月8日将关闭网页访问请及时下载最新APP</text>
</view> </view>
</up-modal> </up-modal>
<!-- #endif --> <!-- #endif -->
<!-- 公告弹窗 -->
<up-modal :show="datas.stopShows" :showConfirmButton="true" title="公告" @confirm="confirmEvent ">
<view class="color-red u-text-left">
<view style="text-align: justify;font-size: 18px;color: #666;"
v-html="datas.noticeList[datas.cloneNum].title"></view>
</view>
</up-modal>
<!-- #ifdef APP -->
<!-- #endif -->
</template> </template>
<script setup> <script setup>
@@ -124,13 +128,13 @@
list: [], // 底部短剧内容 list: [], // 底部短剧内容
page: 1, // 首页推荐分页 page: 1, // 首页推荐分页
stopShow:true,//h5关闭弹窗 stopShow: true, //h5关闭弹窗
ruleShow: false, ruleShow: false,
rule_title: '', // 首页弹窗标题 rule_title: '', // 首页弹窗标题
rule_content: '', // 首页弹窗内容 rule_content: '', // 首页弹窗内容
ruleIndex: 0, ruleIndex: 0,
ruleList: [], ruleList: [],
stopShows: false,
version: { version: {
show: false, show: false,
title: "", title: "",
@@ -139,7 +143,8 @@
cancelText: "", cancelText: "",
downloadLink: "" downloadLink: ""
}, },
setindexdata: false setindexdata: false,
cloneNum: 0
}) })
onLoad(() => { onLoad(() => {
versionUpdate() versionUpdate()
@@ -164,16 +169,26 @@
++datas.page ++datas.page
getrecomVideo() getrecomVideo()
}) })
function stopConfirm(){ function confirmEvent() {
datas.stopShow=false datas.stopShows = false
if (datas.cloneNum < datas.noticeList.length - 1) {
++datas.cloneNum
datas.stopShows = true
}
}
function stopConfirm() {
datas.stopShow = false
uni.navigateTo({ uni.navigateTo({
url:'/pages/login/download' url: '/pages/login/download'
}) })
} }
function stopCancel(){
datas.stopShow=false function stopCancel() {
datas.stopShow = false
} }
function versionUpdate() { function versionUpdate() {
//#ifdef APP-PLUS //#ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //竖屏正方向锁定 plus.screen.lockOrientation('portrait-primary'); //竖屏正方向锁定
@@ -288,10 +303,14 @@
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
if (res.list.length) {
datas.stopShows = true
}
} }
//获取推荐视频 //获取推荐视频
async function getrecomVideo(sort, active = 1) { async function getrecomVideo(sort, active = 1) {