tree.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="base-container">
  3. <view class="tree-head">
  4. <view class="user-info">
  5. <up-image class="avatar" :fade="false"
  6. src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" width="96rpx"
  7. height="96rpx" shape="circle"></up-image>
  8. <view class="level-wrap">
  9. <text class="name">V1 青铜守护</text>
  10. <view class="progress-wrap">
  11. <view class="progress-value">
  12. <view class="total"></view>
  13. </view>
  14. <view class="progress-score">
  15. <text class="cur-val">80</text>/100分
  16. </view>
  17. </view>
  18. <view class="level-desc">
  19. 再累计能量<text class="level-text"> 20分 </text>即可升级到 青铜等级
  20. </view>
  21. </view>
  22. </view>
  23. <view class="toogle" @click="handleShow">切换 {{name}}<up-icon class="icon" name="arrow-down" color="#fff" size="12"></up-icon></view>
  24. </view>
  25. <view class="tree-cont">
  26. <view class="tree-info">
  27. <view class="info-text">
  28. <view>汕尾妙荔</view>
  29. <text>现代农业产业园</text>
  30. </view>
  31. <view class="info-text">
  32. <view>16年老树</view>
  33. <text class="text">妃子笑荔枝</text>
  34. </view>
  35. <view class="info-text">
  36. <view>成熟期</view>
  37. <text class="text">温度适宜-梢期杀虫</text>
  38. </view>
  39. </view>
  40. <image class="drone-icon" :src="`${config.BASIC_IMG}img/treePage/drone-icon.png`"></image>
  41. <view class="tool-wrap">
  42. <view class="tool-left">
  43. <view :class="['tool-item',item.className]" v-for="(item,index) in toolLeftList" :key="index">
  44. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/l-tree-icon-${index+1}.png`"></image>
  45. <view class="name">{{item.name}}</view>
  46. </view>
  47. </view>
  48. <view class="tool-right">
  49. <view :class="['tool-item',item.className]" v-for="(item,index) in toolRightList" :key="index" @click="handleToolItem(item)">
  50. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/r-tree-icon-${index+1}.png`"></image>
  51. <view class="name">{{item.name}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="tree-footer">
  57. <view class="footer-item" v-for="(item,index) in footerList" :key="index">
  58. <image class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-${index+1}.png`"></image>
  59. <view class="name">{{item}}</view>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 切换 -->
  64. <up-picker :show="showPicker" :columns="columns" :defaultIndex="[0]" @cancel="handleCancel" @confirm="handleConfirm"></up-picker>
  65. </template>
  66. <script setup>
  67. import config from "@/api/config.js"
  68. import {
  69. ref,
  70. reactive,
  71. onMounted
  72. } from 'vue';
  73. const name = ref('荔枝')
  74. const showPicker = ref(false)
  75. const columns = reactive([
  76. ['荔枝', '香蕉', '苹果']
  77. ]);
  78. const handleShow = () =>{
  79. showPicker.value = true
  80. }
  81. const handleCancel= () =>{
  82. showPicker.value = false
  83. }
  84. const handleConfirm = (e) =>{
  85. name.value = e.value[0]
  86. handleCancel()
  87. }
  88. const toolLeftList = [{
  89. name: "相册",
  90. },
  91. {
  92. name: "日记",
  93. },
  94. {
  95. name: "海报",
  96. className: 'blue'
  97. },
  98. {
  99. name: "礼物",
  100. className: 'gift'
  101. }
  102. ]
  103. const toolRightList = [{
  104. name: "好友",
  105. className: 'friend',
  106. path:'rank'
  107. },
  108. {
  109. name: "认养",
  110. },
  111. {
  112. name: "果园",
  113. },
  114. {
  115. name: "动态",
  116. className: 'dynamic',
  117. path:'dynamic'
  118. }
  119. ]
  120. const handleToolItem = ({path})=>{
  121. uni.navigateTo({
  122. url: `/pages/tabBar/tree/subPages/${path}`
  123. });
  124. }
  125. const footerList = ["每日阳光", "送ta祝福", "分享转发", "水果订购"]
  126. </script>
  127. <style lang="scss" scoped>
  128. @import "@/static/style/mixin.scss";
  129. .base-container {
  130. @include ossBg("tree-bg.png");
  131. // background-position: top left;
  132. padding: 22rpx 0;
  133. .tree-head {
  134. display: flex;
  135. border-radius: 70rpx 0 0 70rpx;
  136. padding: 16rpx 20rpx;
  137. margin-left: 24rpx;
  138. position: relative;
  139. width: calc(100% - 24rpx);
  140. box-sizing: border-box;
  141. background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.4), transparent);
  142. .user-info {
  143. width: 100%;
  144. display: flex;
  145. .avatar {
  146. border: 2rpx solid #fff;
  147. border-radius: 50%;
  148. margin-right: 20rpx;
  149. }
  150. .level-wrap {
  151. line-height: 32rpx;
  152. width: 54%;
  153. .name {
  154. // color: #fff;
  155. font-family: 'PangMenZhengDao';
  156. }
  157. .progress-wrap{
  158. font-size: 20rpx;
  159. color: rgba(0, 0, 0, 0.8);
  160. display: flex;
  161. align-items: center;
  162. justify-content: space-between;
  163. .progress-value{
  164. width: calc(100% - 120rpx);
  165. height: 16rpx;
  166. background: #E7E7E7;
  167. border-radius: 40rpx;
  168. border: 2rpx solid #fff;
  169. .total{
  170. width: 80%;
  171. height: 100%;
  172. border-radius: 20rpx;
  173. background-image: linear-gradient(120deg,#FDE492,#FB9C03);
  174. }
  175. }
  176. .cur-val{
  177. font-size: 26rpx;
  178. font-weight: 500;
  179. color: #fff;
  180. }
  181. }
  182. .level-desc{
  183. font-size: 20rpx;
  184. color: rgba(0, 0, 0, 0.84);
  185. .level-text{
  186. color: #fff;
  187. }
  188. }
  189. }
  190. }
  191. .toogle {
  192. position: absolute;
  193. right: 0;
  194. top: calc(50% - 36rpx);
  195. font-size: 24rpx;
  196. color: #fff;
  197. border-radius: 50rpx 0 0 50rpx;
  198. background: rgba(0, 0, 0, 0.2);
  199. padding: 12rpx 20rpx;
  200. display: flex;
  201. .icon{
  202. margin-left: 10rpx;
  203. }
  204. }
  205. }
  206. .tree-cont {
  207. width: 100%;
  208. margin-top: 10rpx;
  209. .tree-info {
  210. width: 95%;
  211. height: 160rpx;
  212. box-sizing: border-box;
  213. padding: 0 50rpx 20rpx;
  214. @include ossBg("treePage/tree-info-bg.png");
  215. display: flex;
  216. justify-content: space-around;
  217. align-items: center;
  218. font-size: 26rpx;
  219. font-weight: 500;
  220. margin: auto;
  221. .info-text {
  222. text-align: center;
  223. line-height: 32rpx;
  224. position: relative;
  225. .text {
  226. font-size: 20rpx;
  227. }
  228. }
  229. .info-text+.info-text {
  230. &::before {
  231. content: '';
  232. position: absolute;
  233. left: -26rpx;
  234. top: 14rpx;
  235. width: 1rpx;
  236. height: 38rpx;
  237. background: rgba(0, 0, 0, 0.26);
  238. }
  239. }
  240. }
  241. .drone-icon {
  242. width: 376rpx;
  243. height: 384rpx;
  244. margin-left: 26rpx;
  245. }
  246. .tool-wrap {
  247. width: 100%;
  248. padding: 14rpx;
  249. box-sizing: border-box;
  250. position: absolute;
  251. bottom: calc(50% - 350rpx);
  252. display: flex;
  253. justify-content: space-between;
  254. .tool-left,
  255. .tool-right {
  256. .tool-item {
  257. color: #fff;
  258. font-size: 24rpx;
  259. font-weight: 500;
  260. text-align: center;
  261. width: 100rpx;
  262. margin-bottom: 16rpx;
  263. text-shadow:
  264. 0 0 3rpx #D7660A,
  265. 0 0 3rpx #D7660A,
  266. 0 0 3rpx #D7660A,
  267. 0 0 3rpx #D7660A;
  268. &.blue {
  269. text-shadow:
  270. 0 0 3rpx #2199F8,
  271. 0 0 3rpx #2199F8,
  272. 0 0 3rpx #2199F8,
  273. 0 0 3rpx #2199F8;
  274. }
  275. .icon {
  276. width: 100%;
  277. height: 82rpx;
  278. position: relative;
  279. }
  280. .name {
  281. margin-top: -24rpx;
  282. position: relative;
  283. z-index: 2;
  284. }
  285. &.gift {
  286. .icon {
  287. height: 114rpx;
  288. margin-top: -5rpx;
  289. }
  290. .name {
  291. margin-top: -44rpx;
  292. }
  293. }
  294. &.friend {
  295. .icon {
  296. height: 90rpx;
  297. }
  298. .name {
  299. margin-top: -35rpx;
  300. }
  301. }
  302. &.dynamic {
  303. .icon {
  304. height: 96rpx;
  305. }
  306. .name {
  307. margin-top: -32rpx;
  308. }
  309. }
  310. }
  311. }
  312. }
  313. }
  314. .tree-footer {
  315. position: absolute;
  316. left: 0;
  317. bottom: 76rpx;
  318. width: 100%;
  319. display: flex;
  320. justify-content: center;
  321. .footer-item {
  322. width: 18%;
  323. text-align: center;
  324. .icon {
  325. width: 96rpx;
  326. height: 96rpx;
  327. }
  328. .name {
  329. font-size: 24rpx;
  330. font-weight: 500;
  331. padding: 2rpx 16rpx;
  332. background-image: linear-gradient(0deg, #FFFFFF, #FFE079);
  333. border-radius: 50rpx;
  334. border: 2rpx solid #fff;
  335. }
  336. }
  337. .footer-item+.footer-item {
  338. margin-left: 30rpx;
  339. }
  340. }
  341. }
  342. </style>