Files
zhxg_app_v1.0/pages/questionnaire/index.vue

368 lines
8.6 KiB
Vue
Raw Normal View History

2025-07-16 15:34:34 +08:00
<template>
<view class="questionnaire">
<Nav :navs="navs" @change="navChange" />
<view class="release-list" v-if="navIndex==0">
<view class="search">
<uni-search-bar radius="5" placeholder="请输入辅导员名称" bgColor="#ffffff" clearButton="auto"
cancelButton="none" v-model="queryParams.teacherName" @confirm="onSearch" @clear="onClear" />
</view>
<scroll-view scroll-y="true" @scrolltolower="questionnaireListScrolltoLower">
<view class="list" v-if="questionnaireList.length>0">
<view class="item" v-for="(item,index) in questionnaireList" :key="index">
<view class="top">
标题:{{item.title}}
<uni-icons type="right" size="18" color="#202020"></uni-icons>
<view class="fill" @tap="toFill(item)">
<uni-icons type="compose" color="#1890FF" size="18"></uni-icons>
<text>填写</text>
</view>
</view>
<view class="content">
<view>辅导员:{{item.teacherName}}</view>
<!-- <view class="level">状态:
<text :class="item.status==1?'underway':'finish'">{{item.status==1?'进行中':"已结束"}}</text>
</view> -->
<view class="level">是否填写:
<text :class="item.completed==1?'underway':'finish'">{{item.completed==1?'已填写':"未填写"}}</text>
</view>
</view>
</view>
</view>
<view class="empty" v-else>
<image src="../../static/empty.png" mode="widthFix"></image>
暂时没有数据
</view>
<view class="loading-more-top" v-if="topLoading">
<uni-load-more style="padding-top: 90px;" status="loading" />
</view>
<view class="loading-more" v-if="loading">
<uni-load-more status="loading" />
</view>
<view class="no-more" v-if="!loading&&questionnaireList.length!=0">
到底啦~~
</view>
</scroll-view>
</view>
<view class="answer-list" v-if="navIndex==1">
<view class="search">
<uni-search-bar radius="5" placeholder="请输入目标对象名称" bgColor="#ffffff" clearButton="auto"
cancelButton="none"/>
</view>
<scroll-view scroll-y="true" @scrolltolower="answerListScrolltoLower">
<view class="list" v-if="answerList.length>0">
<view class="item" @tap="toDetail(item)" v-for="(item,index) in answerList" :key="index">
<view class="top">
标题:{{item.title}}
<uni-icons type="right" size="18" color="#202020"></uni-icons>
</view>
<view class="content">
<view>目标对象:{{item.targetName}}</view>
</view>
</view>
</view>
<view class="empty" v-else>
<image src="../../static/empty.png" mode="widthFix"></image>
暂时没有数据
</view>
<view class="loading-more-top" v-if="topLoading">
<uni-load-more style="padding-top: 90px;" status="loading" />
</view>
<view class="loading-more" v-if="loading">
<uni-load-more status="loading" />
</view>
<view class="no-more" v-if="!loading&&answerList.length!=0">
到底啦~~
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import Nav from "@/components/navs/navs.vue";
import {
questionnaireList,
answerList
} from '@/api/questionnaire/questionnaire.js';
export default {
components: {
Nav
},
data() {
return {
loading: false,
topLoading: true,
navIndex: 0,
searchTxt: "", //搜索字段
questionnaireList: [],
answerList: [],
navs: [{
text: "问卷调查",
val: 0
},
{
text: "填写记录",
val: 1
}
],
queryParams: {
pageNum: 1,
pageSize: 10,
teacherName: ""
}
}
},
onLoad() {
this.getQuestionnaireList();
},
methods: {
navChange(index) {
this.navIndex = index;
this.queryParams.pageNum = 1;
if (index == 1) {
this.getAnswerList();
} else {
this.getQuestionnaireList();
}
},
questionnaireListScrolltoLower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
this.getQuestionnaireList()
}, 1000)
} else {
}
},
answerListScrolltoLower() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.loading = true;
setTimeout(() => {
this.getAnswerList()
}, 1000)
}
},
getQuestionnaireList() {
questionnaireList(this.queryParams).then(res => {
if (res.code == 200) {
this.loading = false;
if (this.queryParams.pageNum == 1) {
this.questionnaireList = res.rows;
} else {
this.questionnaireList = this.questionnaireList.concat(res.rows); // 否则追加新数据到列表中
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
}
})
},
getAnswerList() {
answerList(this.queryParams).then(res => {
if (res.code == 200) {
this.loading = false;
if (this.queryParams.pageNum == 1) {
this.answerList = res.rows;
} else {
this.answerList = this.answerList.concat(res.rows); // 否则追加新数据到列表中
}
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
this.topLoading = false;
}
})
},
toFill(item) {
uni.navigateTo({
url: `./fillIn?id=${item.id}&teacherId=${item.teacherId}&navIndex=0`
})
},
toDetail(item){
uni.navigateTo({
url: `./fillIn?id=${item.questionnaireId}&teacherId=${item.targetId}&navIndex=1`
})
},
onSearch() {
this.queryParams.pageNum = 1;
this.getQuestionnaireList();
},
onClear() {
this.queryParams.teacherName = "";
this.getQuestionnaireList();
}
}
}
</script>
<style lang="scss" scoped>
.questionnaire {
background-color: #F5F5F7;
height: calc(100vh - 44px);
overflow: hidden;
box-sizing: border-box;
padding: 0 40rpx;
padding-top: 60px;
/deep/ .navs {
text {
padding-bottom: 8px;
}
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 200rpx;
color: #9E9E9E;
font-size: 36rpx;
image {
width: 250rpx;
margin-bottom: 50rpx;
}
}
.search {
box-shadow: 0 0 5px #e6e6e6;
position: fixed;
top: 100px;
z-index: 999;
left: 40rpx;
right: 40rpx;
.uni-searchbar {
padding: 0;
}
}
scroll-view {
padding-top:45px;
height: 84vh;
.no-more {
text-align: center;
color: gray;
padding-bottom: 10px;
}
.list {
.item {
background-color: white;
margin-bottom: 40rpx;
padding: 40rpx;
border-radius: 16rpx;
position: relative;
.top {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #F5F5F7;
padding-bottom: 20rpx;
.uni-icons {
opacity: 0.5;
}
.fill {
position: absolute;
right: 0;
bottom: 0;
display: flex;
color: #1890FF;
border: 1px solid #A3D3FF;
background-color: #E8F4FF;
padding: 5px 15px;
border-radius: 16rpx 0 16rpx 0;
}
}
.content {
padding-top: 20rpx;
.level {
display: flex;
align-items: center;
margin-top:15px;
text{
padding:0;
display: inline-block;
width:50px;
height:20px;
text-align: center;
line-height: 20px;
margin-left: 5px;
border-radius: 8rpx;
}
.underway{
background-color: #E7FAF0;
color: #71E2A3;
border: 1px solid #D0F5E0;
}
.finish{
background-color: #F5F5F7;
color: #A7A8AC;
border: 1px solid #A7A8AC;
}
}
&>view:not(:last-child) {
margin-bottom: 15rpx;
.progress {
color: #1890FF;
}
}
.status {
position: absolute;
bottom: 0;
right: 0;
color: white;
.status-text {
position: absolute;
bottom: 15px;
right: 8%;
font-size: 35rpx;
}
.triangle-right {
width: 0;
height: 0;
/* 上边框设置为透明 */
border-left: 120px solid transparent;
}
&.submit {
color: #202020;
.triangle-right {
/* 左边框设置为与文本相同的颜色 */
border-bottom: 100px solid #D7D7D7;
}
}
&.agree {
.triangle-right {
/* 左边框设置为与文本相同的颜色 */
border-bottom: 100px solid #2FB15B;
}
}
&.refuse {
.triangle-right {
/* 左边框设置为与文本相同的颜色 */
border-bottom: 100px solid #FF759F;
}
}
}
}
}
}
}
}
</style>