index.vue 34 KB

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