my_learn.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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="!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. if (item.externalLinkStatus) {
  273. return true;
  274. }
  275. return (
  276. (item.interfacePushId > 0 && item.officialStatus != 1) ||
  277. this.sysTime <= item.serviceStartTime ||
  278. this.sysTime >= item.serviceEndTime ||
  279. (item.classStartTime && this.sysTime <= item.classStartTime) ||
  280. (item.classEndTime && this.sysTime >= item.classEndTime) ||
  281. item.learningStatus == 2 ||
  282. item.classStatus == 0 ||
  283. (item.learningStatus == 3 && this.sysTime < item.learningTimeStart)
  284. );
  285. },
  286. refreshByIndex() {
  287. this.$api
  288. .getcourseperiodlistGoods({
  289. pageNum: this.itemIndex + 1,
  290. pageSize: 1,
  291. orderGoodsId: this.orderGoodsId,
  292. })
  293. .then((res) => {
  294. if (res.data.code === 200) {
  295. this.$set(this.listData, this.itemIndex, res.data.rows[0]);
  296. }
  297. });
  298. },
  299. copyText() {
  300. uni.setClipboardData({
  301. data: "http://gdzczx.gdcic.net/",
  302. success: () => {
  303. //复制成功的回调函数
  304. uni.showToast({
  305. //提示
  306. title: "复制成功",
  307. });
  308. },
  309. });
  310. },
  311. jumpPage(v, int, index, appoint) {
  312. if (v.externalLinkStatus) {
  313. this.$method.toLink(v.externalLink);
  314. return;
  315. }
  316. console.log("--item", v);
  317. // return
  318. this.itemIndex = index;
  319. //int 1.课程学习 2.预约考试 3.进入刷题 4.查看详情 5.重修目录
  320. if (int === 1 || int === 5) {
  321. // /lock/lockStatus
  322. this.$api
  323. .lockLockStatus({
  324. action: "jxjy",
  325. uuid: this.$method.getUuid(),
  326. })
  327. .then((res) => {
  328. if (res.data.code == 200) {
  329. //有其他端在操作,不能学习
  330. uni.showToast({
  331. icon: "none",
  332. title: res.data.msg,
  333. mask: true,
  334. duration: 3000,
  335. });
  336. } else if (res.data.code == 500) {
  337. //可以学习
  338. this.$http({
  339. url: "/course/courseList",
  340. method: "get",
  341. data: {
  342. pageNum: 1,
  343. pageSize: 100,
  344. goodsId: v.goodsId,
  345. gradeId: v.gradeId,
  346. orderGoodsId: v.orderGoodsId,
  347. },
  348. noLoading: true,
  349. }).then((res) => {
  350. if (res.data.code == 200) {
  351. if (res.data.total > 1) {
  352. uni.navigateTo({
  353. url: `/pages3/polyv/detail?id=''&goodsId=${v.goodsId}&orderGoodsId=${v.orderGoodsId}&gradeId=${v.gradeId}`,
  354. });
  355. } else if (res.data.total == 1) {
  356. uni.navigateTo({
  357. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${v.goodsId}&orderGoodsId=${v.orderGoodsId}&gradeId=${v.gradeId}`,
  358. });
  359. } else {
  360. uni.showToast({
  361. icon: "none",
  362. title: "暂无可观看的视频课程",
  363. });
  364. }
  365. }
  366. });
  367. }
  368. });
  369. // this.$navTo.togo(
  370. // `/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`
  371. // );
  372. }
  373. if (int === 2) {
  374. var data = {
  375. goodsId: v.goodsId,
  376. gradeId: v.gradeId,
  377. applyId: appoint.applyId,
  378. };
  379. this.$api.getApplysubscribe(data).then((res) => {
  380. if (res.data.code === 500) {
  381. uni.showModal({
  382. showCancel: false,
  383. content: res.data.msg,
  384. });
  385. }
  386. if (res.data.code === 200) {
  387. this.$navTo.togo("/pages2/appointment/index", {
  388. goodsId: v.goodsId,
  389. gradeId: v.gradeId,
  390. orderGoodsId: v.orderGoodsId,
  391. applyId: appoint.applyId,
  392. });
  393. }
  394. });
  395. }
  396. if (int === 3) {
  397. this.appBeforeAddress(v);
  398. }
  399. if (int === 4) {
  400. this.$navTo.togo(
  401. `/pages2/learn/details?goodsId=${v.goodsId}&gradeId=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`
  402. );
  403. }
  404. // if (int === 5) {
  405. // this.$navTo.togo(
  406. // `/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`
  407. // );
  408. // }
  409. },
  410. getUserCertificateList() {
  411. this.loading = true;
  412. this.$api
  413. .getUserCertificateList(this.param)
  414. .then((res) => {
  415. this.loading = false;
  416. if (res.data.code === 200) {
  417. this.listData = [...this.listData, ...res.data.rows];
  418. this.total = res.data.total;
  419. }
  420. })
  421. .catch((err) => {
  422. this.loading = false;
  423. });
  424. },
  425. getcourseperiodlistGoods() {
  426. this.loading = true;
  427. this.$api
  428. .getcourseperiodlistGoods(this.param)
  429. .then((res) => {
  430. this.loading = false;
  431. if (res.data.code === 200) {
  432. this.listData = [...this.listData, ...res.data.rows];
  433. this.total = res.data.total;
  434. }
  435. })
  436. .catch((err) => {
  437. this.loading = false;
  438. });
  439. },
  440. appBeforeAddress(v) {
  441. this.$api
  442. .appBeforeAddress({
  443. goodsId: v.goodsId,
  444. orderGoodsId: v.orderGoodsId,
  445. })
  446. .then((res) => {
  447. if (res.data.code == 200) {
  448. uni.navigateToMiniProgram({
  449. appId: res.data.data.url,
  450. success(res) {
  451. // 打开成功
  452. },
  453. });
  454. } else {
  455. uni.showToast({
  456. title: res.data.msg,
  457. icon: "none",
  458. });
  459. }
  460. });
  461. },
  462. change(index) {
  463. if (this.loading) {
  464. return;
  465. }
  466. this.current = index;
  467. this.listData = [];
  468. this.total = 0;
  469. this.param = {
  470. pageNum: 1,
  471. pageSize: 10,
  472. orderGoodsId: this.orderGoodsId,
  473. };
  474. if (this.current == 1) {
  475. this.getcourseperiodlistGoods();
  476. } else if (this.current == 0) {
  477. this.getUserCertificateList();
  478. }
  479. },
  480. showPhoto(item) {
  481. // 预览图片
  482. uni.previewImage({
  483. urls: [this.$method.splitImgHost(item.certificatePath, true, 1000)],
  484. longPressActions: {
  485. itemList: ["发送给朋友", "保存图片", "收藏"],
  486. success: function (data) {
  487. console.log(
  488. "选中了第" +
  489. (data.tapIndex + 1) +
  490. "个按钮,第" +
  491. (data.index + 1) +
  492. "张图片"
  493. );
  494. },
  495. fail: function (err) {
  496. console.log(err.errMsg);
  497. },
  498. },
  499. });
  500. },
  501. saveEwm(item) {
  502. // #ifdef H5
  503. window.location.href = this.$method.splitImgHost(
  504. item.certificatePath,
  505. true,
  506. 1000
  507. );
  508. // #endif
  509. // #ifdef MP-WEIXIN
  510. //获取相册授权
  511. uni.getSetting({
  512. success: (res) => {
  513. if (!res.authSetting["scope.writePhotosAlbum"]) {
  514. uni.authorize({
  515. scope: "scope.writePhotosAlbum",
  516. success() {
  517. //这里是用户同意授权后的回调
  518. this.saveImgToLocal(item);
  519. },
  520. fail() {
  521. //这里是用户拒绝授权后的回调
  522. },
  523. });
  524. } else {
  525. //用户已经授权过了
  526. this.saveImgToLocal(item);
  527. }
  528. },
  529. });
  530. // #endif
  531. },
  532. saveImgToLocal(item) {
  533. uni.showModal({
  534. title: "提示",
  535. content: "确定保存到相册吗",
  536. success: (res) => {
  537. if (res.confirm) {
  538. uni.downloadFile({
  539. url: this.$method.splitImgHost(item.certificatePath, true, 1000), //图片地址
  540. success: (res) => {
  541. if (res.statusCode === 200) {
  542. uni.saveImageToPhotosAlbum({
  543. filePath: res.tempFilePath,
  544. success: function () {
  545. uni.showToast({
  546. title: "保存成功",
  547. icon: "none",
  548. });
  549. },
  550. fail: function () {
  551. uni.showToast({
  552. title: "保存失败",
  553. icon: "none",
  554. });
  555. },
  556. });
  557. }
  558. },
  559. });
  560. } else if (res.cancel) {
  561. }
  562. },
  563. });
  564. },
  565. downloadCard(item) {
  566. console.log(this.$method.splitImgHost(item.certificatePath, true));
  567. uni.downloadFile({
  568. url: this.$method.splitImgHost(item.certificatePath, true),
  569. success: function (res) {
  570. console.log(res, "res");
  571. var filePath = res.tempFilePath;
  572. uni.openDocument({
  573. filePath: filePath,
  574. showMenu: true,
  575. success: function (res) {
  576. console.log(res, "打开文档成功");
  577. },
  578. fail: function (err) {
  579. console.log(err);
  580. },
  581. });
  582. },
  583. });
  584. },
  585. },
  586. computed: { ...mapGetters(["userInfo"]) },
  587. };
  588. </script>
  589. <style>
  590. page {
  591. background: #eaeef1;
  592. }
  593. </style>
  594. <style scoped lang="scss">
  595. .copySty {
  596. color: #007aff;
  597. text-decoration: underline;
  598. }
  599. .color666 {
  600. color: #666;
  601. }
  602. .learnWrap {
  603. padding: 98rpx 8rpx 8rpx;
  604. }
  605. .noData {
  606. font-size: 32rpx;
  607. font-family: PingFang SC;
  608. font-weight: 500;
  609. color: #999999;
  610. margin: 160rpx auto;
  611. text-align: center;
  612. }
  613. .learnItem {
  614. position: relative;
  615. background: #ffffff;
  616. border-radius: 16rpx;
  617. padding: 32rpx 32rpx 0;
  618. font-family: PingFang SC;
  619. margin-bottom: 16rpx;
  620. overflow: hidden;
  621. &.card {
  622. &::before {
  623. content: "";
  624. width: 20rpx;
  625. height: 20rpx;
  626. position: absolute;
  627. background: #eaeef1;
  628. left: -10rpx;
  629. bottom: 80rpx;
  630. border-radius: 50%;
  631. }
  632. &::after {
  633. content: "";
  634. width: 20rpx;
  635. height: 20rpx;
  636. position: absolute;
  637. background: #eaeef1;
  638. right: -10rpx;
  639. bottom: 80rpx;
  640. border-radius: 50%;
  641. }
  642. }
  643. .red {
  644. color: #ff3b30 !important;
  645. }
  646. .blue {
  647. color: #007aff !important;
  648. }
  649. .green {
  650. color: #34c759 !important;
  651. }
  652. .title {
  653. font-size: 30rpx;
  654. font-weight: bold;
  655. color: #333333;
  656. margin-bottom: 68rpx;
  657. }
  658. .status {
  659. font-size: 24rpx;
  660. font-weight: 500;
  661. color: #666666;
  662. margin-bottom: 26rpx;
  663. display: flex;
  664. }
  665. .number {
  666. font-size: 24rpx;
  667. font-weight: 500;
  668. color: #666666;
  669. margin-bottom: 26rpx;
  670. font-size: 30rpx;
  671. font-weight: bold;
  672. font-family: PingFang SC;
  673. color: #333;
  674. .label {
  675. font-size: 24rpx;
  676. font-weight: 500;
  677. color: #666666;
  678. }
  679. }
  680. .val {
  681. font-size: 30rpx;
  682. font-weight: bold;
  683. color: #333;
  684. .remark {
  685. font-size: 24rpx;
  686. font-family: PingFang SC;
  687. font-weight: 500;
  688. color: #666666;
  689. }
  690. .link {
  691. font-size: 30rpx;
  692. font-family: PingFang SC;
  693. font-weight: 500;
  694. text-decoration: underline;
  695. color: #007aff;
  696. margin-top: 36rpx;
  697. text-decoration: underline;
  698. }
  699. }
  700. .tip {
  701. font-size: 24rpx;
  702. font-weight: 500;
  703. color: #666666;
  704. margin: 30rpx 0 27rpx;
  705. display: flex;
  706. }
  707. .label {
  708. width: 120rpx;
  709. flex-shrink: 0;
  710. margin-top: 5rpx;
  711. }
  712. .subTitle {
  713. font-size: 30rpx;
  714. font-weight: bold;
  715. color: #333333;
  716. margin: 15rpx 0 40rpx;
  717. }
  718. .btnBox {
  719. height: 88rpx;
  720. display: flex;
  721. align-items: center;
  722. justify-content: flex-end;
  723. .btn {
  724. width: 224rpx;
  725. height: 56rpx;
  726. line-height: 56rpx;
  727. text-align: center;
  728. background: #007aff;
  729. border-radius: 16rpx;
  730. font-size: 30rpx;
  731. font-family: PingFang SC;
  732. font-weight: 500;
  733. color: #ffffff;
  734. margin-left: 16rpx;
  735. }
  736. }
  737. }
  738. </style>