my_learn.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. <template>
  2. <view class="safeArea">
  3. <nav-bar title="目录"></nav-bar>
  4. <view
  5. style="
  6. width: 100%;
  7. text-align: center;
  8. position: fixed;
  9. height: 96rpx;
  10. z-index: 999;
  11. "
  12. >
  13. <u-tabs
  14. :list="list"
  15. sticky
  16. :current="current"
  17. @change="change"
  18. active-color="#333"
  19. inactive-color="#999"
  20. ></u-tabs>
  21. </view>
  22. <view class="learnWrap">
  23. <template v-if="current === 1">
  24. <view class="noData" v-if="listData.length == 0"
  25. >您暂无相关学时审核记录哦~</view
  26. >
  27. <view class="learnItem" v-for="(item, index) in listData" :key="index">
  28. <view class="title">{{ item.goodsName }}</view>
  29. <view class="status">
  30. <view class="label">审核状态:</view>
  31. <view
  32. class="val"
  33. :class="
  34. item.periodStatus === -1
  35. ? 'red'
  36. : item.periodStatus === 1
  37. ? 'green'
  38. : item.periodStatus === 2 || item.periodStatus === 3
  39. ? 'blue'
  40. : ''
  41. "
  42. >
  43. <text>
  44. {{
  45. item.periodStatus === -1
  46. ? "不可审核"
  47. : item.periodStatus === 1
  48. ? "机构审核通过"
  49. : item.periodStatus === 2
  50. ? "等待审核"
  51. : item.periodStatus === 3
  52. ? "审核中"
  53. : item.periodStatus === 0
  54. ? "机构审核不通过"
  55. : ""
  56. }}
  57. </text>
  58. <view
  59. v-if="item.periodStatus === 0"
  60. style="font-size: 24rpx; color: #666"
  61. >
  62. <text style="color: #ff3b30">{{ item.rebuild }}节</text>
  63. 需要重修
  64. </view>
  65. </view>
  66. </view>
  67. <view class="tip" v-if="item.periodStatus === 1">
  68. <template
  69. v-if="
  70. item.educationName == '继续教育' &&
  71. item.businessName == '二级' &&
  72. item.projectName == '建造师'
  73. "
  74. >
  75. <view class="label">审核提示:</view>
  76. <view>
  77. 机构已审核通过,需等待注册中心复审后即可获得继续教育学时。审核时间约15个工作日,届时请前往官网申请证书延期。
  78. <view class="copySty" @tap="copyText">复制官网链接</view>
  79. </view>
  80. </template>
  81. </view>
  82. <view class="tip" v-else>
  83. <view class="label">审核提示:</view>
  84. <view class="val color666" v-if="item.periodStatus === -1"
  85. >您的学时还未修完,请尽快完成课程学习</view
  86. >
  87. <view class="val color666" v-if="item.periodStatus === 2"
  88. >学习完成后7-15个工作日完成学时审核。</view
  89. >
  90. <view class="val color666" v-if="item.periodStatus === 0"
  91. >请查看需重学记录,并及时重学对应课程,以免延误学时审核进度。</view
  92. >
  93. <view class="val color666" v-if="item.periodStatus === 3"
  94. >会在7-15个工作日左右完成学时审核</view
  95. >
  96. </view>
  97. <view v-if="item.periodStatus !== 2">
  98. <u-line color="#EEEEEE" />
  99. <view v-if="item.periodStatus === -1">
  100. <view class="btnBox"
  101. ><view
  102. class="btn"
  103. v-if="item.externalLinkStatus || !showLearn(item)"
  104. @click="jumpPage(item, 1, index)"
  105. >课程学习</view
  106. ></view
  107. >
  108. </view>
  109. <view>
  110. <view
  111. v-if="
  112. item.periodStatus === 1 &&
  113. item.applyStatus === 1 &&
  114. !(
  115. sysTime <= item.serviceStartTime ||
  116. sysTime >= item.serviceEndTime ||
  117. (item.classStartTime && sysTime <= item.classStartTime) ||
  118. (item.classEndTime && sysTime >= item.classEndTime) ||
  119. item.learningStatus == 2 ||
  120. item.classStatus == 0 ||
  121. (item.learningStatus == 3 &&
  122. sysTime < item.learningTimeStart)
  123. )
  124. "
  125. >
  126. <template v-for="apply in item.applyList">
  127. <view class="subTitle">{{ apply.applyName }}</view>
  128. <!-- <view class="status">
  129. <view class="label">审核状态:</view>
  130. <view class="val green">
  131. <text>
  132. 机构审核通过
  133. </text>
  134. </view>
  135. </view> -->
  136. <view class="btnBox"
  137. ><view class="btn" @click="jumpPage(item, 2, index, apply)"
  138. >预约考试</view
  139. ></view
  140. >
  141. </template>
  142. </view>
  143. <u-line
  144. color="#EEEEEE"
  145. v-if="item.periodStatus === 1 && item.applyStatus === 1"
  146. />
  147. <view
  148. v-if="
  149. item.periodStatus === 1 &&
  150. item.beforeStatus === 1 &&
  151. !(
  152. sysTime <= item.serviceStartTime ||
  153. sysTime >= item.serviceEndTime ||
  154. (item.classStartTime && sysTime <= item.classStartTime) ||
  155. (item.classEndTime && sysTime >= item.classEndTime) ||
  156. item.learningStatus == 2 ||
  157. item.classStatus == 0 ||
  158. (item.learningStatus == 3 &&
  159. sysTime < item.learningTimeStart)
  160. )
  161. "
  162. >
  163. <view class="subTitle">{{ item.beforeName }}</view>
  164. <!-- <view class="status">
  165. <view class="label">审核状态:</view>
  166. <view class="val green">
  167. <text>
  168. 机构审核通过
  169. </text>
  170. </view>
  171. </view> -->
  172. <view class="btnBox"
  173. ><view class="btn" @click="jumpPage(item, 3, index)"
  174. >进入刷题</view
  175. ></view
  176. >
  177. </view>
  178. </view>
  179. <view v-if="item.periodStatus === 0 && item.rebuildStatus === 0">
  180. <view class="btnBox"
  181. ><view class="btn" @click="jumpPage(item, 4, index)"
  182. >查看详情</view
  183. ></view
  184. >
  185. </view>
  186. <view v-if="item.periodStatus === 0 && item.rebuildStatus === 1">
  187. <view class="btnBox"
  188. ><view class="btn" @click="jumpPage(item, 5, index)"
  189. >重修目录</view
  190. ></view
  191. >
  192. </view>
  193. </view>
  194. </view>
  195. </template>
  196. <template v-if="current === 0">
  197. <view class="noData" v-if="listData.length == 0"
  198. >您暂无相关学习凭证记录哦~</view
  199. >
  200. <view
  201. class="learnItem card"
  202. v-for="(item, index) in listData"
  203. :key="index"
  204. >
  205. <view class="title">{{ item.title }}</view>
  206. <view class="number">
  207. <text class="label">编号:</text>
  208. {{ item.certificateCode }}
  209. </view>
  210. <view class="btnBox">
  211. <view class="btn" @click="showPhoto(item)">电子照片</view>
  212. <view class="btn" @click="saveEwm(item)">下载凭证</view>
  213. </view>
  214. </view>
  215. </template>
  216. </view>
  217. </view>
  218. </template>
  219. <script>
  220. import { mapGetters } from "vuex";
  221. export default {
  222. components: {},
  223. data() {
  224. return {
  225. loading: false,
  226. current: 0,
  227. list: [
  228. {
  229. name: "学习凭证",
  230. },
  231. {
  232. name: "学时审核",
  233. },
  234. ],
  235. param: {
  236. pageNum: 1,
  237. pageSize: 10,
  238. orderGoodsId: "",
  239. },
  240. total: 0,
  241. itemIndex: "",
  242. listData: [],
  243. orderGoodsId: 0,
  244. sysTime: 0,
  245. };
  246. },
  247. onLoad(option) {
  248. this.orderGoodsId = option.orderGoodsId || "";
  249. this.param.orderGoodsId = option.orderGoodsId || "";
  250. this.getUserCertificateList();
  251. },
  252. onShow() {
  253. this.sysTime = +this.$method.timest();
  254. if (this.itemIndex !== "") {
  255. if (this.current == 0) {
  256. this.refreshByIndex();
  257. }
  258. }
  259. },
  260. onReachBottom() {
  261. if (this.listData.length < this.total) {
  262. this.param.pageNum++;
  263. if (this.current == 1) {
  264. this.getcourseperiodlistGoods();
  265. } else if (this.current == 0) {
  266. this.getUserCertificateList();
  267. }
  268. }
  269. },
  270. methods: {
  271. showLearn(item) {
  272. return (
  273. (item.interfacePushId > 0 && item.officialStatus != 1) ||
  274. this.sysTime <= item.serviceStartTime ||
  275. this.sysTime >= item.serviceEndTime ||
  276. (item.classStartTime && this.sysTime <= item.classStartTime) ||
  277. (item.classEndTime && this.sysTime >= item.classEndTime) ||
  278. item.learningStatus == 2 ||
  279. item.classStatus == 0 ||
  280. (item.learningStatus == 3 && this.sysTime < item.learningTimeStart)
  281. );
  282. },
  283. refreshByIndex() {
  284. this.$api
  285. .getcourseperiodlistGoods({
  286. pageNum: this.itemIndex + 1,
  287. pageSize: 1,
  288. orderGoodsId: this.orderGoodsId,
  289. })
  290. .then((res) => {
  291. if (res.data.code === 200) {
  292. this.$set(this.listData, this.itemIndex, res.data.rows[0]);
  293. }
  294. });
  295. },
  296. copyText() {
  297. uni.setClipboardData({
  298. data: "http://gdzczx.gdcic.net/",
  299. success: () => {
  300. //复制成功的回调函数
  301. uni.showToast({
  302. //提示
  303. title: "复制成功",
  304. });
  305. },
  306. });
  307. },
  308. jumpPage(v, int, index, appoint) {
  309. if (v.externalLinkStatus) {
  310. this.$method.toLink(v.externalLink);
  311. return;
  312. }
  313. console.log("--item", v);
  314. // return
  315. this.itemIndex = index;
  316. //int 1.课程学习 2.预约考试 3.进入刷题 4.查看详情 5.重修目录
  317. if (int === 1 || int === 5) {
  318. // /lock/lockStatus
  319. this.$api
  320. .lockLockStatus({
  321. action: "jxjy",
  322. uuid: this.$method.getUuid(),
  323. })
  324. .then((res) => {
  325. if (res.data.code == 200) {
  326. //有其他端在操作,不能学习
  327. uni.showToast({
  328. icon: "none",
  329. title: res.data.msg,
  330. mask: true,
  331. duration: 3000,
  332. });
  333. } else if (res.data.code == 500) {
  334. //可以学习
  335. this.$http({
  336. url: "/course/courseList",
  337. method: "get",
  338. data: {
  339. pageNum: 1,
  340. pageSize: 100,
  341. goodsId: v.goodsId,
  342. gradeId: v.gradeId,
  343. orderGoodsId: v.orderGoodsId,
  344. },
  345. noLoading: true,
  346. }).then((res) => {
  347. if (res.data.code == 200) {
  348. if (res.data.total > 1) {
  349. uni.navigateTo({
  350. url: `/pages3/polyv/detail?id=''&goodsId=${v.goodsId}&orderGoodsId=${v.orderGoodsId}&gradeId=${v.gradeId}`,
  351. });
  352. } else if (res.data.total == 1) {
  353. uni.navigateTo({
  354. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${v.goodsId}&orderGoodsId=${v.orderGoodsId}&gradeId=${v.gradeId}`,
  355. });
  356. } else {
  357. uni.showToast({
  358. icon: "none",
  359. title: "暂无可观看的视频课程",
  360. });
  361. }
  362. }
  363. });
  364. }
  365. });
  366. // this.$navTo.togo(
  367. // `/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`
  368. // );
  369. }
  370. if (int === 2) {
  371. var data = {
  372. goodsId: v.goodsId,
  373. gradeId: v.gradeId,
  374. applyId: appoint.applyId,
  375. };
  376. this.$api.getApplysubscribe(data).then((res) => {
  377. if (res.data.code === 500) {
  378. uni.showModal({
  379. showCancel: false,
  380. content: res.data.msg,
  381. });
  382. }
  383. if (res.data.code === 200) {
  384. this.$navTo.togo("/pages2/appointment/index", {
  385. goodsId: v.goodsId,
  386. gradeId: v.gradeId,
  387. orderGoodsId: v.orderGoodsId,
  388. applyId: appoint.applyId,
  389. });
  390. }
  391. });
  392. }
  393. if (int === 3) {
  394. this.appBeforeAddress(v);
  395. }
  396. if (int === 4) {
  397. this.$navTo.togo(
  398. `/pages2/learn/details?goodsId=${v.goodsId}&gradeId=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`
  399. );
  400. }
  401. // if (int === 5) {
  402. // this.$navTo.togo(
  403. // `/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`
  404. // );
  405. // }
  406. },
  407. getUserCertificateList() {
  408. this.loading = true;
  409. this.$api
  410. .getUserCertificateList(this.param)
  411. .then((res) => {
  412. this.loading = false;
  413. if (res.data.code === 200) {
  414. this.listData = [...this.listData, ...res.data.rows];
  415. this.total = res.data.total;
  416. }
  417. })
  418. .catch((err) => {
  419. this.loading = false;
  420. });
  421. },
  422. getcourseperiodlistGoods() {
  423. this.loading = true;
  424. this.$api
  425. .getcourseperiodlistGoods(this.param)
  426. .then((res) => {
  427. this.loading = false;
  428. if (res.data.code === 200) {
  429. this.listData = [...this.listData, ...res.data.rows];
  430. this.total = res.data.total;
  431. }
  432. })
  433. .catch((err) => {
  434. this.loading = false;
  435. });
  436. },
  437. appBeforeAddress(v) {
  438. this.$api
  439. .appBeforeAddress({
  440. goodsId: v.goodsId,
  441. orderGoodsId: v.orderGoodsId,
  442. })
  443. .then((res) => {
  444. if (res.data.code == 200) {
  445. uni.navigateToMiniProgram({
  446. appId: res.data.data.url,
  447. success(res) {
  448. // 打开成功
  449. },
  450. });
  451. } else {
  452. uni.showToast({
  453. title: res.data.msg,
  454. icon: "none",
  455. });
  456. }
  457. });
  458. },
  459. change(index) {
  460. if (this.loading) {
  461. return;
  462. }
  463. this.current = index;
  464. this.listData = [];
  465. this.total = 0;
  466. this.param = {
  467. pageNum: 1,
  468. pageSize: 10,
  469. orderGoodsId: this.orderGoodsId,
  470. };
  471. if (this.current == 1) {
  472. this.getcourseperiodlistGoods();
  473. } else if (this.current == 0) {
  474. this.getUserCertificateList();
  475. }
  476. },
  477. showPhoto(item) {
  478. // 预览图片
  479. uni.previewImage({
  480. urls: [this.$method.splitImgHost(item.certificatePath, true, 1000)],
  481. longPressActions: {
  482. itemList: ["发送给朋友", "保存图片", "收藏"],
  483. success: function (data) {
  484. console.log(
  485. "选中了第" +
  486. (data.tapIndex + 1) +
  487. "个按钮,第" +
  488. (data.index + 1) +
  489. "张图片"
  490. );
  491. },
  492. fail: function (err) {
  493. console.log(err.errMsg);
  494. },
  495. },
  496. });
  497. },
  498. saveEwm(item) {
  499. // #ifdef H5
  500. window.location.href = this.$method.splitImgHost(
  501. item.certificatePath,
  502. true,
  503. 1000
  504. );
  505. // #endif
  506. // #ifdef MP-WEIXIN
  507. //获取相册授权
  508. uni.getSetting({
  509. success: (res) => {
  510. if (!res.authSetting["scope.writePhotosAlbum"]) {
  511. uni.authorize({
  512. scope: "scope.writePhotosAlbum",
  513. success() {
  514. //这里是用户同意授权后的回调
  515. this.saveImgToLocal(item);
  516. },
  517. fail() {
  518. //这里是用户拒绝授权后的回调
  519. },
  520. });
  521. } else {
  522. //用户已经授权过了
  523. this.saveImgToLocal(item);
  524. }
  525. },
  526. });
  527. // #endif
  528. },
  529. saveImgToLocal(item) {
  530. uni.showModal({
  531. title: "提示",
  532. content: "确定保存到相册吗",
  533. success: (res) => {
  534. if (res.confirm) {
  535. uni.downloadFile({
  536. url: this.$method.splitImgHost(item.certificatePath, true, 1000), //图片地址
  537. success: (res) => {
  538. if (res.statusCode === 200) {
  539. uni.saveImageToPhotosAlbum({
  540. filePath: res.tempFilePath,
  541. success: function () {
  542. uni.showToast({
  543. title: "保存成功",
  544. icon: "none",
  545. });
  546. },
  547. fail: function () {
  548. uni.showToast({
  549. title: "保存失败",
  550. icon: "none",
  551. });
  552. },
  553. });
  554. }
  555. },
  556. });
  557. } else if (res.cancel) {
  558. }
  559. },
  560. });
  561. },
  562. downloadCard(item) {
  563. console.log(this.$method.splitImgHost(item.certificatePath, true));
  564. uni.downloadFile({
  565. url: this.$method.splitImgHost(item.certificatePath, true),
  566. success: function (res) {
  567. console.log(res, "res");
  568. var filePath = res.tempFilePath;
  569. uni.openDocument({
  570. filePath: filePath,
  571. showMenu: true,
  572. success: function (res) {
  573. console.log(res, "打开文档成功");
  574. },
  575. fail: function (err) {
  576. console.log(err);
  577. },
  578. });
  579. },
  580. });
  581. },
  582. },
  583. computed: { ...mapGetters(["userInfo"]) },
  584. };
  585. </script>
  586. <style>
  587. page {
  588. background: #eaeef1;
  589. }
  590. </style>
  591. <style scoped lang="scss">
  592. .copySty {
  593. color: #007aff;
  594. text-decoration: underline;
  595. }
  596. .color666 {
  597. color: #666;
  598. }
  599. .learnWrap {
  600. padding: 98rpx 8rpx 8rpx;
  601. }
  602. .noData {
  603. font-size: 32rpx;
  604. font-family: PingFang SC;
  605. font-weight: 500;
  606. color: #999999;
  607. margin: 160rpx auto;
  608. text-align: center;
  609. }
  610. .learnItem {
  611. position: relative;
  612. background: #ffffff;
  613. border-radius: 16rpx;
  614. padding: 32rpx 32rpx 0;
  615. font-family: PingFang SC;
  616. margin-bottom: 16rpx;
  617. overflow: hidden;
  618. &.card {
  619. &::before {
  620. content: "";
  621. width: 20rpx;
  622. height: 20rpx;
  623. position: absolute;
  624. background: #eaeef1;
  625. left: -10rpx;
  626. bottom: 80rpx;
  627. border-radius: 50%;
  628. }
  629. &::after {
  630. content: "";
  631. width: 20rpx;
  632. height: 20rpx;
  633. position: absolute;
  634. background: #eaeef1;
  635. right: -10rpx;
  636. bottom: 80rpx;
  637. border-radius: 50%;
  638. }
  639. }
  640. .red {
  641. color: #ff3b30 !important;
  642. }
  643. .blue {
  644. color: #007aff !important;
  645. }
  646. .green {
  647. color: #34c759 !important;
  648. }
  649. .title {
  650. font-size: 30rpx;
  651. font-weight: bold;
  652. color: #333333;
  653. margin-bottom: 68rpx;
  654. }
  655. .status {
  656. font-size: 24rpx;
  657. font-weight: 500;
  658. color: #666666;
  659. margin-bottom: 26rpx;
  660. display: flex;
  661. }
  662. .number {
  663. font-size: 24rpx;
  664. font-weight: 500;
  665. color: #666666;
  666. margin-bottom: 26rpx;
  667. font-size: 30rpx;
  668. font-weight: bold;
  669. font-family: PingFang SC;
  670. color: #333;
  671. .label {
  672. font-size: 24rpx;
  673. font-weight: 500;
  674. color: #666666;
  675. }
  676. }
  677. .val {
  678. font-size: 30rpx;
  679. font-weight: bold;
  680. color: #333;
  681. .remark {
  682. font-size: 24rpx;
  683. font-family: PingFang SC;
  684. font-weight: 500;
  685. color: #666666;
  686. }
  687. .link {
  688. font-size: 30rpx;
  689. font-family: PingFang SC;
  690. font-weight: 500;
  691. text-decoration: underline;
  692. color: #007aff;
  693. margin-top: 36rpx;
  694. text-decoration: underline;
  695. }
  696. }
  697. .tip {
  698. font-size: 24rpx;
  699. font-weight: 500;
  700. color: #666666;
  701. margin: 30rpx 0 27rpx;
  702. display: flex;
  703. }
  704. .label {
  705. width: 120rpx;
  706. flex-shrink: 0;
  707. margin-top: 5rpx;
  708. }
  709. .subTitle {
  710. font-size: 30rpx;
  711. font-weight: bold;
  712. color: #333333;
  713. margin: 15rpx 0 40rpx;
  714. }
  715. .btnBox {
  716. height: 88rpx;
  717. display: flex;
  718. align-items: center;
  719. justify-content: flex-end;
  720. .btn {
  721. width: 224rpx;
  722. height: 56rpx;
  723. line-height: 56rpx;
  724. text-align: center;
  725. background: #007aff;
  726. border-radius: 16rpx;
  727. font-size: 30rpx;
  728. font-family: PingFang SC;
  729. font-weight: 500;
  730. color: #ffffff;
  731. margin-left: 16rpx;
  732. }
  733. }
  734. }
  735. </style>