123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <template>
- <div class="collection-box">
- <div>
- <img class="collectionHeader" mode="widthFix" :src="collectionHeader" />
- </div>
- <div class="choose">
- <div class="choose-img" @click="goExercise('wrong')">
- <span class="choose-text1"> 做错题 </span>
- <span class="choose-text2"> 共 {{ wrongListCount }} 题 </span>
- <image mode="widthFix" class="bg" :src="wrongBg" />
- <image mode="widthFix" class="goArrow" :src="goArrow" />
- <view
- :hover-stop-propagation="true"
- data-type="wrong"
- @touchend.stop="clearTopics('wrong')"
- style="color: #498ef5"
- class="clear"
- >
- 清空错题
- </view>
- </div>
- <div class="choose-img" @click="goExercise('collect')">
- <span class="choose-text1">收藏题</span>
- <span class="choose-text2"> 共 {{ collectionListCount }} 题 </span>
- <image mode="widthFix" class="bg" :src="collectionBg" />
- <image mode="widthFix" class="goArrow" :src="goArrow" />
- <view
- :hover-stop-propagation="true"
- data-type="collect"
- @touchend.stop="clearTopics('collect')"
- style="color: #01c18d"
- class="clear"
- >
- 清空收藏
- </view>
- </div>
- </div>
- <div class="bottom">
- <image mode="widthFix" :src="collectionBottomBg" />
- </div>
- <!-- <van-swipe ref="swiper" :show-indicators="false" :touchable="false">
- <van-swipe-item> <listCom type="wrong" /> </van-swipe-item>
- <van-swipe-item> <listCom type="collection" /> </van-swipe-item>
- </van-swipe> -->
- </div>
- </template>
- <script>
- import goArrow from "@/assets/img/goArrow.png";
- import api from "@/api/index";
- import utils from "@/utils/index";
- export default {
- data() {
- return {
- wrongBg:
- "https://ct.zzxcx.net/ctjk/mp-wx/collection/wrongBg.png",
- collectionBottomBg:
- "https://ct.zzxcx.net/ctjk/mp-wx/collection/collectionBottomBg.png",
- goArrow,
- collectionBg:
- "https://ct.zzxcx.net/ctjk/mp-wx/collection/collectionBg.png",
- collectionHeader:
- "https://ct.zzxcx.net/ctjk/mp-wx/collection/collectionHeader.png",
- query: {
- questionIds: "",
- },
- gsMap: {
- xc: "小车",
- hc: "货车",
- mtc: "摩托车",
- kc: "客车",
- },
- wrongList: [],
- wrongListCount: 1,
- collectionList: [],
- collectionListCount: 1,
- };
- },
- onLoad(query) {
- this.query = query;
- api.exam
- .studentQuestionWrongWrongCountByUser({
- carType: this.gsMap[query.gs],
- km: query.subject === "1" ? "科目一" : "科目四",
- pageNum: 1,
- pageSize: 10000,
- })
- .then((res) => {
- this.wrongListCount = res.data;
- });
- api.exam
- .studentQuestionCollectionCollectionCountByUser({
- carType: this.gsMap[query.gs],
- km: query.subject === "1" ? "科目一" : "科目四",
- pageNum: 1,
- pageSize: 10000,
- })
- .then((res) => {
- this.collectionListCount = res.data;
- });
- },
- methods: {
- goExercise(type) {
- let query = Object.assign({}, this.query);
- if (type == "wrong" && this.wrongListCount == 0) {
- uni.showToast({
- title: "没有题目了",
- icon: "none",
- });
- return;
- }
- if (type == "collect" && this.collectionListCount == 0) {
- uni.showToast({
- title: "没有题目了",
- icon: "none",
- });
- return;
- }
- if (type == "wrong") {
- uni.navigateTo({
- url: "/otherPages/exerciseWrong/index?" + utils.mapToUrlQuery(query),
- });
- }
- if (type === "collect") {
- uni.navigateTo({
- url:
- "/otherPages/exerciseCollect/index?" + utils.mapToUrlQuery(query),
- });
- }
- },
- clearTopics(type) {
- let that = this;
- if (type === "wrong") {
- uni.showModal({
- title: "是否清空错题",
- success(res) {
- if (res.confirm) {
- api.exam
- .studentQuestionWrongCancelAll({
- carType: that.gsMap[that.query.gs],
- km: that.query.subject === "1" ? "科目一" : "科目四",
- })
- .then((res) => {
- api.exam
- .studentQuestionWrongWrongCountByUser({
- carType: that.gsMap[that.query.gs],
- km: that.query.subject === "1" ? "科目一" : "科目四",
- pageNum: 1,
- pageSize: 10000,
- })
- .then((res) => {
- that.wrongListCount = res.data;
- });
- });
- }
- },
- });
- } else if (type === "collect") {
- uni.showModal({
- title: "是否清空收藏题",
- success(res) {
- if (res.confirm) {
- api.exam
- .studentQuestionCollectionCancelAll({
- carType: that.gsMap[that.query.gs],
- km: that.query.subject === "1" ? "科目一" : "科目四",
- })
- .then((res) => {
- api.exam
- .studentQuestionCollectionCollectionCountByUser({
- carType: that.gsMap[that.query.gs],
- km: that.query.subject === "1" ? "科目一" : "科目四",
- pageNum: 1,
- pageSize: 10000,
- })
- .then((res) => {
- that.collectionListCount = res.data;
- });
- });
- }
- },
- });
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .bottom {
- bottom: 0;
- image {
- width: 100%;
- }
- }
- .choose {
- width: 100%;
- display: flex;
- justify-content: center;
- align-content: space-between;
- align-items: space-between;
- flex-wrap: wrap;
- transform: translate(0%, -8%);
- .choose-img {
- width: 690rpx;
- position: relative;
- margin-bottom: 25rpx;
- .bg {
- width: 690rpx;
- }
- .clear {
- background: #fff;
- border-radius: 30rpx;
- position: absolute;
- bottom: 40rpx;
- width: 200rpx;
- height: 60rpx;
- left: 40rpx;
- bottom: 40rpx;
- border: 0;
- font-size: 26rpx;
- line-height: 60rpx;
- text-align: center;
- }
- .goArrow {
- position: absolute;
- top: 64rpx;
- right: 40rpx;
- width: 146rpx;
- }
- .choose-text1 {
- position: absolute;
- font-size: 50rpx;
- color: #fff;
- left: 40rpx;
- top: 40rpx;
- }
- .choose-text2 {
- position: absolute;
- top: 112rpx;
- left: 44rpx;
- color: #fff;
- }
- img {
- width: 100%;
- }
- }
- }
- .collectionHeader {
- width: 100%;
- }
- .collection-box {
- height: 100vh;
- display: flex;
- flex-direction: column;
- }
- </style>
|