my_learn.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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" @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. },
  131. total:0,
  132. itemIndex:'',
  133. listData: []
  134. };
  135. },
  136. onLoad(option) {
  137. this.getcourseperiodlistGoods();
  138. },
  139. onShow() {
  140. if(this.itemIndex !== '') {
  141. if(this.current == 0) {
  142. this.refreshByIndex();
  143. }
  144. }
  145. },
  146. onReachBottom() {
  147. if(this.listData.length < this.total) {
  148. this.param.pageNum++;
  149. if(this.current == 0) {
  150. this.getcourseperiodlistGoods();
  151. } else if(this.current == 1){
  152. this.getUserCertificateList();
  153. }
  154. }
  155. },
  156. methods: {
  157. refreshByIndex() {
  158. this.$api.getcourseperiodlistGoods({
  159. pageNum:this.itemIndex + 1,
  160. pageSize:1
  161. }).then(res => {
  162. if (res.data.code === 200) {
  163. this.$set(this.listData,this.itemIndex,res.data.rows[0])
  164. }
  165. });
  166. },
  167. copyText() {
  168. uni.setClipboardData({
  169. data: 'http://gdzczx.gdcic.net/',
  170. success: () => {
  171. //复制成功的回调函数
  172. uni.showToast({
  173. //提示
  174. title: '复制成功'
  175. });
  176. }
  177. });
  178. },
  179. jumpPage(v, int,index) {
  180. this.itemIndex = index;
  181. //int 1.课程学习 2.预约考试 3.进入刷题 4.查看详情 5.重修目录
  182. if (int === 1) {
  183. this.$navTo.togo(`/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}`);
  184. }
  185. if (int === 2) {
  186. var data = {
  187. goodsId: v.goodsId,
  188. gradeId: v.gradeId
  189. };
  190. this.$api.getApplysubscribe(data).then(res => {
  191. if (res.data.code === 500) {
  192. uni.showModal({
  193. showCancel: false,
  194. content: res.data.msg
  195. });
  196. }
  197. if (res.data.code === 200) {
  198. this.$navTo.togo('/pages2/appointment/index', {
  199. goodsId: v.goodsId,
  200. gradeId: v.gradeId,
  201. orderGoodsId:v.orderGoodsId
  202. });
  203. }
  204. });
  205. }
  206. if (int === 3) {
  207. this.appBeforeAddress(v.goodsId)
  208. }
  209. if (int === 4) {
  210. this.$navTo.togo(`/pages2/learn/details?goodsId=${v.goodsId}&gradeId=${v.gradeId}`);
  211. }
  212. if (int === 5) {
  213. this.$navTo.togo(`/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}`);
  214. }
  215. },
  216. getUserCertificateList() {
  217. this.loading = true;
  218. this.$api.getUserCertificateList(this.param).then(res => {
  219. this.loading = false;
  220. if (res.data.code === 200) {
  221. this.listData = [...this.listData,...res.data.rows];
  222. this.total = res.data.total;
  223. }
  224. }).catch(err => {
  225. this.loading = false;
  226. })
  227. },
  228. getcourseperiodlistGoods() {
  229. this.loading = true;
  230. this.$api.getcourseperiodlistGoods(this.param).then(res => {
  231. this.loading = false;
  232. if (res.data.code === 200) {
  233. this.listData = [...this.listData,...res.data.rows];
  234. this.total = res.data.total;
  235. }
  236. }).catch(err => {
  237. this.loading = false;
  238. })
  239. },
  240. appBeforeAddress(goodsId) {
  241. this.$api.appBeforeAddress({
  242. goodsId
  243. }).then(res => {
  244. if(res.data.code == 200) {
  245. uni.navigateToMiniProgram({
  246. appId: res.data.data.url,
  247. success(res) {
  248. // 打开成功
  249. }
  250. })
  251. } else {
  252. uni.showToast({
  253. title: res.data.msg,
  254. icon: 'none',
  255. })
  256. }
  257. })
  258. },
  259. change(index) {
  260. if(this.loading) {
  261. return;
  262. }
  263. this.current = index;
  264. this.listData = [];
  265. this.total = 0;
  266. this.param = {
  267. pageNum:1,
  268. pageSize:10
  269. };
  270. if(this.current == 0) {
  271. this.getcourseperiodlistGoods();
  272. } else if(this.current == 1){
  273. this.getUserCertificateList();
  274. }
  275. },
  276. showPhoto(item) {
  277. // 预览图片
  278. uni.previewImage({
  279. urls: [this.$method.splitImgHost(item.certificatePath,true,1000)],
  280. longPressActions: {
  281. itemList: ['发送给朋友', '保存图片', '收藏'],
  282. success: function(data) {
  283. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  284. },
  285. fail: function(err) {
  286. console.log(err.errMsg);
  287. }
  288. }
  289. });
  290. },
  291. saveEwm(item){
  292. //获取相册授权
  293. uni.getSetting({
  294. success:(res) => {
  295. if (!res.authSetting['scope.writePhotosAlbum']) {
  296. uni.authorize({
  297. scope: 'scope.writePhotosAlbum',
  298. success() {
  299. //这里是用户同意授权后的回调
  300. this.saveImgToLocal(item);
  301. },
  302. fail() {//这里是用户拒绝授权后的回调
  303. }
  304. })
  305. } else {//用户已经授权过了
  306. this.saveImgToLocal(item);
  307. }
  308. }
  309. })
  310. },
  311. saveImgToLocal(item){
  312. uni.showModal({
  313. title: '提示',
  314. content: '确定保存到相册吗',
  315. success: (res) => {
  316. if (res.confirm) {
  317. uni.downloadFile({
  318. url: this.$method.splitImgHost(item.certificatePath,true,1000),//图片地址
  319. success: (res) =>{
  320. if (res.statusCode === 200){
  321. uni.saveImageToPhotosAlbum({
  322. filePath: res.tempFilePath,
  323. success: function() {
  324. uni.showToast({
  325. title: "保存成功",
  326. icon: "none"
  327. });
  328. },
  329. fail: function() {
  330. uni.showToast({
  331. title: "保存失败",
  332. icon: "none"
  333. });
  334. }
  335. });
  336. }
  337. }
  338. })
  339. } else if (res.cancel) {
  340. }
  341. }
  342. });
  343. },
  344. downloadCard(item) {
  345. console.log(this.$method.splitImgHost(item.certificatePath,true))
  346. uni.downloadFile({
  347. url: this.$method.splitImgHost(item.certificatePath,true),
  348. success: function (res) {
  349. console.log(res,'res')
  350. var filePath = res.tempFilePath;
  351. uni.openDocument({
  352. filePath: filePath,
  353. showMenu: true,
  354. success: function (res) {
  355. console.log(res,'打开文档成功');
  356. },
  357. fail:function(err) {
  358. console.log(err)
  359. }
  360. });
  361. }
  362. });
  363. }
  364. },
  365. computed: { ...mapGetters(['userInfo']) }
  366. };
  367. </script>
  368. <style>
  369. page {
  370. background: #eaeef1;
  371. }
  372. </style>
  373. <style scoped lang="scss">
  374. .copySty {
  375. color: #007aff;
  376. text-decoration: underline;
  377. }
  378. .color666 {
  379. color: #666;
  380. }
  381. .learnWrap {
  382. padding: 98rpx 8rpx 8rpx;
  383. }
  384. .noData {
  385. font-size: 32rpx;
  386. font-family: PingFang SC;
  387. font-weight: 500;
  388. color: #999999;
  389. margin: 160rpx auto;
  390. text-align: center;
  391. }
  392. .learnItem {
  393. position: relative;
  394. background: #ffffff;
  395. border-radius: 16rpx;
  396. padding: 32rpx 32rpx 0;
  397. font-family: PingFang SC;
  398. margin-bottom: 16rpx;
  399. overflow: hidden;
  400. &.card {
  401. &::before {
  402. content:'';
  403. width:20rpx;
  404. height:20rpx;
  405. position:absolute;
  406. background:#eaeef1;
  407. left:-10rpx;
  408. bottom:80rpx;
  409. border-radius: 50%;
  410. }
  411. &::after {
  412. content:'';
  413. width:20rpx;
  414. height:20rpx;
  415. position:absolute;
  416. background:#eaeef1;
  417. right:-10rpx;
  418. bottom:80rpx;
  419. border-radius: 50%;
  420. }
  421. }
  422. .red {
  423. color: #ff3b30 !important;
  424. }
  425. .blue {
  426. color: #007aff !important;
  427. }
  428. .green {
  429. color: #34c759 !important;
  430. }
  431. .title {
  432. font-size: 30rpx;
  433. font-weight: bold;
  434. color: #333333;
  435. margin-bottom:68rpx;
  436. }
  437. .status {
  438. font-size: 24rpx;
  439. font-weight: 500;
  440. color: #666666;
  441. margin-bottom: 26rpx;
  442. display: flex;
  443. }
  444. .number {
  445. font-size: 24rpx;
  446. font-weight: 500;
  447. color: #666666;
  448. margin-bottom: 26rpx;
  449. font-size: 30rpx;
  450. font-weight: bold;
  451. font-family: PingFang SC;
  452. color: #333;
  453. .label {
  454. font-size: 24rpx;
  455. font-weight: 500;
  456. color: #666666;
  457. }
  458. }
  459. .val {
  460. font-size: 30rpx;
  461. font-weight: bold;
  462. color: #333;
  463. .remark {
  464. font-size: 24rpx;
  465. font-family: PingFang SC;
  466. font-weight: 500;
  467. color: #666666;
  468. }
  469. .link {
  470. font-size: 30rpx;
  471. font-family: PingFang SC;
  472. font-weight: 500;
  473. text-decoration: underline;
  474. color: #007aff;
  475. margin-top: 36rpx;
  476. text-decoration: underline;
  477. }
  478. }
  479. .tip {
  480. font-size: 24rpx;
  481. font-weight: 500;
  482. color: #666666;
  483. margin: 30rpx 0 27rpx;
  484. display: flex;
  485. }
  486. .label {
  487. width: 120rpx;
  488. flex-shrink: 0;
  489. margin-top: 5rpx;
  490. }
  491. .subTitle {
  492. font-size: 30rpx;
  493. font-weight: bold;
  494. color: #333333;
  495. margin: 15rpx 0 40rpx;
  496. }
  497. .btnBox {
  498. height: 88rpx;
  499. display: flex;
  500. align-items: center;
  501. justify-content: flex-end;
  502. .btn {
  503. width: 224rpx;
  504. height: 56rpx;
  505. line-height: 56rpx;
  506. text-align: center;
  507. background: #007aff;
  508. border-radius: 16rpx;
  509. font-size: 30rpx;
  510. font-family: PingFang SC;
  511. font-weight: 500;
  512. color: #ffffff;
  513. margin-left: 16rpx;
  514. }
  515. }
  516. }
  517. </style>