@ -0,0 +1,53 @@ | |||||
<template> | |||||
<uv-popup | |||||
ref="popup" | |||||
:overlayOpacity="0.8" | |||||
mode="bottom" | |||||
round="20rpx" | |||||
> | |||||
<view class="flex qr-popup"> | |||||
<text class="tips">长按识别二维码,了解更多内容!</text> | |||||
<image class="qr" :src="src"></image> | |||||
</view> | |||||
</uv-popup> | |||||
</template> | |||||
<script> | |||||
export default { | |||||
props: { | |||||
src: { | |||||
type: String, | |||||
default: null | |||||
} | |||||
}, | |||||
data() { | |||||
return { | |||||
} | |||||
}, | |||||
methods: { | |||||
open() { | |||||
this.$refs.popup.open(); | |||||
}, | |||||
close() { | |||||
this.$refs.popup.close(); | |||||
}, | |||||
}, | |||||
} | |||||
</script> | |||||
<style scoped lang="scss"> | |||||
.qr-popup { | |||||
flex-direction: column; | |||||
.tips { | |||||
margin-top: 75rpx; | |||||
color: #1B1B1B; | |||||
font-size: 32rpx; | |||||
} | |||||
.qr { | |||||
margin-top: 40rpx; | |||||
width: 350rpx; | |||||
height: 350rpx; | |||||
} | |||||
} | |||||
</style> |
@ -0,0 +1,62 @@ | |||||
<template> | |||||
<uv-popup | |||||
ref="popup" | |||||
:overlayOpacity="0.8" | |||||
:customStyle="{ | |||||
backgroundColor: 'transparent', | |||||
}" | |||||
> | |||||
<view> | |||||
<image class="popup-bg" :src="src"></image> | |||||
<view class="flex popup-btns"> | |||||
<button plain class="btn-simple" @click="close"> | |||||
<image class="popup-btn" src="../static/sharing/cancel.png"></image> | |||||
</button> | |||||
<button plain class="btn-simple" open-type="share"> | |||||
<image class="popup-btn" src="../static/sharing/forward.png"></image> | |||||
</button> | |||||
</view> | |||||
</view> | |||||
</uv-popup> | |||||
</template> | |||||
<script> | |||||
export default { | |||||
props: { | |||||
src: { | |||||
type: String, | |||||
default: null | |||||
} | |||||
}, | |||||
data() { | |||||
return { | |||||
} | |||||
}, | |||||
methods: { | |||||
open() { | |||||
this.$refs.popup.open(); | |||||
}, | |||||
close() { | |||||
this.$refs.popup.close(); | |||||
}, | |||||
}, | |||||
} | |||||
</script> | |||||
<style scoped lang="scss"> | |||||
.popup { | |||||
&-bg { | |||||
width: 578rpx; height: 317rpx; | |||||
} | |||||
&-btns { | |||||
justify-content: space-between; | |||||
margin-top: 56rpx; | |||||
} | |||||
&-btn { | |||||
width: 265rpx; | |||||
height: 84rpx; | |||||
} | |||||
} | |||||
</style> |
@ -1,18 +1,169 @@ | |||||
<template> | <template> | ||||
<view> | <view> | ||||
<navbar leftClick @leftClick="$utils.navigateBack" /> | |||||
<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> | </view> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
import popupUnlock from '../components/popupUnlock.vue' | |||||
import popupQrCode from '../components/popupQrCode.vue' | |||||
export default { | export default { | ||||
components: { | |||||
popupUnlock, | |||||
popupQrCode, | |||||
}, | |||||
data() { | data() { | ||||
return { | 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> | </script> | ||||
<style scoped lang="scss"> | <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> | </style> |
@ -1,18 +1,154 @@ | |||||
<template> | <template> | ||||
<view> | |||||
<view class="page"> | |||||
<navbar leftClick @leftClick="$utils.navigateBack" /> | <navbar leftClick @leftClick="$utils.navigateBack" /> | ||||
<view class="content"> | |||||
<image class="avatar" :src="detail.imageUrl"></image> | |||||
<text class="nick-name">{{ detail.groupName }}</text> | |||||
<template v-if="isLocked"> | |||||
<button class="btn" type="success" @click="openPopup">加入</button> | |||||
</template> | |||||
<view v-else class="group-info flex"> | |||||
<text>扫一扫,加群主审核进群</text> | |||||
<image class="qr" :src="detail.qrCode"></image> | |||||
</view> | |||||
</view> | |||||
<popupUnlock ref="popupUnlock" src="../static/sharing/unlock-group.png"></popupUnlock> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
import popupUnlock from '../components/popupUnlock.vue' | |||||
export default { | export default { | ||||
components: { | |||||
popupUnlock, | |||||
}, | |||||
data() { | data() { | ||||
return { | return { | ||||
detail: { | |||||
id: null, | |||||
avatarUrl: null, | |||||
nickName: null, | |||||
imageUrl: null, | |||||
times: 10, | |||||
qrCode: null, | |||||
description: null, | |||||
}, | |||||
isLocked: true, | |||||
} | |||||
}, | |||||
onLoad(option) { | |||||
const { id } = option | |||||
this.fetchSharingDetail(id) | |||||
}, | |||||
onShareAppMessage(res) { | |||||
const { | |||||
description, | |||||
imageUrl, | |||||
} = this.detail | |||||
// todo: check | |||||
let o = { | |||||
title : description, | |||||
imageUrl: imageUrl, | |||||
// path: `/pages_order/sharing/personal?id=${this.detail.id}` | |||||
query: `id=${this.detail.id}`, | |||||
} | } | ||||
} | |||||
// todo: check callback? settimeout? | |||||
// todo: get times and check is unlocked | |||||
this.isLocked = false | |||||
return o | |||||
}, | |||||
methods: { | |||||
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: '如此好用的赚钱项目,赶快加入吧!', | |||||
auditStatus: 2, | |||||
createTime: '2025年2月1日', | |||||
state: 2, | |||||
} | |||||
}, | |||||
openPopup() { | |||||
this.$refs.popupUnlock.open(); | |||||
}, | |||||
}, | |||||
} | } | ||||
</script> | </script> | ||||
<style scoped lang="scss"> | <style scoped lang="scss"> | ||||
.page { | |||||
position: relative; | |||||
height: 100vh; | |||||
} | |||||
.content { | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
} | |||||
.avatar { | |||||
width: 180rpx; | |||||
height: 180rpx; | |||||
margin-top: 127rpx; | |||||
} | |||||
.nick-name { | |||||
color: #1B1B1B; | |||||
font-size: 32rpx; | |||||
margin-top: 30rpx; | |||||
} | |||||
.btn, .group-info { | |||||
position: absolute; | |||||
} | |||||
.btn { | |||||
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; | |||||
} | |||||
.group-info { | |||||
bottom: 269rpx; | |||||
flex-direction: column; | |||||
color: #1B1B1B; | |||||
font-size: 32rpx; | |||||
} | |||||
.qr { | |||||
margin-top: 40rpx; | |||||
width: 350rpx; | |||||
height: 350rpx; | |||||
} | |||||
</style> | </style> |