YNUtdPlatform/pages/YNEduApp/learnProj/learnProj.vue

393 lines
9.9 KiB
Vue
Raw Normal View History

2024-08-07 14:53:53 +08:00
<template>
2024-08-24 18:27:34 +08:00
<view class="page">
2024-08-15 17:47:52 +08:00
<u-navbar title="学习项目" @leftClick="leftClick" placeholder />
2024-08-07 14:53:53 +08:00
<view class="status-secs">
<view
v-for="(item, index) in statusList"
:key="item.id"
2024-08-24 18:27:34 +08:00
:class="[{ active: totalStatus.statusCount === item.id }]"
2024-08-07 14:53:53 +08:00
@click="chooseStatus(item.id)"
>
{{ item.text }}
</view>
</view>
<uni-easyinput
2024-08-24 18:27:34 +08:00
prefixIcon="search"
v-model="totalStatus.keyword"
placeholder="请输入项目名称"
@iconClick="toggleSearch"
2024-08-07 14:53:53 +08:00
></uni-easyinput>
2024-08-26 21:46:08 +08:00
2024-08-07 14:53:53 +08:00
<view class="project-cont">
2024-08-24 18:27:34 +08:00
<view v-for="(item, index) in projList" :key="item.id" class="single-proj" @click="toggleDetail(item.id)">
2024-08-07 14:53:53 +08:00
<h4 class="img">
2024-08-24 18:27:34 +08:00
<image src="https://cdn.uviewui.com/uview/swiper/1.jpg"></image>
2024-08-07 14:53:53 +08:00
</h4>
<view class="proj-detail">
<view class="detail-upper">
2024-08-24 18:27:34 +08:00
<h5 style="font-size: 16px">{{ item.name }}</h5>
2024-08-26 21:46:08 +08:00
<!-- <l-starRate v-model="item.star" :disabled="true"></l-starRate> -->
2024-08-07 14:53:53 +08:00
</view>
<view class="detail-lower">
2024-08-26 21:46:08 +08:00
<!-- <view class="avatar">
2024-08-07 14:53:53 +08:00
<image :src="item.avatar"></image>
2024-08-26 21:46:08 +08:00
</view> -->
2024-08-07 14:53:53 +08:00
<view class="progress">
2024-08-26 21:46:08 +08:00
<span>{{ item.userName }}</span>
2024-08-07 14:53:53 +08:00
<view class="bar">
<liu-progressbar
2024-08-26 21:46:08 +08:00
:progress="Number(item.trainPercentage) || 0"
2024-08-24 18:27:34 +08:00
color="#000"
:height="'10rpx'"
bgColor="#1989FA"
:textInside="false"
2024-08-07 14:53:53 +08:00
/>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
2024-08-24 18:27:34 +08:00
import { getStudentStudyWorkList } from '@/api/eduApp'
2024-08-28 09:51:05 +08:00
import config from '@/config'
2024-08-24 18:27:34 +08:00
export default {
data() {
return {
statusList: [
2024-08-26 21:46:08 +08:00
// status -1: 全部 1: 已完成 0: 未完成
2024-08-24 18:27:34 +08:00
{ text: '全部', id: 0 },
{ text: '已完成', id: 1 },
{ text: '未完成', id: 2 }
],
// 参数状态
totalStatus: {
statusCount: 0,
keyword: '',
learnType: '',
outDateStatus: '',
qualStatus: '',
signupStatus: ''
2024-08-15 17:47:52 +08:00
},
2024-08-24 18:27:34 +08:00
// 状态选项
learnTypeRange: [
{ text: '学习类型', value: '' },
{ text: '不学', value: 1 },
{ text: '要学', value: 2 }
],
outDateStatusRange: [
{ text: '逾期状态', value: '' },
{ text: '临期', value: 1 },
{ text: '过期', value: 2 }
],
qualStatusRange: [
{ text: '合格状态', value: '' },
{ text: '合格', value: 1 },
{ text: '不及格', value: 2 }
],
signupStatusRange: [
{ text: '报名状态', value: '' },
{ text: '报了', value: 1 },
{ text: '没报', value: 2 }
],
// 项目列表
2024-08-26 21:46:08 +08:00
projList: []
// projList: [
// {
// id: 1,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 5,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 71
// },
// {
// id: 2,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 3,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 33
// },
// {
// id: 3,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 2,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 94
// },
// {
// id: 4,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 4,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 76
// },
// {
// id: 5,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 1,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 63
// },
// {
// id: 6,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 5,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 52
// },
// {
// id: 7,
// img: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '应急抢险',
// star: 4,
// avatar: '/static/eduImg/avatar.jpg',
// user: '管理员',
// percent: 18
// }
// ]
2024-08-24 18:27:34 +08:00
}
},
mounted() {
this.getList()
},
methods: {
async getList() {
const params = {
2024-08-26 21:46:08 +08:00
userId: uni.getStorageSync('userId'),
status: '-1'
2024-08-07 14:53:53 +08:00
}
2024-08-28 09:51:05 +08:00
// const res = await getStudentStudyWorkList(params)
// this.projList = res.data
this.getStudentStudyWorkList(params)
2024-08-24 18:27:34 +08:00
},
2024-08-26 21:46:08 +08:00
async chooseStatus(count) {
this.projList = []
// 清空搜索框
this.totalStatus.keyword = ''
let params = {
userId: uni.getStorageSync('userId'),
status: '-1'
}
2024-08-24 18:27:34 +08:00
this.totalStatus.statusCount = count
2024-08-26 21:46:08 +08:00
if (count === 0) {
params.status = '-1'
} else if (count === 1) {
params.status = '1'
} else if (count === 2) {
params.status = '0'
}
2024-08-28 09:51:05 +08:00
// const res = await getStudentStudyWorkList(params)
// this.projList = res.data
this.getStudentStudyWorkList(params)
2024-08-24 18:27:34 +08:00
},
2024-08-26 21:46:08 +08:00
async toggleSearch() {
this.projList = []
console.log('开始搜索', this.totalStatus.keyword)
let params = {
userId: uni.getStorageSync('userId'),
status: '-1',
name: this.totalStatus.keyword
}
if (this.totalStatus.statusCount === 0) {
params.status = '-1'
} else if (this.totalStatus.statusCount === 1) {
params.status = '1'
} else if (this.totalStatus.statusCount === 2) {
params.status = '0'
}
2024-08-28 09:51:05 +08:00
// const res = await getStudentStudyWorkList(params)
// this.projList = res.data
this.getStudentStudyWorkList(params)
2024-08-24 18:27:34 +08:00
},
statusChange(item) {
console.log(this.totalStatus)
},
toggleDetail(id) {
uni.navigateTo({
url: `/pages/YNEduApp/learnProj/learnProjDetail?id=${id}`
})
},
leftClick() {
uni.navigateTo({
url: '/pages/YNEduApp/index/index'
})
2024-08-28 09:51:05 +08:00
},
getStudentStudyWorkList(params) {
2024-09-06 14:53:49 +08:00
this.$verificationToken()
2024-08-28 09:51:05 +08:00
uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getStudentStudyWorkList',
method: 'post',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: uni.getStorageSync('access_token')
},
data: params,
success: res => {
console.log('🚀 ~ getList ~ res:', res)
res = res.data
this.projList = res.data
},
fail: err => {
console.log(err)
}
})
2024-08-24 18:27:34 +08:00
}
2024-09-14 09:32:50 +08:00
},
onBackPress(options) {
console.log(options)
if (options.from == 'backbutton') {
// 来自手势返回
console.log('手势返回')
// 返回为 true 时,不会执行返回操作,可以自定义返回逻辑
// 返回为 false 或者不返回时,则执行默认返回操作
return true
}
// 返回为 false 或者不返回时,则执行默认返回操作
return false
2024-08-24 18:27:34 +08:00
}
}
2024-08-07 14:53:53 +08:00
</script>
<style lang="scss">
2024-08-24 18:27:34 +08:00
.page {
width: 100vw;
height: 100vh;
background-color: #f8f8f8;
box-sizing: border-box;
padding: 0 10px;
.status-secs {
width: 100%;
display: flex;
align-items: center;
margin-bottom: 1vh;
view {
box-sizing: border-box;
padding: 0 15rpx;
font-size: 18px;
color: #9ea2ac;
font-weight: bold;
}
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.active {
font-size: 28px;
color: #000;
}
}
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.drops {
width: 100%;
margin-top: 1vh;
display: flex;
}
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.project-cont {
width: 100%;
height: 10rpx;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.single-proj {
width: 49%;
height: 30vh;
2024-08-07 14:53:53 +08:00
margin-bottom: 1vh;
2024-08-24 18:27:34 +08:00
border-radius: 10px;
overflow: hidden;
2024-08-07 14:53:53 +08:00
display: flex;
2024-08-24 18:27:34 +08:00
flex-direction: column;
background-color: #fff;
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.img {
width: 100%;
height: 45%;
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
image {
width: 100%;
height: 100%;
}
}
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.proj-detail {
flex: 1;
2024-08-07 14:53:53 +08:00
display: flex;
flex-direction: column;
2024-08-24 18:27:34 +08:00
.detail-upper {
2024-08-07 14:53:53 +08:00
width: 100%;
2024-08-24 18:27:34 +08:00
height: 65%;
border-bottom: 1px solid #dfdfdf;
box-sizing: border-box;
padding: 5px;
display: flex;
flex-direction: column;
justify-content: space-around;
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.icons {
font-size: 12px;
color: #c0c0c0;
display: flex;
align-items: center;
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
span {
padding-left: 5rpx;
}
2024-08-07 14:53:53 +08:00
}
}
2024-08-24 18:27:34 +08:00
.detail-lower {
2024-08-07 14:53:53 +08:00
flex: 1;
2024-08-24 18:27:34 +08:00
box-sizing: border-box;
padding: 5px;
2024-08-07 14:53:53 +08:00
display: flex;
2024-08-24 18:27:34 +08:00
align-items: center;
.avatar {
width: 5vh;
height: 5vh;
border-radius: 50%;
overflow: hidden;
margin-right: 10rpx;
image {
width: 100%;
height: 100%;
2024-08-07 14:53:53 +08:00
}
}
2024-08-24 18:27:34 +08:00
.progress {
2024-08-07 14:53:53 +08:00
flex: 1;
box-sizing: border-box;
2024-08-24 18:27:34 +08:00
font-size: 12px;
2024-08-07 14:53:53 +08:00
display: flex;
2024-08-24 18:27:34 +08:00
flex-direction: column;
justify-content: space-around;
2024-08-07 14:53:53 +08:00
2024-08-24 18:27:34 +08:00
.bar {
2024-08-07 14:53:53 +08:00
flex: 1;
}
}
}
}
}
}
2024-08-24 18:27:34 +08:00
}
2024-08-07 14:53:53 +08:00
</style>