index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062
  1. <template>
  2. <view class="learnings">
  3. <u-navbar :is-back="false" title="学习中心" :border-bottom="false" title-color="#333333" back-icon-color="#ffffff">
  4. <view class="slot-wrap">
  5. <image src="/static/logo2.png" style="width: 178rpx;height: 31rpx;margin-left: 30rpx;"></image>
  6. </view>
  7. </u-navbar>
  8. <u-line color="#D6D6DB" />
  9. <view class="contents">
  10. <!-- <view class="diatance">
  11. <image class="clock" src="/static/learn/clock.png" mode=""></image>
  12. <text>
  13. 一级建造师,距离考试还有
  14. </text>
  15. <u-count-down :timestamp="leftDays" :show-days="true" separator="zh"
  16. :show-hours="false" :show-minutes="false" :show-seconds="false" font-size="28"
  17. bg-color="#007AFF" separator-color="#fff" color="#fff" separator-size="28">
  18. </u-count-down>
  19. </view> -->
  20. <!-- 有学习的课程 -->
  21. <view v-if="allCourse" class="had_courses">
  22. <!-- 直播 -->
  23. <view v-if="livingLists.length" class="lives">
  24. <view v-for="(live, l_index) in livingLists" :key="l_index" class="live_item" @click="toLiveLook(live)">
  25. <view class="live_con">
  26. <view class="live_status">
  27. <image v-if="bgShow(live.liveStartTime, live.watchStatus)" src="/static/learn/living.png" class="liv_icon"></image>
  28. <image v-else src="/static/learn/wlive.png" class="liv_icon"></image>
  29. <text class="status_s">{{ live.liveStartTime | liveStatus(live.watchStatus)}}</text>
  30. <view class="look_bt"
  31. :class="{'living': lookTimeStatus(live.liveStartTime, live.watchStatus) == 1,
  32. 'futuring': lookTimeStatus(live.liveStartTime, live.watchStatus) == 4,
  33. 'curring': [2,3].includes(lookTimeStatus(live.liveStartTime, live.watchStatus))}"
  34. >
  35. <text v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 1">点击观看</text>
  36. <text v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 2">即将开播</text>
  37. <template v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 3">
  38. 剩余:
  39. <u-count-down :timestamp="curTimeTamp(live.liveStartTime)" :show-days="false"
  40. color="#fff" separator-color="#fff" font-size="24" separator-size="24" bg-color="#FFB102">
  41. </u-count-down>
  42. </template>
  43. <template v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 4">
  44. 剩余:
  45. <u-count-down :timestamp="curTimeTamp(live.liveStartTime)" :show-days="true" separator="zh"
  46. color="#fff" separator-color="#fff" bg-color="#007AFF"
  47. :show-hours="false" :show-minutes="false" :show-seconds="false" font-size="24" separator-size="24">
  48. </u-count-down>
  49. <u-count-down :timestamp="curTimeTamp(live.liveStartTime)" :show-days="false"
  50. color="#fff" separator-color="#fff" bg-color="#007AFF"
  51. font-size="24" separator-size="24">
  52. </u-count-down>
  53. </template>
  54. </view>
  55. </view>
  56. <view class="liv_time">
  57. <text class="timeR">{{ live.liveStartTime | formate('mm月dd日')}}</text>
  58. <text>{{ live.liveStartTime | formate('hh:mm')}}</text>
  59. </view>
  60. <view class="liv_title">{{ live.name }}</view>
  61. </view>
  62. <image v-if="bgShow(live.liveStartTime, live.watchStatus)" src="/static/learn/living_bg.png" class="my_bg"></image>
  63. <image v-else src="/static/learn/wlive_bg.png" class="my_bg"></image>
  64. </view>
  65. </view>
  66. <!-- 我的课程 -->
  67. <view v-if="courseLists.length" class="my_courses">
  68. <text class="titles">我的课程</text>
  69. <view v-for="(item, index) in courseLists" :key="index" class="course_item">
  70. <view class="titlews" @click="studyIn(item.goodsId,item.gradeId,item,index)">
  71. <view class="cou_titles">{{ item.goodsName }}</view>
  72. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  73. <image class="l_range" src="/static/learn/learn_range.png"></image>
  74. 学习周期:
  75. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  76. </view>
  77. </view>
  78. <!-- 状态 -->
  79. <view v-if="item.goodsType == 1" class="all_status" @click="studyIn(item.goodsId,item.gradeId,item,index)">
  80. <!-- 不在学习服务期 -->
  81. <template v-if="item.serviceStartTime && (sysTime < item.serviceStartTime || sysTime > item.serviceEndTime)">
  82. <view class="class-warm" v-if="item.gradeId != 0 && item.gradeStatus == 1">
  83. <view class="class-warm__text">
  84. <view class="date">
  85. 不在学习服务期,不可以学习了哦
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <template v-else>
  91. <!-- 班级有效期过了 -->
  92. <template v-if="item.classEndTime && (item.classEndTime < sysTime) ">
  93. <view class="class-warm">
  94. <u-icon class="class-warm__icon" size="30" color="#FF3B30" name="error-circle-fill">
  95. </u-icon>
  96. <view class="class-warm__text">
  97. <view class="date">班级有效期:{{$method.timestampToTime(item.classStartTime,true,true)}} - {{$method.timestampToTime(item.classEndTime,true,true)}}</view>
  98. <view class="date">班级状态:已过期,有疑问请联系 <text @click="call()">020-87085982</text></view>
  99. </view>
  100. </view>
  101. </template>
  102. <!-- 班级有效期之前 -->
  103. <template v-else-if="item.classStartTime && (item.classStartTime > sysTime) ">
  104. <view class="class-warm">
  105. <u-icon class="class-warm__icon" size="30" color="#FF3B30" name="error-circle-fill">
  106. </u-icon>
  107. <view class="class-warm__text">
  108. <view class="date">班级有效期:{{$method.timestampToTime(item.classStartTime,true,true)}} -
  109. {{$method.timestampToTime(item.classEndTime,true,true)}}</view>
  110. <view class="date">班级状态:未到学习时间,有疑问请联系 <text @click="call()">020-87085982</text></view>
  111. </view>
  112. </view>
  113. </template>
  114. <!-- 在班级有效期之间或者没有班级有效期 -->
  115. <template v-else>
  116. <view class="class-warm"
  117. v-if="item.gradeId != 0 && item.gradeStatus == 1 && item.classStatus != null">
  118. <view class="class-warm__text">
  119. <view class="date">
  120. 班级状态:
  121. <text v-if="item.classStatus == 1">已开班</text>
  122. <text v-if="item.classStatus == 0">未开班</text>
  123. </view>
  124. <view class="date" v-if="item.classStatus == 0">教务处正在为您开通班级,请耐心等待</view>
  125. <view class="date"
  126. v-if="item.classStatus == 1 && item.classStartTime && item.classEndTime">
  127. 班级有效期:{{$method.timestampToTime(item.classStartTime,true,true)}}-{{$method.timestampToTime(item.classEndTime,true,true)}}
  128. </view>
  129. </view>
  130. </view>
  131. <!-- 学时审核状态不可审核 -->
  132. <template v-if="item.periodStatus == -1 || item.periodStatus == 2">
  133. <view class="class-warm" v-if="item.classStatus == 1 || item.classStatus === null">
  134. <view class="class-warm__text">
  135. <view class="date">
  136. <template
  137. v-if="sysTime >= item.serviceStartTime && sysTime <= item.serviceEndTime">
  138. 学习状态:
  139. <text v-if="item.stuAllNum+item.recordNum == 0">未学习</text>
  140. <text
  141. v-else-if="item.stuAllNum+item.recordNum > 0 && item.stuAllNum+item.recordNum < item.secAllNum+item.examNum">学习中</text>
  142. <text v-else-if="item.stuAllNum+item.recordNum >= item.secAllNum+item.examNum">已学完</text>
  143. </template>
  144. <template v-else>
  145. <template v-if="item.serviceStartTime">已过学习服务期,不可以学习了哦!</template>
  146. </template>
  147. </view>
  148. </view>
  149. </view>
  150. </template>
  151. <!-- 学时审核状态可以审核 -->
  152. <template v-if="item.periodStatus != -1">
  153. <view class="class-warm">
  154. <view class="class-warm__text">
  155. <view class="date">
  156. <text v-if="item.periodStatus == 0">机构审核:学时审核不通过</text>
  157. <!-- <text v-else-if="item.periodStatus == 2">学时待审核</text> -->
  158. <text v-else-if="item.periodStatus == 3">学时审核中</text>
  159. <text v-else-if="item.periodStatus == 1">
  160. <text v-if="item.periodPlush > 0">学时已上报注册中心</text>
  161. <text v-else>机构审核:学时审核通过</text>
  162. </text>
  163. </view>
  164. </view>
  165. </view>
  166. <view class="class-warm" v-if="item.subscribeId != null && item.periodStatus == 1">
  167. <view class="class-warm__text">
  168. <view class="date">
  169. <view v-if="item.subExamStatus === null">待预约考试</view>
  170. <view
  171. v-else-if="item.subExamStatus === 0 && sysTime < $method.TimeTotimestamp(
  172. $method.timestampToTime(item.subApplySiteExamTime, true) +
  173. ' ' +
  174. item.subApplySiteStartTime
  175. )">
  176. 待考试,考试时间:
  177. {{
  178. $method.timestampToTime(item.subApplySiteExamTime, true) +
  179. " " +
  180. item.subApplySiteStartTime
  181. }}
  182. -
  183. {{
  184. $method.timestampToTime(item.subApplySiteExamTime, true) +
  185. " " +
  186. item.subApplySiteEndTime
  187. }}
  188. </view>
  189. <view v-else-if="item.subExamStatus === 0">待出考试结果</view>
  190. <view v-else-if="item.subExamStatus === 1">
  191. <text v-if="item.subResult === null">待出考试结果</text>
  192. <text v-if="item.subResult === 0">考试结果:不通过,需补考</text>
  193. <text
  194. v-else-if="item.subResult === 1">考试结果:通过,考试成绩为{{item.subPerformance}}</text>
  195. </view>
  196. <view v-else-if="item.subExamStatus === 2">缺考,无成绩,需补考</view>
  197. <view v-else-if="item.subExamStatus === 3">作弊,无成绩,需补考</view>
  198. <view v-else-if="item.subExamStatus === 4">替考,无成绩,需补考</view>
  199. </view>
  200. </view>
  201. </view>
  202. </template>
  203. </template>
  204. </template>
  205. </view>
  206. <view class="c_downs" @click="studyIn(item.goodsId,item.gradeId,item,index)">
  207. <view class="lefts">
  208. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  209. <view v-if="item.goodsType == 6" class="live_icon">直播</view>
  210. </view>
  211. <view class="rights">
  212. <template
  213. v-if="item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > sysTime) && (item.serviceStartTime < sysTime)
  214. && (item.classEndTime && (item.classEndTime < sysTime)) && (item.periodStatus == 0 || item.periodStatus == -1)
  215. && item.studyCount > 0">
  216. </template>
  217. <view v-else class="learn_progress">
  218. <view class="progress_up">
  219. <!-- 学习进度 (已做试卷+已做节)/(试卷数+节数) -->
  220. <view>
  221. 学习进度:{{ item.stuAllNum+item.recordNum }}/{{ item.secAllNum+item.examNum }}
  222. </view>
  223. <view class="progress_bar" style="width: 100%;">
  224. <u-line-progress :showText="false" height="22" active-color="#ff9900" :show-percent="false"
  225. :percent="((item.stuAllNum+item.recordNum) / (item.secAllNum+item.examNum)) * 100"></u-line-progress>
  226. </view>
  227. </view>
  228. </view>
  229. </view>
  230. </view>
  231. <!-- 按钮 -->
  232. <view class="study_btns">
  233. <template
  234. v-if="item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > sysTime) && (item.serviceStartTime < sysTime) &&
  235. (item.classEndTime && (item.classEndTime < sysTime)) && (item.periodStatus == 0 || item.periodStatus == -1) &&
  236. item.userStudyCount > 0">
  237. <view class="exam_word ones" @click.stop="selectClass(item,index)">
  238. 选班重学
  239. </view>
  240. </template>
  241. <!-- examApplyGoodsList.length -是判断是否关联指定学员 -->
  242. <view v-else class="exam_btns">
  243. <view class="box_appoint" v-if="item.applyStatus === 1 && !( sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime
  244. || (item.classStartTime && sysTime <= item.classStartTime) || (item.classEndTime && sysTime >= item.classEndTime) ||
  245. item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && sysTime < item.learningTimeStart) ||
  246. !item.examApplyGoodsList.length)"
  247. @click="appointment(item,appoint)">
  248. <view class="exam_word ones">预约考试</view>
  249. </view>
  250. <view class="box_appoint" v-if="item.beforeStatus === 1 && !( sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime
  251. || (item.classStartTime && sysTime <= item.classStartTime) || (item.classEndTime && sysTime >= item.classEndTime) ||
  252. item.learningStatus == 2 || item.classStatus == 0 || (item.learningStatus == 3 && sysTime < item.learningTimeStart))"
  253. @click="appBeforeAddress(item.goodsId,item)">
  254. <view class="exam_word ones">进入刷题</view>
  255. </view>
  256. </view>
  257. <view class="box_appoint" @click="studyIn(item.goodsId,item.gradeId,item,index)">
  258. <view class="exam_word intos">进入学习</view>
  259. </view>
  260. </view>
  261. </view>
  262. </view>
  263. <!-- 我的题库 -->
  264. <!-- <view class="my_courses">
  265. <text class="titles">我的题库</text>
  266. <view class="bottoms">
  267. <navigator hover-class="none" url="/pages2/subject/collect">
  268. <view class="item collect">
  269. <view class="text">收藏集<u-icon name="arrow-right"></u-icon></view>
  270. <image class="img" src="/static/questionBank_collect.png"></image>
  271. </view>
  272. </navigator>
  273. <view class="item list">
  274. <navigator hover-class="none" url="/pages2/bank/question_record">
  275. <view class="list-in">
  276. <image class="img" src="/static/questionBank_record.png" ></image>
  277. <view class="text">
  278. 做题记录 <u-icon name="arrow-right"></u-icon>
  279. </view>
  280. </view>
  281. </navigator>
  282. <navigator hover-class="none" url="/pages2/subject/wrong">
  283. <view class="list-in">
  284. <image class="img" src="/static/questionBank_wrong.png"></image>
  285. <view class="text">
  286. 错题集 <u-icon name="arrow-right"></u-icon>
  287. </view>
  288. </view>
  289. </navigator>
  290. </view>
  291. </view>
  292. <template v-if="questionLists.length">
  293. <view v-for="(item, indexq) in questionLists" :key="indexq" class="course_item">
  294. <view>
  295. <view class="cou_titles">{{ item.goodsName }}</view>
  296. <view v-if="item.serviceStartTime && item.serviceEndTime" class="learn_ranges">
  297. <image class="l_range" src="/static/learn/learn_range.png"></image>
  298. 学习周期:
  299. <text class="l_time">{{ item.serviceStartTime | formate('yyyy.mm.dd') }} - {{ item.serviceEndTime | formate('yyyy.mm.dd') }}</text>
  300. </view>
  301. </view>
  302. <view class="c_downs">
  303. <view class="lefts">
  304. <image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
  305. </view>
  306. <view class="rights">
  307. <view class="learn_progress">
  308. <view class="progress_up">
  309. <view>
  310. 学习进度:{{item.doNum}}/{{item.totalNum}}
  311. </view>
  312. <view class="progress_bar" style="width: 100%;">
  313. <u-line-progress :show-percent="false" height="22" active-color="#ff9900" :percent="(item.doNum/item.totalNum)*100"></u-line-progress>
  314. </view>
  315. </view>
  316. <view class="progress_down">
  317. <view class="enter_into" @click="studyques(item,index)">进入练习</view>
  318. </view>
  319. </view>
  320. </view>
  321. </view>
  322. </view>
  323. </template>
  324. </view> -->
  325. </view>
  326. <!-- 没有学习的课程 -->
  327. <view v-if="!allLoading && !allCourse" class="no_datas">
  328. <image class="courses" src="/static/learn/no_course.png" mode=""></image>
  329. <view class="no_learns">您目前没有可学习的课程</view>
  330. <view class="choose" @click="toChoose()">立即去选购</view>
  331. </view>
  332. </view>
  333. <!-- 弹窗 -->
  334. <u-popup v-model="selectClassModal" @close="gradeValue = -1" mode="bottom" border-radius="40">
  335. <view class="popup_box">
  336. <view style="margin-bottom: 20rpx;">
  337. <view class="line1"></view>
  338. <view class="grade">选择班级</view>
  339. </view>
  340. <u-line color="#D6D6DB" />
  341. <view>
  342. <scroll-view scroll-y="true" style="height: 500rpx;">
  343. <view>
  344. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  345. <view v-for="(item, index) in gradeList" :key="index">
  346. <view style="display: flex;align-items: center;padding: 20rpx;">
  347. <view>
  348. <u-radio shape="circle" :name="index"
  349. :disabled="item.studentNum > 0 && item.studentNum == item.studentUpper">
  350. <view :class="item.checked?'white-box blue-box':'white-box'">
  351. <view>
  352. <view class="blackTxt">{{item.className}}</view>
  353. <view class="redTxt" v-if="item.classEndTime">
  354. 有效期至:{{$method.timestampToTime(item.classEndTime,true,true)}}
  355. </view>
  356. <view class="redTxt" v-if="item.classEndTime">
  357. 本班还剩{{$method.GetRTime(item.classEndTime)}}天将结束学习</view>
  358. </view>
  359. </view>
  360. </u-radio>
  361. </view>
  362. </view>
  363. </view>
  364. </u-radio-group>
  365. </view>
  366. </scroll-view>
  367. </view>
  368. <view class="confrim-btn">
  369. <view class="okBtn" @click="okPopup()">确定</view>
  370. </view>
  371. </view>
  372. </u-popup>
  373. <!-- <select-class :selectClassModal.sync="selectClassModal" :gradeList="gradeList" @okPopup="okPopup()" @closeModal="closeModal()"></select-class> -->
  374. <u-modal v-model="showUserConfirmInfo" @confirm="confirmUserConfirm" ref="uModal" :async-close="true"
  375. @cancel="cancelUserConfirm" :confirm-text="'确认' + (confirmCount > 0 ? '('+confirmCount+')' : '')"
  376. :confirm-color="confirmCount > 0 ? '#999' : '#2979ff'" class="confirm-modal" title="实名验证确认"
  377. cancel="取消" :show-cancel-button="true">
  378. <view class="slot-content">
  379. <view class="content">
  380. 为避免个人信息不正确导致您的学习时长无效,请认真核对以下信息是否正确,如信息有误请取消当前操作,立刻联系020-38946666
  381. <view class="msg-list">
  382. <view class="item">
  383. <text class="item__left">姓名:</text>
  384. <text class="item__right">{{userInfo.realname}}</text>
  385. </view>
  386. <view class="item">
  387. <text class="item__left">手机号:</text>
  388. <text class="item__right">{{userInfo.telphone}}</text>
  389. </view>
  390. <view class="item">
  391. <text class="item__left">身份号:</text>
  392. <text class="item__right">{{userInfo.idCard}}</text>
  393. </view>
  394. <view class="item">
  395. <u-checkbox v-model="confirmChecked" :label-disabled="false">确认个人信息无误</u-checkbox>
  396. </view>
  397. </view>
  398. </view>
  399. </view>
  400. </u-modal>
  401. <!-- 多个预约考试时的弹窗 -->
  402. <u-popup v-model="appointTestShow" mode="bottom" border-radius="40">
  403. <view class="popuptest_box">
  404. <view class="check_head">
  405. <view class="headers">
  406. <view class="grade">切换课程</view>
  407. <u-icon name="close" color="#9C9C9C" size="40" @click="closePop()"></u-icon>
  408. </view>
  409. </view>
  410. <view class="check_con">
  411. <scroll-view scroll-y="true" style="height: 700rpx;">
  412. <view class="course_items" v-for="(appoint, index) in appointTestList" :key="index">
  413. <view class="course_lefts">
  414. <view class="course_title">{{ appoint.applyName }}</view>
  415. </view>
  416. <view class="course_rights" @click="jumpTest(appointItemIndex, appoint)">
  417. <view class="intoStudy">预约</view>
  418. </view>
  419. </view>
  420. </scroll-view>
  421. </view>
  422. </view>
  423. </u-popup>
  424. </view>
  425. </template>
  426. <script>
  427. var curTime = new Date().getTime() // 当前时间的时间戳
  428. import {mapGetters,mapActions} from 'vuex'
  429. import { WEBVIEW_URL } from '@/common/request.js'
  430. export default {
  431. data() {
  432. return {
  433. leftDays: 0,
  434. paramC: {
  435. pageNum: 1,
  436. pageSize: 50
  437. },
  438. activeItem: {},
  439. itemIndex: '',
  440. confirmTimer:null,
  441. confirmCount:10,
  442. confirmChecked:false,
  443. showUserConfirmInfo:false,
  444. selectItem: {},
  445. selectClassModal: false,
  446. gradeList: [],
  447. gradeValue: -1,
  448. sysTime: 0,
  449. courseLists: [], // 课程列表
  450. // questionLists: [], // 题库列表
  451. // paramQ: {
  452. // pageNum: 1,
  453. // pageSize: 50
  454. // },
  455. // queitemIndex:'',
  456. livingLists: [], // 直播列表
  457. allLoading: false, // 加载样式
  458. current: 2,
  459. appointTestShow: false, //预约考试弹窗
  460. appointTestList: [],
  461. appointItemIndex: {}, // 点击了哪项课程
  462. }
  463. },
  464. filters: {
  465. liveStatus(liveTime, watchStatus) {
  466. let value = liveTime * 1000
  467. if (curTime < value) { // 判断当前时间和直播开始时间
  468. return ' 未开播'
  469. } else {
  470. return watchStatus == 'live' ? '正在直播中' : '即将开播'
  471. }
  472. }
  473. },
  474. computed: {
  475. ...mapGetters(['userInfo']),
  476. allCourse() {
  477. return this.courseLists.length || this.livingLists.length ? true : false
  478. }
  479. },
  480. onLoad() {
  481. // 1668873600 ,2022.11.20的时间戳
  482. this.leftDays = 1668873600 - parseInt(curTime/1000)
  483. // this.sysTime = +this.$method.timest()
  484. },
  485. async onShow() {
  486. this.getCourseLiveQues()
  487. await this.commonSystemTime()
  488. },
  489. onPullDownRefresh() {
  490. this.getCourseLiveQues()
  491. },
  492. methods: {
  493. ...mapActions(['getUserInfo']),
  494. bgShow(liveTime, watchStatus) {
  495. let value = liveTime * 1000
  496. if (curTime > value) { // 判断当前时间和直播开始时间
  497. return watchStatus == 'live' ? true : false
  498. }
  499. },
  500. lookTimeStatus(liveTime, watchStatus) {
  501. if (liveTime) {
  502. let value = new Date(liveTime * 1000)
  503. var Y = value.getFullYear()
  504. var M = value.getMonth() + 1 < 10 ? '0' + (value.getMonth() + 1) : value.getMonth() + 1
  505. var D = value.getDate() < 10 ? '0' + value.getDate() : value.getDate()
  506. var valZ = Y + '/' + M + '/' + D
  507. let curZeroTime = new Date(valZ).getTime() // 获取开始直播时间当天的零点时间戳
  508. if (curTime > value) { // 判断当前时间和直播开始时间
  509. if (watchStatus == 'live') { //
  510. return 1
  511. } else {
  512. return 2
  513. }
  514. } else {
  515. if (curZeroTime <= curTime && curTime <= value) { //当天
  516. return 3
  517. } else {
  518. return 4
  519. }
  520. }
  521. }
  522. },
  523. curTimeTamp(liveTime) {
  524. let min = liveTime - parseInt(curTime / 1000)
  525. return min
  526. },
  527. toChoose() {
  528. uni.switchTab({
  529. url:'/pages/course/index'
  530. })
  531. },
  532. // 查询直播课
  533. getCourseLiveQues() {
  534. this.allLoading = true
  535. // this.$api.listUserFreeUnionBuyGoodsList(this.paramQ), // 查询用户拥有免费+自购题库商品 /bank/question/listUserFreeUnionBuyGoodsList
  536. let arrs = [
  537. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  538. this.$api.getgoodsLiveList({
  539. pageNum: 1,
  540. pageSize: 3 // 默认3条
  541. })
  542. ]
  543. wx.stopPullDownRefresh()
  544. Promise.all(arrs).then((res) => {
  545. // if (res.data.code == 200) {
  546. const [{ data: res1}, { data: res2}] = res
  547. if (res1.code == 200) {
  548. this.courseLists = res1.rows || []
  549. }
  550. // if (res2.code == 200) {
  551. // this.questionLists = res2.rows || []
  552. // }
  553. if (res2.code == 200) {
  554. this.livingLists = res2.rows || []
  555. } else {
  556. this.$u.toast(res2.msg)
  557. }
  558. this.allLoading = false
  559. // }
  560. uni.hideLoading()
  561. }).catch(err => {
  562. uni.hideLoading()
  563. this.allLoading = false
  564. })
  565. },
  566. commonSystemTime() {
  567. return new Promise(resolve => {
  568. this.$api.commonSystemTime().then(res => {
  569. this.sysTime = res.data.data;
  570. })
  571. })
  572. },
  573. // 看直播
  574. toLiveLook(item) {
  575. let moduleId = item.moduleId || 0
  576. let chapterId = item.chapterId || 0
  577. let sectionId = item.sectionId || item.menuId
  578. let uuid = new Date().valueOf() + ""
  579. // buyCourse 是否购买课程:1是 0否
  580. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
  581. +item.liveUrl+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId+'&chapterId='
  582. +chapterId+'&moduleId='+moduleId+'&buyCourse=1'+'&ident='+uuid+'&sectionType=2')
  583. uni.navigateTo({
  584. url:`../../pages/webview/index?url=`+encode
  585. })
  586. },
  587. toLive(item) {
  588. this.$api.courseCourseList({
  589. pageNum: 1,
  590. pageSize: 1,
  591. goodsId: item.goodsId,
  592. gradeId: 0,
  593. orderGoodsId: item.orderGoodsId,
  594. }).then(res => {
  595. if (res.data.code == 200) {
  596. if(res.data.total > 1) {
  597. // uni.navigateTo({
  598. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  599. // })
  600. uni.navigateTo({
  601. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId=""'
  602. })
  603. } else if(res.data.total == 1) {
  604. uni.navigateTo({
  605. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
  606. })
  607. } else {
  608. uni.showToast({
  609. icon:'none',
  610. title:'暂无可观看的直播课程'
  611. })
  612. }
  613. }
  614. })
  615. },
  616. async studyIn(v, i, item, index) {
  617. if (item.goodsType == 6) { // 进入直播课
  618. this.toLive(item)
  619. return
  620. }
  621. // 进入视频课
  622. this.activeItem = item
  623. if (item.interfaceAccountId > 0) { //学习账号已开通
  624. if (item.learnStatus == 1) { //跳转第三方h5
  625. uni.navigateTo({
  626. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&isOther=1`
  627. })
  628. return;
  629. } else {
  630. uni.showModal({
  631. showCancel: false,
  632. content: '您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!'
  633. });
  634. return;
  635. }
  636. return;
  637. }
  638. if (item.serviceStartTime && (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  639. uni.showToast({
  640. icon: 'none',
  641. title: '不在学习服务期,不能进入学习'
  642. })
  643. return;
  644. }
  645. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  646. .sysTime >= item.classEndTime)) {
  647. uni.showToast({
  648. icon: 'none',
  649. title: '不在班级有效期,不能进入学习'
  650. })
  651. return
  652. }
  653. if (item.learningStatus == 2) {
  654. uni.showToast({
  655. icon: 'none',
  656. title: '开放学习时间待定,不能进入学习'
  657. })
  658. return
  659. }
  660. if (item.classStatus == 0) {
  661. uni.showToast({
  662. icon: 'none',
  663. title: '尚未开班,不能进入学习'
  664. })
  665. return
  666. }
  667. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  668. uni.showToast({
  669. icon: 'none',
  670. title: '不在开放学习时间,不能进入学习'
  671. })
  672. return;
  673. }
  674. uni.showLoading({
  675. title: '拼命加载中...',
  676. mask:true,
  677. })
  678. var confirmDetail = true;
  679. if (item.educationName == '继续教育') {
  680. if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  681. confirmDetail = await this.userConfirmInfoDetail()
  682. }
  683. }
  684. if(!confirmDetail) {
  685. return;
  686. }
  687. this.itemIndex = index
  688. if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
  689. .classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
  690. .periodStatus == -1) && item.studyCount > 0) {
  691. this.selectClass(item, index, 'loading')
  692. return
  693. }
  694. // /course/goodsRebuildStatus查询用户商品重修状态
  695. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  696. if (rebuildStatus == 0) {
  697. uni.hideLoading()
  698. this.$navTo.togo('/pages2/learn/details', {
  699. gradeId: item.gradeId,
  700. goodsId: item.goodsId,
  701. orderGoodsId: item.orderGoodsId,
  702. });
  703. return;
  704. }
  705. // /lock/lockStatus
  706. this.$api.lockLockStatus({
  707. action: 'jxjy',
  708. uuid:this.$method.getUuid()
  709. }).then(res => {
  710. if (res.data.code == 200) { //有其他端在操作,不能学习
  711. uni.showToast({
  712. icon: 'none',
  713. title: res.data.msg,
  714. mask: true,
  715. duration: 3000
  716. })
  717. } else if (res.data.code == 500) { //可以学习
  718. this.$http({
  719. url: '/course/courseList',
  720. method: 'get',
  721. data: {
  722. pageNum: 1,
  723. pageSize: 100,
  724. goodsId: item.goodsId,
  725. gradeId: item.gradeId,
  726. orderGoodsId: item.orderGoodsId,
  727. },
  728. noLoading: true
  729. })
  730. .then(res => {
  731. if (res.data.code == 200) {
  732. if(res.data.total > 1) {
  733. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  734. uni.navigateTo({
  735. url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  736. })
  737. } else if(res.data.total == 1) {
  738. uni.navigateTo({
  739. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  740. })
  741. } else {
  742. uni.showToast({
  743. icon:'none',
  744. title:'暂无可观看的视频课程'
  745. })
  746. }
  747. }
  748. });
  749. return;
  750. }
  751. })
  752. },
  753. /**
  754. * @param {Object} goodsId 商品id
  755. * 查询商品重修状态
  756. */
  757. courseGoodsRebuildStatus(goodsId, gradeId) {
  758. return new Promise(resolve => {
  759. this.$http({
  760. url: '/course/goodsRebuildStatus',
  761. method: 'get',
  762. data: {
  763. goodsId: goodsId,
  764. gradeId: gradeId
  765. },
  766. noLoading: true,
  767. compleLoading: true, // 请求成功是否还要继续显示加载中
  768. })
  769. .then(res => {
  770. resolve(res.data.data)
  771. })
  772. })
  773. },
  774. userConfirmInfoDetail(){
  775. return new Promise(resolve => {
  776. this.$http({
  777. url: '/user/confirm/info/detail',
  778. method: 'get',
  779. data: { orderGoodsId:this.activeItem.orderGoodsId },
  780. noLoading:true,
  781. })
  782. .then(res => {
  783. if(!res.data.data) {
  784. clearInterval(this.confirmTimer);
  785. this.confirmCount = 10;
  786. this.showUserConfirmInfo = true;
  787. this.confirmTimer = setInterval(() => {
  788. if(this.confirmCount > 0) {
  789. this.confirmCount--
  790. } else {
  791. clearInterval(this.confirmTimer);
  792. }
  793. },1000)
  794. } else {
  795. if(res.data.data.pushInfo) {
  796. resolve(true)
  797. } else {
  798. uni.showModal({
  799. showCancel:false,
  800. title:'提示',
  801. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  802. })
  803. resolve(false)
  804. }
  805. }
  806. })
  807. })
  808. },
  809. selectClass(item, index, load) {
  810. this.itemIndex = index;
  811. this.selectItem = item;
  812. this.selectClassModal = true;
  813. this.goodsGradeList(item.goodsId, load);
  814. },
  815. goodsGradeList(id, load) {
  816. this.$http({
  817. url: '/grade/grade/list',
  818. method: 'get',
  819. data: { goodsId: id },
  820. noLoading: load ? true : false,
  821. })
  822. .then(res => {
  823. if (res.data.code == 200) {
  824. this.gradeList = res.data.rows
  825. if (this.gradeList.length == 0) {
  826. let item = {
  827. className: '系统分班',
  828. gradeId: 0
  829. }
  830. this.gradeList.push(item)
  831. } else {
  832. let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
  833. .studentNum == item.studentUpper))
  834. //所有班级都满了
  835. if (isGradeFull) {
  836. let item = {
  837. className: '系统分班',
  838. gradeId: 0
  839. }
  840. this.gradeList.unshift(item)
  841. }
  842. }
  843. }
  844. });
  845. },
  846. radioGroupChange(e) {
  847. // console.log(e)
  848. },
  849. okPopup() {
  850. if (this.gradeValue == -1) {
  851. uni.showToast({
  852. icon: 'none',
  853. title: '请选择班级'
  854. })
  855. return;
  856. }
  857. this.$api.changeGrade({
  858. goodsId: this.selectItem.goodsId,
  859. gradeId: this.gradeValue,
  860. oldGradeId: this.selectItem.gradeId,
  861. orderGoodsId: this.selectItem.orderGoodsId,
  862. userId: this.selectItem.userId
  863. }).then(res => {
  864. if (res.data.code == 200) {
  865. if (this.itemIndex !== '') {
  866. this.refreshByIndex();
  867. }
  868. this.selectClassModal = false;
  869. uni.showToast({
  870. title: '选班成功'
  871. })
  872. } else {
  873. uni.showToast({
  874. icon: 'none',
  875. title: res.data.msg
  876. })
  877. }
  878. })
  879. },
  880. /**
  881. * 返回刷新之前进入的课程数据
  882. */
  883. refreshByIndex() {
  884. this.$api.listUserVideoLive({
  885. pageNum: this.itemIndex + 1,
  886. pageSize: 1
  887. }).then(res => {
  888. if (res.data.code == 200) {
  889. this.$set(this.courseLists, this.itemIndex, res.data.rows[0])
  890. }
  891. });
  892. },
  893. confirmUserConfirm() {
  894. this.$refs.uModal.clearLoading();
  895. if(this.confirmCount <= 0) {
  896. if(this.confirmChecked) {
  897. let infoJson = {
  898. realname:this.userInfo.realname,
  899. idCard:this.userInfo.idCard,
  900. telphone:this.userInfo.telphone
  901. }
  902. this.$api.userConfirminfo({
  903. orderGoodsId:this.activeItem.orderGoodsId,
  904. infoJson:JSON.stringify(infoJson)
  905. }).then(res => {
  906. if(res.data.data.pushInfo) {
  907. uni.showToast({
  908. icon:'none',
  909. title:'提交成功'
  910. })
  911. } else {
  912. uni.showModal({
  913. showCancel:false,
  914. title:'提示',
  915. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  916. })
  917. }
  918. this.showUserConfirmInfo = false;
  919. })
  920. } else {
  921. uni.showToast({
  922. icon:'none',
  923. title:'请勾选确认个人信息无误'
  924. })
  925. }
  926. } else {
  927. return;
  928. }
  929. },
  930. cancelUserConfirm() {
  931. clearInterval(this.confirmTimer)
  932. },
  933. call() {
  934. uni.makePhoneCall({
  935. phoneNumber: '020-87085982' //仅为示例
  936. })
  937. },
  938. closePop() {
  939. this.appointTestShow = false
  940. },
  941. jumpTest(item, appoint) {
  942. this.appoint_an(item, appoint)
  943. this.appointTestShow = false
  944. },
  945. appointment(item, appoint) {
  946. this.appointItemIndex = item
  947. if (item.examApplyGoodsList.length > 1) { // 多个考试预约
  948. this.appointTestList = item.examApplyGoodsList
  949. this.appointTestShow = true
  950. return
  951. }
  952. let appoint_item = item.examApplyGoodsList[0]
  953. this.appoint_an(item, appoint_item)
  954. },
  955. appoint_an(item, appoint) {
  956. var data = {
  957. goodsId: item.goodsId,
  958. gradeId: item.gradeId,
  959. applyId:appoint.applyId,
  960. orderGoodsId:item.orderGoodsId
  961. };
  962. this.$api.getApplysubscribe(data).then(res => {
  963. if (res.data.code === 500) {
  964. uni.showModal({
  965. showCancel: false,
  966. content: res.data.msg
  967. });
  968. }
  969. if (res.data.code === 200) {
  970. this.$navTo.togo('/pages2/appointment/index', {
  971. goodsId: item.goodsId,
  972. gradeId: item.gradeId,
  973. orderGoodsId: item.orderGoodsId,
  974. applyId:appoint.applyId
  975. });
  976. }
  977. });
  978. },
  979. // 进入刷题,调整小程序
  980. appBeforeAddress(goodsId,item) {
  981. this.$api.appBeforeAddress({
  982. orderGoodsId:item.orderGoodsId
  983. }).then(res => {
  984. if (res.data.code == 200) {
  985. uni.navigateToMiniProgram({
  986. appId: res.data.data.url,
  987. success(res) {
  988. // 打开成功
  989. }
  990. })
  991. } else {
  992. uni.showModal({
  993. title:'提示',
  994. content:res.data.msg,
  995. showCancel:false,
  996. })
  997. }
  998. })
  999. },
  1000. }
  1001. }
  1002. </script>
  1003. <style>
  1004. page {
  1005. background: #eaeef1;
  1006. }
  1007. </style>
  1008. <style lang="scss" scoped>
  1009. @import './index.scss';
  1010. </style>