2024-08-07 14:53:53 +08:00
|
|
|
<template>
|
2024-08-26 21:46:08 +08:00
|
|
|
<view class="page">
|
2024-08-19 17:53:53 +08:00
|
|
|
<u-navbar leftIcon="" title="首页" placeholder />
|
2024-08-07 14:53:53 +08:00
|
|
|
<view class="search">
|
2024-08-26 21:46:08 +08:00
|
|
|
<uni-icons type="scan" size="24" style="margin-right: 2vw; color: #bababa" @click="toggleScan"></uni-icons>
|
2024-08-07 14:53:53 +08:00
|
|
|
<uni-easyinput
|
2024-08-26 21:46:08 +08:00
|
|
|
suffixIcon="search"
|
2024-08-27 13:32:10 +08:00
|
|
|
v-model="keyword"
|
2024-08-26 21:46:08 +08:00
|
|
|
placeholder="请输入搜索关键词"
|
|
|
|
|
@iconClick="toggleSearch"
|
2024-08-07 14:53:53 +08:00
|
|
|
></uni-easyinput>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="opt-grids">
|
2024-08-26 21:46:08 +08:00
|
|
|
<view v-for="(part, index) in opts" :key="index" @click="jumpUrl(part.url)">
|
2024-08-07 14:53:53 +08:00
|
|
|
<image :src="part.src" mode=""></image>
|
|
|
|
|
<span>{{ part.name }}</span>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="swipe-area">
|
2024-08-26 21:46:08 +08:00
|
|
|
<swiper class="swiper-box" autoplay interval="3000" indicator-dots="true">
|
|
|
|
|
<swiper-item v-for="(item, index) in imgList" :key="index">
|
|
|
|
|
<img :src="item.image" alt="" style="width: 100%; height: 100%" />
|
|
|
|
|
</swiper-item>
|
|
|
|
|
</swiper>
|
2024-08-07 14:53:53 +08:00
|
|
|
</view>
|
|
|
|
|
<uni-notice-bar
|
2024-08-26 21:46:08 +08:00
|
|
|
show-icon
|
|
|
|
|
scrollable
|
|
|
|
|
color="#808080"
|
|
|
|
|
background-color="transparent"
|
2024-08-27 13:32:10 +08:00
|
|
|
:text="msgList.length > 0 ? msgList[0].noticeName : '暂无消息'"
|
|
|
|
|
@click="handleMsg"
|
2024-08-07 14:53:53 +08:00
|
|
|
/>
|
|
|
|
|
<view class="my-task">
|
|
|
|
|
<h3 style="margin-bottom: 1vh">我的任务</h3>
|
2024-08-27 13:32:10 +08:00
|
|
|
<div class="task-list">
|
|
|
|
|
<div class="list-item" v-for="(item, index) in taskList" :key="index" @click="toggleDetail(item.id)">
|
|
|
|
|
<div class="item-title">{{ item.name }}</div>
|
|
|
|
|
<div>{{ item.userName }}</div>
|
|
|
|
|
<div>{{ item.validityDate }}</div>
|
|
|
|
|
<div class="item-progress">
|
|
|
|
|
<u-line-progress
|
|
|
|
|
:percentage="Number(item.trainPercentage)"
|
|
|
|
|
:showText="false"
|
|
|
|
|
height="8"
|
|
|
|
|
activeColor="#579AF8"
|
|
|
|
|
/>
|
|
|
|
|
<div>{{ item.trainPercentage }}%</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-08-26 21:46:08 +08:00
|
|
|
<view class="no-task" v-show="taskList.length === 0">
|
2024-08-07 14:53:53 +08:00
|
|
|
<view class="no-task-img">
|
|
|
|
|
<image src="/static/eduImg/no-task.png"></image>
|
|
|
|
|
<span>可联系管理员发布</span>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-08-27 13:32:10 +08:00
|
|
|
</div>
|
2024-08-07 14:53:53 +08:00
|
|
|
</view>
|
|
|
|
|
<m-tabbar fixed fill :current="0" :tabbar="tabbar"></m-tabbar>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-08-26 21:46:08 +08:00
|
|
|
import TabbarConfig from '@/tabbar.js'
|
|
|
|
|
// import face from '../../../uni_modules/mcc-face/index'
|
2024-08-27 13:32:10 +08:00
|
|
|
import { getNoticeAnnoByUserId, getStudentStudyWorkList } from '@/api/eduApp'
|
|
|
|
|
import config from '@/config'
|
2024-08-26 21:46:08 +08:00
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2024-08-27 13:32:10 +08:00
|
|
|
userId: uni.getStorageSync('userId'),
|
2024-08-26 21:46:08 +08:00
|
|
|
tabbar: TabbarConfig,
|
2024-08-27 13:32:10 +08:00
|
|
|
keyword: '',
|
2024-08-26 21:46:08 +08:00
|
|
|
opts: [
|
|
|
|
|
{ name: '学习项目', src: '/static/eduImg/learnProj.png', url: 'learnProj' },
|
|
|
|
|
// { name: '学习', src: '/static/eduImg/learn.png', url: 'learn' },
|
|
|
|
|
{ name: '考试', src: '/static/eduImg/exam.png', url: 'exam' },
|
|
|
|
|
{ name: '练习', src: '/static/eduImg/prac.png', url: 'prac' }
|
|
|
|
|
],
|
|
|
|
|
imgList: [
|
|
|
|
|
{
|
|
|
|
|
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
|
|
|
|
|
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
|
|
|
|
|
title: '身无彩凤双飞翼,心有灵犀一点通'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
|
|
|
|
|
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
|
|
|
|
|
}
|
|
|
|
|
],
|
2024-08-27 13:32:10 +08:00
|
|
|
taskList: [],
|
|
|
|
|
msgList: []
|
2024-08-26 21:46:08 +08:00
|
|
|
}
|
|
|
|
|
},
|
2024-08-27 13:32:10 +08:00
|
|
|
mounted() {
|
2024-08-26 21:46:08 +08:00
|
|
|
this.getUserInfo()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取用户信息
|
|
|
|
|
getUserInfo() {
|
|
|
|
|
const params = {
|
|
|
|
|
username: uni.getStorageSync('userPhone'),
|
|
|
|
|
jwtToken: uni.getStorageSync('jwtToken')
|
2024-08-07 14:53:53 +08:00
|
|
|
}
|
2024-08-26 21:46:08 +08:00
|
|
|
uni.removeStorageSync('App-Token')
|
|
|
|
|
uni.request({
|
|
|
|
|
url: config.login + '/login',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: JSON.stringify(params),
|
|
|
|
|
header: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
success: res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
let req = res.data
|
|
|
|
|
console.log('🚀 ~ getUserInfo ~ req:', req, req.data.access_token)
|
|
|
|
|
uni.setStorageSync('App-Token', req.data.access_token)
|
|
|
|
|
uni.setStorageSync('userId', req.data.loginUser.userId)
|
2024-08-27 13:32:10 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
|
// this.getList()
|
|
|
|
|
}, 1000)
|
|
|
|
|
this.getMsgList()
|
2024-08-26 21:46:08 +08:00
|
|
|
},
|
|
|
|
|
fail: err => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2024-08-27 13:32:10 +08:00
|
|
|
async getList() {
|
|
|
|
|
this.taskList = []
|
|
|
|
|
let params = {
|
|
|
|
|
userId: this.userId,
|
|
|
|
|
status: '0'
|
|
|
|
|
}
|
|
|
|
|
const res = await getStudentStudyWorkList(params)
|
|
|
|
|
this.taskList = res.data
|
|
|
|
|
},
|
|
|
|
|
// 搜索
|
|
|
|
|
async toggleSearch() {
|
|
|
|
|
this.taskList = []
|
|
|
|
|
console.log('开始搜索', this.keyword)
|
|
|
|
|
let params = {
|
|
|
|
|
userId: this.userId,
|
|
|
|
|
status: '0',
|
|
|
|
|
name: this.keyword
|
|
|
|
|
}
|
|
|
|
|
const res = await getStudentStudyWorkList(params)
|
|
|
|
|
this.taskList = res.data
|
|
|
|
|
},
|
|
|
|
|
// 获取消息列表
|
|
|
|
|
async getMsgList() {
|
|
|
|
|
uni.request({
|
|
|
|
|
url: config.bmwUrl + '/studentUsers/getNoticeList',
|
|
|
|
|
method: 'post',
|
|
|
|
|
data: {},
|
|
|
|
|
header: {
|
|
|
|
|
Authorization: this.token
|
|
|
|
|
},
|
|
|
|
|
success: res => {
|
|
|
|
|
console.log('🚀 ~ getMsgList ~ res:', res)
|
|
|
|
|
this.msgList = res.data
|
|
|
|
|
console.log('🚀 ~ getMsgList ~ this.msgList:', this.msgList)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 点击消息
|
|
|
|
|
handleMsg() {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/YNEduApp/user/myMsg'
|
|
|
|
|
})
|
2024-08-26 21:46:08 +08:00
|
|
|
},
|
|
|
|
|
toggleScan() {
|
|
|
|
|
uni.scanCode({
|
|
|
|
|
success: res => {
|
|
|
|
|
console.log(res.result)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
jumpUrl(path) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/YNEduApp/${path}/${path}`
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
openFaceScan() {
|
|
|
|
|
face.open(['a', 'c'], function (e) {
|
|
|
|
|
face.close()
|
|
|
|
|
})
|
2024-08-27 13:32:10 +08:00
|
|
|
},
|
|
|
|
|
toggleDetail(id) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/YNEduApp/learnProj/learnProjDetail?id=${id}`
|
|
|
|
|
})
|
|
|
|
|
},
|
2024-08-26 21:46:08 +08:00
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
/* getNoticeAnnoByUserId({
|
2024-08-07 16:43:03 +08:00
|
|
|
status: 0
|
|
|
|
|
}).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log(err)
|
2024-08-08 11:25:33 +08:00
|
|
|
}) */
|
2024-08-26 21:46:08 +08:00
|
|
|
/*uni.showModal({
|
2024-08-07 14:53:53 +08:00
|
|
|
title: '人脸识别',
|
|
|
|
|
content: '开启人脸识别?',
|
|
|
|
|
success:(res) => {
|
|
|
|
|
if(res.confirm) this.openFaceScan()
|
|
|
|
|
}
|
2024-08-07 16:43:03 +08:00
|
|
|
})*/
|
2024-08-26 21:46:08 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2024-08-26 21:46:08 +08:00
|
|
|
.page {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
background-color: #f8f8f8;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
|
|
|
|
|
.search {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
.opt-grids {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
margin: 3vh auto;
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
view {
|
|
|
|
|
width: 25%;
|
2024-08-07 14:53:53 +08:00
|
|
|
display: flex;
|
2024-08-26 21:46:08 +08:00
|
|
|
flex-direction: column;
|
2024-08-07 14:53:53 +08:00
|
|
|
align-items: center;
|
2024-08-26 21:46:08 +08:00
|
|
|
//margin-bottom: 2vh;
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
image {
|
|
|
|
|
width: 60%;
|
|
|
|
|
height: 7vh;
|
|
|
|
|
margin-bottom: 10px;
|
2024-08-07 14:53:53 +08:00
|
|
|
}
|
|
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
span {
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
}
|
2024-08-26 21:46:08 +08:00
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
.swipe-area {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 20vh;
|
|
|
|
|
border-radius: 15rpx;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
margin-bottom: 10rpx;
|
|
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
.my-task {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 40vh;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
border-radius: 15rpx;
|
|
|
|
|
box-shadow: 3px 3px 3px #f4f4f4;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 15rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
.task-list {
|
|
|
|
|
flex: 1;
|
|
|
|
|
overflow-y: auto;
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-27 13:32:10 +08:00
|
|
|
.list-item {
|
|
|
|
|
margin: 10px 0;
|
|
|
|
|
background-color: #f8f8f8;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
padding: 5px;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
.item-title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
}
|
|
|
|
|
.item-progress {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
.u-line-progress {
|
|
|
|
|
width: 80%;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
.no-task {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
.no-task-img {
|
|
|
|
|
width: 80%;
|
|
|
|
|
height: 80%;
|
|
|
|
|
margin: auto;
|
2024-08-07 14:53:53 +08:00
|
|
|
display: flex;
|
2024-08-26 21:46:08 +08:00
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
align-items: center;
|
2024-08-07 14:53:53 +08:00
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 90%;
|
2024-08-07 14:53:53 +08:00
|
|
|
}
|
|
|
|
|
|
2024-08-26 21:46:08 +08:00
|
|
|
span {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #c2c2c2;
|
|
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-26 21:46:08 +08:00
|
|
|
}
|
2024-08-07 14:53:53 +08:00
|
|
|
</style>
|