my.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view>
  3. <u-navbar title="我的" :is-back="false"></u-navbar>
  4. <view class="head">
  5. <u-row>
  6. <u-col span="3" offset="1">
  7. <navigator url="/pages2/wd/avatar" hover-class="none">
  8. <image :src="userInfo != null ? $method.splitImgHost(userInfo.avatar) : ''" class="avatar"></image>
  9. </navigator>
  10. </u-col>
  11. <u-col span="6">
  12. <view style="display: flex;">
  13. <navigator class="name" url="/pages2/wd/avatar" hover-class="none">{{ userInfo.nickname }}</navigator>
  14. <navigator class="tag" url="/pages2/wd/level" hover-class="none">{{userInfo.userLevel === null ? '初出茅庐':levelList[userInfo.userLevel -1]}}</navigator>
  15. </view>
  16. <navigator url="/pages2/wd/level" hover-class="none" style="position: relative;margin-top: 20rpx;">
  17. <view class="progress_text">{{userInfo.integral === null ? 0 : userInfo.integral}}/{{userInfo.userLevel === null ? '0': userLevelList[userInfo.userLevel -1]}}</view>
  18. <u-line-progress height="8" active-color="#2F4379" :percent="0" :show-percent="false"></u-line-progress>
  19. </navigator>
  20. </u-col>
  21. <view class="qiandao" @click="qd" v-if="issue === 0">签到</view>
  22. <view class="qiandao" v-if="issue === 1">已签到</view>
  23. </u-row>
  24. <view style="margin-top: 20rpx;">
  25. <u-row>
  26. <u-col span="4" text-align="center">
  27. <navigator url="/pages2/wd/collect" hover-class="none">
  28. <view class="head_t1">收藏</view>
  29. <view class="head_t2">{{ collectTotal }}</view>
  30. </navigator>
  31. </u-col>
  32. <u-col span="4" text-align="center">
  33. <navigator url="/pages2/wd/collect" hover-class="none">
  34. <view class="head_t1">金币</view>
  35. <view class="head_t2">{{ userInfo.money }}</view>
  36. </navigator>
  37. </u-col>
  38. <u-col span="4" text-align="center">
  39. <navigator url="/pages2/wd/ranking" hover-class="none">
  40. <view class="head_t1">学习排名</view>
  41. <view class="head_t2" v-if="rank > 0">NO.{{ rank }}</view>
  42. <view class="head_t2" v-else>暂未上榜</view>
  43. </navigator>
  44. </u-col>
  45. </u-row>
  46. </view>
  47. </view>
  48. <view style="padding: 30rpx;">
  49. <!-- 学习记录-->
  50. <view class="record">
  51. <view class="r_t1">
  52. 最近学习记录
  53. <u-icon name="arrow-right" size="28"></u-icon>
  54. </view>
  55. <scroll-view class="r_sliper" scroll-x="true">
  56. <view v-for="(item, index) in list" :key="index" style="margin-right: 20rpx;display:inline-block" @click="jumpDetail(item)">
  57. <image :src="$method.splitImgHost(item.coverUrl)" class="r_image"></image>
  58. <view class="r_t2">{{ item.courseName }}</view>
  59. </view>
  60. </scroll-view>
  61. </view>
  62. <!-- 模块-->
  63. <view class="module">
  64. <u-row>
  65. <u-col span="3" text-align="center">
  66. <navigator url="/pages2/study/index" hover-class="none">
  67. <image src="/static/tool_1.png" class="tool_img"></image>
  68. <view class="tool_t">我的学习</view>
  69. </navigator>
  70. </u-col>
  71. <u-col span="3" text-align="center">
  72. <navigator url="/pages2/wd/menu" hover-class="none">
  73. <image src="/static/tool_2.png" class="tool_img"></image>
  74. <view class="tool_t">基本资料</view>
  75. </navigator>
  76. </u-col>
  77. <u-col span="3" text-align="center">
  78. <navigator url="/pages2/wd/help" hover-class="none">
  79. <image src="/static/tool_3.png" class="tool_img"></image>
  80. <view class="tool_t">助学活动</view>
  81. </navigator>
  82. </u-col>
  83. <u-col span="3" text-align="center">
  84. <navigator url="/pages2/wd/coupon" hover-class="none">
  85. <image src="/static/tool_7.png" class="tool_img"></image>
  86. <view class="tool_t">优惠券</view>
  87. </navigator>
  88. </u-col>
  89. </u-row>
  90. <view style="margin-top: 30rpx;">
  91. <u-row>
  92. <u-col span="3" text-align="center">
  93. <navigator url="/pages2/wd/enroll" hover-class="none">
  94. <image src="/static/tool_5.png" class="tool_img"></image>
  95. <view class="tool_t">考试报名</view>
  96. </navigator>
  97. </u-col>
  98. <u-col span="3" text-align="center">
  99. <view @click="jumpPopup">
  100. <image src="/static/tool_4.png" class="tool_img"></image>
  101. <view class="tool_t">成长地图</view>
  102. </view>
  103. </u-col>
  104. </u-row>
  105. </view>
  106. </view>
  107. <view class="module2">
  108. <u-row>
  109. <u-col span="3" text-align="center">
  110. <view @click="jumpPopup">
  111. <image src="/static/tool_6.png" class="tool_img"></image>
  112. <view class="tool_t">异常反馈</view>
  113. </view>
  114. </u-col>
  115. </u-row>
  116. </view>
  117. </view>
  118. <u-modal v-model="show" :content="content"></u-modal>
  119. </view>
  120. </template>
  121. <script>
  122. import { mapGetters } from 'vuex';
  123. export default {
  124. name: 'my',
  125. data() {
  126. return {
  127. list: [23, 24, 25, 26, 27, 28, 29],
  128. content: '此功能暂未开放',
  129. show: false,
  130. collectTotal: 0,
  131. rank: 0,
  132. issue: 0,
  133. levelList: ['初出茅庐','崭露头角','自成一派','小有名气','惊艳四座','初露锋芒'],
  134. userLevelList: []
  135. };
  136. },
  137. methods: {
  138. getLevel(){
  139. var self = this
  140. this.$api.gradelist().then(res => {
  141. res.data.rows.forEach((item,index) => {
  142. self.userLevelList.push(item.needIntegralEnd)
  143. })
  144. })
  145. },
  146. qd() {
  147. var self = this
  148. var data = {
  149. taskType: 0
  150. }
  151. self.$api.taskSignIn(data).then(res => {
  152. if(res.data.code === 200){
  153. self.getInfoAttached()
  154. //刷新用户信息
  155. self.$api.refreshUserInfo()
  156. }
  157. })
  158. },
  159. jumpDetail(item) {
  160. this.$navTo.togo('/pages2/course/detail', {
  161. id: item.courseId
  162. });
  163. return;
  164. },
  165. init() {
  166. this.getInfoAttached();
  167. this.getLevel()
  168. },
  169. jumpPopup() {
  170. this.show = true;
  171. },
  172. getInfoAttached() {
  173. let self = this;
  174. this.$api.appInfoAttached().then(res => {
  175. self.collectTotal = res.data.data.collectTotal;
  176. self.rank = res.data.data.rank;
  177. self.issue = res.data.data.issue
  178. });
  179. this.studyRecordList();
  180. },
  181. studyRecordList() {
  182. let self = this;
  183. this.$api.studyRecordList().then(res => {
  184. self.list = res.data.rows;
  185. });
  186. }
  187. },
  188. computed: { ...mapGetters(['userInfo']) }
  189. };
  190. </script>
  191. <style>
  192. ::-webkit-scrollbar {
  193. width: 0;
  194. height: 0;
  195. color: transparent;
  196. }
  197. </style>
  198. <style scoped>
  199. .module2 {
  200. width: 100%;
  201. height: 130rpx;
  202. background: #ffffff;
  203. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  204. border-radius: 32rpx;
  205. margin-top: 30rpx;
  206. padding: 30rpx 0;
  207. }
  208. .tool_t {
  209. font-size: 24rpx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. color: #2f4379;
  213. }
  214. .tool_img {
  215. width: 42rpx;
  216. height: 42rpx;
  217. }
  218. .module {
  219. width: 100%;
  220. height: 260rpx;
  221. background: #ffffff;
  222. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  223. border-radius: 32rpx;
  224. margin-top: 30rpx;
  225. padding: 30rpx 0;
  226. }
  227. .r_sliper {
  228. padding: 0 20rpx;
  229. }
  230. .r_t2 {
  231. font-size: 20rpx;
  232. font-family: PingFang SC;
  233. font-weight: 400;
  234. color: #2f4379;
  235. }
  236. .r_image {
  237. width: 278rpx;
  238. height: 134rpx;
  239. }
  240. .r_t1 {
  241. font-size: 24rpx;
  242. font-family: PingFang SC;
  243. font-weight: 500;
  244. color: #2f4379;
  245. padding: 20rpx;
  246. }
  247. .record {
  248. width: 100%;
  249. height: 260rpx;
  250. background: #ffffff;
  251. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  252. border-radius: 32rpx;
  253. white-space: nowrap;
  254. overflow: hidden;
  255. }
  256. page {
  257. background: #fdfdfd;
  258. }
  259. .head_t2 {
  260. font-size: 32rpx;
  261. font-family: MF YiHei (Noncommercial);
  262. font-weight: bold;
  263. color: #2f4379;
  264. }
  265. .head_t1 {
  266. font-size: 24rpx;
  267. font-family: PingFang SC;
  268. font-weight: bold;
  269. color: #2f4379;
  270. opacity: 0.6;
  271. }
  272. .qiandao {
  273. float: right;
  274. width: 100rpx;
  275. height: 40rpx;
  276. background: #2f4379;
  277. border-radius: 20rpx 0rpx 0rpx 20rpx;
  278. color: #ffffff;
  279. text-align: center;
  280. }
  281. .progress_text {
  282. font-size: 24rpx;
  283. font-family: PingFang SC;
  284. font-weight: 800;
  285. color: #2f4379;
  286. position: relative;
  287. top: 15rpx;
  288. }
  289. .tag {
  290. font-size: 24rpx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. color: #2f4379;
  294. margin-left: 30rpx;
  295. border: 1px solid #2f4379;
  296. border-radius: 20px;
  297. padding: 6rpx;
  298. }
  299. .name {
  300. font-size: 32rpx;
  301. font-family: PingFang SC;
  302. font-weight: 800;
  303. color: #2f4379;
  304. }
  305. .wrap {
  306. padding: 24rpx;
  307. }
  308. .head {
  309. padding-top: 30rpx;
  310. background-color: #ffffff;
  311. padding-bottom: 20rpx;
  312. }
  313. .avatar {
  314. width: 140rpx;
  315. height: 140rpx;
  316. border-radius: 50%;
  317. }
  318. </style>