my_learn.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <template>
  2. <view class="safeArea">
  3. <nav-bar title="目录"></nav-bar>
  4. <view style="width: 100%;text-align: center;position: fixed;height: 96rpx;z-index: 999;">
  5. <u-tabs :list="list" sticky :current="current" @change="change" active-color="#333" inactive-color="#999"></u-tabs>
  6. </view>
  7. <view class="learnWrap">
  8. <template v-if="current === 0">
  9. <view class="noData" v-if="listData.length == 0">您暂无相关学时审核记录哦~</view>
  10. <view class="learnItem" v-for="(item, index) in listData" :key="index">
  11. <view class="title">{{ item.goodsName }}</view>
  12. <view class="status">
  13. <view class="label">审核状态:</view>
  14. <view
  15. class="val"
  16. :class="item.periodStatus === -1? 'red' : item.periodStatus === 1 ? 'green' : item.periodStatus === 2 || item.periodStatus === 3 ? 'blue' : ''"
  17. >
  18. <text>
  19. {{
  20. item.periodStatus === -1
  21. ? '不可审核'
  22. : item.periodStatus === 1
  23. ? '机构审核通过'
  24. : item.periodStatus === 2
  25. ? '等待审核'
  26. : item.periodStatus === 3
  27. ? '审核中'
  28. : item.periodStatus === 0
  29. ? '机构审核不通过'
  30. : ''
  31. }}
  32. </text>
  33. <view v-if="item.periodStatus === 0" style="font-size: 24rpx;color:#666;">
  34. <text style="color:#FF3B30;">{{ item.rebuild }}节</text>
  35. 需要重修
  36. </view>
  37. </view>
  38. </view>
  39. <view class="tip" v-if="item.periodStatus === 1 ">
  40. <template v-if="(item.educationName == '继续教育' && item.businessName == '二级' && item.projectName == '建造师')">
  41. <view class="label">审核提示:</view>
  42. <view>
  43. 机构已审核通过,需等待注册中心复审后即可获得继续教育学时。审核时间约15个工作日,届时请前往官网申请证书延期。
  44. <view class="copySty" @tap="copyText">复制官网链接</view>
  45. </view>
  46. </template>
  47. </view>
  48. <view class="tip" v-else>
  49. <view class="label">审核提示:</view>
  50. <view class="val color666" v-if="item.periodStatus === -1">您的学时还未修完,请尽快完成课程学习</view>
  51. <view class="val color666" v-if="item.periodStatus === 2">学习完成后7-15个工作日完成学时审核。</view>
  52. <view class="val color666" v-if="item.periodStatus === 0">请查看需重学记录,并及时重学对应课程,以免延误学时审核进度。</view>
  53. <view class="val color666" v-if="item.periodStatus === 3">会在7-15个工作日左右完成学时审核</view>
  54. </view>
  55. <view v-if="item.periodStatus !== 2">
  56. <u-line color="#EEEEEE" />
  57. <view v-if="item.periodStatus === -1">
  58. <view class="btnBox"><view class="btn" v-if="!showLearn(item)" @click="jumpPage(item, 1,index)">课程学习</view></view>
  59. </view>
  60. <view>
  61. <view v-if="item.periodStatus === 1 && item.applyStatus === 1 && !( sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime || (item.classStartTime && sysTime <= item.classStartTime) || (item.classEndTime && sysTime >= item.classEndTime) || item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && sysTime < item.learningTimeStart))">
  62. <template v-for="apply in item.applyList">
  63. <view class="subTitle">{{ apply.applyName }}</view>
  64. <!-- <view class="status">
  65. <view class="label">审核状态:</view>
  66. <view class="val green">
  67. <text>
  68. 机构审核通过
  69. </text>
  70. </view>
  71. </view> -->
  72. <view class="btnBox"><view class="btn" @click="jumpPage(item, 2,index,apply)">预约考试</view></view>
  73. </template>
  74. </view>
  75. <u-line color="#EEEEEE" v-if="item.periodStatus === 1 && item.applyStatus === 1" />
  76. <view v-if="item.periodStatus === 1 && item.beforeStatus === 1 && !( sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime || (item.classStartTime && sysTime <= item.classStartTime) || (item.classEndTime && sysTime >= item.classEndTime) || item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && sysTime < item.learningTimeStart))">
  77. <view class="subTitle">{{ item.beforeName }}</view>
  78. <!-- <view class="status">
  79. <view class="label">审核状态:</view>
  80. <view class="val green">
  81. <text>
  82. 机构审核通过
  83. </text>
  84. </view>
  85. </view> -->
  86. <view class="btnBox"><view class="btn" @click="jumpPage(item, 3,index)">进入刷题</view></view>
  87. </view>
  88. </view>
  89. <view v-if="item.periodStatus === 0 && item.rebuildStatus === 0">
  90. <view class="btnBox"><view class="btn" @click="jumpPage(item, 4,index)">查看详情</view></view>
  91. </view>
  92. <view v-if="item.periodStatus === 0 && item.rebuildStatus === 1">
  93. <view class="btnBox"><view class="btn" @click="jumpPage(item, 5,index)">重修目录</view></view>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <template v-if="current === 1">
  99. <view class="noData" v-if="listData.length == 0">您暂无相关学习凭证记录哦~</view>
  100. <view class="learnItem card" v-for="(item,index) in listData" :key="index">
  101. <view class="title">{{item.title}}</view>
  102. <view class="number">
  103. <text class="label">编号:</text>
  104. {{item.certificateCode}}
  105. </view>
  106. <view class="btnBox">
  107. <view class="btn" @click="showPhoto(item)">电子照片</view>
  108. <view class="btn" @click="saveEwm(item)">下载凭证</view>
  109. </view>
  110. </view>
  111. </template>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import { mapGetters } from 'vuex';
  117. export default {
  118. components: {},
  119. data() {
  120. return {
  121. loading:false,
  122. current: 0,
  123. list: [
  124. {
  125. name: '学时审核'
  126. },
  127. {
  128. name: '学习凭证'
  129. }
  130. ],
  131. param:{
  132. pageNum:1,
  133. pageSize:10,
  134. orderGoodsId:''
  135. },
  136. total:0,
  137. itemIndex:'',
  138. listData: [],
  139. orderGoodsId:0,
  140. sysTime:0
  141. };
  142. },
  143. onLoad(option) {
  144. this.orderGoodsId = option.orderGoodsId||''
  145. console.log(this.orderGoodsId)
  146. this.param.orderGoodsId = option.orderGoodsId||''
  147. this.getcourseperiodlistGoods();
  148. },
  149. onShow() {
  150. this.sysTime = +this.$method.timest();
  151. if(this.itemIndex !== '') {
  152. if(this.current == 0) {
  153. this.refreshByIndex();
  154. }
  155. }
  156. },
  157. onReachBottom() {
  158. if(this.listData.length < this.total) {
  159. this.param.pageNum++;
  160. if(this.current == 0) {
  161. this.getcourseperiodlistGoods();
  162. } else if(this.current == 1){
  163. this.getUserCertificateList();
  164. }
  165. }
  166. },
  167. methods: {
  168. showLearn(item) {
  169. console.log(item.goodsName)
  170. console.log(((item.interfacePushId > 0 && item.officialStatus != 1) || this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime || (item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this.sysTime >= item.classEndTime) || item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && this.sysTime < item.learningTimeStart)))
  171. return ((item.interfacePushId > 0 && item.officialStatus != 1) || this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime || (item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this.sysTime >= item.classEndTime) || item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && this.sysTime < item.learningTimeStart))
  172. },
  173. refreshByIndex() {
  174. this.$api.getcourseperiodlistGoods({
  175. pageNum:this.itemIndex + 1,
  176. pageSize:1,
  177. orderGoodsId:this.orderGoodsId
  178. }).then(res => {
  179. if (res.data.code === 200) {
  180. this.$set(this.listData,this.itemIndex,res.data.rows[0])
  181. }
  182. });
  183. },
  184. copyText() {
  185. uni.setClipboardData({
  186. data: 'http://gdzczx.gdcic.net/',
  187. success: () => {
  188. //复制成功的回调函数
  189. uni.showToast({
  190. //提示
  191. title: '复制成功'
  192. });
  193. }
  194. });
  195. },
  196. jumpPage(v, int,index,appoint) {
  197. this.itemIndex = index;
  198. //int 1.课程学习 2.预约考试 3.进入刷题 4.查看详情 5.重修目录
  199. if (int === 1) {
  200. this.$navTo.togo(`/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`);
  201. }
  202. if (int === 2) {
  203. var data = {
  204. goodsId: v.goodsId,
  205. gradeId: v.gradeId,
  206. applyId:appoint.applyId
  207. };
  208. this.$api.getApplysubscribe(data).then(res => {
  209. if (res.data.code === 500) {
  210. uni.showModal({
  211. showCancel: false,
  212. content: res.data.msg
  213. });
  214. }
  215. if (res.data.code === 200) {
  216. this.$navTo.togo('/pages2/appointment/index', {
  217. goodsId: v.goodsId,
  218. gradeId: v.gradeId,
  219. orderGoodsId:v.orderGoodsId,
  220. applyId:appoint.applyId
  221. });
  222. }
  223. });
  224. }
  225. if (int === 3) {
  226. this.appBeforeAddress(v)
  227. }
  228. if (int === 4) {
  229. this.$navTo.togo(`/pages2/learn/details?goodsId=${v.goodsId}&gradeId=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`);
  230. }
  231. if (int === 5) {
  232. this.$navTo.togo(`/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}&orderGoodsId=${v.orderGoodsId}`);
  233. }
  234. },
  235. getUserCertificateList() {
  236. this.loading = true;
  237. this.$api.getUserCertificateList(this.param).then(res => {
  238. this.loading = false;
  239. if (res.data.code === 200) {
  240. this.listData = [...this.listData,...res.data.rows];
  241. this.total = res.data.total;
  242. }
  243. }).catch(err => {
  244. this.loading = false;
  245. })
  246. },
  247. getcourseperiodlistGoods() {
  248. this.loading = true;
  249. this.$api.getcourseperiodlistGoods(this.param).then(res => {
  250. this.loading = false;
  251. if (res.data.code === 200) {
  252. this.listData = [...this.listData,...res.data.rows];
  253. this.total = res.data.total;
  254. }
  255. }).catch(err => {
  256. this.loading = false;
  257. })
  258. },
  259. appBeforeAddress(v) {
  260. this.$api.appBeforeAddress({
  261. goodsId:v.goodsId,
  262. orderGoodsId:v.orderGoodsId
  263. }).then(res => {
  264. if(res.data.code == 200) {
  265. uni.navigateToMiniProgram({
  266. appId: res.data.data.url,
  267. success(res) {
  268. // 打开成功
  269. }
  270. })
  271. } else {
  272. uni.showToast({
  273. title: res.data.msg,
  274. icon: 'none',
  275. })
  276. }
  277. })
  278. },
  279. change(index) {
  280. if(this.loading) {
  281. return;
  282. }
  283. this.current = index;
  284. this.listData = [];
  285. this.total = 0;
  286. this.param = {
  287. pageNum:1,
  288. pageSize:10,
  289. orderGoodsId:this.orderGoodsId
  290. };
  291. if(this.current == 0) {
  292. this.getcourseperiodlistGoods();
  293. } else if(this.current == 1){
  294. this.getUserCertificateList();
  295. }
  296. },
  297. showPhoto(item) {
  298. // 预览图片
  299. uni.previewImage({
  300. urls: [this.$method.splitImgHost(item.certificatePath,true,1000)],
  301. longPressActions: {
  302. itemList: ['发送给朋友', '保存图片', '收藏'],
  303. success: function(data) {
  304. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  305. },
  306. fail: function(err) {
  307. console.log(err.errMsg);
  308. }
  309. }
  310. });
  311. },
  312. saveEwm(item){
  313. //获取相册授权
  314. uni.getSetting({
  315. success:(res) => {
  316. if (!res.authSetting['scope.writePhotosAlbum']) {
  317. uni.authorize({
  318. scope: 'scope.writePhotosAlbum',
  319. success() {
  320. //这里是用户同意授权后的回调
  321. this.saveImgToLocal(item);
  322. },
  323. fail() {//这里是用户拒绝授权后的回调
  324. }
  325. })
  326. } else {//用户已经授权过了
  327. this.saveImgToLocal(item);
  328. }
  329. }
  330. })
  331. },
  332. saveImgToLocal(item){
  333. uni.showModal({
  334. title: '提示',
  335. content: '确定保存到相册吗',
  336. success: (res) => {
  337. if (res.confirm) {
  338. uni.downloadFile({
  339. url: this.$method.splitImgHost(item.certificatePath,true,1000),//图片地址
  340. success: (res) =>{
  341. if (res.statusCode === 200){
  342. uni.saveImageToPhotosAlbum({
  343. filePath: res.tempFilePath,
  344. success: function() {
  345. uni.showToast({
  346. title: "保存成功",
  347. icon: "none"
  348. });
  349. },
  350. fail: function() {
  351. uni.showToast({
  352. title: "保存失败",
  353. icon: "none"
  354. });
  355. }
  356. });
  357. }
  358. }
  359. })
  360. } else if (res.cancel) {
  361. }
  362. }
  363. });
  364. },
  365. downloadCard(item) {
  366. console.log(this.$method.splitImgHost(item.certificatePath,true))
  367. uni.downloadFile({
  368. url: this.$method.splitImgHost(item.certificatePath,true),
  369. success: function (res) {
  370. console.log(res,'res')
  371. var filePath = res.tempFilePath;
  372. uni.openDocument({
  373. filePath: filePath,
  374. showMenu: true,
  375. success: function (res) {
  376. console.log(res,'打开文档成功');
  377. },
  378. fail:function(err) {
  379. console.log(err)
  380. }
  381. });
  382. }
  383. });
  384. }
  385. },
  386. computed: { ...mapGetters(['userInfo']) }
  387. };
  388. </script>
  389. <style>
  390. page {
  391. background: #eaeef1;
  392. }
  393. </style>
  394. <style scoped lang="scss">
  395. .copySty {
  396. color: #007aff;
  397. text-decoration: underline;
  398. }
  399. .color666 {
  400. color: #666;
  401. }
  402. .learnWrap {
  403. padding: 98rpx 8rpx 8rpx;
  404. }
  405. .noData {
  406. font-size: 32rpx;
  407. font-family: PingFang SC;
  408. font-weight: 500;
  409. color: #999999;
  410. margin: 160rpx auto;
  411. text-align: center;
  412. }
  413. .learnItem {
  414. position: relative;
  415. background: #ffffff;
  416. border-radius: 16rpx;
  417. padding: 32rpx 32rpx 0;
  418. font-family: PingFang SC;
  419. margin-bottom: 16rpx;
  420. overflow: hidden;
  421. &.card {
  422. &::before {
  423. content:'';
  424. width:20rpx;
  425. height:20rpx;
  426. position:absolute;
  427. background:#eaeef1;
  428. left:-10rpx;
  429. bottom:80rpx;
  430. border-radius: 50%;
  431. }
  432. &::after {
  433. content:'';
  434. width:20rpx;
  435. height:20rpx;
  436. position:absolute;
  437. background:#eaeef1;
  438. right:-10rpx;
  439. bottom:80rpx;
  440. border-radius: 50%;
  441. }
  442. }
  443. .red {
  444. color: #ff3b30 !important;
  445. }
  446. .blue {
  447. color: #007aff !important;
  448. }
  449. .green {
  450. color: #34c759 !important;
  451. }
  452. .title {
  453. font-size: 30rpx;
  454. font-weight: bold;
  455. color: #333333;
  456. margin-bottom:68rpx;
  457. }
  458. .status {
  459. font-size: 24rpx;
  460. font-weight: 500;
  461. color: #666666;
  462. margin-bottom: 26rpx;
  463. display: flex;
  464. }
  465. .number {
  466. font-size: 24rpx;
  467. font-weight: 500;
  468. color: #666666;
  469. margin-bottom: 26rpx;
  470. font-size: 30rpx;
  471. font-weight: bold;
  472. font-family: PingFang SC;
  473. color: #333;
  474. .label {
  475. font-size: 24rpx;
  476. font-weight: 500;
  477. color: #666666;
  478. }
  479. }
  480. .val {
  481. font-size: 30rpx;
  482. font-weight: bold;
  483. color: #333;
  484. .remark {
  485. font-size: 24rpx;
  486. font-family: PingFang SC;
  487. font-weight: 500;
  488. color: #666666;
  489. }
  490. .link {
  491. font-size: 30rpx;
  492. font-family: PingFang SC;
  493. font-weight: 500;
  494. text-decoration: underline;
  495. color: #007aff;
  496. margin-top: 36rpx;
  497. text-decoration: underline;
  498. }
  499. }
  500. .tip {
  501. font-size: 24rpx;
  502. font-weight: 500;
  503. color: #666666;
  504. margin: 30rpx 0 27rpx;
  505. display: flex;
  506. }
  507. .label {
  508. width: 120rpx;
  509. flex-shrink: 0;
  510. margin-top: 5rpx;
  511. }
  512. .subTitle {
  513. font-size: 30rpx;
  514. font-weight: bold;
  515. color: #333333;
  516. margin: 15rpx 0 40rpx;
  517. }
  518. .btnBox {
  519. height: 88rpx;
  520. display: flex;
  521. align-items: center;
  522. justify-content: flex-end;
  523. .btn {
  524. width: 224rpx;
  525. height: 56rpx;
  526. line-height: 56rpx;
  527. text-align: center;
  528. background: #007aff;
  529. border-radius: 16rpx;
  530. font-size: 30rpx;
  531. font-family: PingFang SC;
  532. font-weight: 500;
  533. color: #ffffff;
  534. margin-left: 16rpx;
  535. }
  536. }
  537. }
  538. </style>