my_learn.vue 21 KB

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