235 lines
5.3 KiB
Vue
235 lines
5.3 KiB
Vue
|
|
<template>
|
||
|
|
<view class="page">
|
||
|
|
<u-navbar class="u-navbar" title="首页" placeholder @leftClick="leftClick" leftIconColor="#fff" bgColor="#00337A" :titleStyle="{ color: '#FFF', fontSize: '32rpx' }"/>
|
||
|
|
<view class="swipe-area">
|
||
|
|
<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>
|
||
|
|
</view>
|
||
|
|
<uni-notice-bar
|
||
|
|
show-icon
|
||
|
|
scrollable
|
||
|
|
color="#808080"
|
||
|
|
background-color="transparent"
|
||
|
|
:text="msgList.length > 0 ? msgList[0].noticeName : '暂无消息'"
|
||
|
|
@click="handleMsg"
|
||
|
|
/>
|
||
|
|
|
||
|
|
<m-tabbar fixed fill :current="0" :tabbar="tabbar"></m-tabbar>
|
||
|
|
</view>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import TabbarConfig from '../util/tabbar.js'
|
||
|
|
// import face from '../../../uni_modules/mcc-face/index'
|
||
|
|
import { getStudentStudyWorkList } from '@/api/eduApp'
|
||
|
|
import config from '@/config'
|
||
|
|
export default {
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
userId: uni.getStorageSync('userId'),
|
||
|
|
tabbar: TabbarConfig,
|
||
|
|
|
||
|
|
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: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
|
||
|
|
}
|
||
|
|
],
|
||
|
|
msgList: []
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onLoad() {
|
||
|
|
console.log('🚀 ~ mounted ~ mounted-index:')
|
||
|
|
// this.getMsgList()
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
// 获取消息列表
|
||
|
|
async getMsgList() {
|
||
|
|
uni.request({
|
||
|
|
url: config.bmwUrl + '/studentUsers/getNoticeList',
|
||
|
|
method: 'post',
|
||
|
|
data: {},
|
||
|
|
header: {
|
||
|
|
Authorization: uni.getStorageSync('access_token')
|
||
|
|
},
|
||
|
|
success: res => {
|
||
|
|
console.log('🚀 ~ getMsgList ~ res:', res)
|
||
|
|
this.msgList = res.data
|
||
|
|
console.log('🚀 ~ getMsgList ~ this.msgList:', this.msgList)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// 点击消息
|
||
|
|
handleMsg() {
|
||
|
|
uni.navigateTo({
|
||
|
|
url: '/pages/realName/my/myMsg'
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
openFaceScan() {
|
||
|
|
face.open(['a', 'c'], function (e) {
|
||
|
|
face.close()
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
// 返回
|
||
|
|
leftClick() {
|
||
|
|
console.log('返回')
|
||
|
|
// // 退出登录
|
||
|
|
// uni.removeStorageSync('access_token')
|
||
|
|
// uni.removeStorageSync('userId')
|
||
|
|
// uni.removeStorageSync('userName')
|
||
|
|
// uni.removeStorageSync('className')
|
||
|
|
// uni.removeStorageSync('facePath')
|
||
|
|
uni.reLaunch({
|
||
|
|
url: '/pages/gzt/index'
|
||
|
|
})
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onShow() {
|
||
|
|
|
||
|
|
/*uni.showModal({
|
||
|
|
title: '人脸识别',
|
||
|
|
content: '开启人脸识别?',
|
||
|
|
success:(res) => {
|
||
|
|
if(res.confirm) this.openFaceScan()
|
||
|
|
}
|
||
|
|
})*/
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style lang="scss">
|
||
|
|
/* 修改U-Navbar中链接的字体颜色 */
|
||
|
|
/deep/.u-navbar .navbar-nav > li > a {
|
||
|
|
color: #FFF; /* 将颜色改为红色 */
|
||
|
|
}
|
||
|
|
/* 如果你想修改当前激活链接的字体颜色 */
|
||
|
|
/deep/.u-navbar .navbar-nav > li.active > a {
|
||
|
|
color: #FFF; /* 将激活链接的颜色改为绿色 */
|
||
|
|
}
|
||
|
|
.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;
|
||
|
|
}
|
||
|
|
|
||
|
|
.opt-grids {
|
||
|
|
width: 100%;
|
||
|
|
display: flex;
|
||
|
|
flex-wrap: wrap;
|
||
|
|
margin: 3vh auto;
|
||
|
|
|
||
|
|
view {
|
||
|
|
width: 25%;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
align-items: center;
|
||
|
|
//margin-bottom: 2vh;
|
||
|
|
|
||
|
|
image {
|
||
|
|
width: 60%;
|
||
|
|
height: 7vh;
|
||
|
|
margin-bottom: 10px;
|
||
|
|
}
|
||
|
|
|
||
|
|
span {
|
||
|
|
font-size: 26rpx;
|
||
|
|
font-weight: bold;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.swipe-area {
|
||
|
|
width: 100%;
|
||
|
|
height: 20vh;
|
||
|
|
border-radius: 15rpx;
|
||
|
|
overflow: hidden;
|
||
|
|
margin-bottom: 10rpx;
|
||
|
|
}
|
||
|
|
|
||
|
|
.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;
|
||
|
|
|
||
|
|
.task-list {
|
||
|
|
flex: 1;
|
||
|
|
overflow-y: auto;
|
||
|
|
|
||
|
|
.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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
.no-task {
|
||
|
|
width: 100%;
|
||
|
|
height: 100%;
|
||
|
|
display: flex;
|
||
|
|
|
||
|
|
.no-task-img {
|
||
|
|
width: 80%;
|
||
|
|
height: 80%;
|
||
|
|
margin: auto;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
justify-content: space-around;
|
||
|
|
align-items: center;
|
||
|
|
|
||
|
|
image {
|
||
|
|
width: 100%;
|
||
|
|
height: 90%;
|
||
|
|
}
|
||
|
|
|
||
|
|
span {
|
||
|
|
font-size: 14px;
|
||
|
|
color: #c2c2c2;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</style>
|