|
@@ -24,9 +24,14 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="tree-footer">
|
|
|
- <view class="footer-item" v-for="(item,index) in footerList" :key="index">
|
|
|
- <image class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-${index+1}.png`"></image>
|
|
|
- <view class="name">{{item}}</view>
|
|
|
+ <view class="footer-item" v-for="(item,index) in footerList" :key="index" @click="handleItem(index)">
|
|
|
+ <view @click="requestSubscribe">
|
|
|
+ <button class="share-btn" open-type="share" v-if="index === 2">
|
|
|
+ <image class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-${index+1}.png`"></image>
|
|
|
+ </button>
|
|
|
+ <image v-else class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-${index+1}.png`"></image>
|
|
|
+ <view class="name">{{item}}</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -36,20 +41,23 @@
|
|
|
<!-- 编辑树名称 -->
|
|
|
<editNamePopup></editNamePopup>
|
|
|
<!-- 海报弹窗 -->
|
|
|
- <posterPopup :showPoster="showPoster" :farmBuyId="farmBuyId"></posterPopup>
|
|
|
+ <posterPopup :showPoster="showPoster" :farmBuyId="farmBuyId" :treeName="treeName"></posterPopup>
|
|
|
<!-- 果树成功弹窗 -->
|
|
|
<guardSuccessPopup :show="showGuardSuccess"></guardSuccessPopup>
|
|
|
<!-- 果树相册弹窗 -->
|
|
|
<tree-album-popup :show="showAlbum"></tree-album-popup>
|
|
|
<!-- 等级升级成功弹窗 -->
|
|
|
- <levelSuccessPopup></levelSuccessPopup>
|
|
|
+ <levelSuccessPopup></levelSuccessPopup>
|
|
|
+ <!-- 祝福弹窗 -->
|
|
|
+ <blessingsPopup :show="showBlessingsPopup" :showSuccess="showSuccess" :farmBuyId="farmBuyId" :clockinType="clockinType" @clockinCallback="getBySampleId"></blessingsPopup>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import config from "@/api/config.js"
|
|
|
- import { onLoad } from '@dcloudio/uni-app'
|
|
|
+ import { onLoad ,onShareAppMessage} from '@dcloudio/uni-app'
|
|
|
import memberLevel from "./components/memberLevel.vue"
|
|
|
import treeAlbumPopup from "./components/treeAlbumPopup.vue"
|
|
|
+ import blessingsPopup from "./components/blessingsPopup.vue"
|
|
|
import TREE from '@/api/tree.js'
|
|
|
import {
|
|
|
ref,
|
|
@@ -121,11 +129,17 @@
|
|
|
|
|
|
const treeData = ref({})
|
|
|
const farmBuyId = ref('')
|
|
|
+ const treeName = ref('')
|
|
|
+ const userInfo = uni.getStorageSync('userInfo')
|
|
|
const getBySampleId = () =>{
|
|
|
- //81317 88891
|
|
|
- TREE.getBySampleId({sampleId:172055}).then(res =>{
|
|
|
- treeData.value = res.data || {}
|
|
|
- farmBuyId.value = res.data.buyList[0].id
|
|
|
+ TREE.getBySampleId({sampleId:172055}).then(({data}) =>{
|
|
|
+ treeData.value = data || {}
|
|
|
+ if(userInfo.tel){
|
|
|
+ treeName.value = data.buyList[0].treeName || (data.buyList[0].nickname.length?data.buyList[0].nickname.slice(0, 3)+"荔": data.buyList[0].owner.slice(0, 3)+"荔")
|
|
|
+ }else{
|
|
|
+ treeName.value = '飞鸟守护'
|
|
|
+ }
|
|
|
+ farmBuyId.value = data.buyList[0].id
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -144,7 +158,79 @@
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- const footerList = ["每日阳光", "送ta祝福", "分享转发", "水果订购"]
|
|
|
+ const footerList = ["每日阳光", "送ta祝福", "分享转发", "水果订购"]
|
|
|
+ const showBlessingsPopup = ref(false)
|
|
|
+ const showSuccess = ref(false)
|
|
|
+ const clockinType = ref('1')
|
|
|
+ const handleItem = (index) =>{
|
|
|
+ if(index === 0){
|
|
|
+ clockinType.value = 1
|
|
|
+ if(treeData.value.buyList[0].level.clockinMap['1']){
|
|
|
+ uni.showToast({
|
|
|
+ title: '今日已守护',
|
|
|
+ icon:'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ showSuccess.value = !showSuccess.value
|
|
|
+ }
|
|
|
+ }else if(index === 1){
|
|
|
+ clockinType.value = 3
|
|
|
+ if(treeData.value.buyList[0].level.clockinMap['3']){
|
|
|
+ uni.showToast({
|
|
|
+ title: '今日已送过祝福',
|
|
|
+ icon:'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ showBlessingsPopup.value = !showBlessingsPopup.value
|
|
|
+ }
|
|
|
+ }else if(index === 2){
|
|
|
+ clockinType.value = 2
|
|
|
+ if(!treeData.value.buyList[0].level.clockinMap['2']){
|
|
|
+ showSuccess.value = !showSuccess.value
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ console.log('123')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function requestSubscribe() {
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ //订阅模板
|
|
|
+ TREE.getSubscribeTemplate({id:1}).then(({data}) =>{
|
|
|
+ uni.requestSubscribeMessage({
|
|
|
+ tmplIds: [data.templateId], // 模板ID
|
|
|
+ success(res) {
|
|
|
+ if (res[data.templateId] === 'accept') {
|
|
|
+ TREE.addSubscribe({templateId:1})
|
|
|
+ } else if (res[data.templateId] === 'reject') {
|
|
|
+ console.log('用户拒绝订阅模板');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ uni.openSetting({
|
|
|
+ withSubscriptions: true, // 显示订阅消息开关
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+
|
|
|
+ onShareAppMessage((res) => {
|
|
|
+ if (res.from === 'button') {
|
|
|
+ const params = {
|
|
|
+ sampleId:treeData.value.buyList[0].sampleId,
|
|
|
+ farmId:treeData.value.buyList[0].farmId,
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ title: '我分享了我的果树,快来查看吧~',
|
|
|
+ path: `/pages/tabBar/tree/subPages/friendTree?params=${JSON.stringify(params)}`, // 分享的小程序页面路径
|
|
|
+ imageUrl:`http://birdseye-api.feiniaotech.sysuimars.cn/mini/z_farm_buy/genImage/${farmBuyId.value}?key=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9&x1=25&y1=220&fontSize1=40&x2=55&y2=250&fontSize2=16×tamp=${Date.now()}`,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -270,7 +356,14 @@
|
|
|
|
|
|
.footer-item {
|
|
|
width: 18%;
|
|
|
- text-align: center;
|
|
|
+ text-align: center;
|
|
|
+ .share-btn{
|
|
|
+ background: transparent;
|
|
|
+ display: inline-flex;
|
|
|
+ &::after{
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
.icon {
|
|
|
width: 96rpx;
|