修复获取身份信息

develoop
ww 5 months ago
parent 8b0f069d35
commit 47e735b82c
  1. 7997
      pnpm-lock.yaml
  2. 4
      src/store/modules/user.ts
  3. 12
      src/views/home/components/Info.vue
  4. 26
      src/views/home/components/Welcome.vue
  5. 6
      src/views/home/index.vue
  6. 2
      src/views/login/index.vue

File diff suppressed because it is too large Load Diff

@ -54,7 +54,6 @@ const useUserStore = defineStore(
SET_TKOEN('TOKEN', this.token)
// localStorage.setItem('TOKEN', this.token)
ElNotification({
type: 'success',
message: '登录成功!',
@ -62,7 +61,6 @@ const useUserStore = defineStore(
})
return 'ok'
} else {
console.log(res, '33333')
// ElNotification({
// // type: 'error',
// message: res.message,
@ -102,6 +100,8 @@ const useUserStore = defineStore(
const result: any = await userGetInfoService(GET_TKOEN('TOKEN'))
if (result.code === 200) {
const res = await userIdenService(result.data.id)
console.log(res, 'huonghu')
// @ts-expect-error
this.userInfo = res.data

@ -10,7 +10,6 @@ const props = defineProps({
type: Object,
},
})
console.log(props.data, 'djegd ')
const formModel = ref()
const loading = ref()
//true
@ -19,6 +18,7 @@ const editForm = ref({
name: '',
content: '',
})
const readonlyField = computed(() => editForm.value.name)
const editRowIndex = ref()
const openEditDialog = (row) => {
@ -46,14 +46,18 @@ const cancelEdit = () => {
}
onMounted(() => {
if (props.data.roleId === 1) {
if (props.data.roleId[0] === '1') {
formModel.value = [
{ par: 'name', name: '姓名', content: props.data.name },
{ par: 'sex', name: '性别', content: props.data.sex },
{ par: 'nationality', name: '民族', content: props.data.nationality },
{ par: 'profession', name: '专业', content: props.data.profession },
{ par: 'education', name: '学历', content: props.data.education },
{ par: 'degree', name: '学位', content: props.data.degree },
{
par: 'academicDegree',
name: '学位',
content: props.data.academicDegree,
},
{
par: 'professionalTitle',
name: '职称',
@ -75,7 +79,7 @@ onMounted(() => {
content: props.data.politicalStatus,
},
]
} else if (props.data.roleId === 2) {
} else if (props.data.roleId[0] === '2') {
formModel.value = [
{ par: 'name', name: '姓名', content: props.data.name },
{ par: 'sex', name: '性别', content: props.data.sex },

@ -1,14 +1,34 @@
<script setup>
import { onMounted, ref, computed } from 'vue'
const props = defineProps({
username: String,
data: {
type: Object,
},
})
const username = ref()
const daysOnJob = ref()
const flagVisible = ref(true)
onMounted(() => {
username.value = props.data.name
const hireDate = new Date(props.data.joinWorkTime)
console.log(props.data.name, 'welcome')
//
const currentDate = new Date()
const millisecondsPerDay = 1000 * 60 * 60 * 24
daysOnJob.value = Math.floor((currentDate - hireDate) / millisecondsPerDay)
})
</script>
<template>
<div class="nav_info">
<div class="name">
{{ props.username }}
{{ username }}
</div>
<div class="intro" v-if="props.data.roleId[0] === '1'">
<p>今天是你工作的第{{ daysOnJob }}~~</p>
</div>
<div class="intro" v-else>
<p>Hell0,欢迎回来</p>
</div>
<div class="intro">今天是你的第一天~~</div>
</div>
</template>
<style scoped>

@ -25,17 +25,15 @@ onMounted(() => {
sum = parseInt(sum) + 1
localStorage.setItem('sum', sum.toString())
console.log(sum, 'sum')
username.value = userStore.userName
data.value = userStore.data
infoData.value = userStore.userInfo
// console.log(data.value, '11111')
// console.log(userStore.userInfo, '22222')
// console.log(userStore, 'userStore')
username.value = data.value.username
flag.value = true
role.value = data.value.roles[0]
if (role.value === '老师') {
if (role.value === '1') {
rightVisible.value = true
} else {
rightVisible.value = false
@ -46,7 +44,7 @@ onMounted(() => {
<div class="container">
<div class="left">
<div class="nav">
<welcome :username="username"></welcome>
<welcome :data="infoData" v-if="flag"></welcome>
</div>
<div class="info" style="width: 100%; height: 368px">
<Info :data="infoData" v-if="flag"></Info>

@ -580,7 +580,7 @@ onUnmounted(() => {
// background: url('../../assets/images/background.jpg') no-repeat;
.loin_form {
position: relative;
top: 30vh;
top: 20vh;
width: 80%;
// background: url('../../assets/images/login_form.png') no-repeat;
// background-size: cover;

Loading…
Cancel
Save