侧边栏2
This commit is contained in:
parent
a63b80c966
commit
f5431ad85e
@ -38,21 +38,23 @@
|
||||
</div>
|
||||
</template>
|
||||
<div class="flex flex-col space-y-4 mb-4 ">
|
||||
<span class="lg:hover:text-blue-700" @click="JumpPersonalBelonging"><UserOutlined class="mr-1.5"/>我的项目</span>
|
||||
|
||||
<span class="lg:hover:text-blue-700" @click="JumpMessage" ><MailOutlined class="mr-1.5"/>消息</span>
|
||||
<span class="lg:hover:text-blue-700" @click="JumpDailyPaper"><BellOutlined class="mr-1.5"/>日报</span>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col space-y-4">
|
||||
<hr class="mb-2">
|
||||
<span class="lg:hover:text-blue-700" @click="JumpPersonalBelonging"><UserOutlined class="mr-1.5"/>我的项目</span>
|
||||
<span class="lg:hover:text-blue-700" @click="JumpMyManage"><ToolOutlined class="mr-1.5"/>我管理的</span>
|
||||
<span v-if="role === true" class=" lg:hover:text-blue-700" @click="JumpMyResponsible" ><UserOutlined class="mr-1.5" />我负责的</span>
|
||||
<hr>
|
||||
<span class=" lg:hover:text-blue-700" @click="JumpPersonalInformation"><MessageOutlined class="mr-1.5" />个人信息管理</span>
|
||||
|
||||
<div v-if="role === true" class="flex flex-col space-y-4">
|
||||
<hr>
|
||||
<span class=" lg:hover:text-blue-700" @click="JumpMyResponsible" ><UserOutlined class="mr-1.5" />我负责的</span>
|
||||
</div>
|
||||
<!-- <div v-if="role === true" class="flex flex-col space-y-4">-->
|
||||
<!-- <hr>-->
|
||||
|
||||
<!-- </div>-->
|
||||
|
||||
</div>
|
||||
<span @click="exitLogin" class="bg-gray-50 lg:hover:text-blue-400 text-lg bottom-2 fixed right-2">退出登录</span>
|
||||
@ -72,12 +74,12 @@
|
||||
<div id="navbar-dropdown" class="w-full md:block md:w-auto">
|
||||
<ul class="flex flex-col font-medium p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white">
|
||||
<li>
|
||||
<a aria-current="page" class="block py-2 px-3 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-500 md:p-0" href="/src/js">
|
||||
<a aria-current="page" class="block py-2 px-3 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-500 md:p-0" href="/" onclick="changeColor('home')">
|
||||
首页
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="block py-2 px-3 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0" href="/Project" @click="changeColor">
|
||||
<a class="block py-2 px-3 text-gray-900 rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0" href="/Project" onclick="changeColor('projects')">
|
||||
项目
|
||||
</a>
|
||||
</li>
|
||||
@ -145,34 +147,59 @@ function toggleDropdown(){
|
||||
isDropdownOpen.value = !isDropdownOpen.value;
|
||||
|
||||
}
|
||||
function changeColor(item){
|
||||
const homeLink = document.getElementById('homeLink');
|
||||
const projectsLink = document.getElementById('projectsLink');
|
||||
|
||||
function changeColor() {
|
||||
// 当按钮被点击时,将文字颜色改为蓝色
|
||||
textColor.value = 'blue';
|
||||
homeLink.classList.remove('text-blue-500');
|
||||
projectsLink.classList.remove('text-blue-500');
|
||||
|
||||
if (item === 'home') {
|
||||
homeLink.classList.add('text-blue-500');
|
||||
} else if (item === 'projects') {
|
||||
projectsLink.classList.add('text-blue-500');
|
||||
}
|
||||
// textColor.value = 'blue';
|
||||
}
|
||||
// function backMain() {
|
||||
// // 当按钮被点击时,将文字颜色改为蓝色
|
||||
// // textColor.value = 'blue';
|
||||
// router.push("/")
|
||||
// }
|
||||
|
||||
function exitLogin(){
|
||||
requests.logout(token).then((res) => {
|
||||
if(res.data.code === 200){
|
||||
router.push("/login")
|
||||
console.log(res)
|
||||
isLoggedIn.value = false; //头像展示
|
||||
message.success("退出成功!")
|
||||
}else{
|
||||
message.error("退出失败!")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
onMounted(() => {
|
||||
requests.userGetProfile(token).then((res)=>{
|
||||
// console.log(res)
|
||||
console.log(res)
|
||||
if (res.data.code === 200) {
|
||||
//登录成功
|
||||
isLoggedIn.value = true; //头像展示
|
||||
username.value = res.data.data.username
|
||||
// avatar.value = res.data.data.avatar 数据库无头像,暂时用下面的头像
|
||||
avatar.value = 'https://img1.baidu.com/it/u=2005056479,139681251&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1710176400&t=4f32b862465c709f79c8fb80d3c0444b';
|
||||
|
||||
console.log(username.value, avatar.value)
|
||||
if (res.data.data.role === 'teacher') {
|
||||
console.log('这是老师');
|
||||
// 执行老师相关的逻辑
|
||||
role.value =true
|
||||
|
||||
} else {
|
||||
console.log('这不是老师');
|
||||
// 执行非老师相关的逻辑
|
||||
role.value= false
|
||||
}
|
||||
|
||||
}else{
|
||||
//用户过期,重新登录
|
||||
message.error("用户过期,请重新登录!")
|
||||
@ -186,7 +213,7 @@ function JumpPersonalBelonging (){
|
||||
router.push("/WorkLoad/PersonalBelongings")
|
||||
}
|
||||
function JumpMessage (){
|
||||
router.push("WorkLoad/Message")
|
||||
router.push("/WorkLoad/Message")
|
||||
}
|
||||
function JumpDailyPaper (){
|
||||
router.push("/WorkLoad/DailyPaper")
|
||||
|
@ -499,6 +499,21 @@ const infoEditSettingHeaderImage = (showType, token) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示全部项目
|
||||
* @param (listAll tags isFinish)
|
||||
* @param token
|
||||
*/
|
||||
const projectGet =(token) => {
|
||||
return axios({
|
||||
url:api+ "/project/get",
|
||||
method: "get",
|
||||
header:{
|
||||
'Authorization':'Bearer '+token,
|
||||
'Timestamp': getCurrentTimestamp()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
login,
|
||||
@ -533,4 +548,6 @@ export default {
|
||||
infoEditSettingHeaderImage,
|
||||
|
||||
|
||||
projectGet
|
||||
|
||||
}
|
@ -23,18 +23,21 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="text-gray-800 flex space-x-5">
|
||||
<label>
|
||||
<input type="checkbox"/>
|
||||
未开始
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox"/>
|
||||
进行中
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox"/>
|
||||
已完成
|
||||
</label>
|
||||
<!-- <label>-->
|
||||
<!-- <input type="checkbox" class="border border-gray-300 rounded"/>-->
|
||||
<!-- 未开始-->
|
||||
<!-- </label>-->
|
||||
<!-- <label>-->
|
||||
<!-- <input type="checkbox"/>-->
|
||||
<!-- 进行中-->
|
||||
<!-- </label>-->
|
||||
<!-- <label>-->
|
||||
<!-- <input type="checkbox"/>-->
|
||||
<!-- 已完成-->
|
||||
<!-- </label>-->
|
||||
<a-checkbox>未开始</a-checkbox>
|
||||
<a-checkbox>进行中</a-checkbox>
|
||||
<a-checkbox>已完成</a-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -178,17 +181,44 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
LearnMore1:false,
|
||||
LearnMore2:false,
|
||||
LearnMore3:false,
|
||||
LearnMore4:false,
|
||||
LearnMore5:false,
|
||||
LearnMore6:false,
|
||||
};
|
||||
},
|
||||
};
|
||||
<script setup>
|
||||
import {onMounted, ref} from "vue";
|
||||
import request from "@/js/request.js";
|
||||
|
||||
const LearnMore1 = ref(false)
|
||||
const LearnMore2 = ref(false)
|
||||
const LearnMore3 = ref(false)
|
||||
const LearnMore4 = ref(false)
|
||||
const LearnMore5 = ref(false)
|
||||
const LearnMore6 = ref(false)
|
||||
|
||||
|
||||
|
||||
// export default {
|
||||
// data() {
|
||||
// return {
|
||||
// LearnMore1:false,
|
||||
// LearnMore2:false,
|
||||
// LearnMore3:false,
|
||||
// LearnMore4:false,
|
||||
// LearnMore5:false,
|
||||
// LearnMore6:false,
|
||||
// };
|
||||
// },
|
||||
// };
|
||||
|
||||
// const Project = reactive({
|
||||
// data:[],
|
||||
// })
|
||||
const token = window.localStorage.getItem('token')
|
||||
|
||||
onMounted(() =>{
|
||||
getAllProject()
|
||||
})
|
||||
function getAllProject(){
|
||||
request.projectGet(token).then((res)=>{
|
||||
console.log(res)
|
||||
// Project.data= res.data.data.data
|
||||
})
|
||||
}
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user