tree.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="base-container">
  3. <member-level>
  4. <view class="toogle" @click="handleShow">切换 {{name}}<up-icon class="icon" name="arrow-down" color="#fff"
  5. size="12"></up-icon></view>
  6. </member-level>
  7. <view class="tree-cont">
  8. <image class="drone-icon" :src="`${config.BASIC_IMG}img/treePage/drone-icon.png`"></image>
  9. <view class="tool-wrap">
  10. <view class="tool-left">
  11. <view :class="['tool-item',item.className]" v-for="(item,index) in toolLeftList" :key="index"
  12. @click="handleToolItem(item)">
  13. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/l-tree-icon-${index+1}.png`"></image>
  14. <view class="name">{{item.name}}</view>
  15. </view>
  16. </view>
  17. <view class="tool-right">
  18. <view :class="['tool-item',item.className]" v-for="(item,index) in toolRightList" :key="index"
  19. @click="handleToolItem(item)">
  20. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/r-tree-icon-${index+1}.png`"></image>
  21. <view class="name">{{item.name}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="tree-footer">
  27. <view class="footer-item" v-for="(item,index) in footerList" :key="index">
  28. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-${index+1}.png`"></image>
  29. <view class="name">{{item}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 切换 -->
  34. <up-picker :show="showPicker" :columns="columns" :defaultIndex="[0]" @cancel="handleCancel"
  35. @confirm="handleConfirm"></up-picker>
  36. <!-- 编辑树名称 -->
  37. <editNamePopup></editNamePopup>
  38. <!-- 海报弹窗 -->
  39. <posterPopup :showPoster="showPoster"></posterPopup>
  40. <!-- 果树成功弹窗 -->
  41. <guardSuccessPopup :show="showGuardSuccess"></guardSuccessPopup>
  42. </template>
  43. <script setup>
  44. import config from "@/api/config.js"
  45. import { onLoad } from '@dcloudio/uni-app'
  46. import memberLevel from "./components/memberLevel.vue"
  47. import {
  48. ref,
  49. reactive,
  50. onMounted
  51. } from 'vue';
  52. const name = ref('荔枝')
  53. const showPicker = ref(false)
  54. const columns = reactive([
  55. ['荔枝', '香蕉', '苹果']
  56. ]);
  57. const handleShow = () => {
  58. showPicker.value = true
  59. }
  60. const handleCancel = () => {
  61. showPicker.value = false
  62. }
  63. const handleConfirm = (e) => {
  64. name.value = e.value[0]
  65. handleCancel()
  66. }
  67. const toolLeftList = [{
  68. name: "相册",
  69. },
  70. {
  71. name: "日记",
  72. path: 'diary'
  73. },
  74. {
  75. name: "海报",
  76. className: 'blue',
  77. clickName:'poster'
  78. },
  79. {
  80. name: "礼物",
  81. className: 'gift',
  82. path: 'gift'
  83. }
  84. ]
  85. const toolRightList = [{
  86. name: "好友",
  87. className: 'friend',
  88. path: 'rank'
  89. },
  90. {
  91. name: "认养",
  92. },
  93. {
  94. name: "果园",
  95. },
  96. {
  97. name: "动态",
  98. className: 'dynamic',
  99. path: 'dynamic'
  100. }
  101. ]
  102. const showGuardSuccess = ref(false)
  103. onLoad(({successTree})=>{
  104. if(successTree){
  105. showGuardSuccess.value = true
  106. }
  107. })
  108. const showPoster = ref(false)
  109. const handleToolItem = ({
  110. path,clickName
  111. }) => {
  112. if(clickName){
  113. showPoster.value = !showPoster.value
  114. }else{
  115. uni.navigateTo({
  116. url: `/pages/tabBar/tree/subPages/${path}`
  117. });
  118. }
  119. }
  120. const footerList = ["每日阳光", "送ta祝福", "分享转发", "水果订购"]
  121. </script>
  122. <style lang="scss" scoped>
  123. @import "@/static/style/mixin.scss";
  124. .base-container {
  125. @include ossBg("tree-bg.png");
  126. // background-position: top left;
  127. padding: 22rpx 0;
  128. .toogle {
  129. position: absolute;
  130. right: 0;
  131. top: calc(50% - 32rpx);
  132. font-size: 24rpx;
  133. color: #fff;
  134. border-radius: 50rpx 0 0 50rpx;
  135. background: rgba(0, 0, 0, 0.2);
  136. padding: 12rpx 20rpx;
  137. display: flex;
  138. .icon {
  139. margin-left: 10rpx;
  140. }
  141. }
  142. .tree-cont {
  143. width: 100%;
  144. margin-top: 10rpx;
  145. .drone-icon {
  146. width: 376rpx;
  147. height: 384rpx;
  148. margin-left: 26rpx;
  149. }
  150. .tool-wrap {
  151. width: 100%;
  152. padding: 14rpx;
  153. box-sizing: border-box;
  154. position: absolute;
  155. bottom: calc(50% - 350rpx);
  156. display: flex;
  157. justify-content: space-between;
  158. .tool-left,
  159. .tool-right {
  160. .tool-item {
  161. color: #fff;
  162. font-size: 24rpx;
  163. font-weight: 500;
  164. text-align: center;
  165. width: 100rpx;
  166. margin-bottom: 16rpx;
  167. text-shadow:
  168. 0 0 3rpx #D7660A,
  169. 0 0 3rpx #D7660A,
  170. 0 0 3rpx #D7660A,
  171. 0 0 3rpx #D7660A;
  172. &.blue {
  173. text-shadow:
  174. 0 0 3rpx #2199F8,
  175. 0 0 3rpx #2199F8,
  176. 0 0 3rpx #2199F8,
  177. 0 0 3rpx #2199F8;
  178. }
  179. .icon {
  180. width: 100%;
  181. height: 82rpx;
  182. position: relative;
  183. }
  184. .name {
  185. margin-top: -24rpx;
  186. position: relative;
  187. z-index: 2;
  188. }
  189. &.gift {
  190. .icon {
  191. height: 114rpx;
  192. margin-top: -5rpx;
  193. }
  194. .name {
  195. margin-top: -44rpx;
  196. }
  197. }
  198. &.friend {
  199. .icon {
  200. height: 90rpx;
  201. }
  202. .name {
  203. margin-top: -35rpx;
  204. }
  205. }
  206. &.dynamic {
  207. .icon {
  208. height: 96rpx;
  209. }
  210. .name {
  211. margin-top: -32rpx;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. .tree-footer {
  219. position: absolute;
  220. left: 0;
  221. bottom: 76rpx;
  222. width: 100%;
  223. display: flex;
  224. justify-content: center;
  225. .footer-item {
  226. width: 18%;
  227. text-align: center;
  228. .icon {
  229. width: 96rpx;
  230. height: 96rpx;
  231. }
  232. .name {
  233. font-size: 24rpx;
  234. font-weight: 500;
  235. padding: 2rpx 16rpx;
  236. background-image: linear-gradient(0deg, #FFFFFF, #FFE079);
  237. border-radius: 50rpx;
  238. border: 2rpx solid #fff;
  239. }
  240. }
  241. .footer-item+.footer-item {
  242. margin-left: 30rpx;
  243. }
  244. }
  245. }
  246. </style>