friendTree.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="base-template">
  3. <view class="sub-base-container">
  4. <member-level :treeData="treeData"></member-level>
  5. <view class="tree-cont">
  6. <view class="tree-name">
  7. <view>{{treeName}}</view>
  8. </view>
  9. <image class="drone-icon" :src="`${config.BASIC_IMG}img/treePage/drone-icon.png`"></image>
  10. <view class="tool-wrap">
  11. <view class="tool-left">
  12. <view :class="['tool-item',item.className]" v-for="(item,index) in toolList" :key="index">
  13. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/${item.icon}.png`"></image>
  14. <view class="name">{{item.name}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="tree-footer">
  20. <view class="blessing" @click="handleBlessing">
  21. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-2.png`"></image>
  22. <text>送ta祝福</text>
  23. </view>
  24. <view class="button" @click="handlePage">{{userInfo.tel?'去看看我的树':'开启我的守护'}}</view>
  25. </view>
  26. </view>
  27. <!-- 祝福弹窗 -->
  28. <blessingsPopup :show="showBlessingsPopup" clockinType="3" :farmBuyId="farmBuyId" @clockinCallback="getBySampleId" isFriend></blessingsPopup>
  29. </view>
  30. </template>
  31. <script setup>
  32. import config from "@/api/config.js"
  33. import memberLevel from "../components/memberLevel.vue"
  34. import blessingsPopup from "../components/blessingsPopup.vue"
  35. import {
  36. onLoad
  37. } from '@dcloudio/uni-app'
  38. import TREE from '@/api/tree.js'
  39. import {
  40. ref,
  41. reactive,
  42. } from 'vue';
  43. const userInfo = uni.getStorageSync('userInfo')
  44. const handlePage = () => {
  45. if (userInfo.tel) {
  46. uni.switchTab({
  47. url: '/pages/tabBar/tree/tree'
  48. })
  49. } else {
  50. uni.navigateTo({
  51. url: `/pages/tabBar/home/subPages/gardenMap?enterSelectTree=true`
  52. });
  53. }
  54. }
  55. const sampleId = ref('')
  56. onLoad((options) => {
  57. sampleId.value = options.sampleId
  58. getBySampleId()
  59. })
  60. const treeData = ref({})
  61. const treeName = ref('')
  62. const farmBuyId = ref('')
  63. const getBySampleId = () => {
  64. TREE.getBySampleId({
  65. sampleId: sampleId.value
  66. }).then(({
  67. data
  68. }) => {
  69. treeData.value = data || {}
  70. treeName.value = data.buyList[0].treeName || (data.buyList[0].nickname.length ? data.buyList[0]
  71. .nickname.slice(0, 3) + "荔" : data.buyList[0].owner.slice(0, 3) + "荔")
  72. farmBuyId.value = data.buyList[0].id
  73. })
  74. }
  75. const showBlessingsPopup = ref(false)
  76. const handleBlessing = () => {
  77. if(treeData.value.buyList[0].level.clockinMap['3']){
  78. uni.showToast({
  79. title: '今日已送过祝福',
  80. icon: 'none',
  81. duration: 2000
  82. });
  83. }else{
  84. showBlessingsPopup.value = !showBlessingsPopup.value
  85. }
  86. }
  87. const toolList = [{
  88. name: "相册",
  89. icon: 'l-tree-icon-1'
  90. },
  91. {
  92. name: "日记",
  93. icon: 'l-tree-icon-2'
  94. },
  95. {
  96. name: "果园",
  97. icon: 'r-tree-icon-3'
  98. }
  99. ]
  100. const handleToolItem = ({
  101. path
  102. }) => {
  103. uni.navigateTo({
  104. url: `/pages/tabBar/tree/subPages/${path}`
  105. });
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. @import "@/static/style/mixin.scss";
  110. .sub-base-container {
  111. @include ossBg("tree-bg.png");
  112. padding: 22rpx 0;
  113. .tree-cont {
  114. width: 100%;
  115. margin-top: 10rpx;
  116. .tree-name {
  117. position: absolute;
  118. top: 60.45%;
  119. left: calc(50% - 32rpx);
  120. z-index: 2;
  121. font-size: 22rpx;
  122. font-family: 'SweiSpringCJKtc';
  123. text-align: center;
  124. width: 88rpx;
  125. }
  126. .drone-icon {
  127. width: 376rpx;
  128. height: 384rpx;
  129. margin-left: 26rpx;
  130. }
  131. .tool-wrap {
  132. width: 100%;
  133. padding: 14rpx;
  134. box-sizing: border-box;
  135. position: absolute;
  136. bottom: calc(50% - 350rpx);
  137. display: flex;
  138. justify-content: space-between;
  139. .tool-left {
  140. .tool-item {
  141. color: #fff;
  142. font-size: 24rpx;
  143. font-weight: 500;
  144. text-align: center;
  145. width: 100rpx;
  146. margin-bottom: 16rpx;
  147. text-shadow:
  148. 0 0 3rpx #D7660A,
  149. 0 0 3rpx #D7660A,
  150. 0 0 3rpx #D7660A,
  151. 0 0 3rpx #D7660A;
  152. .icon {
  153. width: 100%;
  154. height: 82rpx;
  155. position: relative;
  156. }
  157. .name {
  158. margin-top: -24rpx;
  159. position: relative;
  160. z-index: 2;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. .tree-footer {
  167. position: absolute;
  168. left: 0;
  169. bottom: 130rpx;
  170. width: 100%;
  171. display: flex;
  172. flex-direction: column;
  173. align-items: center;
  174. color: #fff;
  175. .blessing {
  176. display: flex;
  177. align-items: center;
  178. background: rgba(0, 0, 0, 0.3);
  179. border-radius: 50rpx;
  180. padding: 6rpx 60rpx;
  181. border: 1rpx solid rgba(255, 255, 255, 0.6);
  182. .icon {
  183. width: 86rpx;
  184. height: 86rpx;
  185. margin-right: 10rpx;
  186. }
  187. }
  188. .button {
  189. padding: 26rpx 80rpx;
  190. border-radius: 50rpx;
  191. border: 2rpx solid #fff;
  192. background-image: linear-gradient(120deg, #FFD887, #ED9E1E);
  193. margin-top: 20rpx;
  194. }
  195. }
  196. }
  197. </style>