| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <template>
- <view style="padding: 30rpx">
- <nav-bar title="自购题卷"></nav-bar>
- <view
- v-for="(item, index) in list"
- :key="index"
- style="margin-bottom: 30rpx"
- @click="studyIn(item, index)"
- >
- <view class="class_item">
- <image
- class="img"
- :src="$method.splitImgHost(item.coverUrl, true)"
- ></image>
- <view style="color: #333333; font-weight: bold; font-size: 32rpx">
- {{ item.goodsName }}
- </view>
- <view
- class="content_box"
- v-if="item.serviceStartTime && item.serviceEndTime"
- >
- <image src="/static/icon/wk_icon2.png" class="wk_icon"></image>
- 学习服务期:<text class="content">
- {{ $method.timestampToTime(item.serviceStartTime, true, true) }}-{{
- $method.timestampToTime(item.serviceEndTime, true, true)
- }}
- </text>
- </view>
- </view>
- <view class="bottomBox">
- <view style="color: #999999; font-size: 24rpx"
- >刷题进度:{{ item.doNum }}/{{ item.totalNum }}</view
- >
- <view class="box_progress">
- <view style="width: 60%">
- <u-line-progress
- :show-percent="false"
- height="22"
- active-color="#007AFF"
- :percent="(item.doNum / item.totalNum) * 100"
- ></u-line-progress>
- </view>
- <view>
- <!-- <navigator hover-class="none" :url="'/pages2/bank/question_detail?id='+item.goodsId"> -->
- <view class="btn">进入刷题</view>
- <!-- </navigator> -->
- </view>
- </view>
- </view>
- </view>
- <view v-if="list.length == 0">
- <u-empty text="暂无题库" margin-top="500" mode="list"></u-empty
- ></view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [],
- param: {
- pageNum: 1,
- pageSize: 10,
- },
- total: 0,
- itemIndex: "",
- };
- },
- onLoad(option) {
- this.listGoodsUserQuestion();
- },
- onShow() {
- if (this.itemIndex !== "") {
- this.refreshByIndex();
- }
- },
- onReachBottom() {
- if (this.list.length < this.total) {
- this.param.pageNum++;
- this.listGoodsUserQuestion();
- }
- },
- methods: {
- listGoodsUserQuestion() {
- this.$api.listGoodsUserQuestion(this.param).then((res) => {
- this.list = [...this.list, ...res.data.rows];
- this.total = res.data.total;
- });
- },
- studyIn(item, index) {
- console.log(item);
- this.itemIndex = index;
- let sysTime = this.$method.timest();
- if (
- item.serviceStartTime &&
- item.serviceEndTime &&
- (sysTime <= item.serviceStartTime ||
- this.sysTime >= item.serviceEndTime)
- ) {
- uni.showToast({
- icon: "none",
- title: "不在学习服务期,不能进入学习",
- });
- return;
- }
- uni.navigateTo({
- url:
- "/pages2/bank/question_detail?id=" +
- item.goodsId +
- "&orderGoodsId=" +
- item.orderGoodsId,
- });
- },
- refreshByIndex() {
- console.log("refreshByIndex");
- this.$api
- .listGoodsUserQuestion({
- pageNum: this.itemIndex + 1,
- pageSize: 1,
- })
- .then((res) => {
- this.$set(this.list, this.itemIndex, res.data.rows[0]);
- });
- },
- },
- };
- </script>
- <style >
- page {
- background: #eaeef1;
- }
- </style>
- <style lang="scss" scope>
- .box_progress {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 20rpx;
- .btn {
- width: 165rpx;
- height: 48rpx;
- background: #007aff;
- border-radius: 16rpx;
- line-height: 48rpx;
- text-align: center;
- color: #fff;
- font-size: 30rpx;
- }
- }
- .bottomBox {
- background: #ffffff;
- width: 94%;
- border-bottom-left-radius: 24rpx;
- border-bottom-right-radius: 24rpx;
- margin: 0 auto;
- padding: 20rpx;
- }
- .content_box {
- display: flex;
- align-items: center;
- color: #999999;
- margin-top: 8rpx;
- }
- .content {
- color: #000000;
- margin: 0 8rpx;
- }
- .wk_icon {
- width: 24rpx;
- height: 24rpx;
- margin-right: 8rpx;
- }
- .class_item {
- width: 100%;
- height: 514rpx;
- background: #ffffff;
- box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
- border-radius: 24rpx;
- padding: 20rpx;
- z-index: 999;
- position: relative;
- .img {
- width: 100%;
- border-radius: 24rpx;
- height: 376rpx;
- }
- }
- </style>
|