Files
t/pages/preview/preview.vue
T
2025-03-12 20:11:03 +08:00

168 lines
3.9 KiB
Vue

<template>
<view class="v-preview">
<image :src="templateSrc" alt="" class="img" mode="widthFix" />
<view class="btn-area">
<view class="red-btn-area">
<button class="red-btn">老兵直播</button>
<button class="red-btn">老兵故事</button>
<button class="red-btn">在线注册</button>
</view>
<view class="red-btn-plain-area">
<view class="red-btn-plain" @click="toIndex()">新四军</view>
<view class="red-btn-plain">抗美援朝</view>
<view class="red-btn-plain">抗美援越</view>
<view class="red-btn-plain">对越自卫反击战</view>
<view class="red-btn-plain">和平时期退役兵</view>
</view>
</view>
<editor
id="editor"
class="cu-editor"
placeholder=""
read-only
:show-img-size="false"
:show-img-toolbar="false"
:show-img-resize="false"
@ready="onEditorReady"
@input="onEditorInput"
></editor>
</view>
</template>
<script>
export default {
data() {
return {
templateSrc: "",
musicSrc: "",
html: "",
};
},
methods: {
toIndex() {
uni.navigateTo({
url:"/pages/articleContentDetail/articleContentDetail"
})
},
onEditorReady() {
const that = this;
uni
.createSelectorQuery()
.in(this)
.select("#editor")
.context(function (res) {
that.editorCtx = res.context;
that.setValue();
})
.exec();
},
setValue() {
if (this.editorCtx) {
this.editorCtx.setContents({
html: this.html,
success: () => {},
});
}
},
// onEditorInput(e) {
// let { html, text } = e.detail;
// this.curLength = text.length - 1;
// },
},
onLoad(options) {
console.log(options); // 输出上一个页面传递的 id 参数
},
mounted() {
this.templateSrc = "https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/bg.jpg?expire_at=1741101988&er_sign=c9732cddaaead925cf110d9a11751231";
// this.templateSrc = uni.getStorageSync("templateSrc");
this.musicSrc = uni.getStorageSync("musicSrc");
this.html = uni.getStorageSync("html");
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.src = this.musicSrc;
innerAudioContext.autoplay = true; // 自动播放
innerAudioContext.play();
},
};
</script>
<style lang="scss" scoped>
.v-preview {
.img {
width: 100%;
}
.cu-editor {
box-sizing: border-box;
width: 100%;
height: 100%;
font-size: 28rpx;
line-height: 1.5;
overflow: auto;
padding: 40rpx 35rpx;
min-height: unset !important;
}
.btn-area {
position: relative;
top: -50rpx;
}
.red-btn-area {
display: flex;
justify-content: center;
padding: 10rpx 0;
margin: 0 40rpx 20rpx 40rpx;
font-size: 20rpx;
.red-btn {
position: relative;
color: #fff;
font-weight: 700;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
margin: 0;
background-image: linear-gradient(to bottom, #c11c1f, #5c0201);
+ .red-btn {
margin-left: 20rpx;
}
}
}
.red-btn-plain-area {
display: flex;
justify-content: center;
padding: 10rpx 0;
margin: 0 40rpx;
font-size: 21rpx;
border-top: 2px solid;
border-bottom: 2px solid;
border-image: linear-gradient(
to right,
#fff,
#f44336bf,
#b13636,
#f44336bf,
#fff
)
1;
.red-btn-plain {
position: relative;
color: #b13636;
font-weight: 700;
padding-left: 15rpx;
+ .red-btn-plain {
margin-left: 10rpx;
&::before {
// border-left: 2px solid #f44336;
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 2px;
height: 20rpx;
background-color: #b13636;
}
}
}
}
}
</style>