achievement.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="我的成就" bgColor="transparent"></cus-header>
  4. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/8dbf51e7-85cb-496a-b3d0-d5816fa8ff34.png" class="top_bg_img" mode="widthFix"></image>
  5. <view class="info">
  6. <view class="info-top adfac">
  7. <image class="avatar" :src="userInfo?.avatarPath||'https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/5dded84d-8594-4bbe-9204-c693098e7532.png'"></image>
  8. <view class="name">Hi~ {{userInfo?.realName??''}}</view>
  9. <view class="level adfac"><text>LV</text><text>{{userInfo?.userLevel??1}}</text></view>
  10. </view>
  11. <view class="info-num">收获勋章:{{numInfo?.myMedals??0}} <text>枚</text></view>
  12. <view class="info-memo">共参与<text>{{numInfo?.activityCount??0}}</text>次公益活动,累计义工时长<text>{{numInfo?.volunteerHours??0}}</text>小时</view>
  13. </view>
  14. <view class="tab adfacjc">
  15. <view class="tab-pre" :class="{'active':queryParams.obtained===''}" @click="changeTab('')">全部</view>
  16. <view class="tab-pre" :class="{'active':queryParams.obtained===1}" @click="changeTab(1)">已获得</view>
  17. </view>
  18. <view class="list" v-if="list.length">
  19. <view class="list-pre adffcac" v-for="(item,index) in list" :key="index" @click="showSz(item)">
  20. <image :src="item.imageUrl??''"></image>
  21. <view class="p">{{item?.medalName||''}}</view>
  22. <view class="p tip" v-if="item?.lightUp">{{item?.lightUpDate2??''}}点亮</view>
  23. <view class="p tip" v-else>未获得</view>
  24. </view>
  25. </view>
  26. <view class="dataEmpty" v-else>
  27. <page-empty text="暂无勋章"></page-empty>
  28. </view>
  29. <view class="btn" @click="showSave">晒出我的成就</view>
  30. <view class="dialog adffcac" :style="{'height':'calc(100vh - '+mt+')px', 'top':mt+'px'}" v-if="xzShow">
  31. <view class="title">"恭喜您获得荣誉勋章"</view>
  32. <view class="img adfacjc">
  33. <image :src="xzInfo.imageUrl"></image>
  34. </view>
  35. <view class="name adfac">
  36. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/902a8c25-9961-48fd-b869-8fd1ac47b271.png"></image>
  37. <text>{{xzInfo.medalName}}</text>
  38. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/0f48d5d2-2961-4d95-9bf9-148b7f615227.png"></image>
  39. </view>
  40. <!-- <view class="heartnum">累计捐赠爱心值{{xzInfo.heartnum||10000}}</view> -->
  41. <view class="date">{{xzInfo.lightUpDate}}获得</view>
  42. <view class="btn adfacjc">
  43. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/4e76f71e-cd46-4380-8437-04b83eec40f3.png"></image>
  44. <text>炫耀一下</text>
  45. </view>
  46. <image class="close" @click="xzShow=false;xzInfo=null" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/34582f76-ea26-4e83-8172-e1f81c0634aa.png"></image>
  47. </view>
  48. <view class="save adffcacjc" :style="{'height':'calc(100vh - '+mt+')px', 'top':mt+'px'}" v-if="saveShow">
  49. <view class="box">
  50. <image class="close" @click="saveShow=false" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/d1bbde08-3c0f-44bb-bed6-a6c3fce72aa2.png"></image>
  51. <view class="top adfac">
  52. <image :src="userInfo?.avatarPath||'https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/98671459-4599-44d2-a5ca-bb8200d42436.png'"></image>
  53. <text>{{userInfo?.realName||''}}的公益勋章墙</text>
  54. </view>
  55. <view class="num"><text>{{numInfo?.myMedals||0}}</text> 枚公益勋章</view>
  56. <view class="xzimgs adfac">
  57. <view class="imgbox">
  58. <scroll-view class="scroll-view_H" scroll-x="true" scroll-with-animation="true">
  59. <view class="scroll-view-item_H" v-for="(item,index) in xzImgList" :key="index">
  60. <view class="cl_item">
  61. <image :src="item"></image>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. </view>
  66. </view>
  67. <view class="bottom adfacjb">
  68. <view class="left adfac">
  69. <view class="img">
  70. <image src=""></image>
  71. </view>
  72. <view class="texts adffc">
  73. <text>扫描二维码</text>
  74. <text>查看你的公益勋章</text>
  75. </view>
  76. </view>
  77. <view class="right">善行少年</view>
  78. </view>
  79. </view>
  80. <view class="text">长按图片,保存到手机</view>
  81. </view>
  82. </view>
  83. </template>
  84. <script setup name="">
  85. import CusHeader from '@/components/CusHeader/index.vue'
  86. import PageEmpty from '@/components/pageEmpty/index.vue'
  87. import { onLoad } from '@dcloudio/uni-app'
  88. import { ref, getCurrentInstance } from 'vue'
  89. const { proxy } = getCurrentInstance()
  90. const userInfo = ref(null)
  91. const numInfo = ref(null)
  92. const queryParams = ref({
  93. page:1,
  94. limit:-1,
  95. userId:'',
  96. obtained:''
  97. })
  98. const typeDict = ref({
  99. 1:'公益萌新',
  100. 2:'青铜公益',
  101. 3:'白银公益',
  102. 4:'黄金公益',
  103. 5:'铂金公益',
  104. 6:'公益王者',
  105. 7:'公益活动能手',
  106. 8:'公益活动达人',
  107. 9:'月月公益达人'
  108. })
  109. const list = ref([])
  110. const xzShow = ref(false)
  111. const xzInfo = ref(null)
  112. const saveShow = ref(false)
  113. const xzImgList = ref([])
  114. const changeTab = type => {
  115. queryParams.value.obtained = type;
  116. getList()
  117. }
  118. const showSz = item => {
  119. if(!item.lightUpDate) return
  120. xzInfo.value = item;
  121. xzShow.value = true;
  122. }
  123. const showSave = () => {
  124. xzImgList.value = list.value.filter(l=>l.lightUpDate).map(l=>l.imageUrl)||[]
  125. saveShow.value = true;
  126. }
  127. const getList = () => {
  128. proxy.$api.get('/core/love/value/record/obtainedMedalList',queryParams.value).then(({data:res})=>{
  129. if(res.code!==0) return proxy.$showToast(res.msg)
  130. list.value = res.data.list;
  131. list.value.forEach(l=>l.lightUpDate2 = new Date(l.lightUpDate).Format('yyyy-MM-dd'));
  132. })
  133. }
  134. onLoad((options)=>{
  135. userInfo.value = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo'));
  136. numInfo.value = options.numInfo&&JSON.parse(options.numInfo);
  137. queryParams.value.userId = userInfo.value&&userInfo.value.id;
  138. getList()
  139. })
  140. </script>
  141. <style scoped lang="scss">
  142. .scroll-view_H {
  143. white-space: nowrap;
  144. width: 100%;
  145. }
  146. .scroll-view-item_H {
  147. display: inline-block;
  148. width: 111rpx;
  149. height: 100%;
  150. margin-left: 23rpx;
  151. &:first-child{
  152. margin-left: 0;
  153. }
  154. }
  155. .common_page{
  156. background: #FFFFFF;
  157. overflow: hidden;
  158. .info{
  159. position: relative;
  160. margin-top: 31rpx;
  161. &-top{
  162. .avatar{
  163. width: 98rpx;
  164. height: 98rpx;
  165. }
  166. .name{
  167. font-family: PingFang-SC, PingFang-SC;
  168. font-weight: bold;
  169. font-size: 32rpx;
  170. color: #252525;
  171. line-height: 54rpx;
  172. margin-left: 15rpx;
  173. }
  174. .level{
  175. width: 137rpx;
  176. height: 42rpx;
  177. background: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/acff6d97-0292-4d2d-9663-9761ac76ba3a.png') no-repeat;
  178. background-size: 100% 100%;
  179. margin-left: 20rpx;
  180. text{
  181. font-family: PingFangSC, PingFang SC;
  182. font-weight: 600;
  183. font-size: 26rpx;
  184. color: #FFFFFF;
  185. line-height: 26rpx;
  186. margin-left: 16rpx;
  187. }
  188. }
  189. }
  190. &-num{
  191. font-family: PingFang-SC, PingFang-SC;
  192. font-weight: bold;
  193. font-size: 44rpx;
  194. color: #252525;
  195. line-height: 48rpx;
  196. margin-top: 24rpx;
  197. text{
  198. font-weight: 400;
  199. font-size: 24rpx;
  200. line-height: 40rpx;
  201. }
  202. }
  203. &-memo{
  204. margin-top: 29rpx;
  205. font-family: PingFangSC, PingFang SC;
  206. font-weight: 400;
  207. font-size: 28rpx;
  208. color: #252525;
  209. line-height: 28rpx;
  210. text{
  211. font-weight: bold;
  212. margin: 0 10rpx;
  213. }
  214. }
  215. }
  216. .tab{
  217. position: relative;
  218. margin-top: 92rpx;
  219. &-pre{
  220. padding: 0 65rpx;
  221. font-family: PingFangSC, PingFang SC;
  222. font-weight: 400;
  223. font-size: 32rpx;
  224. color: #676775;
  225. line-height: 48rpx;
  226. position: relative;
  227. &.active{
  228. font-weight: bold;
  229. font-size: 36rpx;
  230. color: #252525;
  231. &::after{
  232. content: '';
  233. width: 42rpx;
  234. height: 6rpx;
  235. background: #77F99B;
  236. border-radius: 3rpx;
  237. position: absolute;
  238. left: 50%;
  239. margin-left: -21rpx;
  240. bottom: -15rpx;
  241. }
  242. }
  243. }
  244. }
  245. .list{
  246. margin-left: -60rpx;
  247. overflow: hidden;
  248. flex: 1;
  249. overflow-y: auto;
  250. &-pre{
  251. width: calc(100% / 3 - 60rpx);
  252. margin-top: 48rpx;
  253. float: left;
  254. margin-left: 60rpx;
  255. image{
  256. width: 180rpx;
  257. height: 176rpx;
  258. }
  259. .p{
  260. font-family: PingFang-SC, PingFang-SC;
  261. font-weight: bold;
  262. font-size: 28rpx;
  263. color: #252525;
  264. line-height: 28rpx;
  265. text-align: center;
  266. margin-top: 24rpx;
  267. &.tip{
  268. font-weight: 400;
  269. font-size: 24rpx;
  270. color: #676775;
  271. line-height: 24rpx;
  272. }
  273. }
  274. }
  275. }
  276. .btn{
  277. width: 100%;
  278. height: 90rpx;
  279. background: #B7F358;
  280. border-radius: 45rpx;
  281. font-family: PingFang-SC, PingFang-SC;
  282. font-weight: bold;
  283. font-size: 32rpx;
  284. color: #151B29;
  285. line-height: 90rpx;
  286. text-align: center;
  287. letter-spacing: 2rpx;
  288. margin-top: 60rpx;
  289. }
  290. .dialog{
  291. position: fixed;
  292. left: 0;
  293. right: 0;
  294. top: 0;
  295. bottom: 0;
  296. background: #252525;
  297. .title{
  298. font-family: FZZCHJW--GB1, FZZCHJW--GB1;
  299. font-weight: normal;
  300. font-size: 36rpx;
  301. color: #FDE2B2;
  302. line-height: 44rpx;
  303. text-align: center;
  304. margin-top: 113rpx;
  305. }
  306. .img{
  307. width: 567rpx;
  308. height: 496rpx;
  309. background: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/e8c96426-1d12-47f1-a105-1fb2f6bf3a19.png') no-repeat;
  310. background-size: 100% 100%;
  311. margin-top: 27rpx;
  312. image{
  313. width: 279rpx;
  314. height: 275rpx;
  315. }
  316. }
  317. .name{
  318. margin-top: 18rpx;
  319. image{
  320. width: 53rpx;
  321. height: 67rpx;
  322. }
  323. text{
  324. font-family: FZZCHJW--GB1, FZZCHJW--GB1;
  325. font-weight: normal;
  326. font-size: 64rpx;
  327. color: #FDE2B2;
  328. line-height: 77rpx;
  329. text-align: center;
  330. }
  331. }
  332. .heartnum{
  333. font-family: PingFangSC, PingFang SC;
  334. font-weight: 400;
  335. font-size: 26rpx;
  336. color: #FDE2B2;
  337. line-height: 37rpx;
  338. text-align: center;
  339. margin-top: 13rpx;
  340. }
  341. .date{
  342. font-family: PingFangSC, PingFang SC;
  343. font-weight: 400;
  344. font-size: 26rpx;
  345. color: #B2AB95;
  346. line-height: 37rpx;
  347. text-align: center;
  348. margin-top: 23rpx;
  349. }
  350. .btn{
  351. width: 368rpx;
  352. height: 88rpx;
  353. background: linear-gradient( 270deg, #F8D7AC 0%, #FEFAD9 100%);
  354. border-radius: 44rpx;
  355. margin-top: 89rpx;
  356. image{
  357. width: 30rpx;
  358. height: 25rpx;
  359. }
  360. text{
  361. font-family: PingFang-SC, PingFang-SC;
  362. font-weight: bold;
  363. font-size: 32rpx;
  364. color: #252525;
  365. line-height: 45rpx;
  366. margin-left: 14rpx;
  367. }
  368. }
  369. .close{
  370. width: 48rpx;
  371. height: 48rpx;
  372. margin-top: 73rpx;
  373. }
  374. }
  375. .save{
  376. position: fixed;
  377. left: 0;
  378. right: 0;
  379. bottom: 0;
  380. background: rgba(0, 0, 0, .8);
  381. .box{
  382. width: calc(100% - 128rpx);
  383. padding: 34rpx 36rpx 28rpx;
  384. box-sizing: border-box;
  385. background: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/29/bfdff5f5-e57f-4deb-8359-b12a0a6ee7dd.png') no-repeat;
  386. background-size: 100% 100%;
  387. position: relative;
  388. .close{
  389. width: 48rpx;
  390. height: 48rpx;
  391. position: absolute;
  392. top: 0;
  393. right: 0;
  394. }
  395. .top{
  396. image{
  397. width: 90rpx;
  398. height: 90rpx;
  399. }
  400. text{
  401. font-family: PingFang-SC, PingFang-SC;
  402. font-weight: bold;
  403. font-size: 32rpx;
  404. color: #FAE5B9;
  405. line-height: 45rpx;
  406. margin-left: 18rpx;
  407. }
  408. }
  409. .num{
  410. margin-top: 10rpx;
  411. font-family: PingFangSC, PingFang SC;
  412. font-weight: 400;
  413. font-size: 28rpx;
  414. color: #FFFFFF;
  415. line-height: 40rpx;
  416. text{
  417. font-weight: bold;
  418. font-size: 40rpx;
  419. color: #FAE5B9;
  420. line-height: 56rpx;
  421. }
  422. }
  423. .xzimgs{
  424. margin-top: 48rpx;
  425. width: 100%;
  426. height: 328rpx;
  427. background: #222632;
  428. border-radius: 16rpx;
  429. padding: 0 26rpx;
  430. box-sizing: border-box;
  431. .imgbox{
  432. width: 100%;
  433. height: 111rpx;
  434. .cl_item{
  435. width: 111rpx;
  436. height: 111rpx;
  437. image{
  438. width: 100%;
  439. height: 100%;
  440. }
  441. }
  442. }
  443. }
  444. .bottom{
  445. margin-top: 26rpx;
  446. .left{
  447. .img{
  448. width: 100rpx;
  449. height: 100rpx;
  450. image{
  451. width: 100%;
  452. height: 100%;
  453. }
  454. }
  455. .texts{
  456. margin-left: 24rpx;
  457. text{
  458. font-family: PingFangSC, PingFang SC;
  459. font-weight: 400;
  460. font-size: 20rpx;
  461. color: #FFFFFF;
  462. line-height: 20rpx;
  463. &:last-child{
  464. margin-top: 20rpx;
  465. }
  466. }
  467. }
  468. }
  469. .right{
  470. font-family: kuaikanshijieti;
  471. font-size: 22rpx;
  472. color: #FFFFFF;
  473. line-height: 38rpx;
  474. font-style: italic;
  475. }
  476. }
  477. }
  478. .text{
  479. font-family: PingFangSC, PingFang SC;
  480. font-weight: 400;
  481. font-size: 28rpx;
  482. color: #FFFFFF;
  483. line-height: 40rpx;
  484. text-align: center;
  485. margin-top: 44rpx;
  486. }
  487. }
  488. }
  489. </style>