my_learn.vue 20 KB

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