123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <view class="phone-kecheng-page">
- <!-- 查询职业 -->
- <view style="padding: 10px">
- <view class="phone-search-content">
- <input class="search-input" placeholder="请输入职业名称" v-model="data.zyName" />
- <view class="search-icon" @click="handleSearch">
- <uni-icons type="search" size="20"></uni-icons>
- </view>
- </view>
- </view>
- <!-- 考试列表 -->
- <view class="cuoti-content-box">
- <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
- :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
- class="cuoti-scroll-view">
- <uni-list>
- <uni-list-item v-for="item in data.list" class="list-item-box">
- <template v-slot:body>
- <!-- 数量 -->
- <view class="item-cuoti-row">
- <view>{{item.ksName}}</view>
- <view>时间:{{item.totalTm}} 分钟</view>
- <view>次数: {{item.maxTimes}}</view>
- <view>总分: {{item.ksScore}}</view>
- <view>及格分: {{item.okScore}}</view>
- </view>
- <view @click="checkKaoshi(item)" class="cuoti-btn">查看考试</view>
- </template>
- </uni-list-item>
- <uni-load-more :status="data.state" @click="getMore(0)"
- :contentText="data.contentText"></uni-load-more>
- </uni-list>
- </scroll-view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref,reactive
- } from "vue";
- import {
- onLoad
- } from "@dcloudio/uni-app";
- import * as kechengApi from "@/api/kecheng.js"
- const data = reactive({
- zyName: '', // 职业名称
- list: [], // 考试列表
- loading: false,
- page: 0,
- size: 10,
- state: 'more',
- contentText: {
- contentdown: '查看更多',
- contentrefresh: '加载中',
- contentnomore: '没有更多'
- }
- })
-
- function handleSearch() {
- data.page = 0;
- refreshData();
- }
- function checkKaoshi(item) {
- uni.navigateTo({
- url: `/pages/admin/Kaoshi/exam?ksId=${item.ksId}`
- })
- }
-
- function onRefresh() {
- data.page = 0;
- data.list = [];
- data.loading = true;
- refreshData();
- }
-
- function refreshData() {
- const opt = {
- page: 1,
- size: 10, // 固定查询10条
- zyName: data.zyName
- }
- data.list = [];
- // 数学
- data.state = 'loading';
- data.page++;
- opt.page = data.page;
-
- kechengApi.getKechengGlList(opt).then(res =>{
- data.list = data.list.concat(res.data.data);
- data.loading = false;
-
- if (res.data.total >= data.list.length) {
- data.state = 'no-more';
- data.loading = false;
- } else {
- data.state = 'more';
- data.loading = false;
- }
- }).catch(err => {
- data.state = 'more';
- data.loading = false;
- })
- }
- function getMore() {
- const opt = {
- page: 1,
- size: 10, // 固定查询10条
- zyName: data.zyName
- }
- if (data.state == 'no-more') return;
- data.state = 'loading';
- data.page++;
- opt.page = data.page;
- kechengApi.getKechengGlList(opt).then(res =>{
- data.list = data.list.concat(res.data.data);
- data.loading = false;
-
- if (res.data.total >= data.list.length) {
- // 数学
- data.state = 'no-more';
- data.loading = false;
- } else {
- // 数学
- data.state = 'more';
- data.loading = false;
- }
- })
- }
-
- onLoad(() => {
- getMore()
- })
- </script>
- <style lang="scss" scoped>
- .phone-kecheng-page {
- background-color: #ccc;
- box-sizing: border-box;
- }
- .phone-search-content {
- position: relative;
- background-color: #fff;
- height: 42px;
- .search-input {
- height: 42px;
- line-height: 40px;
- border-radius: 20px;
- border: 1px solid #ccc;
- padding: 0 70px 0 20px;
- }
- .search-icon {
- position: absolute;
- right: 5px;
- top: 4px;
- padding: 6px;
- background-color: #ccc;
- border-radius: 20px;
- width: 50px;
- text-align: center;
- }
- }
- </style>
|