index.vue 35 KB

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