my.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="tab_page" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <up-navbar title=" " bgColor="transparent">
  4. <template #left></template>
  5. </up-navbar>
  6. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/17/9043fbbe-2e5d-4adb-ba36-039d33a9b694.png" class="top_bg_img" mode="widthFix"></image>
  7. <view class="info">
  8. <view class="info-top adfacjb">
  9. <view class="info-top-left adfac">
  10. <image class="avatar" :src="userInfo?.avatarPath||'https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/17/6db27a79-235b-4595-87f2-89ff09fc66a5.png'"></image>
  11. <view class="text" @click="showLogin">
  12. <view class="text-top">{{userInfo?userInfo?.realName:'未登录'}}</view>
  13. <view class="text-bottom lv" v-if="userInfo">Lv&nbsp;&nbsp;&nbsp;{{userInfo?.userLevel||1}}&nbsp;&nbsp;></view>
  14. <view class="text-bottom" v-else>去登录注册&nbsp;>></view>
  15. </view>
  16. </view>
  17. <view class="info-top-right" @click="handleTurnPage('/pagesMy/information')">
  18. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/17/d0319d8d-1445-47d6-94fa-cb934e022ab8.png"></image>
  19. </view>
  20. </view>
  21. <view class="info-tip">
  22. <view class="info-tip-pre adfacjb" @click="handleTurnPage('/pagesMy/information')">
  23. <view class="left">家庭公益名称:{{userInfo?userInfo.welfareName:'暂无'}}</view>
  24. <view class="right">
  25. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/17/79079542-4711-44e8-9246-9cd1b8ea4e39.png"></image>
  26. </view>
  27. </view>
  28. <view class="info-tip-pre adfacjb" @click="handleTurnPage('/pagesMy/information')">
  29. <view class="left">家庭公益口号:{{userInfo?userInfo.welfareSlogan:'暂无'}}</view>
  30. <view class="right">
  31. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/17/79079542-4711-44e8-9246-9cd1b8ea4e39.png"></image>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="box" style="margin-top: 40rpx;">
  37. <view class="box-title">公益记录</view>
  38. <view class="box-card adfacjb">
  39. <view class="box-card-pre adffcac red" @click="handleTurnPage('/pagesMy/heartNumber')">
  40. <image class="top" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/4e6e3db8-127f-433d-9644-66f1451a6d72.png"></image>
  41. <view class="num">{{(heartNum||0).toFixed(2)}}</view>
  42. <view class="text adf">
  43. <text>我的爱心值</text>
  44. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/35df3e58-7b8c-4d3c-8f09-41f252cb3805.png"></image>
  45. </view>
  46. </view>
  47. <view class="box-card-pre adffcac purple" @click="handleTurnPage('/pagesMy/archives')">
  48. <image class="top" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/dc26c6af-2617-47b7-ab38-9ccbf2016c5c.png"></image>
  49. <view class="num">{{(fileNum||0).toFixed(2)}}</view>
  50. <view class="text adf">
  51. <text>我的档案</text>
  52. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/51adb43e-acdd-475e-9e3d-64cbeedd4fe4.png"></image>
  53. </view>
  54. </view>
  55. <view class="box-card-pre adffcac orange" @click="handleTurnPage('/pagesMy/volunteerHours')">
  56. <image class="top" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/c5048d96-826e-4bbf-a133-dd2115162746.png"></image>
  57. <view class="num">{{(hourNum||0).toFixed(2)}}</view>
  58. <view class="text adf">
  59. <text>义工时长(h)</text>
  60. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/9bdc2845-e4bc-4215-82d0-9582066b710f.png"></image>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="box" @click="handleTurnPage('/pagesMy/achievement')">
  66. <view class="box-title">我的成就</view>
  67. <view class="box-achievement adfacjb">
  68. <view class="box-achievement-left">收获<span>{{achievement}}</span>项成就</view>
  69. <view class="box-achievement-right adfacjb">
  70. <view class="imgs"></view>
  71. <view class="jt">
  72. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/17/79079542-4711-44e8-9246-9cd1b8ea4e39.png"></image>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="box">
  78. <view class="box-title">其他功能</view>
  79. <view class="box-other adfacjb">
  80. <view class="box-other-pre adffcac" @click="handleTurnPage('/pagesMy/practice')">
  81. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/53fb5a7a-e7fb-4e5d-b902-f434cfc6d786.png"></image>
  82. <text>申领社会实践记录</text>
  83. </view>
  84. <view class="box-other-pre adffcac" @click="handleTurnPage('/pagesMy/familyMember')">
  85. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/06acc5f2-45e8-43ea-96a3-c17e79a190bc.png"></image>
  86. <text>家庭成员</text>
  87. </view>
  88. <view class="box-other-pre adffcac" @click="handleTurnPage('/pagesMy/exclusiveScroll')">
  89. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/7746f429-615d-4e1b-8564-c943f07882be.png"></image>
  90. <text>我的专享卷</text>
  91. </view>
  92. </view>
  93. </view>
  94. <CusTabbar :tabbarIndex="2"></CusTabbar>
  95. <login-register></login-register>
  96. </view>
  97. </template>
  98. <script setup name="">
  99. import CusTabbar from '@/components/CusTabbar/index.vue'
  100. import { ref, onMounted, watch, getCurrentInstance } from 'vue'
  101. const { proxy } = getCurrentInstance();
  102. import { useUserStore } from '@/common/stores/user';
  103. const userStore = useUserStore();
  104. import { useGlobalShare } from '@/common/composables/useGlobalShare';
  105. const { isLogin } = useGlobalShare();
  106. const userInfo = ref(null)
  107. const heartNum = ref(0)
  108. const fileNum = ref(0)
  109. const hourNum = ref(0)
  110. const achievement = ref(0)
  111. const showLogin = () => {
  112. if(userInfo.value) return
  113. userStore.openLoginModal();
  114. }
  115. const handleTurnPage = (url) => {
  116. if(!isLogin()) return
  117. uni.navigateTo({ url })
  118. }
  119. const getUserInfo = () => {
  120. try{
  121. proxy.$api.get(`/wx/${JSON.parse(uni.getStorageSync('userInfo')).id}`).then(({data:res})=>{
  122. if(res.code!==0) return proxy.$showToast(res.msg)
  123. userInfo.value = res.data;
  124. })
  125. }catch(e){
  126. userInfo.value = null
  127. }
  128. }
  129. watch(()=>userStore.token,newVal=>{
  130. getUserInfo()
  131. })
  132. onMounted(()=>{
  133. getUserInfo()
  134. })
  135. </script>
  136. <style scoped lang="scss">
  137. .tab_page{
  138. .info{
  139. margin-top: 40rpx;
  140. position: relative;
  141. padding: 0 24rpx 0 16rpx;
  142. &-top{
  143. &-left{
  144. .avatar{
  145. width: 148rpx;
  146. height: 148rpx;
  147. }
  148. .text{
  149. margin-left: 24rpx;
  150. &-top{
  151. font-family: PingFang-SC, PingFang-SC;
  152. font-weight: bold;
  153. font-size: 40rpx;
  154. color: #151B29;
  155. line-height: 40rpx;
  156. }
  157. &-bottom{
  158. font-family: PingFangSC, PingFang SC;
  159. font-weight: 400;
  160. font-size: 26rpx;
  161. color: #151B29;
  162. line-height: 26rpx;
  163. margin-top: 26rpx;
  164. &.lv{
  165. width: 137rpx;
  166. height: 42rpx;
  167. background: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/11/17/0d460a9f-e13b-4469-b08d-dcc73e417ce9.png') no-repeat;
  168. background-size: 100% 100%;
  169. font-family: PingFangSC, PingFang SC;
  170. font-weight: 600;
  171. font-size: 26rpx;
  172. color: #FFFFFF;
  173. line-height: 38rpx;
  174. padding-left: 16rpx;
  175. box-sizing: border-box;
  176. margin-top: 18rpx;
  177. }
  178. }
  179. }
  180. }
  181. &-right{
  182. image{
  183. width: 48rpx;
  184. height: 48rpx;
  185. }
  186. }
  187. }
  188. &-tip{
  189. margin-top: 4rpx;
  190. &-pre{
  191. margin-top: 36rpx;
  192. .left{
  193. font-family: PingFangSC, PingFang SC;
  194. font-weight: 400;
  195. font-size: 28rpx;
  196. color: #252525;
  197. line-height: 28rpx;
  198. }
  199. .right{
  200. image{
  201. width: 32rpx;
  202. height: 32rpx;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. .box{
  209. background: #FFFFFF;
  210. border-radius: 24rpx;
  211. padding: 40rpx 24rpx 36rpx;
  212. margin-top: 20rpx;
  213. position: relative;
  214. &-title{
  215. font-family: PingFang-SC, PingFang-SC;
  216. font-weight: bold;
  217. font-size: 36rpx;
  218. color: #151B29;
  219. line-height: 40rpx;
  220. }
  221. &-card{
  222. margin-top: 72rpx;
  223. &-pre{
  224. width: calc(100% / 3 - 8rpx);
  225. height: 200rpx;
  226. position: relative;
  227. background-size: 100% 100%;
  228. background-repeat: no-repeat;
  229. .top{
  230. width: 82rpx;
  231. height: 82rpx;
  232. position: absolute;
  233. left: 50%;
  234. margin-left: -41rpx;
  235. top: -32rpx;
  236. }
  237. .num{
  238. font-family: DINAlternate, DINAlternate;
  239. font-weight: bold;
  240. font-size: 40rpx;
  241. line-height: 40rpx;
  242. text-align: center;
  243. margin-top: 86rpx;
  244. }
  245. .text{
  246. margin-top: 20rpx;
  247. text{
  248. font-family: PingFangSC, PingFang SC;
  249. font-weight: 400;
  250. font-size: 24rpx;
  251. line-height: 24rpx;
  252. }
  253. image{
  254. width: 26rpx;
  255. height: 26rpx;
  256. margin-left: 6rpx;
  257. }
  258. }
  259. &.red{
  260. background-image: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/0b81f526-1698-459f-9428-f875c91c9e23.png');
  261. .num,.text text{
  262. color: #FC5768;
  263. }
  264. }
  265. &.purple{
  266. background-image: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/cca2576e-318c-4cbc-8e42-67c27b6882e4.png');
  267. .num,.text text{
  268. color: #8360E8;
  269. }
  270. }
  271. &.orange{
  272. background-image: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/18/ce8e6415-4490-41e9-b04c-292e6344f9ed.png');
  273. .num,.text text{
  274. color: #FF8200;
  275. }
  276. }
  277. }
  278. }
  279. &-achievement{
  280. margin-top: 24rpx;
  281. &-left{
  282. width: 210rpx;
  283. font-family: PingFangSC, PingFang SC;
  284. font-weight: 400;
  285. font-size: 24rpx;
  286. color: #676775;
  287. line-height: 24rpx;
  288. label{
  289. font-weight: bold;
  290. font-size: 32rpx;
  291. color: #EA3044;
  292. line-height: 32rpx;
  293. margin: 0 7rpx;
  294. }
  295. }
  296. &-right{
  297. width: calc(100% - 210rpx);
  298. .jt{
  299. image{
  300. width: 32rpx;
  301. height: 32rpx;
  302. }
  303. }
  304. }
  305. }
  306. &-other{
  307. margin-top: 39rpx;
  308. &-pre{
  309. width: calc(100% / 3);
  310. image{
  311. width: 48rpx;
  312. height: 48rpx;
  313. }
  314. text{
  315. font-family: PingFangSC, PingFang SC;
  316. font-weight: 400;
  317. font-size: 24rpx;
  318. color: #151B29;
  319. line-height: 33rpx;
  320. text-align: center;
  321. margin-top: 16rpx;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. </style>