123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <view>
-
- <view class="lz-status_bar">
- <view class="lz-top_view"></view>
- </view>
-
-
- <view class="kaoshi-head">
- <view class="kaoshi-head-top">
- <view class="kaoshi-head-left">
- <view class="iconfont icon-zuojiantou" @tap="$navigateBack"></view>
- </view>
- <view class="kaoshi-head-m">题目搜索</view>
- <view class="kaoshi-head-right"></view>
- </view>
- </view>
-
- <view class="search-box">
- <uni-search-bar class="uni-mt-10" radius="100" placeholder="请输入关键字搜索题目" @confirm="search" v-model="keyword"
- clearButton="none" cancelButton="none" style="width: 86%;" />
- <view class="search-submit" @tap="search">搜索</view>
- </view>
- <view class="search-wuc" v-if="issearch">
- <wuc-tab :tab-list="order_sort" :tabCur="current_index" @change="tabChange"
- tab-class="text-black bg-white list_top" select-class="text-blue text-xl"></wuc-tab>
- </view>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
- :up="upOption">
- <view v-for="(item,index) in list" :key="index" @tap="gotoDetail(item.id)">
- <view class="searchbox">
- <view class="classify">{{item.type_text}}</view>
- <uc-parse :node="item.question_name"></uc-parse>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import {
- mapState
- } from 'vuex'
- import WucTab from '@/components/wuc-tab/wuc-tab.vue';
- import Error from '@/core/untils/error/index';
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
- keyword: '',
- mescroll: null,
-
- downOption: {
- use: true,
- auto: false,
- native: false
- },
-
- upOption: {
- auto: false,
- page: {
- num: 0,
- size: 10
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
-
- list: [],
- order_sort: [{
- name: '全部',
- goods_type: '0'
- },
- {
- name: '单选',
- goods_type: '1'
- },
- {
- name: '多选',
- goods_type: '2'
- },
- {
- name: '判断',
- goods_type: '3'
- },
- {
- name: '填空',
- goods_type: '4'
- },
- {
- name: '简答题',
- goods_type: '5'
- }
- ],
- current_id: '0',
- current_index: 0,
- issearch: false,
- }
- },
- computed: {
- ...mapState(['subject', 'userinfo'])
- },
- methods: {
- gotoDetail(id) {
- if (this.userinfo.token == undefined) {
- Error.errorNotLoggedIn();
- return
- }
- uni.navigateTo({
- url: '/pages/questionSearch/questionDetail?id=' + id
- })
- },
- search() {
- if (this.keyword == '') return
- this.issearch = true
- this.mescroll.resetUpScroll()
- },
-
- async upCallback(page) {
- let pageNum = page.num;
- let pageSize = page.size;
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.questionsSearchResult,
- data: {
- subject_id: this.subject.id,
- keyword: this.keyword,
- page: pageNum,
- limit: pageSize,
- type: this.current_id
- },
- needLogin: false
- })
- if (res.code == 1) {
-
- let curPageData = res.data.data;
-
- let curPageLen = curPageData.length;
-
-
-
- let totalSize = res.data.total;
- this.mescroll.endBySize(curPageLen, totalSize);
- if (page.num == 1) this.list = [];
- this.list = this.list.concat(curPageData);
- } else {
- this.mescroll.endErr()
- }
-
-
- },
- tabChange(index) {
- this.current_index = index;
- this.current_id = this.order_sort[index].goods_type;
- if (this.keyword == '') {
- return
- }
- this.mescroll.resetUpScroll(false)
- }
- }
- }
- </script>
- <style>
- page {
- background-color: #f6f6f6;
- }
- .search-box {
- display: flex;
- flex: 1;
- justify-content: space-between;
- background-color: #fff;
- }
- .search-submit {
- width: 16%;
- height: 32px;
- background: #3c7bfc;
- text-align: center;
- margin-right: 10px;
- line-height: 32px;
- margin-top: 11px;
- border-radius: 16px;
- color: #fff;
- font-size: 14px;
- }
- .searchbox {
- margin: 10px 15px;
- padding: 10px;
- background-color: #fff;
- border-radius: 8px;
- }
- .classify {
- font-size: 16px;
- margin: 5px 0 10px -10px;
- padding-left: 11px;
- line-height: 16px;
- border-left: 5px solid #3c7bfc;
- }
- </style>
|