index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="person-center">
  3. <Header></Header>
  4. <section class="section">
  5. <div class="container">
  6. <div class="section__header">
  7. <img
  8. :src="
  9. userInfo
  10. ? userInfo.avatar
  11. ? $tools.splitImgHost(userInfo.avatar, true)
  12. : '@/assets/qrcode.png'
  13. : ''
  14. "
  15. class="img"
  16. alt=""
  17. />
  18. <div class="text">
  19. <div class="title">{{ userInfo && userInfo.realname }}</div>
  20. <div class="desc">你好</div>
  21. </div>
  22. </div>
  23. <el-tabs class="tabs" :value="activeName" @tab-click="handleClick">
  24. <el-tab-pane name="1">
  25. <div class="label" slot="label">
  26. <img src="@/assets/study-center.png" alt="" />
  27. 学习中心
  28. </div>
  29. </el-tab-pane>
  30. <el-tab-pane name="2">
  31. <div class="label" slot="label">
  32. <img src="@/assets/person-center.png" alt="" />
  33. 个人中心
  34. </div>
  35. </el-tab-pane>
  36. </el-tabs>
  37. <div class="swiper">
  38. <swiper
  39. v-if="businessList.length > 0"
  40. ref="mySwiper"
  41. v-bind:options="swiperOptions"
  42. >
  43. <swiper-slide
  44. class="swiper-item"
  45. v-for="(item, index) in businessList"
  46. v-bind:key="index"
  47. :class="{ active: item == businessItem }"
  48. @click.native="swiperClick(item)"
  49. >
  50. {{ item.educationName }} - {{ item.aliasName }}
  51. </swiper-slide>
  52. </swiper>
  53. <div class="swiper-button-next"></div>
  54. <div class="swiper-button-prev"></div>
  55. </div>
  56. <div class="section__body clearfix">
  57. <div class="nav">
  58. <div class="nav__section">
  59. <div class="title">我的课程</div>
  60. <div class="list">
  61. <router-link to="/person-center/my-course">
  62. <div class="item">我的网课</div>
  63. </router-link>
  64. <router-link to="/person-center/play-record">
  65. <div class="item">播放记录</div>
  66. </router-link>
  67. </div>
  68. </div>
  69. <div class="nav__section">
  70. <div class="title">我的直播课</div>
  71. <div class="list">
  72. <router-link to="/person-center/my-live">
  73. <div class="item">学习列表</div>
  74. </router-link>
  75. </div>
  76. </div>
  77. <div class="nav__section">
  78. <div class="title">我的题库</div>
  79. <div class="list">
  80. <router-link to="/person-center/my-bank">
  81. <div class="item">自购题卷</div>
  82. </router-link>
  83. <router-link to="/person-center/free-bank">
  84. <div class="item">赠送题卷</div>
  85. </router-link>
  86. <router-link to="/person-center/bank-record">
  87. <div class="item">做题记录</div>
  88. </router-link>
  89. <router-link to="/person-center/my-collect">
  90. <div class="item">收藏集</div>
  91. </router-link>
  92. <router-link to="/person-center/my-wrong">
  93. <div class="item">错题集</div>
  94. </router-link>
  95. </div>
  96. </div>
  97. <div class="nav__section">
  98. <div class="title">个人管理</div>
  99. <div class="list">
  100. <router-link to="/person-center/my-order">
  101. <div class="item">我的订单</div>
  102. </router-link>
  103. <router-link to="/person-center/my-invoice">
  104. <div class="item">我的发票</div>
  105. </router-link>
  106. <router-link to="/person-center/my-classhour">
  107. <div class="item">我的学时</div>
  108. </router-link>
  109. <router-link to="/person-center/my-examination">
  110. <div class="item">我的考试</div>
  111. </router-link>
  112. <router-link to="/person-center/my-mock">
  113. <div class="item">我的模考</div>
  114. </router-link>
  115. <router-link to="/person-center/mock-record">
  116. <div class="item">模考记录</div>
  117. </router-link>
  118. <router-link to="/person-center/my-message">
  119. <div class="item">我的消息</div>
  120. </router-link>
  121. <router-link to="/person-center/my-info">
  122. <div class="item">我的资料</div>
  123. </router-link>
  124. <!-- <router-link to="/">
  125. <div class="item">学习计划</div>
  126. </router-link> -->
  127. </div>
  128. </div>
  129. </div>
  130. <div class="content">
  131. <router-view></router-view>
  132. </div>
  133. </div>
  134. </div>
  135. </section>
  136. <ToolBar></ToolBar>
  137. <Footer></Footer>
  138. </div>
  139. </template>
  140. <script>
  141. import { swiper, swiperSlide } from "vue-awesome-swiper";
  142. import Footer from "@/components/footer/index";
  143. import Header from "@/components/header/index";
  144. import ToolBar from "@/components/toolbar/index";
  145. import "swiper/swiper-bundle.css";
  146. import { mapGetters, mapMutations } from "vuex";
  147. export default {
  148. name: "PersonCenter",
  149. components: {
  150. swiper,
  151. swiperSlide,
  152. Footer,
  153. Header,
  154. ToolBar,
  155. },
  156. data() {
  157. return {
  158. activeName: "1",
  159. swiperOptions: {
  160. freeMode: false,
  161. observer: true,
  162. slidesPerView: "auto",
  163. observeParents: true,
  164. speed: 300,
  165. autoplayDisableOnInteraction: false,
  166. autoplayStopOnLast: false,
  167. // 设置点击箭头
  168. navigation: {
  169. nextEl: ".swiper-button-next",
  170. prevEl: ".swiper-button-prev",
  171. },
  172. },
  173. };
  174. },
  175. computed: {
  176. ...mapGetters(["userInfo", "businessList", "businessItem"]),
  177. },
  178. mounted() {},
  179. methods: {
  180. ...mapMutations(["setBusinessItem"]),
  181. handleClick(e) {
  182. if (this.activeName == e.name) {
  183. return;
  184. }
  185. this.activeName = e.name;
  186. },
  187. swiperClick(item) {
  188. this.setBusinessItem(item);
  189. },
  190. },
  191. };
  192. </script>
  193. <!-- Add "scoped" attribute to limit CSS to this component only -->
  194. <style scoped lang="scss">
  195. .person-center {
  196. .section {
  197. &__header {
  198. padding-left: 28px;
  199. display: flex;
  200. align-items: center;
  201. width: 100%;
  202. height: 138px;
  203. background: #ebf3ff;
  204. .img {
  205. width: 90px;
  206. height: 90px;
  207. border-radius: 50%;
  208. }
  209. .text {
  210. margin-left: 24px;
  211. .title {
  212. font-size: 16px;
  213. font-family: Microsoft YaHei;
  214. font-weight: 400;
  215. color: #333333;
  216. }
  217. .desc {
  218. margin-top: 10px;
  219. font-size: 16px;
  220. font-family: Microsoft YaHei;
  221. font-weight: 400;
  222. color: #333333;
  223. }
  224. }
  225. }
  226. .tabs {
  227. /deep/ .el-tabs__item {
  228. height: 64px;
  229. line-height: 64px;
  230. }
  231. .label {
  232. width: 138px;
  233. text-align: center;
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. }
  238. img {
  239. margin-right: 10px;
  240. }
  241. }
  242. .swiper {
  243. position: relative;
  244. padding: 0 40px;
  245. .swiper-slide {
  246. cursor: pointer;
  247. width: auto !important;
  248. height: 40px;
  249. line-height: 40px;
  250. border-radius: 8px;
  251. padding: 0 24px;
  252. background: #eeeeee;
  253. color: #333333;
  254. margin-right: 24px;
  255. font-size: 16px;
  256. &.active {
  257. color: #fff;
  258. background: #3f8dfd;
  259. }
  260. }
  261. .swiper-button-prev,
  262. .swiper-button-next {
  263. &::after {
  264. font-size: 30px;
  265. }
  266. }
  267. }
  268. &__body {
  269. margin: 20px 0;
  270. .nav {
  271. float: left;
  272. width: 138px;
  273. background: #f8f8fc;
  274. padding: 0 4px;
  275. &__section {
  276. .title {
  277. height: 40px;
  278. line-height: 40px;
  279. padding-left: 20px;
  280. font-size: 14px;
  281. font-family: Microsoft YaHei;
  282. font-weight: bold;
  283. color: #333333;
  284. }
  285. .list {
  286. .router-link-active {
  287. .item {
  288. color: #3f8dfd;
  289. background: #e4e4e6;
  290. }
  291. }
  292. .item {
  293. margin-top: 4px;
  294. text-align: center;
  295. display: block;
  296. height: 40px;
  297. border-radius: 8px;
  298. line-height: 40px;
  299. font-size: 14px;
  300. font-family: Microsoft YaHei;
  301. font-weight: 400;
  302. color: #333333;
  303. }
  304. }
  305. }
  306. }
  307. .content {
  308. margin-left: 138px;
  309. padding-left: 24px;
  310. }
  311. }
  312. }
  313. }
  314. </style>