my_learn.vue 21 KB

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