top.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <div id="top">
  3. <div class="n_box">
  4. <div class="left">
  5. <div class="tab_main">
  6. <header>
  7. <div :class="active == 1 ? 'active_tab' : ''">课程导航</div>
  8. <!-- <div :class="active == 2 ? 'active_tab' : ''">报考指导</div> -->
  9. </header>
  10. <div class="content_tab scroll_style">
  11. <div class="tab_li" v-for="(item, index) in typeList" :key="index">
  12. <div class="tops">
  13. <span>{{ item.educationName }}</span>
  14. <i class="el-icon-arrow-right"></i>
  15. </div>
  16. <ul>
  17. <li
  18. v-for="(items, indexs) in item.businessList"
  19. :key="indexs"
  20. v-show="indexs < 4"
  21. >
  22. {{ items.aliasName }}
  23. </li>
  24. <li
  25. v-if="$store.state.TENANT_NANE == '680980002459417532'"
  26. @click="goLink('https://cranesystem.gdcic.net:8080/')"
  27. >
  28. 建筑施工特种作业人员<span
  29. v-if="item.educationName == '考前培训'"
  30. >(建筑电工、司索工、施工升降机)</span
  31. >
  32. </li>
  33. <div style="clear:both;"></div>
  34. </ul>
  35. <div class="ri_p">
  36. <h4>{{ typeList[index].educationName }}</h4>
  37. <div class="fgx" style="margin:12px 0px;"></div>
  38. <ul class="scroll_style">
  39. <li
  40. v-for="(it, ix) in typeList[index].businessList"
  41. :key="ix"
  42. @click="goCourse(it)"
  43. >
  44. {{ it.aliasName }}
  45. </li>
  46. <li
  47. v-if="$store.state.TENANT_NANE == '680980002459417532'"
  48. @click="goLink('https://cranesystem.gdcic.net:8080/')"
  49. >
  50. 建筑施工特种作业人员<span
  51. v-if="typeList[index].educationName == '考前培训'"
  52. >(建筑电工、司索工、施工升降机)</span
  53. >
  54. </li>
  55. <div style="clear:both;"></div>
  56. </ul>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="swiper">
  62. <swiper
  63. v-if="swiperOptions.bannerList.length > 0"
  64. :options="swiperOptions"
  65. >
  66. <swiper-slide
  67. v-for="(item, index) in swiperOptions.bannerList"
  68. v-bind:key="index"
  69. @click.native="swiperJump(item)"
  70. >
  71. <img :src="$tools.splitImgHost(item.adverUrl)" alt="" />
  72. </swiper-slide>
  73. <div class="swiper-pagination" slot="pagination"></div>
  74. </swiper>
  75. </div>
  76. </div>
  77. <div class="login">
  78. <template v-if="!userInfo">
  79. <h2 class="title">账号登录注册</h2>
  80. <p class="value">获取海量优质课程</p>
  81. <img class="ggImg" src="@/assets/new1/zshktj.png" alt="" />
  82. <div class="btn" @click="$refs.login.openBox()">登录/注册</div>
  83. </template>
  84. <template v-else>
  85. <header class="header_user">
  86. <div>
  87. <img :src="$tools.splitImgHost(userInfo.avatar)" alt="" />
  88. <span>{{ userInfo.realname }}</span>
  89. </div>
  90. <div>
  91. <span
  92. @click="go('/person-center/my-info')"
  93. style="cursor: pointer;"
  94. >个人中心</span
  95. >
  96. <i class="el-icon-arrow-right"></i>
  97. </div>
  98. </header>
  99. <div class="header_li">
  100. <div
  101. @click="go('/person-center/my-course')"
  102. style="cursor: pointer;"
  103. >
  104. <img src="@/assets/kc.png" alt="" />
  105. <p>课程</p>
  106. </div>
  107. <div @click="go('/person-center/my-bank')" style="cursor: pointer;">
  108. <img src="@/assets/tk.png" alt="" />
  109. <p>题库</p>
  110. </div>
  111. <div
  112. @click="go('/person-center/my-order')"
  113. style="cursor: pointer;"
  114. >
  115. <img src="@/assets/dd.png" alt="" />
  116. <p>订单</p>
  117. </div>
  118. </div>
  119. <div class="fgx" style="width: 100%;opacity: 0.5;"></div>
  120. <div class="f_box" v-if="recordList.goodsId">
  121. <div class="btnsy">上次播放</div>
  122. <div class="title" @click="goLast">{{ recordList.goodsName }}</div>
  123. <div class="remark">
  124. <span
  125. >已学{{
  126. toFixed(
  127. (recordList.videoCurrentTime / recordList.durationTime) *
  128. 100
  129. )
  130. }}%</span
  131. >
  132. <span>{{ recordList.date }}</span>
  133. </div>
  134. </div>
  135. </template>
  136. </div>
  137. </div>
  138. <login ref="login"></login>
  139. </div>
  140. </template>
  141. <script>
  142. import login from "@/components/login";
  143. import { swiper, swiperSlide } from "vue-awesome-swiper";
  144. import "swiper/swiper-bundle.css";
  145. import { mapGetters } from "vuex";
  146. export default {
  147. components: {
  148. swiper,
  149. swiperSlide,
  150. login
  151. },
  152. data() {
  153. return {
  154. recordList: {},
  155. active: 1,
  156. typeList: [],
  157. swiperOptions: {
  158. bannerList: [],
  159. loop: true,
  160. observer: true,
  161. observeParents: true,
  162. speed: 300,
  163. autoplayDisableOnInteraction: false,
  164. autoplayStopOnLast: false,
  165. autoplay: {
  166. delay: 1000,
  167. disableOnInteraction: false
  168. },
  169. // 显示分页
  170. pagination: {
  171. el: ".swiper-pagination",
  172. clickable: true //允许分页点击跳转
  173. },
  174. // 设置点击箭头
  175. navigation: {
  176. nextEl: ".swiper-button-next",
  177. prevEl: ".swiper-button-prev"
  178. }
  179. } //轮播
  180. };
  181. },
  182. computed: {
  183. ...mapGetters(["userInfo"]),
  184. toFixed: function() {
  185. return function(num) {
  186. if (num) {
  187. let str = String(num).indexOf(".");
  188. if (str != -1) {
  189. return +num.toFixed(2);
  190. } else {
  191. return num;
  192. }
  193. } else {
  194. return 0;
  195. }
  196. };
  197. }
  198. },
  199. watch: {
  200. userInfo: {
  201. handler(newVal, oldVal) {
  202. this.getRecord();
  203. }
  204. }
  205. },
  206. mounted() {
  207. this.advertisingList();
  208. this.educationTypeList();
  209. this.getRecord();
  210. },
  211. methods: {
  212. /**
  213. * 播放记录
  214. */
  215. getRecord() {
  216. this.recordList = {};
  217. if (this.userInfo) {
  218. this.$request
  219. .studRrecordListUserRecord({
  220. pageNum: 1,
  221. pageSize: 1
  222. })
  223. .then(res => {
  224. if (res.rows.length) {
  225. this.recordList = res.rows[0];
  226. }
  227. });
  228. }
  229. },
  230. go(path, query) {
  231. this.$router.push({
  232. path,
  233. query
  234. });
  235. },
  236. goLast() {
  237. if (this.recordList.goodsType == 6) {
  238. this.go("/my-live-detail/" + this.recordList.goodsId, {
  239. gradeId: this.recordList.gradeId,
  240. orderGoodsId: this.recordList.orderGoodsId,
  241. courseId: this.recordList.courseId
  242. });
  243. } else if (this.recordList.goodsType == 1) {
  244. this.$router.push({
  245. path: `/my-course-detail/${this.recordList.goodsId}`,
  246. query: {
  247. gradeId: this.recordList.gradeId,
  248. orderGoodsId: this.recordList.orderGoodsId,
  249. }
  250. });
  251. }
  252. },
  253. goCourse(item) {
  254. // if (item.topicId) {
  255. // this.$router.push({
  256. // path: "/goodsTopic",
  257. // query: {
  258. // topicId: item.topicId
  259. // }
  260. // });
  261. // return;
  262. // }
  263. this.$router.push({
  264. path: "/course-list",
  265. query: {
  266. educationId: item.educationId ? item.educationId : item.id || "",
  267. projectId: item.projectId || "",
  268. businessId: item.educationId ? item.id : ""
  269. }
  270. });
  271. },
  272. educationTypeList() {
  273. this.$request.educationTypeList().then(res => {
  274. this.typeList = res.rows || [];
  275. this.typeList.forEach(async (item, index) => {
  276. const A = await this.$request.businessList({ educationId: item.id });
  277. item.businessList = A.rows.filter(items => items.aliasName);
  278. });
  279. });
  280. },
  281. swiperJump(swiper) {
  282. if (swiper.jumpType == 1) {
  283. //无跳转
  284. return;
  285. } else if (swiper.jumpType == 2) {
  286. //url
  287. window.open(swiper.jumpUrl, "_blank");
  288. } else if (swiper.jumpType == 3) {
  289. //内部接口
  290. this.$router.push({
  291. path: swiper.jumpUrl
  292. });
  293. }
  294. },
  295. goLink(path) {
  296. window.open(path);
  297. },
  298. advertisingList() {
  299. this.$request
  300. .advertisinghomeLocationList({
  301. platform: 2, //1小程序2PC网站
  302. status: 1,
  303. locationKey: "home-banner" //首页轮播KEY
  304. })
  305. .then(res => {
  306. /**
  307. * 如果存在-调用轮播图列表
  308. */
  309. if (res.data.length) {
  310. this.$request
  311. .advertisingList({ locationId: res.data[0].locationId })
  312. .then(result => {
  313. this.swiperOptions.autoplay.delay =
  314. res.data[0].intervalTime * 1000;
  315. this.swiperOptions.bannerList = result.rows;
  316. });
  317. }
  318. });
  319. }
  320. }
  321. };
  322. </script>
  323. <style lang="scss" scoped>
  324. .scroll_style {
  325. &::-webkit-scrollbar {
  326. width: 5px;
  327. height: 9px;
  328. display: none;
  329. }
  330. /*定义滚动条轨道 内阴影+圆角*/
  331. &::-webkit-scrollbar-track {
  332. background-color: inherit;
  333. border: none;
  334. /* margin: 6px; */
  335. border-radius: 10px;
  336. /* -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
  337. background-color: #F5F5F5; */
  338. }
  339. /*定义滑块 内阴影+圆角*/
  340. &::-webkit-scrollbar-thumb {
  341. border-radius: 10px;
  342. position: relative;
  343. right: 2px;
  344. /*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);*/
  345. background-color: #c6c6cd;
  346. width: 6px;
  347. }
  348. }
  349. #top {
  350. height: 600px;
  351. background: url("../../assets/new1/banner.png");
  352. position: relative;
  353. .n_box {
  354. position: absolute;
  355. width: 1200px;
  356. height: 400px;
  357. top: 126px;
  358. left: 50%;
  359. transform: translateX(-50%);
  360. display: flex;
  361. align-items: center;
  362. & > .left {
  363. flex: 1;
  364. background-color: #fff;
  365. border-radius: 4px;
  366. overflow: hidden;
  367. height: 100%;
  368. position: relative;
  369. .tab_main {
  370. backdrop-filter: blur(10px);
  371. width: 300px;
  372. height: 400px;
  373. z-index: 10;
  374. position: absolute;
  375. top: 0;
  376. left: 0;
  377. background-color: rgba(0, 0, 0, 0.85);
  378. & > header {
  379. display: flex;
  380. align-items: center;
  381. height: 50px;
  382. color: #fff;
  383. user-select: none;
  384. & > div {
  385. font-size: 16px;
  386. flex: 1;
  387. text-align: center;
  388. height: 48px;
  389. line-height: 48px;
  390. cursor: pointer;
  391. font-weight: 400;
  392. border-bottom: 2px solid #eeeeee50;
  393. &:hover {
  394. border-color: rgb(0, 122, 255);
  395. font-weight: bold;
  396. }
  397. // border-bottom: 2px solid #eee;
  398. }
  399. & > .active_tab {
  400. border-color: rgb(0, 122, 255);
  401. font-weight: bold;
  402. }
  403. }
  404. & > .content_tab {
  405. height: 350px;
  406. overflow: auto;
  407. & > .tab_li {
  408. padding: 16px 0px;
  409. margin: 0px;
  410. color: #fff;
  411. border-bottom: 1px solid rgb(86, 89, 92);
  412. &:hover {
  413. color: #007aff !important;
  414. }
  415. & > .ri_p {
  416. visibility: hidden;
  417. position: absolute;
  418. background-color: #fff;
  419. top: 0px;
  420. left: 300px;
  421. width: 580px;
  422. height: 400px;
  423. // transition: all 0.3s;
  424. opacity: 0;
  425. padding: 15px 30px 0px;
  426. display: flex;
  427. flex-direction: column;
  428. h4 {
  429. font-weight: bold;
  430. color: #007aff;
  431. font-size: 16px;
  432. }
  433. ul {
  434. overflow: auto;
  435. > li {
  436. user-select: none;
  437. cursor: pointer;
  438. float: left;
  439. margin: 0px 36px 20px 0px;
  440. color: #007aff;
  441. &:hover {
  442. font-weight: bold;
  443. }
  444. }
  445. }
  446. }
  447. &:hover .ri_p {
  448. visibility: visible;
  449. opacity: 1;
  450. }
  451. &:last-child {
  452. border-bottom: none;
  453. }
  454. & > .tops {
  455. padding: 0px 20px;
  456. user-select: none;
  457. display: flex;
  458. align-items: center;
  459. justify-content: space-between;
  460. margin-bottom: 14px;
  461. font-weight: bold;
  462. }
  463. & > ul {
  464. padding: 0px 20px;
  465. & > li {
  466. margin: 0px 10px 6px 0px;
  467. float: left;
  468. user-select: none;
  469. }
  470. }
  471. }
  472. }
  473. }
  474. }
  475. & > .login {
  476. margin-left: 20px;
  477. border-radius: 4px;
  478. overflow: hidden;
  479. background-color: rgba(0, 0, 0, 0.5);
  480. backdrop-filter: blur(10px);
  481. width: 300px;
  482. height: 100%;
  483. display: flex;
  484. flex-direction: column;
  485. align-items: center;
  486. & > .title {
  487. font-size: 18px;
  488. font-weight: bold;
  489. color: #fff;
  490. margin-top: 50px;
  491. margin-bottom: 20px;
  492. }
  493. & > .value {
  494. font-size: 14px;
  495. color: #fff;
  496. margin-bottom: 20px;
  497. }
  498. & > .ggImg {
  499. border-radius: 14px;
  500. overflow: hidden;
  501. margin-bottom: 20px;
  502. width: 211px;
  503. height: 120px;
  504. background-color: #fff;
  505. }
  506. & > .btn {
  507. user-select: none;
  508. cursor: pointer;
  509. width: 211px;
  510. border-radius: 100px;
  511. color: #fff;
  512. background-color: rgb(0, 122, 255);
  513. text-align: center;
  514. height: 30px;
  515. line-height: 30px;
  516. transition: all 0.2s;
  517. &:hover {
  518. background-color: rgb(2, 106, 244);
  519. }
  520. }
  521. & > .header_user {
  522. display: flex;
  523. align-items: center;
  524. justify-content: space-between;
  525. width: 100%;
  526. padding: 30px;
  527. padding-top: 25px;
  528. & > div {
  529. display: flex;
  530. align-items: center;
  531. & > img {
  532. width: 40px;
  533. height: 40px;
  534. margin-right: 6px;
  535. overflow: hidden;
  536. border-radius: 50%;
  537. }
  538. & > span {
  539. color: #fff;
  540. margin-right: 6px;
  541. }
  542. & > i {
  543. color: #fff;
  544. }
  545. }
  546. }
  547. & > .header_li {
  548. width: 100%;
  549. display: flex;
  550. align-items: center;
  551. justify-content: space-between;
  552. padding: 0px 30px;
  553. & > div {
  554. color: #fff;
  555. & > img {
  556. width: 60px;
  557. height: 60px;
  558. overflow: hidden;
  559. border-radius: 50%;
  560. margin-bottom: 15px;
  561. }
  562. & > p {
  563. text-align: center;
  564. }
  565. }
  566. }
  567. & > .f_box {
  568. user-select: none;
  569. padding: 20px;
  570. color: #fff;
  571. width: 100%;
  572. & > .btnsy {
  573. display: inline-block;
  574. border-radius: 14px;
  575. padding: 4px 8px;
  576. border: 1px solid #fff;
  577. margin-bottom: 20px;
  578. }
  579. & > .title {
  580. margin-bottom: 15px;
  581. cursor: pointer;
  582. &:hover {
  583. color: #409eff;
  584. }
  585. }
  586. & > .remark {
  587. display: flex;
  588. align-items: center;
  589. justify-content: space-between;
  590. margin-bottom: 10px;
  591. }
  592. }
  593. }
  594. }
  595. }
  596. .swiper-slide {
  597. cursor: pointer;
  598. height: 400px;
  599. img {
  600. width: 100%;
  601. height: 100%;
  602. }
  603. }
  604. .swiper-pagination {
  605. text-align: right;
  606. padding-right: 24px;
  607. /deep/ .swiper-pagination-bullet {
  608. background: rgba(255, 255, 255, 0.4);
  609. &-active {
  610. background: rgba(255, 255, 255, 1);
  611. }
  612. }
  613. }
  614. .fgx {
  615. margin-top: 30px;
  616. height: 1px;
  617. background-color: #eee;
  618. }
  619. </style>