index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  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.studyCount > 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. <!-- <tab-bar v-model="current" :list="tabbarlist" :mid-button="true" :mid-button-size="50" class="tab_items"></tab-bar> -->
  425. </view>
  426. </template>
  427. <script>
  428. var curTime = new Date().getTime() // 当前时间的时间戳
  429. import {mapGetters,mapActions} from 'vuex'
  430. import { WEBVIEW_URL } from '@/common/request.js'
  431. export default {
  432. data() {
  433. return {
  434. leftDays: 0,
  435. paramC: {
  436. pageNum: 1,
  437. pageSize: 50
  438. },
  439. activeItem: {},
  440. itemIndex: '',
  441. confirmTimer:null,
  442. confirmCount:10,
  443. confirmChecked:false,
  444. showUserConfirmInfo:false,
  445. selectItem: {},
  446. selectClassModal: false,
  447. gradeList: [],
  448. gradeValue: -1,
  449. sysTime: 0,
  450. courseLists: [], // 课程列表
  451. questionLists: [], // 题库列表
  452. paramQ: {
  453. pageNum: 1,
  454. pageSize: 50
  455. },
  456. queitemIndex:'',
  457. livingLists: [], // 直播列表
  458. allLoading: false, // 加载样式
  459. current: 2,
  460. appointTestShow: false, //预约考试弹窗
  461. appointTestList: [],
  462. appointItemIndex: {}, // 点击了哪项课程
  463. }
  464. },
  465. filters: {
  466. liveStatus(liveTime, watchStatus) {
  467. let value = liveTime * 1000
  468. if (curTime < value) { // 判断当前时间和直播开始时间
  469. return ' 未开播'
  470. } else {
  471. return watchStatus == 'live' ? '正在直播中' : '即将开播'
  472. }
  473. }
  474. },
  475. computed: {
  476. ...mapGetters(['userInfo']),
  477. allCourse() {
  478. return this.courseLists.length || this.questionLists.length || this.livingLists.length ? true : false
  479. }
  480. },
  481. onLoad() {
  482. // 1668873600 ,2022.11.20的时间戳
  483. this.leftDays = 1668873600 - parseInt(curTime/1000)
  484. // this.sysTime = +this.$method.timest()
  485. },
  486. async onShow() {
  487. this.getCourseLiveQues()
  488. await this.commonSystemTime()
  489. },
  490. onPullDownRefresh() {
  491. this.getCourseLiveQues()
  492. },
  493. methods: {
  494. ...mapActions(['getUserInfo']),
  495. bgShow(liveTime, watchStatus) {
  496. let value = liveTime * 1000
  497. if (curTime > value) { // 判断当前时间和直播开始时间
  498. return watchStatus == 'live' ? true : false
  499. }
  500. },
  501. lookTimeStatus(liveTime, watchStatus) {
  502. if (liveTime) {
  503. let value = new Date(liveTime * 1000)
  504. var Y = value.getFullYear()
  505. var M = value.getMonth() + 1 < 10 ? '0' + (value.getMonth() + 1) : value.getMonth() + 1
  506. var D = value.getDate() < 10 ? '0' + value.getDate() : value.getDate()
  507. var valZ = Y + '/' + M + '/' + D
  508. let curZeroTime = new Date(valZ).getTime() // 获取开始直播时间当天的零点时间戳
  509. if (curTime > value) { // 判断当前时间和直播开始时间
  510. if (watchStatus == 'live') { //
  511. return 1
  512. } else {
  513. return 2
  514. }
  515. } else {
  516. if (curZeroTime <= curTime && curTime <= value) { //当天
  517. return 3
  518. } else {
  519. return 4
  520. }
  521. }
  522. }
  523. },
  524. curTimeTamp(liveTime) {
  525. let min = liveTime - parseInt(curTime / 1000)
  526. return min
  527. },
  528. toChoose() {
  529. uni.switchTab({
  530. url:'/pages/course/index'
  531. })
  532. },
  533. // 查询直播课
  534. getCourseLiveQues() {
  535. this.allLoading = true
  536. let arrs = [
  537. this.$api.listUserVideoLive(this.paramC), // 查询用户拥有视频+直播商品 /goods/listUserVideoLive
  538. this.$api.listUserFreeUnionBuyGoodsList(this.paramQ), // 查询用户拥有免费+自购题库商品 /bank/question/listUserFreeUnionBuyGoodsList
  539. this.$api.getgoodsLiveList({
  540. pageNum: 1,
  541. pageSize: 3 // 默认3条
  542. })
  543. ]
  544. Promise.all(arrs).then((res) => {
  545. // if (res.data.code == 200) {
  546. const [{ data: res1}, { data: res2}, {data: res3}] = 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 (res3.code == 200) {
  554. this.livingLists = res3.rows || []
  555. } else {
  556. this.$u.toast(res3.msg)
  557. }
  558. this.allLoading = false
  559. // }
  560. wx.stopPullDownRefresh()
  561. }).catch(err => {
  562. this.allLoading = false
  563. wx.stopPullDownRefresh()
  564. // this.$u.toast('请重新刷新请求')
  565. })
  566. },
  567. commonSystemTime() {
  568. return new Promise(resolve => {
  569. this.$api.commonSystemTime().then(res => {
  570. this.sysTime = res.data.data;
  571. })
  572. })
  573. },
  574. // 看直播
  575. toLiveLook(item) {
  576. let moduleId = item.moduleId || 0
  577. let chapterId = item.chapterId || 0
  578. let sectionId = item.sectionId || item.menuId
  579. let uuid = new Date().valueOf() + ""
  580. // buyCourse 是否购买课程:1是 0否
  581. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
  582. +item.liveUrl+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId+'&chapterId='
  583. +chapterId+'&moduleId='+moduleId+'&buyCourse=1'+'&ident='+uuid+'&sectionType=2')
  584. uni.navigateTo({
  585. url:`../../pages/webview/index?url=`+encode
  586. })
  587. },
  588. toLive(item) {
  589. this.$api.courseCourseList({
  590. pageNum: 1,
  591. pageSize: 1,
  592. goodsId: item.goodsId,
  593. gradeId: 0,
  594. orderGoodsId: item.orderGoodsId,
  595. }).then(res => {
  596. if (res.data.code == 200) {
  597. if(res.data.total > 1) {
  598. // uni.navigateTo({
  599. // url:'/pages5/liveDetail/course?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
  600. // })
  601. uni.navigateTo({
  602. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId=""'
  603. })
  604. } else if(res.data.total == 1) {
  605. uni.navigateTo({
  606. url:'/pages3/live/detail?orderGoodsId='+item.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
  607. })
  608. } else {
  609. uni.showToast({
  610. icon:'none',
  611. title:'暂无可观看的直播课程'
  612. })
  613. }
  614. }
  615. })
  616. },
  617. async studyIn(v, i, item, index) {
  618. if (item.goodsType == 6) { // 进入直播课
  619. this.toLive(item)
  620. return
  621. }
  622. // 进入视频课
  623. this.activeItem = item
  624. if (item.interfaceAccountId > 0) { //学习账号已开通
  625. if (item.learnStatus == 1) { //跳转第三方h5
  626. uni.navigateTo({
  627. url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&isOther=1`
  628. })
  629. return;
  630. } else {
  631. uni.showModal({
  632. showCancel: false,
  633. content: '您的学习账号未开通,请稍后再尝试,有疑问,请联系020-87085982!'
  634. });
  635. return;
  636. }
  637. return;
  638. }
  639. if (item.serviceStartTime && (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  640. uni.showToast({
  641. icon: 'none',
  642. title: '不在学习服务期,不能进入学习'
  643. })
  644. return;
  645. }
  646. if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
  647. .sysTime >= item.classEndTime)) {
  648. uni.showToast({
  649. icon: 'none',
  650. title: '不在班级有效期,不能进入学习'
  651. })
  652. return
  653. }
  654. if (item.learningStatus == 2) {
  655. uni.showToast({
  656. icon: 'none',
  657. title: '开放学习时间待定,不能进入学习'
  658. })
  659. return
  660. }
  661. if (item.classStatus == 0) {
  662. uni.showToast({
  663. icon: 'none',
  664. title: '尚未开班,不能进入学习'
  665. })
  666. return
  667. }
  668. if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
  669. uni.showToast({
  670. icon: 'none',
  671. title: '不在开放学习时间,不能进入学习'
  672. })
  673. return;
  674. }
  675. uni.showLoading({
  676. title: '拼命加载中...',
  677. mask:true,
  678. })
  679. var confirmDetail = true;
  680. if (item.educationName == '继续教育') {
  681. if(item.officialName && item.businessName == '二级' && item.projectName == '建造师') {
  682. confirmDetail = await this.userConfirmInfoDetail()
  683. }
  684. }
  685. if(!confirmDetail) {
  686. return;
  687. }
  688. this.itemIndex = index
  689. if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
  690. .classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
  691. .periodStatus == -1) && item.studyCount > 0) {
  692. this.selectClass(item, index, 'loading')
  693. return
  694. }
  695. // /course/goodsRebuildStatus查询用户商品重修状态
  696. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId, item.gradeId)
  697. if (rebuildStatus == 0) {
  698. uni.hideLoading()
  699. this.$navTo.togo('/pages2/learn/details', {
  700. gradeId: item.gradeId,
  701. goodsId: item.goodsId,
  702. orderGoodsId: item.orderGoodsId,
  703. });
  704. return;
  705. }
  706. // /lock/lockStatus
  707. this.$api.lockLockStatus({
  708. action: 'jxjy',
  709. uuid:this.$method.getUuid()
  710. }).then(res => {
  711. if (res.data.code == 200) { //有其他端在操作,不能学习
  712. uni.showToast({
  713. icon: 'none',
  714. title: res.data.msg,
  715. mask: true,
  716. duration: 3000
  717. })
  718. } else if (res.data.code == 500) { //可以学习
  719. this.$http({
  720. url: '/course/courseList',
  721. method: 'get',
  722. data: {
  723. pageNum: 1,
  724. pageSize: 100,
  725. goodsId: item.goodsId,
  726. gradeId: item.gradeId,
  727. orderGoodsId: item.orderGoodsId,
  728. },
  729. noLoading: true
  730. })
  731. .then(res => {
  732. if (res.data.code == 200) {
  733. if(res.data.total > 1) {
  734. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  735. uni.navigateTo({
  736. url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  737. })
  738. } else if(res.data.total == 1) {
  739. uni.navigateTo({
  740. url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
  741. })
  742. } else {
  743. uni.showToast({
  744. icon:'none',
  745. title:'暂无可观看的视频课程'
  746. })
  747. }
  748. }
  749. });
  750. return;
  751. }
  752. })
  753. },
  754. /**
  755. * @param {Object} goodsId 商品id
  756. * 查询商品重修状态
  757. */
  758. courseGoodsRebuildStatus(goodsId, gradeId) {
  759. return new Promise(resolve => {
  760. this.$http({
  761. url: '/course/goodsRebuildStatus',
  762. method: 'get',
  763. data: {
  764. goodsId: goodsId,
  765. gradeId: gradeId
  766. },
  767. noLoading: true,
  768. compleLoading: true, // 请求成功是否还要继续显示加载中
  769. })
  770. .then(res => {
  771. resolve(res.data.data)
  772. })
  773. })
  774. },
  775. userConfirmInfoDetail(){
  776. return new Promise(resolve => {
  777. this.$http({
  778. url: '/user/confirm/info/detail',
  779. method: 'get',
  780. data: { orderGoodsId:this.activeItem.orderGoodsId },
  781. noLoading:true,
  782. })
  783. .then(res => {
  784. if(!res.data.data) {
  785. clearInterval(this.confirmTimer);
  786. this.confirmCount = 10;
  787. this.showUserConfirmInfo = true;
  788. this.confirmTimer = setInterval(() => {
  789. if(this.confirmCount > 0) {
  790. this.confirmCount--
  791. } else {
  792. clearInterval(this.confirmTimer);
  793. }
  794. },1000)
  795. } else {
  796. if(res.data.data.pushInfo) {
  797. resolve(true)
  798. } else {
  799. uni.showModal({
  800. showCancel:false,
  801. title:'提示',
  802. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  803. })
  804. resolve(false)
  805. }
  806. }
  807. })
  808. })
  809. },
  810. selectClass(item, index, load) {
  811. this.itemIndex = index;
  812. this.selectItem = item;
  813. this.selectClassModal = true;
  814. this.goodsGradeList(item.goodsId, load);
  815. },
  816. goodsGradeList(id, load) {
  817. this.$http({
  818. url: '/grade/grade/list',
  819. method: 'get',
  820. data: { goodsId: id },
  821. noLoading: load ? true : false,
  822. })
  823. .then(res => {
  824. if (res.data.code == 200) {
  825. this.gradeList = res.data.rows
  826. if (this.gradeList.length == 0) {
  827. let item = {
  828. className: '系统分班',
  829. gradeId: 0
  830. }
  831. this.gradeList.push(item)
  832. } else {
  833. let isGradeFull = this.gradeList.every(item => (item.studentNum > 0 && item
  834. .studentNum == item.studentUpper))
  835. //所有班级都满了
  836. if (isGradeFull) {
  837. let item = {
  838. className: '系统分班',
  839. gradeId: 0
  840. }
  841. this.gradeList.unshift(item)
  842. }
  843. }
  844. }
  845. });
  846. },
  847. // 进入练习
  848. studyques(item,index){
  849. this.queitemIndex = index;
  850. let sysTime = this.$method.timest()
  851. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || sysTime >= item.serviceEndTime)) {
  852. uni.showToast({
  853. icon: 'none',
  854. title: '不在学习服务期,不能进入学习'
  855. })
  856. return;
  857. }
  858. uni.navigateTo({
  859. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
  860. })
  861. },
  862. radioGroupChange(e) {
  863. // console.log(e)
  864. },
  865. okPopup() {
  866. if (this.gradeValue == -1) {
  867. uni.showToast({
  868. icon: 'none',
  869. title: '请选择班级'
  870. })
  871. return;
  872. }
  873. this.$api.changeGrade({
  874. goodsId: this.selectItem.goodsId,
  875. gradeId: this.gradeValue,
  876. oldGradeId: this.selectItem.gradeId,
  877. orderGoodsId: this.selectItem.orderGoodsId,
  878. userId: this.selectItem.userId
  879. }).then(res => {
  880. if (res.data.code == 200) {
  881. if (this.itemIndex !== '') {
  882. this.refreshByIndex();
  883. }
  884. this.selectClassModal = false;
  885. uni.showToast({
  886. title: '选班成功'
  887. })
  888. } else {
  889. uni.showToast({
  890. icon: 'none',
  891. title: res.data.msg
  892. })
  893. }
  894. })
  895. },
  896. /**
  897. * 返回刷新之前进入的课程数据
  898. */
  899. refreshByIndex() {
  900. this.$api.listUserVideoLive({
  901. pageNum: this.itemIndex + 1,
  902. pageSize: 1
  903. }).then(res => {
  904. if (res.data.code == 200) {
  905. this.$set(this.courseLists, this.itemIndex, res.data.rows[0])
  906. }
  907. });
  908. },
  909. confirmUserConfirm() {
  910. this.$refs.uModal.clearLoading();
  911. if(this.confirmCount <= 0) {
  912. if(this.confirmChecked) {
  913. let infoJson = {
  914. realname:this.userInfo.realname,
  915. idCard:this.userInfo.idCard,
  916. telphone:this.userInfo.telphone
  917. }
  918. this.$api.userConfirminfo({
  919. orderGoodsId:this.activeItem.orderGoodsId,
  920. infoJson:JSON.stringify(infoJson)
  921. }).then(res => {
  922. if(res.data.data.pushInfo) {
  923. uni.showToast({
  924. icon:'none',
  925. title:'提交成功'
  926. })
  927. } else {
  928. uni.showModal({
  929. showCancel:false,
  930. title:'提示',
  931. content:'开通信息推送不成功,无法进入学习,请联系020-87085982!'
  932. })
  933. }
  934. this.showUserConfirmInfo = false;
  935. })
  936. } else {
  937. uni.showToast({
  938. icon:'none',
  939. title:'请勾选确认个人信息无误'
  940. })
  941. }
  942. } else {
  943. return;
  944. }
  945. },
  946. cancelUserConfirm() {
  947. clearInterval(this.confirmTimer)
  948. },
  949. call() {
  950. uni.makePhoneCall({
  951. phoneNumber: '020-87085982' //仅为示例
  952. })
  953. },
  954. closePop() {
  955. this.appointTestShow = false
  956. },
  957. jumpTest(item, appoint) {
  958. this.appoint_an(item, appoint)
  959. this.appointTestShow = false
  960. },
  961. appointment(item, appoint) {
  962. console.log('====', item.examApplyGoodsList, this.userInfo)
  963. this.appointItemIndex = item
  964. if (item.examApplyGoodsList.length > 1) { // 多个考试预约
  965. this.appointTestList = item.examApplyGoodsList
  966. this.appointTestShow = true
  967. return
  968. }
  969. let appoint_item = item.examApplyGoodsList[0]
  970. this.appoint_an(item, appoint_item)
  971. },
  972. appoint_an(item, appoint) {
  973. // console.log('==appoint=', appoint)
  974. var data = {
  975. goodsId: item.goodsId,
  976. gradeId: item.gradeId,
  977. applyId:appoint.applyId,
  978. orderGoodsId:item.orderGoodsId
  979. };
  980. this.$api.getApplysubscribe(data).then(res => {
  981. if (res.data.code === 500) {
  982. uni.showModal({
  983. showCancel: false,
  984. content: res.data.msg
  985. });
  986. }
  987. if (res.data.code === 200) {
  988. this.$navTo.togo('/pages2/appointment/index', {
  989. goodsId: item.goodsId,
  990. gradeId: item.gradeId,
  991. orderGoodsId: item.orderGoodsId,
  992. applyId:appoint.applyId
  993. });
  994. }
  995. });
  996. },
  997. // 进入刷题,调整小程序
  998. appBeforeAddress(goodsId,item) {
  999. this.$api.appBeforeAddress({
  1000. orderGoodsId:item.orderGoodsId
  1001. }).then(res => {
  1002. if (res.data.code == 200) {
  1003. uni.navigateToMiniProgram({
  1004. appId: res.data.data.url,
  1005. success(res) {
  1006. // 打开成功
  1007. }
  1008. })
  1009. } else {
  1010. uni.showModal({
  1011. title:'提示',
  1012. content:res.data.msg,
  1013. showCancel:false,
  1014. })
  1015. }
  1016. })
  1017. },
  1018. }
  1019. }
  1020. </script>
  1021. <style>
  1022. page {
  1023. background: #eaeef1;
  1024. }
  1025. </style>
  1026. <style lang="scss" scoped>
  1027. @import './index.scss';
  1028. </style>