detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view>
  3. <nav-bar title="消息详情"></nav-bar>
  4. <view class="item">
  5. <view class="title">{{ listData.systemStatus === 2 ? listData.informVo.informName : listData.systemStatus === 1 ? listData.remind : '' }}</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) }}</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. };
  50. },
  51. onPullDownRefresh() {},
  52. onLoad(option) {
  53. this.sysTime = this.$method.timest();
  54. this.id = Number(option.id);
  55. },
  56. onShow() {
  57. this.getInfo();
  58. /* if(this.current === 2 && this.$method.isLogin()){
  59. this.$refs.refMy.init();
  60. } */
  61. },
  62. onShareAppMessage(res) {
  63. var self = this;
  64. return {
  65. title: '中正',
  66. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  67. };
  68. },
  69. methods: {
  70. /**
  71. * 获取系统当前时间
  72. */
  73. commonSystemTime() {
  74. this.$api.commonSystemTime().then(res => {
  75. this.sysTime = res.data.data;
  76. })
  77. },
  78. //跳转页面
  79. async jumpFuns(item,remindId) {
  80. switch (remindId) {
  81. case 1:
  82. case 3:
  83. case 5:
  84. case 6:
  85. case 7:
  86. case 19:
  87. case 21:
  88. case 22:
  89. case 23:
  90. case 10:
  91. case 12:
  92. case 18:
  93. //课程
  94. if(item.goodsType == 1) {
  95. let currentTime = this.$method.timest();
  96. console.log(currentTime)
  97. console.log(item)
  98. console.log(item.serviceStartTime)
  99. console.log(item.serviceEndTime)
  100. console.log(currentTime < item.serviceStartTime || currentTime > item.serviceEndTime)
  101. if(currentTime < item.serviceStartTime || currentTime > item.serviceEndTime) {
  102. uni.showToast({
  103. title:'不在学习有效期,不可以学习了哦',
  104. icon:'none'
  105. })
  106. return;
  107. }
  108. if( (item.classStartTime && currentTime <= item.classStartTime) || (item.classEndTime && currentTime >= item.classEndTime) ) {
  109. uni.showToast({
  110. title:'不在班级有效期,不能进入学习',
  111. icon:'none'
  112. })
  113. return;
  114. }
  115. if(item.learningStatus == 2) {
  116. uni.showToast({
  117. title:'开放学习时间待定,不能进入学习',
  118. icon:'none'
  119. })
  120. return;
  121. }
  122. if(item.classStatus == 0 ) {
  123. uni.showToast({
  124. title:'尚未开班,不能进入学习',
  125. icon:'none'
  126. })
  127. return;
  128. }
  129. if(item.learningStatus == 3 && (currentTime < item.learningTimeStart) ) {
  130. uni.showToast({
  131. title:'不在开放学习时间,不能进入学习',
  132. icon:'none'
  133. })
  134. return;
  135. }
  136. if(item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > currentTime) && (item.classEndTime && (item.classEndTime < currentTime)) && (item.periodStatus == 0 || item.periodStatus == -1) && item.studyCount > 0) {
  137. uni.showModal({
  138. title:'提示',
  139. content:'班级已过期,需要重新选班',
  140. showCancel:false,
  141. success:() => {
  142. uni.navigateTo({
  143. url:"/pages2/wd/class"
  144. })
  145. }
  146. })
  147. return;
  148. }
  149. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId,item.gradeId);
  150. if(rebuildStatus == 0) {
  151. this.$navTo.togo('/pages2/learn/details', {
  152. gradeId:item.gradeId,
  153. goodsId: item.goodsId
  154. })
  155. return;
  156. }
  157. if(item.courseNum == 1 ) {
  158. this.$api.courseCourseList({
  159. pageNum:1,
  160. pageSize:1,
  161. goodsId:item.goodsId,
  162. gradeId:item.gradeId
  163. }).then(res => {
  164. if(res.data.code == 200) {
  165. uni.navigateTo({
  166. url:`/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}`
  167. })
  168. }
  169. });
  170. return;
  171. }
  172. this.$navTo.togo('/pages2/wd/course', {
  173. id: item.goodsId,
  174. gid: item.gradeId
  175. });
  176. // arsty = '立刻学习';
  177. //题库
  178. } else if(item.goodsType ==2) {
  179. this.$navTo.togo('/pages2/bank/question_detail', {
  180. id: item.goodsId
  181. });
  182. }
  183. break;
  184. case 2:
  185. case 4:
  186. this.$navTo.togo('/pages2/verify/input', {
  187. id: item.goodsId
  188. });
  189. break;
  190. case 24:
  191. this.$navTo.togo('/pages2/verify/input2', {
  192. id: item.goodsId
  193. });
  194. break;
  195. case 11:
  196. case 13:
  197. var data = {
  198. goodsId: item.goodsId,
  199. gradeId: item.gradeId
  200. };
  201. this.$api.getApplysubscribe(data).then(res => {
  202. if (res.data.code === 500) {
  203. uni.showModal({
  204. showCancel: false,
  205. content: res.data.msg
  206. });
  207. }
  208. if (res.data.code === 200) {
  209. this.$navTo.togo('/pages2/appointment/index', {
  210. goodsId: item.goodsId,
  211. gradeId: item.gradeId
  212. });
  213. }
  214. });
  215. break;
  216. case 20:
  217. this.$navTo.togo('/pages3/course/detail', {
  218. id: item.goodsId
  219. });
  220. break;
  221. default:
  222. break;
  223. }
  224. },
  225. /**
  226. * @param {Object} goodsId 商品id
  227. * 查询商品重修状态
  228. */
  229. courseGoodsRebuildStatus(goodsId,gradeId) {
  230. return new Promise(resolve => {
  231. this.$api.courseGoodsRebuildStatus({
  232. goodsId:goodsId,
  233. gradeId:gradeId
  234. }).then(res => {
  235. resolve(res.data.data)
  236. })
  237. })
  238. },
  239. //跳转节视频
  240. jumpSection(item) {
  241. item.noteSecond = Number(item.topicNum) * 60; //转秒数
  242. this.$navTo.togo('/pages3/polyv/detail', {
  243. id: item.courseId,
  244. goodsId: item.goodsId,
  245. noteSecond: item.noteSecond,
  246. sectionId: item.sectionId,
  247. recordingUrl: item.recordingUrl,
  248. moduleId:item.moduleId || 0,
  249. chapterId:item.chapterId || 0
  250. });
  251. },
  252. //跳转题库题目
  253. jumpExam(item) {
  254. console.log(item);
  255. uni.navigateTo({
  256. url:
  257. '/pages2/bank/questionBank?current=' +
  258. (item.topicNum - 1) +
  259. '&id=' +
  260. item.examId +
  261. '&goodsid=' +
  262. item.goodsId +
  263. '&chapterId=' +
  264. item.moduleId +
  265. '&moduleId=' +
  266. item.moduleId
  267. });
  268. },
  269. isOk() {
  270. this.$api.courseappinformUser({ id: this.listData.id, receiptStatus: 1 }).then(res => {
  271. if (res.data.code === 200) {
  272. uni.navigateBack({
  273. delta: 1
  274. });
  275. }
  276. });
  277. },
  278. backPage() {
  279. uni.navigateBack({
  280. delta: 1
  281. });
  282. },
  283. getInfo() {
  284. this.$api.getappinformUserId(this.id).then(res => {
  285. if (res.data.code === 200) {
  286. if (res.data.data.receiptStatus === 1 && (res.data.data.remindId === 2 || res.data.data.remindId === 4 || res.data.data.remindId === 24)) {
  287. this.$api.getbaseprofiletpgetInfo({ goodsId: res.data.data.goodsId }).then(k => {
  288. if ((k.data.data.status === 3 && k.data.data.changeStatus === 2) || k.data.data.status === 2 || k.data.data.status === 1) {
  289. this.statusGO = false;
  290. }
  291. });
  292. }
  293. if (!res.data.data.receiptStatus) {
  294. this.$api.courseappinformUser({ id: res.data.data.id, receiptStatus: 1 }).then(res => {
  295. if (res.data.code === 200) {
  296. }
  297. });
  298. }
  299. if (res.data.data.informVo && res.data.data.informVo.affiche) {
  300. res.data.data.informVo.affiche = res.data.data.informVo.affiche.replace(/<img/gi, '<img style="max-width:100%;"');
  301. }
  302. this.listData = res.data.data;
  303. if(res.data.data.goodsId) {
  304. if(res.data.data.gradeId) {
  305. this.$api.goodsDetail(res.data.data.goodsId).then(rs => {
  306. this.goodsData = rs.data.data
  307. if (
  308. rs.data.data.goodsType === 3 &&
  309. (res.data.data.remindId === 1 ||
  310. res.data.data.remindId === 3 ||
  311. res.data.data.remindId === 5 ||
  312. res.data.data.remindId === 6 ||
  313. res.data.data.remindId === 7 ||
  314. res.data.data.remindId === 19 ||
  315. res.data.data.remindId === 21 ||
  316. res.data.data.remindId === 22)
  317. ) {
  318. this.statusGO = false;
  319. }
  320. });
  321. } else {
  322. this.$api.commonGoodsDetail(res.data.data.goodsId).then(rs => {
  323. this.goodsData = rs.data.data
  324. if (
  325. rs.data.data.goodsType === 3 &&
  326. (res.data.data.remindId === 1 ||
  327. res.data.data.remindId === 3 ||
  328. res.data.data.remindId === 5 ||
  329. res.data.data.remindId === 6 ||
  330. res.data.data.remindId === 7 ||
  331. res.data.data.remindId === 19 ||
  332. res.data.data.remindId === 21 ||
  333. res.data.data.remindId === 22)
  334. ) {
  335. this.statusGO = false;
  336. }
  337. });
  338. }
  339. }
  340. }
  341. });
  342. },
  343. change(index) {
  344. this.current = index;
  345. },
  346. getNames(int) {
  347. var arsty = '';
  348. switch (int) {
  349. case 1:
  350. case 3:
  351. case 5:
  352. case 6:
  353. case 7:
  354. case 19:
  355. case 21:
  356. case 22:
  357. case 23:
  358. arsty = '立刻学习';
  359. break;
  360. case 2:
  361. case 4:
  362. case 24:
  363. arsty = '马上填写';
  364. break;
  365. case 10:
  366. case 12:
  367. case 18:
  368. arsty = '立即重学';
  369. break;
  370. case 11:
  371. arsty = '立即预约';
  372. break;
  373. case 13:
  374. arsty = '预约考试';
  375. break;
  376. case 20:
  377. arsty = '重新购买';
  378. break;
  379. default:
  380. break;
  381. }
  382. return arsty;
  383. }
  384. },
  385. onReachBottom() {},
  386. computed: { ...mapGetters(['userInfo']) },
  387. onUnload() {
  388. var pages = getCurrentPages();
  389. var currPage = pages[pages.length - 1]; //当前页面
  390. var prePage = pages[pages.length - 2]; //上一个页面
  391. //调用上一页拉取数据的方法
  392. if (prePage.route == 'pages2/msg/index') {
  393. prePage.$vm.getChangeData(this.id);
  394. }
  395. }
  396. };
  397. </script>
  398. <style>
  399. page {
  400. background: #eaeef1;
  401. }
  402. </style>
  403. <style scoped>
  404. .lsow:last-child {
  405. border-bottom: none !important;
  406. }
  407. .timeStys {
  408. margin: 0rpx 6rpx;
  409. color: #007aff;
  410. font-size: 28rpx;
  411. font-weight: bold;
  412. border-bottom: 1rpx solid #007aff;
  413. }
  414. .h4 {
  415. color: #333;
  416. font-size: 28rpx;
  417. font-weight: bold;
  418. }
  419. .aSty {
  420. color: #999;
  421. font-size: 24rpx;
  422. margin-left: 8rpx;
  423. }
  424. .h33 {
  425. font-size: 28rpx;
  426. color: #666;
  427. }
  428. .content {
  429. font-size: 28rpx;
  430. color: #666666;
  431. line-height: 36rpx;
  432. }
  433. .time {
  434. font-size: 24rpx;
  435. color: #999999;
  436. margin: 15rpx 0;
  437. }
  438. .btn1 {
  439. width: 526rpx;
  440. height: 80rpx;
  441. background: #007aff;
  442. border-radius: 40rpx;
  443. color: #ffffff;
  444. font-size: 30rpx;
  445. font-weight: bold;
  446. text-align: center;
  447. line-height: 80rpx;
  448. margin: 30rpx auto;
  449. }
  450. .item {
  451. width: 100%;
  452. background: #ffffff;
  453. border-radius: 16rpx;
  454. padding: 15rpx;
  455. }
  456. .title {
  457. font-size: 30rpx;
  458. font-weight: bold;
  459. color: #333333;
  460. }
  461. </style>