tree.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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">
  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. },
  107. {
  108. name: "认养",
  109. },
  110. {
  111. name: "果园",
  112. },
  113. {
  114. name: "动态",
  115. className: 'dynamic'
  116. }
  117. ]
  118. const footerList = ["每日阳光", "送ta祝福", "分享转发", "水果订购"]
  119. </script>
  120. <style lang="scss" scoped>
  121. @import "@/static/style/mixin.scss";
  122. .base-container {
  123. @include ossBg("tree-bg.png");
  124. // background-position: top left;
  125. padding: 22rpx 0;
  126. .tree-head {
  127. display: flex;
  128. border-radius: 70rpx 0 0 70rpx;
  129. padding: 16rpx 20rpx;
  130. margin-left: 24rpx;
  131. position: relative;
  132. width: calc(100% - 24rpx);
  133. box-sizing: border-box;
  134. background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.4), transparent);
  135. .user-info {
  136. width: 100%;
  137. display: flex;
  138. .avatar {
  139. border: 2rpx solid #fff;
  140. border-radius: 50%;
  141. margin-right: 20rpx;
  142. }
  143. .level-wrap {
  144. line-height: 32rpx;
  145. width: 54%;
  146. .name {
  147. // color: #fff;
  148. font-family: 'PangMenZhengDao';
  149. }
  150. .progress-wrap{
  151. font-size: 20rpx;
  152. color: rgba(0, 0, 0, 0.8);
  153. display: flex;
  154. align-items: center;
  155. justify-content: space-between;
  156. .progress-value{
  157. width: calc(100% - 120rpx);
  158. height: 16rpx;
  159. background: #E7E7E7;
  160. border-radius: 40rpx;
  161. border: 2rpx solid #fff;
  162. .total{
  163. width: 80%;
  164. height: 100%;
  165. border-radius: 20rpx;
  166. background-image: linear-gradient(120deg,#FDE492,#FB9C03);
  167. }
  168. }
  169. .cur-val{
  170. font-size: 26rpx;
  171. font-weight: 500;
  172. color: #fff;
  173. }
  174. }
  175. .level-desc{
  176. font-size: 20rpx;
  177. color: rgba(0, 0, 0, 0.84);
  178. .level-text{
  179. color: #fff;
  180. }
  181. }
  182. }
  183. }
  184. .toogle {
  185. position: absolute;
  186. right: 0;
  187. top: calc(50% - 36rpx);
  188. font-size: 24rpx;
  189. color: #fff;
  190. border-radius: 50rpx 0 0 50rpx;
  191. background: rgba(0, 0, 0, 0.2);
  192. padding: 12rpx 20rpx;
  193. display: flex;
  194. .icon{
  195. margin-left: 10rpx;
  196. }
  197. }
  198. }
  199. .tree-cont {
  200. width: 100%;
  201. margin-top: 10rpx;
  202. .tree-info {
  203. width: 95%;
  204. height: 160rpx;
  205. box-sizing: border-box;
  206. padding: 0 50rpx 20rpx;
  207. @include ossBg("treePage/tree-info-bg.png");
  208. display: flex;
  209. justify-content: space-around;
  210. align-items: center;
  211. font-size: 26rpx;
  212. font-weight: 500;
  213. margin: auto;
  214. .info-text {
  215. text-align: center;
  216. line-height: 32rpx;
  217. position: relative;
  218. .text {
  219. font-size: 20rpx;
  220. }
  221. }
  222. .info-text+.info-text {
  223. &::before {
  224. content: '';
  225. position: absolute;
  226. left: -26rpx;
  227. top: 14rpx;
  228. width: 1rpx;
  229. height: 38rpx;
  230. background: rgba(0, 0, 0, 0.26);
  231. }
  232. }
  233. }
  234. .drone-icon {
  235. width: 376rpx;
  236. height: 384rpx;
  237. margin-left: 26rpx;
  238. }
  239. .tool-wrap {
  240. width: 100%;
  241. padding: 14rpx;
  242. box-sizing: border-box;
  243. position: absolute;
  244. bottom: calc(50% - 350rpx);
  245. display: flex;
  246. justify-content: space-between;
  247. .tool-left,
  248. .tool-right {
  249. .tool-item {
  250. color: #fff;
  251. font-size: 24rpx;
  252. font-weight: 500;
  253. text-align: center;
  254. width: 100rpx;
  255. margin-bottom: 16rpx;
  256. text-shadow:
  257. 0 0 3rpx #D7660A,
  258. 0 0 3rpx #D7660A,
  259. 0 0 3rpx #D7660A,
  260. 0 0 3rpx #D7660A;
  261. &.blue {
  262. text-shadow:
  263. 0 0 3rpx #2199F8,
  264. 0 0 3rpx #2199F8,
  265. 0 0 3rpx #2199F8,
  266. 0 0 3rpx #2199F8;
  267. }
  268. .icon {
  269. width: 100%;
  270. height: 82rpx;
  271. position: relative;
  272. }
  273. .name {
  274. margin-top: -24rpx;
  275. position: relative;
  276. z-index: 2;
  277. }
  278. &.gift {
  279. .icon {
  280. height: 114rpx;
  281. margin-top: -5rpx;
  282. }
  283. .name {
  284. margin-top: -44rpx;
  285. }
  286. }
  287. &.friend {
  288. .icon {
  289. height: 90rpx;
  290. }
  291. .name {
  292. margin-top: -35rpx;
  293. }
  294. }
  295. &.dynamic {
  296. .icon {
  297. height: 96rpx;
  298. }
  299. .name {
  300. margin-top: -32rpx;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. }
  307. .tree-footer {
  308. position: absolute;
  309. left: 0;
  310. bottom: 76rpx;
  311. width: 100%;
  312. display: flex;
  313. justify-content: center;
  314. .footer-item {
  315. width: 18%;
  316. text-align: center;
  317. .icon {
  318. width: 96rpx;
  319. height: 96rpx;
  320. }
  321. .name {
  322. font-size: 24rpx;
  323. font-weight: 500;
  324. padding: 2rpx 16rpx;
  325. background-image: linear-gradient(0deg, #FFFFFF, #FFE079);
  326. border-radius: 50rpx;
  327. border: 2rpx solid #fff;
  328. }
  329. }
  330. .footer-item+.footer-item {
  331. margin-left: 30rpx;
  332. }
  333. }
  334. }
  335. </style>