class.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <view class="class" v-for="(item, index) in goodsList" :key="index">
  4. <view class="class_item">
  5. <navigator hover-class="none" :url="`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}`">
  6. <image :src="$method.splitImgHost(item.coverUrl, true)" class="class_img"></image>
  7. <view class="class_text">
  8. <view class="class_title">{{ item.goodsName }}</view>
  9. <view class="content_box">
  10. <image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  11. <text class="content">{{ item.courseNum }}</text>
  12. <text class="content">{{ item.secAllNum }}</text>
  13. <text class="content">{{ item.classHours }}</text>
  14. 学时
  15. </view>
  16. <view class="content_box">
  17. <image src="/static/icon/wk_icon2.png" class="wk_icon"></image>
  18. 学习有效期:
  19. <text class="content">{{ $method.timestampToTime(item.validityStartTime) }} - {{ $method.timestampToTime(item.validityEndTime) }}</text>
  20. </view>
  21. </view>
  22. </navigator>
  23. <!-- <view class="class-warm">
  24. <u-icon class="class-warm__icon" size="30" color="#FF3B30" name="error-circle-fill"></u-icon>
  25. <view class="class-warm__text">
  26. <view class="date">班级有效期:2021/11/30 - 2021/11/30</view>
  27. <view class="state">班级状态:已过期,有疑问请联系 <text @click="call">020-87085982</text></view>
  28. </view>
  29. </view> -->
  30. </view>
  31. <view class="bottomBox">
  32. <view class="content_box">
  33. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  34. 学习进度:{{ item.stuAllNum }}/{{ item.secAllNum }}
  35. </view>
  36. <view class="box_progress">
  37. <view style="width: 60%;"><u-line-progress :showText="false" height="22" active-color="#ff9900" :show-percent="false" :percent="(item.stuAllNum / item.secAllNum) * 100"></u-line-progress></view>
  38. <view><u-button :class="{disabled:sysTime <= item.validityStartTime || sysTime >= item.validityEndTime}" type="warning" size="mini" @click.stop="studyIn(item.goodsId,item.gradeId,item)">进入学习</u-button></view>
  39. </view>
  40. <view class="box_progress" v-if="item.applyStatus === 1">
  41. <view style="width: 60%;">
  42. <text style="color: #333333;white-space: nowrap;text-overflow: ellipsis;">{{ item.applyName }}</text>
  43. </view>
  44. <view><u-button :plain="true" type="primary" size="mini" @click.stop="appointment(item)">预约考试</u-button></view>
  45. </view>
  46. <view class="box_progress" v-if="item.beforeStatus === 1">
  47. <view style="width: 60%;">
  48. <text style="color: #2979ff;white-space: nowrap;text-overflow: ellipsis;">{{ item.beforeName }}</text>
  49. </view>
  50. <view><u-button type="primary" size="mini" @click="appBeforeAddress(item.goodsId)">进入刷题</u-button></view>
  51. </view>
  52. <!-- <view class="restart" @click="selectClass(item)">
  53. 选班重学
  54. </view> -->
  55. </view>
  56. </view>
  57. <view v-if="goodsList.length==0">
  58. <u-empty text="暂无网课" margin-top="500" mode="list"></u-empty>
  59. </view>
  60. <u-popup v-model="selectClassModal" @close="gradeValue = -1" mode="bottom" border-radius="40">
  61. <view class="popup_box">
  62. <view style="margin-bottom: 20rpx;">
  63. <view class="line1"></view>
  64. <view class="grade">选择班级</view>
  65. </view>
  66. <u-line color="#D6D6DB" />
  67. <view>
  68. <scroll-view scroll-y="true" style="height: 500rpx;">
  69. <view>
  70. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  71. <view v-for="(item, index) in gradeList" :key="index" >
  72. <view style="display: flex;align-items: center;padding: 20rpx;">
  73. <view>
  74. <u-radio
  75. shape="circle"
  76. :name="index"
  77. >
  78. <view :class="item.checked?'white-box blue-box':'white-box'" >
  79. <view>
  80. <view class="blackTxt">{{item.className}}</view>
  81. <view class="redTxt" v-if="item.classEndTime">有效期至:{{$method.timestampToTime(item.classEndTime)}}</view>
  82. <view class="redTxt" v-if="item.classEndTime">本班还剩{{$method.GetRTime(item.classEndTime)}}天将结束学习</view>
  83. </view>
  84. </view>
  85. </u-radio>
  86. </view>
  87. </view>
  88. </view>
  89. </u-radio-group>
  90. </view>
  91. </scroll-view>
  92. </view>
  93. <view class="confrim-btn">
  94. <view class="okBtn" @click="okPopup()">确定</view>
  95. </view>
  96. </view>
  97. </u-popup>
  98. </view>
  99. </template>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. list: [1, 2, 3],
  105. goodsList: [],
  106. selectClassModal:false,
  107. gradeList:[],
  108. gradeValue:-1,
  109. param:{
  110. pageNum: 1,
  111. pageSize: 10
  112. },
  113. total: 0,
  114. sysTime:0,
  115. };
  116. },
  117. onLoad(option) {
  118. },
  119. onShow() {
  120. this.courseGoodsList();
  121. this.commonSystemTime()
  122. },
  123. onReachBottom() {
  124. if (this.goodsList.length < this.total) {
  125. this.param.pageNum++;
  126. this.courseGoodsList();
  127. }
  128. },
  129. methods: {
  130. commonSystemTime() {
  131. this.$api.commonSystemTime().then(res => {
  132. this.sysTime = res.data.data;
  133. })
  134. },
  135. selectClass(item) {
  136. console.log(item)
  137. this.selectClassModal = true;
  138. this.goodsGradeList(item.goodsId);
  139. },
  140. radioGroupChange(e){
  141. console.log(e)
  142. },
  143. goodsGradeList(id) {
  144. let self = this
  145. this.$api.goodsGradeList({goodsId:id}).then(res => {
  146. if(res.data.code==200){
  147. self.gradeList = res.data.rows
  148. if(self.gradeList.length==0){
  149. let item = {
  150. className:'系统分班',
  151. gradeId:0
  152. }
  153. self.gradeList.push(item)
  154. }
  155. }
  156. });
  157. },
  158. appBeforeAddress(goodsId) {
  159. this.$api.appBeforeAddress({
  160. goodsId
  161. }).then(res => {
  162. if(res.data.code == 200) {
  163. uni.navigateToMiniProgram({
  164. appId: res.data.data.url,
  165. success(res) {
  166. // 打开成功
  167. }
  168. })
  169. } else {
  170. uni.showToast({
  171. title: res.data.msg,
  172. icon: 'none',
  173. })
  174. }
  175. })
  176. },
  177. courseGoodsList() {
  178. let self = this;
  179. this.$api.courseGoodsList(this.param).then(res => {
  180. if (res.data.code == 200) {
  181. self.goodsList.push.apply(self.goodsList, res.data.rows);
  182. self.total = res.data.total;
  183. }
  184. });
  185. },
  186. studyIn(v,i,item) {
  187. if(this.sysTime <= item.validityStartTime || this.sysTime >= item.validityEndTime) {
  188. uni.showToast({
  189. icon:'none',
  190. title:'不在学习时间,不能进入学习'
  191. })
  192. return;
  193. }
  194. if(item.rebuildStatus == 0) {
  195. this.$navTo.togo('/pages2/learn/details', {
  196. gradeId:item.gradeId,
  197. goodsId: item.goodsId
  198. });
  199. return;
  200. }
  201. this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}`);
  202. },
  203. appointment(item) {
  204. var data = {
  205. goodsId: item.goodsId,
  206. gradeId: item.gradeId
  207. };
  208. this.$api.getApplysubscribe(data).then(res => {
  209. if (res.data.code === 500) {
  210. uni.showModal({
  211. showCancel: false,
  212. content: res.data.msg
  213. });
  214. }
  215. if (res.data.code === 200) {
  216. this.$navTo.togo('/pages2/appointment/index', {
  217. goodsId: item.goodsId,
  218. gradeId: item.gradeId
  219. });
  220. }
  221. });
  222. },
  223. okPopup() {
  224. this.selectClassModal = false;
  225. uni.showToast({
  226. title:'选班成功'
  227. })
  228. },
  229. call() {
  230. uni.makePhoneCall({
  231. phoneNumber: '020-87085982' //仅为示例
  232. })
  233. }
  234. }
  235. };
  236. </script>
  237. <style>
  238. page {
  239. background: #eaeef1;
  240. }
  241. </style>
  242. <style scope lang="scss">
  243. .box_progress {
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. margin-top: 20rpx;
  248. .disabled {
  249. opacity: 0.6;
  250. }
  251. }
  252. .bottomBox {
  253. background: #ffffff;
  254. width: 94%;
  255. border-bottom-left-radius: 24rpx;
  256. border-bottom-right-radius: 24rpx;
  257. margin: 0 auto;
  258. padding: 20rpx;
  259. .restart {
  260. margin:0 auto;
  261. text-align: center;
  262. line-height: 80rpx;
  263. color:#fff;
  264. font-size: 30rpx;
  265. width: 440rpx;
  266. height: 80rpx;
  267. background: #FF0000;
  268. border-radius: 40rpx 40rpx 40rpx 40rpx;
  269. }
  270. }
  271. .content_box {
  272. font-size: 24rpx;
  273. display: flex;
  274. align-items: center;
  275. color: #999999;
  276. margin-top: 8rpx;
  277. }
  278. .content {
  279. color: #000000;
  280. margin: 0 8rpx;
  281. }
  282. .wk_icon {
  283. width: 24rpx;
  284. height: 24rpx;
  285. margin-right: 8rpx;
  286. }
  287. .class {
  288. margin-bottom: 30rpx;
  289. .class_item {
  290. width: 100%;
  291. background: #ffffff;
  292. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  293. border-radius: 24rpx;
  294. padding: 20rpx;
  295. z-index: 999;
  296. position: relative;
  297. .class_img {
  298. height: 316rpx;
  299. width: 100%;
  300. border-radius: 24rpx;
  301. }
  302. .class_text {
  303. padding:0 20rpx;
  304. .class_title {
  305. color: #333333;
  306. font-weight: bold;
  307. font-size: 32rpx;
  308. }
  309. }
  310. .class-warm {
  311. padding:10rpx 20rpx;
  312. display: flex;
  313. align-items: flex-start;
  314. &__icon {
  315. margin-right:10rpx;
  316. }
  317. &__text {
  318. .date {
  319. font-size: 24rpx;
  320. font-weight: bold;
  321. color: #FF3B30;
  322. }
  323. .state {
  324. margin-top:15rpx;
  325. font-size: 24rpx;
  326. font-weight: bold;
  327. color: #FF3B30;
  328. }
  329. }
  330. }
  331. }
  332. }
  333. .popup_box {
  334. height: 700rpx;
  335. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  336. border-radius: 32rpx 32rpx 0rpx 0rpx;
  337. .line1{
  338. width: 80rpx;
  339. height: 8rpx;
  340. background: #999999;
  341. border-radius: 4rpx;
  342. margin: 0 auto;
  343. margin-top: 15rpx;
  344. }
  345. .grade{
  346. height: 23rpx;
  347. font-size: 24rpx;
  348. color: #999999;
  349. margin: 0 auto;
  350. margin-top: 15rpx;
  351. text-align: center;
  352. }
  353. .confrim-btn{
  354. height: 98rpx;
  355. width: 100%;
  356. display: flex;
  357. align-items: center;
  358. justify-content:center;
  359. .okBtn{
  360. width: 200rpx;
  361. height: 64rpx;
  362. background: linear-gradient(0deg, #015EEA, #00C0FA);
  363. border-radius: 32rpx;
  364. color: #FFFFFF;
  365. text-align: center;
  366. line-height: 64rpx;
  367. }
  368. }
  369. }
  370. </style>