my_learn.vue 21 KB

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