tree.vue 8.1 KB

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