my_learn.vue 19 KB

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