YNUtdPlatform/pages/realName/index/index.vue

275 lines
6.4 KiB
Vue
Raw Normal View History

2024-09-02 18:17:17 +08:00
<template>
<view class="page">
<u-navbar class="u-navbar" title="首页" placeholder @leftClick="leftClick" leftIconColor="#fff" bgColor="#00337A" :titleStyle="{ color: '#FFF', fontSize: '32rpx' }"/>
2024-09-29 10:19:21 +08:00
<!-- <view class="swipe-area">
2024-09-02 18:17:17 +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-09-29 10:19:21 +08:00
</view> -->
<!-- <uni-notice-bar
2024-09-02 18:17:17 +08:00
show-icon
scrollable
color="#808080"
background-color="transparent"
:text="msgList.length > 0 ? msgList[0].noticeName : '暂无消息'"
@click="handleMsg"
2024-09-29 10:19:21 +08:00
/> -->
2024-09-02 18:17:17 +08:00
<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'
2024-09-09 09:44:11 +08:00
import AES from "@/utils/realNameAes.js";
2024-09-02 18:17:17 +08:00
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() {
2024-09-29 10:19:21 +08:00
console.log('?? ~ mounted ~ mounted-index:')
2024-09-09 09:44:11 +08:00
this.getLogin()
2024-09-02 18:17:17 +08:00
// this.getMsgList()
},
methods: {
2024-09-09 09:44:11 +08:00
getLogin(){
const realParams = {
username: AES.encrypt(uni.getStorageSync('userPhone')),
password: AES.encrypt('YNsbd@123456'),
jwtToken: uni.getStorageSync('App-Token')
}
uni.request({
url: config.realLoginUrl + 'login',
method: 'POST',
data: JSON.stringify(realParams),
header: {
'Content-Type': 'application/json'
},
success: res => {
2024-09-29 10:19:21 +08:00
console.log('?? ~ gotoYy ~ res:', res)
// console.log('?? ~ gotoYy ~ res:', res.data.token)
2024-09-09 09:44:11 +08:00
if (res.data.code == 200) {
// uni.setStorageSync('tjToken', res.data.token)
uni.setStorageSync('realNameToken', res.data.data.access_token)
uni.setStorageSync('realNameUser', res.data.data.loginUser.sysUser)
2024-09-29 10:19:21 +08:00
uni.setStorageSync('realNamePermissions', res.data.data.loginUser.permissions)
uni.removeStorageSync('hasChosenPro')
2024-09-09 09:44:11 +08:00
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
},
fail: err => {
2024-09-29 10:19:21 +08:00
console.log('?? ~ gotoYy ~ err:', err)
2024-09-09 09:44:11 +08:00
uni.showToast({
title: err.message,
icon: 'none'
})
}
})
},
2024-09-02 18:17:17 +08:00
// 获取消息列表
async getMsgList() {
uni.request({
url: config.bmwUrl + '/studentUsers/getNoticeList',
method: 'post',
data: {},
header: {
Authorization: uni.getStorageSync('access_token')
},
success: res => {
2024-09-29 10:19:21 +08:00
console.log('?? ~ getMsgList ~ res:', res)
2024-09-02 18:17:17 +08:00
this.msgList = res.data
2024-09-29 10:19:21 +08:00
console.log('?? ~ getMsgList ~ this.msgList:', this.msgList)
2024-09-02 18:17:17 +08:00
}
})
},
// 点击消息
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;
2024-09-29 10:19:21 +08:00
background-color: #EFEFEF;
2024-09-02 18:17:17 +08:00
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;
2024-09-29 10:19:21 +08:00
background-color: #EFEFEF;
2024-09-02 18:17:17 +08:00
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>