Compare commits

...

2 Commits

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

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

@ -1,14 +1,34 @@
<script setup> <script setup>
import { onMounted, ref, computed } from 'vue'
const props = defineProps({ 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> </script>
<template> <template>
<div class="nav_info"> <div class="nav_info">
<div class="name"> <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>
<div class="intro">今天是你的第一天~~</div>
</div> </div>
</template> </template>
<style scoped> <style scoped>

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

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

Loading…
Cancel
Save