tree.vue 6.0 KB

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