detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <template>
  2. <view>
  3. <nav-bar title="消息详情"></nav-bar>
  4. <view class="item">
  5. <view class="title">{{ getTitleName() }}</view>
  6. <view class="time">{{ $method.timestampToTime(listData.sendTime, false) }}</view>
  7. <view v-if="listData.systemStatus === 2" class="content" v-html="listData.informVo.affiche" style="width: 100%;"></view>
  8. <view v-if="listData.systemStatus === 1" class="content" style="width: 100%;">{{ listData.text }}</view>
  9. <view class="boxstistyle" v-if="listData.informVo">
  10. <view class="lsow" style="border-bottom: 1rpx solid #eee;margin-top: 10rpx;" v-for="(item, index) in listData.informVo.informCourseVo" :key="index">
  11. <view class="h4">{{ item.goodsName }}</view>
  12. <view class="h33">
  13. {{ item.courseName }}{{ item.moduleName ? '/' + item.moduleName : '' }}{{ item.chapterName ? '/' + item.chapterName : '' }}{{ item.sectionName }}
  14. </view>
  15. <view style="display: flex;align-items: center;margin:28rpx 0rpx;" @click="jumpSection(item)">
  16. <image style="width: 35rpx;height: 35rpx;" src="@/static/courseIcon.png" mode=""></image>
  17. <text class="timeStys">{{ $method.secondToTime(item.topicNum,false) }}</text>
  18. <text class="aSty">点击可直接跳转</text>
  19. </view>
  20. </view>
  21. <view class="lsow" style="border-bottom: 1rpx solid #eee;margin-top: 10rpx;" v-for="(item, index) in listData.informVo.informExamVo" :key="index">
  22. <view class="h4">{{ item.goodsName }}</view>
  23. <view class="h33">{{ item.moduleName ? '/' + item.moduleName : '' }}{{ item.chapterName ? '/' + item.chapterName : '' }}{{ item.examName }}</view>
  24. <view style="display: flex;align-items: center;margin:28rpx 0rpx;" @click="jumpExam(item)">
  25. <image style="width: 35rpx;height: 35rpx;" src="@/static/examIcon.png" mode=""></image>
  26. <text class="timeStys">第{{ item.topicNum }}道题</text>
  27. <text class="aSty">点击可直接跳转</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="btn1" @click="isOk" v-if="listData.systemStatus === 2 && listData.receiptStatus === 0">我已阅读</view>
  33. <view class="btn1" v-if="statusGO && listData.systemStatus === 1 && getNames(listData.remindId) !== ''" @click="jumpFuns(goodsData,listData.remindId)">{{ getNames(listData.remindId) }}</view>
  34. </view>
  35. </template>
  36. <script>
  37. import { mapGetters } from 'vuex';
  38. export default {
  39. components: {},
  40. data() {
  41. return {
  42. listData: {},
  43. goodsData:{},
  44. sysTime:0,
  45. id: null,
  46. img1: '/static/icon/msg_icon1.png',
  47. img2: '/static/icon/msg_icon2.png',
  48. statusGO: true,
  49. orderGoodsId:0,
  50. };
  51. },
  52. onPullDownRefresh() {},
  53. onLoad(option) {
  54. this.sysTime = this.$method.timest();
  55. this.id = Number(option.id);
  56. this.orderGoodsId = option.orderGoodsId;
  57. },
  58. onShow() {
  59. this.getInfo();
  60. /* if(this.current === 2 && this.$method.isLogin()){
  61. this.$refs.refMy.init();
  62. } */
  63. },
  64. onShareAppMessage(res) {
  65. var self = this;
  66. return {
  67. title: '中正',
  68. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  69. };
  70. },
  71. methods: {
  72. getTitleName() {
  73. // 28-已开通商品课程2天后学员未上课,29-已开通商品课程5天后学员未上课,31-近3天学员没有学习,32-近5天学员没有学习
  74. if ([28,29,31,32].includes(+this.listData.remindId)) { // 要先判断督学消息的显示
  75. return this.listData.remind
  76. } else {
  77. return this.listData.systemStatus === 2 ? this.listData.informVo.informName : this.listData.systemStatus === 1 ? this.listData.remind : ''
  78. }
  79. },
  80. /**
  81. * 获取系统当前时间
  82. */
  83. commonSystemTime() {
  84. this.$api.commonSystemTime().then(res => {
  85. this.sysTime = res.data.data;
  86. })
  87. },
  88. //跳转页面
  89. async jumpFuns(item,remindId) {
  90. switch (remindId) {
  91. case 1:
  92. case 3:
  93. case 5:
  94. case 6:
  95. case 7:
  96. case 19:
  97. case 21:
  98. case 22:
  99. case 23:
  100. case 10:
  101. case 12:
  102. case 18:
  103. case 28:
  104. case 29:
  105. case 31:
  106. case 32:
  107. //课程
  108. if(item.goodsType == 1) {
  109. this.$api.orderInfo({
  110. orderGoodsId:this.orderGoodsId
  111. }).then(async res => {
  112. console.log(res)
  113. let item = res.data.data;
  114. let currentTime = this.$method.timest();
  115. console.log(currentTime)
  116. console.log(item)
  117. console.log(item.serviceStartTime)
  118. console.log(item.serviceEndTime)
  119. console.log(currentTime < item.serviceStartTime || currentTime > item.serviceEndTime)
  120. //内部系统
  121. if (item.interfacePushId > 0 && item.officialStatus != 1) {
  122. uni.showModal({
  123. showCancel: false,
  124. content: '机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!'
  125. });
  126. return;
  127. }
  128. if (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime) {
  129. uni.showToast({
  130. icon: 'none',
  131. title: '不在学习服务期,不能进入学习'
  132. })
  133. return;
  134. }
  135. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  136. .sysTime >= item.classEndTime)) {
  137. uni.showToast({
  138. icon: 'none',
  139. title: '不在班级有效期,不能进入学习'
  140. })
  141. return
  142. }
  143. if (item.learningStatus == 2) {
  144. uni.showToast({
  145. icon: 'none',
  146. title: '开放学习时间待定,不能进入学习'
  147. })
  148. return
  149. }
  150. if (item.classStatus == 0) {
  151. uni.showToast({
  152. icon: 'none',
  153. title: '尚未开班,不能进入学习'
  154. })
  155. return
  156. }
  157. console.log(this.sysTime, item.learningTimeStart)
  158. console.log(this.sysTime < item.learningTimeStart)
  159. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  160. uni.showToast({
  161. icon: 'none',
  162. title: '不在开放学习时间,不能进入学习'
  163. })
  164. return;
  165. }
  166. if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
  167. .classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
  168. .periodStatus == -1) && item.studyCount > 0) {
  169. uni.showModal({
  170. title:'提示',
  171. content:'班级有效期已过期,请选择班级',
  172. success:(res) => {
  173. if(res.confirm) {
  174. uni.navigateTo({
  175. url:'../wd/class'
  176. })
  177. }
  178. }
  179. })
  180. return;
  181. }
  182. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId,item.gradeId);
  183. if(rebuildStatus == 0) {
  184. this.$navTo.togo('/pages2/learn/details', {
  185. gradeId:item.gradeId,
  186. goodsId: item.goodsId,
  187. orderGoodsId:this.orderGoodsId
  188. })
  189. return;
  190. }
  191. this.$api.courseCourseList({
  192. pageNum: 1,
  193. pageSize: 1,
  194. goodsId: item.goodsId,
  195. gradeId: item.gradeId,
  196. orderGoodsId: this.orderGoodsId,
  197. }).then(res => {
  198. if (res.data.code == 200) {
  199. if(res.data.total > 1) {
  200. this.$navTo.togo(`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}&orderGoodsId=${this.orderGoodsId}`);
  201. } else if(res.data.total == 1) {
  202. uni.navigateTo({
  203. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${this.orderGoodsId}`
  204. })
  205. } else {
  206. uni.showToast({
  207. icon:'none',
  208. title:'暂无可观看的视频课程'
  209. })
  210. }
  211. }
  212. })
  213. // if(item.courseNum == 1 ) {
  214. // this.$api.courseCourseList({
  215. // pageNum:1,
  216. // pageSize:1,
  217. // goodsId:item.goodsId,
  218. // gradeId:item.gradeId
  219. // }).then(res => {
  220. // if(res.data.code == 200) {
  221. // uni.navigateTo({
  222. // url:`/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}`
  223. // })
  224. // }
  225. // });
  226. // return;
  227. // }
  228. // this.$navTo.togo('/pages2/wd/course', {
  229. // id: item.goodsId,
  230. // gid: item.gradeId
  231. // });
  232. })
  233. // arsty = '立刻学习';
  234. //题库
  235. } else if(item.goodsType ==2) {
  236. // this.$navTo.togo('/pages2/bank/question_detail', {
  237. // id: item.goodsId
  238. // });
  239. uni.navigateTo({
  240. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+this.orderGoodsId
  241. })
  242. } else if (item.goodsType == 6) {
  243. // 进入直播课
  244. this.toLive(item)
  245. }
  246. break;
  247. case 2:
  248. case 4:
  249. this.$navTo.togo('/pages2/verify/input', {
  250. id: item.goodsId
  251. });
  252. break;
  253. case 24:
  254. this.$navTo.togo('/pages2/verify/input2', {
  255. id: item.goodsId
  256. });
  257. break;
  258. case 11:
  259. case 13:
  260. var data = {
  261. goodsId: item.goodsId,
  262. gradeId: item.gradeId
  263. };
  264. this.$api.getApplysubscribe(data).then(res => {
  265. if (res.data.code === 500) {
  266. uni.showModal({
  267. showCancel: false,
  268. content: res.data.msg
  269. });
  270. }
  271. if (res.data.code === 200) {
  272. this.$navTo.togo('/pages2/appointment/index', {
  273. goodsId: item.goodsId,
  274. gradeId: item.gradeId
  275. });
  276. }
  277. });
  278. break;
  279. case 20:
  280. this.$navTo.togo('/pages3/course/detail', {
  281. id: item.goodsId
  282. });
  283. break;
  284. default:
  285. break;
  286. }
  287. },
  288. toLive(item) {
  289. this.$api.courseCourseList({
  290. pageNum: 1,
  291. pageSize: 1,
  292. goodsId: item.goodsId,
  293. gradeId: 0,
  294. orderGoodsId: this.orderGoodsId,
  295. }).then(res => {
  296. if (res.data.code == 200) {
  297. if(res.data.total > 1) {
  298. uni.navigateTo({
  299. url:'/pages5/liveDetail/course?orderGoodsId='+this.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  300. })
  301. } else if(res.data.total == 1) {
  302. uni.navigateTo({
  303. url:'/pages3/live/detail?orderGoodsId='+this.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
  304. })
  305. } else {
  306. uni.showToast({
  307. icon:'none',
  308. title:'暂无可观看的直播课程'
  309. })
  310. }
  311. }
  312. })
  313. },
  314. /**
  315. * @param {Object} goodsId 商品id
  316. * 查询商品重修状态
  317. */
  318. courseGoodsRebuildStatus(goodsId,gradeId) {
  319. return new Promise(resolve => {
  320. this.$api.courseGoodsRebuildStatus({
  321. goodsId:goodsId,
  322. gradeId:gradeId
  323. }).then(res => {
  324. resolve(res.data.data)
  325. })
  326. })
  327. },
  328. //跳转节视频
  329. jumpSection(item) {
  330. console.log(item)
  331. item.noteSecond = Number(item.topicNum) * 60; //转秒数
  332. this.$navTo.togo('/pages3/polyv/detail', {
  333. id: item.courseId,
  334. goodsId: item.goodsId,
  335. noteSecond: item.noteSecond,
  336. sectionId: item.sectionId,
  337. recordingUrl: item.recordingUrl,
  338. moduleId:item.moduleId || 0,
  339. chapterId:item.chapterId || 0
  340. });
  341. },
  342. //跳转题库题目
  343. jumpExam(item) {
  344. console.log(item);
  345. uni.navigateTo({
  346. url:
  347. '/pages2/bank/questionBank?current=' +
  348. (item.topicNum - 1) +
  349. '&id=' +
  350. item.examId +
  351. '&goodsid=' +
  352. item.goodsId +
  353. '&chapterId=' +
  354. item.moduleId +
  355. '&moduleId=' +
  356. item.moduleId
  357. });
  358. },
  359. isOk() {
  360. this.$api.courseappinformUser({ id: this.listData.id, receiptStatus: 1 }).then(res => {
  361. if (res.data.code === 200) {
  362. uni.navigateBack({
  363. delta: 1
  364. });
  365. }
  366. });
  367. },
  368. backPage() {
  369. uni.navigateBack({
  370. delta: 1
  371. });
  372. },
  373. getInfo() {
  374. this.$api.getappinformUserId(this.id).then(res => {
  375. if (res.data.code === 200) {
  376. if (res.data.data.receiptStatus === 1 && (res.data.data.remindId === 2 || res.data.data.remindId === 4 || res.data.data.remindId === 24)) {
  377. this.$api.getbaseprofiletpgetInfo({ goodsId: res.data.data.goodsId }).then(k => {
  378. if ((k.data.data.status === 3 && k.data.data.changeStatus === 2) || k.data.data.status === 2 || k.data.data.status === 1) {
  379. this.statusGO = false;
  380. }
  381. });
  382. }
  383. if (!res.data.data.receiptStatus) {
  384. this.$api.courseappinformUser({ id: res.data.data.id, receiptStatus: 1 }).then(res => {
  385. if (res.data.code === 200) {
  386. }
  387. });
  388. }
  389. if (res.data.data.informVo && res.data.data.informVo.affiche) {
  390. res.data.data.informVo.affiche = res.data.data.informVo.affiche.replace(/<img/gi, '<img style="max-width:100%;"');
  391. }
  392. this.listData = res.data.data;
  393. console.log('listDatalistData:', this.listData)
  394. if(res.data.data.goodsId) {
  395. if(res.data.data.gradeId) {
  396. this.$api.goodsDetail(res.data.data.goodsId).then(rs => {
  397. this.goodsData = rs.data.data
  398. if (
  399. rs.data.data.goodsType === 3 &&
  400. (res.data.data.remindId === 1 ||
  401. res.data.data.remindId === 3 ||
  402. res.data.data.remindId === 5 ||
  403. res.data.data.remindId === 6 ||
  404. res.data.data.remindId === 7 ||
  405. res.data.data.remindId === 19 ||
  406. res.data.data.remindId === 21 ||
  407. res.data.data.remindId === 22)
  408. ) {
  409. this.statusGO = false;
  410. }
  411. });
  412. } else {
  413. this.$api.commonGoodsDetail(res.data.data.goodsId).then(rs => {
  414. this.goodsData = rs.data.data
  415. if (
  416. rs.data.data.goodsType === 3 &&
  417. (res.data.data.remindId === 1 ||
  418. res.data.data.remindId === 3 ||
  419. res.data.data.remindId === 5 ||
  420. res.data.data.remindId === 6 ||
  421. res.data.data.remindId === 7 ||
  422. res.data.data.remindId === 19 ||
  423. res.data.data.remindId === 21 ||
  424. res.data.data.remindId === 22)
  425. ) {
  426. this.statusGO = false;
  427. }
  428. });
  429. }
  430. }
  431. }
  432. });
  433. },
  434. change(index) {
  435. this.current = index;
  436. },
  437. getNames(int) {
  438. var arsty = '';
  439. switch (int) {
  440. case 1:
  441. case 3:
  442. case 5:
  443. case 6:
  444. case 7:
  445. case 19:
  446. case 21:
  447. case 22:
  448. case 23:
  449. case 28:
  450. case 29:
  451. case 31:
  452. case 32:
  453. arsty = '立刻学习';
  454. break;
  455. case 2:
  456. case 4:
  457. case 24:
  458. arsty = '马上填写';
  459. break;
  460. case 10:
  461. case 12:
  462. case 18:
  463. arsty = '立即重学';
  464. break;
  465. case 11:
  466. arsty = '立即预约';
  467. break;
  468. case 13:
  469. arsty = '预约考试';
  470. break;
  471. case 20:
  472. arsty = '重新购买';
  473. break;
  474. default:
  475. break;
  476. }
  477. return arsty;
  478. }
  479. },
  480. onReachBottom() {},
  481. computed: { ...mapGetters(['userInfo']) },
  482. onUnload() {
  483. var pages = getCurrentPages();
  484. var currPage = pages[pages.length - 1]; //当前页面
  485. var prePage = pages[pages.length - 2]; //上一个页面
  486. //调用上一页拉取数据的方法
  487. if (prePage.route == 'pages2/msg/index') {
  488. prePage.$vm.getChangeData(this.id);
  489. }
  490. }
  491. };
  492. </script>
  493. <style>
  494. page {
  495. background: #eaeef1;
  496. }
  497. </style>
  498. <style scoped>
  499. .lsow:last-child {
  500. border-bottom: none !important;
  501. }
  502. .timeStys {
  503. margin: 0rpx 6rpx;
  504. color: #007aff;
  505. font-size: 28rpx;
  506. font-weight: bold;
  507. border-bottom: 1rpx solid #007aff;
  508. }
  509. .h4 {
  510. color: #333;
  511. font-size: 28rpx;
  512. font-weight: bold;
  513. }
  514. .aSty {
  515. color: #999;
  516. font-size: 24rpx;
  517. margin-left: 8rpx;
  518. }
  519. .h33 {
  520. font-size: 28rpx;
  521. color: #666;
  522. }
  523. .content {
  524. font-size: 28rpx;
  525. color: #666666;
  526. line-height: 36rpx;
  527. }
  528. .time {
  529. font-size: 24rpx;
  530. color: #999999;
  531. margin: 15rpx 0;
  532. }
  533. .btn1 {
  534. width: 526rpx;
  535. height: 80rpx;
  536. background: #007aff;
  537. border-radius: 40rpx;
  538. color: #ffffff;
  539. font-size: 30rpx;
  540. font-weight: bold;
  541. text-align: center;
  542. line-height: 80rpx;
  543. margin: 30rpx auto;
  544. }
  545. .item {
  546. width: 100%;
  547. background: #ffffff;
  548. border-radius: 16rpx;
  549. padding: 15rpx;
  550. }
  551. .title {
  552. font-size: 30rpx;
  553. font-weight: bold;
  554. color: #333333;
  555. }
  556. </style>