my_learn.vue 14 KB

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