裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

169 lines
5.1 KiB

<template>
<view>
<view class="content">
<view class="title">{{ detail.title || '' }}</view>
<view class="desc">{{ detail.publishTime ? `发布于${detail.publishTime}` : '' }}</view>
<editor id="editor" class="editor"
:read-only="true"
@ready="onEditorReady"
></editor>
</view>
<uv-overlay :show="true" :opacity="0">
<navbar leftClick @leftClick="$utils.navigateBack" />
<button class="btn" type="success" @click="openPopup">查看更多</button>
<popupUnlock ref="popupUnlock" src="../static/sharing/unlock-article.png"></popupUnlock>
<popupQrCode ref="popupQrCode" :src="detail.qrCode"></popupQrCode>
</uv-overlay>
</view>
</template>
<script>
import popupUnlock from '../components/popupUnlock.vue'
import popupQrCode from '../components/popupQrCode.vue'
export default {
components: {
popupUnlock,
popupQrCode,
},
data() {
return {
detail: {
id: null,
groupName: null,
imageUrl: null,
times: null,
qrCode: null,
title: null,
description: null,
auditStatus: null,
createTime: null,
publishTime: null,
state: null,
},
isLocked: true,
}
},
async onLoad(option) {
const { id } = option
await this.fetchSharingDetail(id)
this.initEditor(this.detail.description)
},
onShareAppMessage(res) {
const {
title,
imageUrl,
} = this.detail
// todo: check
let o = {
title : title,
imageUrl: imageUrl,
query: `id=${this.detail.id}`,
}
// todo: check callback? settimeout?
// todo: get times and check is unlocked
this.isLocked = false
this.$refs.popupQrCode.open()
return o
},
methods: {
onEditorReady() {
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
},
initEditor(html) {
if (!this.editorCtx) {
setTimeout(() => {
this.initEditor(html)
}, 200)
return
}
this.editorCtx.setContents({ html })
},
async fetchSharingDetail(id) {
// todo: init data by id
this.detail = {
id: '001',
groupName: '裂变星创业服务交流群',
imageUrl: 'http://gips3.baidu.com/it/u=70459541,3412285454&fm=3028&app=3028&f=JPEG&fmt=auto?w=960&h=1280',
times: 10,
qrCode: '../static/temp-qrcode.png',
title: '裂变星轻松获客',
description: '<p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p><br></p><p>aaaaaaaaa</p><p><br></p><p><br></p><p>bbbbbbb</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p><br></p><p>aaaaaaaaa</p><p><br></p><p><br></p><p>bbbbbbb</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p>',
auditStatus: 2,
createTime: '2025年2月1日',
publishTime: '2024年11月13日 11:29',
state: 2,
}
},
openPopup() {
if (this.isLocked) {
this.$refs.popupUnlock.open();
} else {
this.$refs.popupQrCode.open()
}
}
}
}
</script>
<style scoped lang="scss">
.content {
padding: 40rpx 20rpx;
padding-top: calc(#{$navbar-height} + var(--status-bar-height) + 20rpx + 40rpx);
}
.title {
color: #474747;
font-size: 36rpx;
font-weight: 700;
}
.desc {
color: #A2A2A2;
font-size: 24rpx;
margin-top: 6rpx;
}
.editor {
margin-top: 22rpx;
height: 40vh;
}
.btn {
position: absolute;
width: calc(100% - 60rpx*2);
height: auto;
left: 60rpx;
bottom: 292rpx;
background-color: #07C160;
border: none;
color: #FFFFFF;
font-size: 28rpx;
line-height: 1;
border-radius: 45rpx;
padding: 25rpx 0;
box-sizing: border-box;
}
</style>