aircraft-pilot/aircraft/index/rich-detail.vue

167 lines
4.1 KiB
Vue
Raw Normal View History

2025-08-04 10:36:35 +08:00
<!-- 纯富文本展示页-暂时无用搬运为修改 -->
2025-07-02 14:58:38 +08:00
<template>
<!-- #ifdef APP -->
<view class="rich-detail" :style="{ backgroundImage: `url(${myFileUrl+background})`,paddingTop: CustomBar+'rpx' }">
<view class="app-top" :style="{ height: CustomBar+'rpx',
background: topLevel===0? '#ffffff00' : `rgba(255, 255, 255,${topLevel})` }"></view>
<!-- #endif -->
<!-- #ifndef APP -->
<view class="rich-detail" :style="{ backgroundImage: `url(${myFileUrl+background})` }">
<!-- #endif -->
<view class="rdt-top">
<!-- #ifdef MP -->
<view :style="{height: `${StatusBar}px`}"></view>
<view class="app-top" :style="{height: `${StatusBar}px`,background: topLevel===0? '#ffffff00' : `rgba(255, 255, 255,${topLevel})`}"></view>
<view class="mobile-logo" :style="{height: `${CustomBarHeight}px`,backgroundColor: `rgba(255, 255, 255,${topLevel})`}">
<!-- #endif -->
<!-- #ifndef MP -->
<view class="mobile-logo" :style="{backgroundColor: `rgba(255, 255, 255,${topLevel})`}">
<!-- #endif -->
<u-icon name="arrow-left" size="40" class="back" @click="back"
:color="topLevel===0? '#f9f9f9' : `rgba(194, 234, 4,${topLevel})`"></u-icon>
<image :src="myFileUrl+logo"></image>
<view style="width: 75rpx;"></view>
</view>
<view class="detail-content">
<u-parse :html="content"></u-parse>
</view>
</view>
<Loading :show="loading" />
</view>
</template>
<script>
import configService from '@/common/config.service.js';
export default {
data(){
return{
// #ifdef MP
// 微信小程序自定义导航栏参数
StatusBar: this.StatusBar || 0,
CustomBarHeight: this.Custom.height+(this.Custom.top-this.StatusBar)*2 || 0,
// #endif
content: '',
loading: true,// 加载
// 基础路径
myFileUrl: configService.fileUrl + 'pixel/my/',
// 我的页面背景
background: 'background.png',
// logo图标
logo: 'logo-new.png',
// 顶部距离等级
topLevel: 0,
}
},
// #ifndef H5
onPageScroll(e) {
const level = e.scrollTop/60;
if(level<=1) this.topLevel = level;
else this.topLevel = 1;
},
// #endif
// #ifdef H5
mounted(){
let that = this;
window.onscroll = function () {
//为了保证兼容性,这里取三个值,哪个有值取哪一个
//scrollTop就是触发滚轮事件时滚轮的高度
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
const level = scrollTop/60;
if(level<=1) that.topLevel = level;
else that.topLevel = 1;
}
},
onHide() {
window.onscroll = null;
},
// #endif
methods:{
// 返回
back(){
uni.navigateBack();
},
// 获取协议内容
async getAgreement(name){
if(!name) {
this.content = '暂无协议内容';
return;
}
try{
this.loading = true;
let res = await this.$api.getArticles({title: name});
if(res.success){
this.content = res.data.records[0].text;
}else{
this.content = name + '\n暂无协议内容';
}
}catch(e){
}finally{
this.loading = false;
}
}
},
onLoad(options) {
uni.setNavigationBarTitle({
title: options.name || '协议内容'
});
this.getAgreement(options.name);
},
}
</script>
<style scoped lang="scss">
.rich-detail{
display: flex;
flex-direction: column;
min-height: 100vh;
background-size: cover;
// #ifdef APP || MP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.rdt-top{
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.mobile-logo{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.back{
margin-left: 35rpx;
margin-top: 5rpx
}
position: fixed;
z-index: 81;
padding: 15rpx 0;
image{
width: 200rpx;
height: 45rpx;
}
// .u-icon{
// }
}
}
// padding: 40rpx;
.detail-content{
margin: 80rpx 40rpx 32rpx;
background-color: rgba(160, 160, 160, 0.4);
border-radius: 20rpx;
padding: 40rpx 25rpx 20rpx;
color: #f9f9f9;
}
}
</style>