国外MOSE官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

343 lines
8.0 KiB

3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
  1. <template>
  2. <view class="my-page">
  3. <!-- 顶部渐变背景区域 -->
  4. <view class="header-section">
  5. <!-- 右上角图标 -->
  6. <view class="header-icons">
  7. <uv-icon name="more-dot-fill" size="20" color="white"></uv-icon>
  8. <uv-icon name="setting" size="20" color="white"></uv-icon>
  9. </view>
  10. <!-- 用户信息区域 -->
  11. <view class="user-info">
  12. <view class="avatar-container">
  13. <image class="avatar" :src="userInfo.headImage || '/static/默认头像.png'" mode="aspectFill"></image>
  14. </view>
  15. <text class="username">{{ userInfo.nickName }}</text>
  16. </view>
  17. </view>
  18. <!-- 积分信息区域 -->
  19. <view class="points-section">
  20. <view class="points-item yellow" @click="navigateTo('favoritesActivity')">
  21. <view class="points-content">
  22. <text class="points-number">{{ userInfo.collection }}</text>
  23. <text class="points-label yellow">我的收藏</text>
  24. </view>
  25. <view class="points-icon">
  26. <uv-icon name="star-fill" size="28" color="#FFD700"></uv-icon>
  27. </view>
  28. </view>
  29. <view class="points-item blue">
  30. <view class="points-content">
  31. <text class="points-number">{{ userInfo.score }}</text>
  32. <text class="points-label blue">可用积分</text>
  33. </view>
  34. <view class="points-icon">
  35. <uv-icon name="integral" size="28" color="#4A90E2"></uv-icon>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 常用功能区域 -->
  40. <view class="functions-container">
  41. <text class="section-title">常用功能</text>
  42. <view class="functions-grid">
  43. <!-- 第一行 -->
  44. <view class="function-item" @click="navigateTo('profile')">
  45. <image class="function-icon" src="/static/我的_我的资料.png" mode="aspectFit"></image>
  46. <text class="function-text">我的资料</text>
  47. </view>
  48. <view class="function-item" @click="navigateTo('reports')">
  49. <image class="function-icon" src="/static/我的_我的报名.png" mode="aspectFit"></image>
  50. <text class="function-text">我的报名</text>
  51. </view>
  52. <view class="function-item" @click="navigateTo('records')">
  53. <image class="function-icon" src="/static/我的_兑换记录.png" mode="aspectFit"></image>
  54. <text class="function-text">兑换记录</text>
  55. </view>
  56. <view class="function-item" @click="navigateTo('favorites')">
  57. <image class="function-icon" src="/static/我的_商品收藏.png" mode="aspectFit"></image>
  58. <text class="function-text">商品收藏</text>
  59. </view>
  60. <!-- 第二行 -->
  61. <view class="function-item" @click="logout">
  62. <image class="function-icon" src="/static/我的_退出登录.png" mode="aspectFit"></image>
  63. <text class="function-text">退出登录</text>
  64. </view>
  65. <view class="function-item" @click="navigateTo('about')">
  66. <image class="function-icon" src="/static/我的_关于我们.png" mode="aspectFit"></image>
  67. <text class="function-text">关于我们</text>
  68. </view>
  69. <view class="function-item" @click="navigateTo('checkin')">
  70. <view class="function-icon-wrapper">
  71. <uv-icon name="file-text-fill" size="32" color="#218cdd"></uv-icon>
  72. </view>
  73. <text class="function-text">活动签到</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. export default {
  81. name: 'MyPage',
  82. data() {
  83. return {
  84. userInfo: {
  85. name: '小精灵',
  86. headImage: '/static/默认头像.png',
  87. collection: 5,
  88. score: 41
  89. }
  90. }
  91. },
  92. methods: {
  93. navigateTo(page) {
  94. console.log('导航到:', page)
  95. // 根据不同页面进行导航
  96. switch(page) {
  97. case 'profile':
  98. uni.navigateTo({
  99. url: '/subPages/my/myProfile'
  100. })
  101. break
  102. case 'reports':
  103. uni.navigateTo({
  104. url: '/subPages/my/myRegistrations'
  105. })
  106. break
  107. case 'records':
  108. uni.navigateTo({
  109. url: '/subPages/my/exchangeRecord'
  110. })
  111. break
  112. case 'favorites':
  113. uni.navigateTo({
  114. url: '/subPages/my/productFavorites'
  115. })
  116. break
  117. case 'favoritesActivity':
  118. uni.navigateTo({
  119. url: '/subPages/my/activityFavorites'
  120. })
  121. break
  122. case 'about':
  123. // 关于我们页面
  124. break
  125. case 'checkin':
  126. uni.navigateTo({
  127. url: '/subPages/my/activityCheckin'
  128. })
  129. break
  130. default:
  131. break
  132. }
  133. },
  134. logout() {
  135. uni.showModal({
  136. title: '提示',
  137. content: '确定要退出登录吗?',
  138. success: (res) => {
  139. if (res.confirm) {
  140. // 清除用户信息
  141. uni.removeStorageSync('userInfo')
  142. uni.showToast({
  143. title: '已退出登录',
  144. icon: 'success'
  145. })
  146. // 跳转到登录页面
  147. setTimeout(() => {
  148. uni.reLaunch({
  149. url: '/subPages/login/login'
  150. })
  151. }, 1500)
  152. }
  153. }
  154. })
  155. },
  156. async getUser() {
  157. const res = await this.$api.user.queryUser()
  158. this.userInfo = res.result
  159. }
  160. },
  161. onShow() {
  162. this.getUser()
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .my-page {
  168. min-height: 100vh;
  169. background-color: #FFFFFF;
  170. }
  171. // 顶部渐变背景区域
  172. .header-section {
  173. background: linear-gradient(180deg, #1488db, #98b5f1);
  174. padding: 60rpx 40rpx 80rpx;
  175. position: relative;
  176. }
  177. .header-icons {
  178. display: flex;
  179. justify-content: flex-end;
  180. gap: 32rpx;
  181. margin-bottom: 40rpx;
  182. }
  183. // 用户信息区域
  184. .user-info {
  185. display: flex;
  186. flex-direction: column;
  187. align-items: center;
  188. margin-bottom: 60rpx;
  189. }
  190. .avatar-container {
  191. width: 120rpx;
  192. height: 120rpx;
  193. border-radius: 50%;
  194. overflow: hidden;
  195. margin-bottom: 20rpx;
  196. border: 4rpx solid rgba(255, 255, 255, 0.3);
  197. }
  198. .avatar {
  199. width: 100%;
  200. height: 100%;
  201. }
  202. .username {
  203. font-size: 30rpx;
  204. color: #000000;
  205. // font-weight: bold;
  206. }
  207. // 积分信息区域
  208. .points-section {
  209. display: flex;
  210. justify-content: space-between;
  211. margin: 30rpx 30rpx;
  212. gap: 24rpx;
  213. }
  214. .points-item {
  215. border-radius: 12rpx;
  216. padding: 32rpx 24rpx;
  217. flex: 1;
  218. display: flex;
  219. align-items: center;
  220. justify-content: space-between;
  221. position: relative;
  222. box-shadow: 0px 1.5px 3px 0px rgba(0,0,0,0.16);
  223. &.yellow {
  224. background: #FEF4D1;
  225. }
  226. &.blue {
  227. background: #C7E6FF;
  228. }
  229. }
  230. .points-content {
  231. display: flex;
  232. flex-direction: column;
  233. align-items: flex-start;
  234. }
  235. .points-number {
  236. font-size: 48rpx;
  237. color: #000000;
  238. font-weight: bold;
  239. line-height: 1;
  240. }
  241. .points-label {
  242. font-size: 24rpx;
  243. color: #000000;
  244. font-size: 24rpx;
  245. // color: white;
  246. margin-top: 8rpx;
  247. &.yellow{
  248. color: #DEB31B;
  249. }
  250. &.blue{
  251. color: #1488db;
  252. }
  253. }
  254. .points-icon {
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. }
  259. // 常用功能区域
  260. .functions-container {
  261. height: 319px;
  262. background: #ffffff;
  263. border-radius: 8px;
  264. box-shadow: 0px 1.5px 3px 0px rgba(0,0,0,0.16);
  265. margin: 20rpx 30rpx;
  266. padding: 40rpx;
  267. }
  268. .section-title {
  269. font-size: 32rpx;
  270. color: #333;
  271. font-weight: bold;
  272. margin-bottom: 40rpx;
  273. display: block;
  274. }
  275. .functions-grid {
  276. display: grid;
  277. grid-template-columns: repeat(4, 1fr);
  278. gap: 40rpx 10rpx;
  279. }
  280. .function-item {
  281. display: flex;
  282. flex-direction: column;
  283. align-items: center;
  284. gap: 16rpx;
  285. padding: 20rpx;
  286. border-radius: 12rpx;
  287. transition: all 0.3s ease;
  288. &:active {
  289. background-color: #F0F8FF;
  290. transform: scale(0.95);
  291. }
  292. }
  293. .function-icon {
  294. width: 48rpx;
  295. height: 48rpx;
  296. }
  297. .function-icon-wrapper {
  298. width: 48rpx;
  299. height: 48rpx;
  300. display: flex;
  301. align-items: center;
  302. justify-content: center;
  303. }
  304. .function-text {
  305. font-size: 24rpx;
  306. color: #000000;
  307. text-align: center;
  308. }
  309. </style>