my_learn.vue 14 KB

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