123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <template>
- <view class="random_practice">
- <nav-bar title="随机练习"></nav-bar>
- <view class="contents">
- <view class="exam_si">试卷情况</view>
- <image src="/pages2/static/random/exam_situ.png" class="examSitu"></image>
- <view class="nums">
- <view class="n_item">
- <text class="do_num">{{ questionNum.doNum || 0 }}</text>
- <text class="word">已完成题数</text>
- </view>
- <view class="n_item">
- <text class="do_num">{{ questionNum.totalNum || 0 }}</text>
- <text class="word">总题数</text>
- </view>
- <view class="n_item">
- <text class="do_num">{{ accuracy }}</text>
- <text class="word">正确率</text>
- </view>
- </view>
- <view class="number_crad">
- <view class="title">选择做题数量</view>
- <view class="crads">
- <view v-for="(item, index) in numberLists" :key="index" class="items"
- :class="{nactive: item == number}" @click="changeNum(item)">
- {{item}}
- </view>
- </view>
- <view class="starts" @click="startPractice()">
- 开始做题
- </view>
- </view>
-
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- goodsId: '',
- orderGoodsId: '',
- numberLists: [5, 10, 15, 20, 50, 100],
- number: 5,
- questionNum: {},
- timer: null,
- }
- },
- onLoad(option) {
- this.goodsId = option.goodsId
- this.orderGoodsId = option.orderGoodsId
- this.getLock()
- this.timer = setInterval(this.getLock, 10000)
- },
- onShow() {
- this.getQuestionTempNum()
- },
- onUnload() {
- clearInterval(this.timer)
- this.$api.lockDelLock({
- action: 'bank',
- uuid: this.$method.getUuid()
- }).then(res => {
- })
- },
- computed: {
- accuracy() {
- if (this.questionNum.rightNum >= this.questionNum.totalNum) {
- return '100%'
- } else {
- let value = (this.questionNum.rightNum / this.questionNum.totalNum ) * 100
- return value.toFixed(2) + '%'
- }
- }
- },
- methods: {
- getLock() {
- this.$api.lockLockAction({
- action: 'bank',
- uuid: this.$method.getUuid()
- }).then(res => {
- })
- },
- changeNum(item) {
- this.number = item
- },
- getQuestionTempNum() {
- this.$http({
- url: `/goods/bank/questionTempNum/${this.orderGoodsId}`,
- method: 'get',
- }).then((res) => {
- if (res.data.code == 200) {
- this.questionNum = res.data.data || {}
- }
- })
- },
- startPractice() {
- this.$http({
- url: '/bank/exam/temp',
- method: 'post',
- data: {
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- number: this.number
- }
- }).then((res) => {
- if(res.data.code == 200) {
- uni.navigateTo({
- url:'/pages2/bank/questionBank?orderGoodsId='+ this.orderGoodsId + '&id=""' + '&goodsid=' + this.goodsId
- +'&moduleId=0' + '&chapterId=0' + '&entryType=random' + '&bankNum=' + this.number
- })
- } else {
- this.$u.toast(res.data.msg)
- }
- })
-
- }
- },
- }
- </script>
- <style lang="scss">
- .random_practice {
- width: 100%;
- padding: 24rpx 26rpx;
- background: #FAFAFA;
- }
- .contents {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- .examSitu {
- width: 200rpx;
- height: 200rpx;
- margin-bottom: 56rpx;
- }
- .exam_si {
- color: #222222;
- font-size: 32rpx;
- font-weight: bold;
- margin: 80rpx 0rpx 40rpx 0rpx;
- }
- .nums {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-around;
- margin-bottom: 132rpx;
- .n_item {
- display: flex;
- flex-direction: column;
- align-items: center;
- .do_num {
- font-size: 48rpx;
- font-family: DIN-Medium, DIN;
- font-weight: 500;
- color: #222222;
- margin-bottom: 8rpx;
- }
- .word {
- font-size: 24rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 500;
- color: #808DA4;
- }
- }
- }
- }
- .number_crad {
- width: 100%;
- padding: 0rpx 26rpx;
- text-align: center;
- background-color: #fff;
- margin-bottom: 178rpx;
- border-radius: 24rpx;
- .title {
- font-size: 36rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 500;
- color: #222222;
- margin: 56rpx 0rpx;
- }
- .crads {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .items {
- width: 204rpx;
- height: 96rpx;
- line-height: 96rpx;
- text-align: center;
- background: #F8F8FA;
- border-radius: 24rpx;
- margin-bottom: 28rpx;
- font-size: 48rpx;
- font-family: DIN Alternate-Bold, DIN Alternate;
- font-weight: bold;
- color: #222222;
- &.nactive {
- background: #E8F6FF;
- color: #3577E8;
- }
- }
- }
- .starts {
- width: 646rpx;
- height: 96rpx;
- line-height: 96rpx;
- text-align: center;
- color: #fff;
- font-size: 32rpx;
- font-weight: bold;
- background: #3577E8;
- border-radius: 24rpx;
- margin: 52rpx 0rpx 40rpx 0rpx;
- }
- }
- </style>
|