my.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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://oss.familydaf.cn/sxsnfile/20251218/0ac9931a34bd432a8a44ef619fa51362.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://oss.familydaf.cn/sxsnfile/20251218/00e0a9dd94c64503aeedfd20907461b6.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://oss.familydaf.cn/sxsnfile/20251218/a4bdf4248ddd44909e8707c83fe33265.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://oss.familydaf.cn/sxsnfile/20251218/938f573288ad401fbd1e57404a870059.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://oss.familydaf.cn/sxsnfile/20251218/938f573288ad401fbd1e57404a870059.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?loveValue='+numInfo?.loveValue)">
  40. <image class="top" src="https://oss.familydaf.cn/sxsnfile/20251218/046c057625704329a478d535cd1b4364.png"></image>
  41. <view class="num">{{(numInfo?.loveValue||0).toFixed(2)}}</view>
  42. <view class="text adf">
  43. <text>我的爱心值</text>
  44. <image src="https://oss.familydaf.cn/sxsnfile/20251218/2e8332c5f36a45cab3af336aa324d20c.png"></image>
  45. </view>
  46. </view>
  47. <view class="box-card-pre adffcac purple" @click="handleTurnPage('/pagesMy/archives')">
  48. <image class="top" src="https://oss.familydaf.cn/sxsnfile/20251218/ee5fffc2b10647ef9492150aed6bb29d.png"></image>
  49. <view class="num">{{(numInfo?.myArchives||0).toFixed(2)}}</view>
  50. <view class="text adf">
  51. <text>我的档案</text>
  52. <image src="https://oss.familydaf.cn/sxsnfile/20251218/6e9e879da03944a4911b48550e915641.png"></image>
  53. </view>
  54. </view>
  55. <view class="box-card-pre adffcac orange" @click="handleTurnPage('/pagesMy/volunteerHours?volunteerHours='+numInfo?.volunteerHours)">
  56. <image class="top" src="https://oss.familydaf.cn/sxsnfile/20251218/3fdb7e3c0d3c444ab03dd5f51a5e3fe0.png"></image>
  57. <view class="num">{{(numInfo?.volunteerHours||0).toFixed(2)}}</view>
  58. <view class="text adf">
  59. <text>义工时长(h)</text>
  60. <image src="https://oss.familydaf.cn/sxsnfile/20251218/625a9a7d454c4e7985bd7e12a9f1af93.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>{{numInfo?.myMedals||0}}</span>项成就</view>
  69. <view class="box-achievement-right adfacjb">
  70. <view class="imgs"></view>
  71. <view class="jt">
  72. <image src="https://oss.familydaf.cn/sxsnfile/20251218/938f573288ad401fbd1e57404a870059.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://oss.familydaf.cn/sxsnfile/20251218/f6d2c342d9414909b4626e34909917c7.png"></image>
  82. <text>申领社会实践记录</text>
  83. </view>
  84. <view class="box-other-pre adffcac" @click="handleTurnPage('/pagesMy/familyMember')">
  85. <image src="https://oss.familydaf.cn/sxsnfile/20251218/248ed751f8bf4821b29cd236ec2dc78b.png"></image>
  86. <text>家庭成员</text>
  87. </view>
  88. <view class="box-other-pre adffcac" @click="handleTurnPage('/pagesMy/exclusiveScroll')">
  89. <image src="https://oss.familydaf.cn/sxsnfile/20251218/7ee3c42e8408489fb0768406d72b73b4.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 numInfo = ref(null)
  108. const showLogin = () => {
  109. if(userInfo.value) return
  110. userStore.openLoginModal();
  111. }
  112. const handleTurnPage = (url) => {
  113. if(!isLogin()) return
  114. if(url == '/pagesMy/achievement'){
  115. url = `/pagesMy/achievement?numInfo=`+JSON.stringify(numInfo.value)
  116. }
  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. const getUserNums = () => {
  130. proxy.$api.get(`/wx/userWelfareData/${JSON.parse(uni.getStorageSync('userInfo')).id}`).then(({data:res})=>{
  131. if(res.code!==0) return proxy.$showToast(res.msg)
  132. numInfo.value = res.data;
  133. })
  134. }
  135. watch(()=>userStore.token,newVal=>{
  136. getUserInfo()
  137. })
  138. onMounted(()=>{
  139. if(uni.getStorageSync('userInfo')){
  140. getUserInfo()
  141. getUserNums()
  142. }
  143. })
  144. </script>
  145. <style scoped lang="scss">
  146. .tab_page{
  147. .info{
  148. margin-top: 40rpx;
  149. position: relative;
  150. padding: 0 24rpx 0 16rpx;
  151. &-top{
  152. &-left{
  153. .avatar{
  154. width: 148rpx;
  155. height: 148rpx;
  156. }
  157. .text{
  158. margin-left: 24rpx;
  159. &-top{
  160. font-family: PingFang-SC, PingFang-SC;
  161. font-weight: bold;
  162. font-size: 40rpx;
  163. color: #151B29;
  164. line-height: 40rpx;
  165. }
  166. &-bottom{
  167. font-family: PingFangSC, PingFang SC;
  168. font-weight: 400;
  169. font-size: 26rpx;
  170. color: #151B29;
  171. line-height: 26rpx;
  172. margin-top: 26rpx;
  173. &.lv{
  174. width: 137rpx;
  175. height: 42rpx;
  176. background: url('https://oss.familydaf.cn/sxsnfile/20251218/b6e6f5b45ad34f91bbaf66c9890fc2cd.png') no-repeat;
  177. background-size: 100% 100%;
  178. font-family: PingFangSC, PingFang SC;
  179. font-weight: 600;
  180. font-size: 26rpx;
  181. color: #FFFFFF;
  182. line-height: 38rpx;
  183. padding-left: 16rpx;
  184. box-sizing: border-box;
  185. margin-top: 18rpx;
  186. }
  187. }
  188. }
  189. }
  190. &-right{
  191. image{
  192. width: 48rpx;
  193. height: 48rpx;
  194. }
  195. }
  196. }
  197. &-tip{
  198. margin-top: 4rpx;
  199. &-pre{
  200. margin-top: 36rpx;
  201. .left{
  202. font-family: PingFangSC, PingFang SC;
  203. font-weight: 400;
  204. font-size: 28rpx;
  205. color: #252525;
  206. line-height: 28rpx;
  207. }
  208. .right{
  209. image{
  210. width: 32rpx;
  211. height: 32rpx;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. .box{
  218. background: #FFFFFF;
  219. border-radius: 24rpx;
  220. padding: 40rpx 24rpx 36rpx;
  221. margin-top: 20rpx;
  222. position: relative;
  223. &-title{
  224. font-family: PingFang-SC, PingFang-SC;
  225. font-weight: bold;
  226. font-size: 36rpx;
  227. color: #151B29;
  228. line-height: 40rpx;
  229. }
  230. &-card{
  231. margin-top: 72rpx;
  232. &-pre{
  233. width: calc(100% / 3 - 8rpx);
  234. height: 200rpx;
  235. position: relative;
  236. background-size: 100% 100%;
  237. background-repeat: no-repeat;
  238. .top{
  239. width: 82rpx;
  240. height: 82rpx;
  241. position: absolute;
  242. left: 50%;
  243. margin-left: -41rpx;
  244. top: -32rpx;
  245. }
  246. .num{
  247. font-family: DINAlternate, DINAlternate;
  248. font-weight: bold;
  249. font-size: 40rpx;
  250. line-height: 40rpx;
  251. text-align: center;
  252. margin-top: 86rpx;
  253. }
  254. .text{
  255. margin-top: 20rpx;
  256. text{
  257. font-family: PingFangSC, PingFang SC;
  258. font-weight: 400;
  259. font-size: 24rpx;
  260. line-height: 24rpx;
  261. }
  262. image{
  263. width: 26rpx;
  264. height: 26rpx;
  265. margin-left: 6rpx;
  266. }
  267. }
  268. &.red{
  269. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/57acefa1a0084d1e980002e165668bc9.png');
  270. .num,.text text{
  271. color: #FC5768;
  272. }
  273. }
  274. &.purple{
  275. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/e0f97b6ca8864d2ca0c3dc48b07dae58.png');
  276. .num,.text text{
  277. color: #8360E8;
  278. }
  279. }
  280. &.orange{
  281. background-image: url('https://oss.familydaf.cn/sxsnfile/20251218/eabb899f7ab14010b61fb30ed24bd818.png');
  282. .num,.text text{
  283. color: #FF8200;
  284. }
  285. }
  286. }
  287. }
  288. &-achievement{
  289. margin-top: 24rpx;
  290. &-left{
  291. width: 210rpx;
  292. font-family: PingFangSC, PingFang SC;
  293. font-weight: 400;
  294. font-size: 24rpx;
  295. color: #676775;
  296. line-height: 24rpx;
  297. label{
  298. font-weight: bold;
  299. font-size: 32rpx;
  300. color: #EA3044;
  301. line-height: 32rpx;
  302. margin: 0 7rpx;
  303. }
  304. }
  305. &-right{
  306. width: calc(100% - 210rpx);
  307. .jt{
  308. image{
  309. width: 32rpx;
  310. height: 32rpx;
  311. }
  312. }
  313. }
  314. }
  315. &-other{
  316. margin-top: 39rpx;
  317. &-pre{
  318. width: calc(100% / 3);
  319. image{
  320. width: 48rpx;
  321. height: 48rpx;
  322. }
  323. text{
  324. font-family: PingFangSC, PingFang SC;
  325. font-weight: 400;
  326. font-size: 24rpx;
  327. color: #151B29;
  328. line-height: 33rpx;
  329. text-align: center;
  330. margin-top: 16rpx;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. </style>