page-person.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="page-person-box">
  3. <div class="user-box">
  4. <!-- 头像 -->
  5. <div class="userCardBox">
  6. <div class="userInfo">
  7. <van-image
  8. class="userHeaderImg"
  9. fit="cover"
  10. :src="maleAvatar"
  11. :show-error="true"
  12. :error-icon="maleAvatar"
  13. />
  14. <div class="userName">
  15. {{ userName }}
  16. </div>
  17. </div>
  18. <div class="userCardLine"></div>
  19. <!-- 今日积分 -->
  20. <div class="todayScoreBox">
  21. <div class="flexRowStartCenter">
  22. <span class="todayScore">今日积分:</span>
  23. <span class="todayScoreNum">50</span>
  24. </div>
  25. </div>
  26. <div style="height: 1rem"></div>
  27. </div>
  28. </div>
  29. <!-- 积分 -->
  30. <div class="all-score-box">
  31. <div class="allScoreCard">
  32. <div class="allScore">总积分: 100</div>
  33. </div>
  34. </div>
  35. <!-- 菜单 -->
  36. <div class="menu-box">
  37. <div class="menuCard">
  38. <van-grid>
  39. <van-grid-item
  40. v-for="(item, index) in menus"
  41. :key="index"
  42. :icon="item.icon"
  43. :text="item.title"
  44. @click="clickGridIcon(item)"
  45. />
  46. </van-grid>
  47. <div style="height: 3rem"></div>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import maleAvatar from "@/assets/image/maleAvatar.jpg";
  54. export default {
  55. name: "page-personal",
  56. components: {},
  57. data() {
  58. return {
  59. maleAvatar,
  60. avatarStyle: {
  61. "border-radius": "3rem",
  62. width: "1.8rem",
  63. height: "1.8rem",
  64. "background-color": "white",
  65. "margin-right": "0.2rem"
  66. },
  67. faceUrl: "",
  68. userName: "test@test.com",
  69. menus: [
  70. { title: "考试成绩", icon: "photo-o", to: "exam-history" },
  71. { title: "收藏", icon: "photo-o", to: "collection" },
  72. { title: "排行榜", icon: "photo-o", to: "rank" },
  73. { title: "使用手册", icon: "photo-o", to: "user-manual" },
  74. { title: "积分兑换", icon: "photo-o", to: "" }
  75. ]
  76. };
  77. },
  78. mounted() {
  79. this.getDailyPoints();
  80. },
  81. methods: {
  82. // 获取今日分数
  83. getDailyPoints() {
  84. let path = {
  85. userName: "testuser-zirKBELIlg"
  86. };
  87. this.$_http
  88. .get(this.$pathParams(this.$_API.JTXT_GET_USER_DAIYL_POINTS, path))
  89. .then(res => {
  90. this.contentObj = res.data;
  91. console.log("--user--" + JSON.stringify(this.contentObj));
  92. })
  93. .catch(() => {
  94. this.$store.commit("toggleLoading", false);
  95. });
  96. },
  97. // 点击宫格图标
  98. clickGridIcon(item) {
  99. console.log("---click--" + JSON.stringify(item));
  100. this.$router.push({
  101. name: item.to,
  102. params: { userId: "testuser-zirKBELIlg" }
  103. });
  104. }
  105. }
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. .page-person-box {
  110. overflow-y: auto;
  111. overflow-x: hidden;
  112. position: relative;
  113. font-size: 1rem;
  114. width: 100%;
  115. height: 100%;
  116. .user-box {
  117. padding: 0.5rem 0.5rem;
  118. .userCardBox {
  119. background-color: #fff;
  120. padding: 0.5rem 0.5rem;
  121. box-shadow: 0 0 4px 2px rgba(139, 163, 198, 0.3);
  122. -webkit-box-shadow: 0 0 4px 2px rgba(139, 163, 198, 0.3);
  123. border-radius: 0.1rem;
  124. .userHeaderImg {
  125. width: 2.5rem;
  126. height: 2.5rem;
  127. border-radius: 0.1rem;
  128. margin-right: 0.5rem;
  129. }
  130. .userCardLine {
  131. border-bottom: 1px solid #f1f1f1;
  132. width: 100%;
  133. height: 1px;
  134. margin: 0.4rem 0;
  135. }
  136. .userInfo {
  137. padding: 0.5rem 0;
  138. display: flex;
  139. flex-direction: row;
  140. justify-content: flex-start;
  141. }
  142. .userName {
  143. display: flex;
  144. flex-direction: row;
  145. justify-content: space-between;
  146. align-items: center;
  147. }
  148. .flexRowStartCenter {
  149. display: flex;
  150. flex-direction: row;
  151. justify-content: flex-start;
  152. align-items: center;
  153. }
  154. .todayScoreBox {
  155. padding: 0.5rem 0;
  156. font-size: 0.5rem;
  157. flex-wrap: nowrap;
  158. white-space: nowrap;
  159. overflow: hidden;
  160. .todayScore {
  161. margin-left: 0.5rem;
  162. margin-right: 0.5rem;
  163. font-size: 0.7rem;
  164. }
  165. .todayScoreNum {
  166. margin-right: 0.5rem;
  167. font-size: 0.7rem;
  168. }
  169. }
  170. }
  171. }
  172. .all-score-box {
  173. padding: 0.5rem 0.5rem;
  174. .allScoreCard {
  175. background-color: #fff;
  176. width: 100%;
  177. padding: 0.5rem 0.5rem;
  178. box-shadow: 0 0 4px 2px rgba(139, 163, 198, 0.3);
  179. -webkit-box-shadow: 0 0 4px 2px rgba(139, 163, 198, 0.3);
  180. border-radius: 0.1rem;
  181. .allScore {
  182. padding: 0.5rem 0;
  183. margin-left: 0.5rem;
  184. margin-right: 0.5rem;
  185. font-size: 0.8rem;
  186. color: #f6664f;
  187. font-weight: bold;
  188. }
  189. }
  190. }
  191. .menu-box {
  192. padding: 0.5rem 0.5rem;
  193. .menuCard {
  194. background-color: #fff;
  195. width: 100%;
  196. padding: 1rem 0.5rem;
  197. box-shadow: 0 0 4px 2px rgba(139, 163, 198, 0.3);
  198. -webkit-box-shadow: 0 0 4px 2px rgba(139, 163, 198, 0.3);
  199. border-radius: 0.1rem;
  200. }
  201. }
  202. }
  203. </style>