develoop
ww 3 months ago
parent 4d7de237dc
commit a96b653f98
  1. 24
      src/api/user/stud.js
  2. 9
      src/api/user/user.js
  3. 2
      src/layout/tabbar/setting/index.vue
  4. 52
      src/views/course/basicCourseInformation.vue
  5. 34
      src/views/course/components/courseEdit.vue
  6. 4
      src/views/home/components/Echarts.vue
  7. 37
      src/views/home/components/Lessonlist.vue
  8. 148
      src/views/home/components/Status.vue
  9. 4
      src/views/home/components/Student1.vue
  10. 149
      src/views/home/components/Welcome.vue
  11. 63
      src/views/home/index.vue
  12. 43
      src/views/message/index.vue
  13. 437
      src/views/student/index.vue

@ -0,0 +1,24 @@
import request from '@/utils/request'
//分页查询
export const stuPageService = (params) => {
// console.log(params, 'params')
return request.get(
`/api/studentManage/page?name=${params.name}&number=${params.number}&page=${params.page}&pageSize=${params.pagesize}&userId=${params.id}`,
)
}
//获取学生
export const stuListService = (id) => {
return request.get(`/api/studentManage/${id}`)
}
//删除和批量删除学生
export const delStuListService = (ids) => {
return request.delete(`/api/studentManage/batchDelete?ids=${ids}`)
}
//重置学生密码
export const reStuPassService = (ids) => {
return request.put(`/api/studentManage/initialPassword?ids=${ids}`)
}
//重置学生密码
export const changeStaService = (status, id) => {
return request.post(`/api/studentManage/status/${status}?id=${id}`)
}

@ -32,10 +32,11 @@ export const userGetInfoService = (token) =>
headers: { Authorization: `Bearer ${token}` },
})
//修改用户信息
export const userChangeService = (jsonData) => {
return request.post('/api/user/update', jsonData, {
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
})
export const userChangeService = (params) => {
// return request.post('/api/user/update', jsonData, {
// headers: { 'Content-Type': 'application/json;charset=UTF-8' },
// })
return request.post(`/api/user/update/PersonalInfo`, params)
}
//获取个人信息
export const userIdenService = (id) => {

@ -16,7 +16,7 @@
size="small"
icon="Link"
circle
@click="openWeb('http://www.baidu.com/', 'baidu')"
@click="openWeb('https://www.baidu.com', 'baidu')"
/>
<img
:src="userStore.data.icon || defImg"

@ -97,6 +97,7 @@ const onAddCourse = () => {
flog.value = false
drawer.value.open({})
}
const flog = ref(false)
//
const onEditCourse = (item: any) => {
@ -208,7 +209,11 @@ const CloseCouresNameChangeEvent = () => {
</el-form>
<div class="course">
<ul class="course_list">
<li v-if="userStore.userInfo.roleId[0] === '1'" @click="onAddCourse()" class="add_course">
<li
v-if="userStore.userInfo.roleId[0] === '1'"
@click="onAddCourse()"
class="add_course"
>
<div class="plus">
<el-icon class="avatar-uploader-icon">
<Plus />
@ -217,8 +222,17 @@ const CloseCouresNameChangeEvent = () => {
<h2 class="course_name">{{ course_name }}</h2>
</li>
<li v-for="item in courseList" :key="item.id">
<img title="点击查看课程详情" :src="item.img" alt="" @click="onGetCourseObject(item.id)" />
<h2 title="点击查看课程基本信息" class="course_name" @click="onEditCourse(item)">
<img
title="点击查看课程详情"
:src="item.img"
alt=""
@click="onGetCourseObject(item.id)"
/>
<h2
title="点击查看课程基本信息"
class="course_name"
@click="onEditCourse(item)"
>
{{ item.name }}
</h2>
<p class="teacher_name">讲师{{ item.teacher }}</p>
@ -231,19 +245,36 @@ const CloseCouresNameChangeEvent = () => {
<el-icon class="del" @click="onDeleteCourse(item.id)">
<Delete />
</el-icon>
<el-button class="object" round plain @click="onGetCourseObject(item.id)">
<el-button
class="object"
round
plain
@click="onGetCourseObject(item.id)"
>
查看课程详情
</el-button>
</li>
</ul>
</div>
<el-pagination v-model:current-page="params.pageNo" v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]" :background="true" layout="jumper,total, sizes, prev, pager, next " :total="total"
@size-change="handleSizeChange" @current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center" />
<el-pagination
v-model:current-page="params.pageNo"
v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]"
:background="true"
layout="jumper,total, sizes, prev, pager, next "
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center"
/>
</div>
<course-edit ref="drawer" @success="onSuccess" @couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent" :flog="flog"></course-edit>
<course-edit
ref="drawer"
@success="onSuccess"
@couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent"
:flog="flog"
></course-edit>
</div>
</div>
</template>
@ -289,7 +320,6 @@ const CloseCouresNameChangeEvent = () => {
}
.course {
// display: flex;
// flex: 0 0 25%;
// justify-content: space-between;

@ -268,11 +268,20 @@ const upload = async (option: any) => {
</script>
<template>
<el-drawer :before-close="handleClose" v-model="visibleDrawer" direction="rtl"
:title="formModel.id ? '编辑课程' : '添加课程'">
<el-drawer
:before-close="handleClose"
v-model="visibleDrawer"
direction="rtl"
:title="formModel.id ? '编辑课程' : '添加课程'"
>
<el-form :model="formModel" :rules="rules" ref="formRef">
<el-form-item label="课程封面" prop="img">
<el-upload v-model="formModel.img" class="avatar-uploader" :http-request="upload" :show-file-list="false">
<el-upload
v-model="formModel.img"
class="avatar-uploader"
:http-request="upload"
:show-file-list="false"
>
<img v-if="imgUrl" :src="imgUrl" class="avatar" />
<el-icon v-else class="avatar-uploader-icon">
<Plus />
@ -311,8 +320,12 @@ const upload = async (option: any) => {
</el-upload> -->
</el-form-item>
<el-form-item label="课程名称" prop="name">
<el-input :disabled="nameDisabled" style="width: 200px" v-model="formModel.name"
@input="courseNameInput"></el-input>
<el-input
:disabled="nameDisabled"
style="width: 200px"
v-model="formModel.name"
@input="courseNameInput"
></el-input>
</el-form-item>
<el-form-item label="课程类别" prop="category">
<el-radio-group v-model="formModel.category">
@ -328,13 +341,20 @@ const upload = async (option: any) => {
</el-radio-group>
</el-form-item>
<el-form-item label="课程编码" prop="code">
<el-input style="width: 200px" v-model="formModel.code" :disabled="codeDisabled"></el-input>
<el-input
style="width: 200px"
v-model="formModel.code"
:disabled="codeDisabled"
></el-input>
</el-form-item>
<el-form-item label="课程学分" prop="credit">
<el-input style="width: 200px" v-model="formModel.credit"></el-input>
</el-form-item>
<el-form-item label="课程学时" prop="classhours">
<el-input style="width: 200px" v-model="formModel.classhours"></el-input>
<el-input
style="width: 200px"
v-model="formModel.classhours"
></el-input>
</el-form-item>
<el-form-item label="考核类型" prop="assessmenttype">
<el-radio-group v-model="formModel.assessmenttype">

@ -16,8 +16,8 @@ onMounted(() => {
// lastMonthBrowseList.value = res.data.lastMonthBrowseList
// thisMonthBrowseList.value = res.data.thisMonthBrowseList
count.value = res.data
console.log(res.data, 'echart11')
console.log(count.value, 'echart')
// console.log(res.data, 'echart11')
// console.log(count.value, 'echart')
})
})
</script>

@ -3,7 +3,10 @@ import conheader from '@/views/home/components/ConHeader.vue'
import courseedit from '@/views/course/components/courseEdit.vue'
import { ref, onMounted } from 'vue'
import useUserStore from '@/store/modules/user'
import { useRouter } from 'vue-router'
import { userLessonListService } from '@/api/user/user.js'
import courseEdit from '@/views/course/components/courseEdit.vue'
const router = useRouter()
const userStore = useUserStore()
// console.log(userStore.data.id, 'sfa')
const loading = ref(false)
@ -15,7 +18,26 @@ const getLesList = async () => {
loading.value = false
// console.log(res.data, 'less')
}
const onGetCourseObject = async (id) => {
router.push({
path: '/curriculumCenter/courseDetails',
query: {
id: id,
},
})
}
const drawer = ref()
const flog = ref(false)
const onEditCourse = (item) => {
flog.value = true
console.log(item, 'item')
drawer.value.open(item)
}
const onSuccess = () => {
loading.value = true
getLesList()
loading.value = false
}
onMounted(() => {
getLesList()
})
@ -36,14 +58,22 @@ onMounted(() => {
<img
:src="item.img"
style="width: 100%; height: 125px; border-radius: 10px 10px 0px 0px"
@click="onGetCourseObject(item.id)"
/>
</div>
<div class="lessonlist-item-info">
<h3>{{ item.name }}</h3>
<div class="p"><p>编辑</p></div>
<h3 @click="onGetCourseObject(item.id)">{{ item.name }}</h3>
<div class="p" @click="onEditCourse(item)"><p>编辑</p></div>
</div>
</div>
</div>
<course-edit
ref="drawer"
@success="onSuccess"
@couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent"
:flog="flog"
></course-edit>
</div>
<courseedit @click="open"></courseedit>
</template>
@ -94,6 +124,7 @@ onMounted(() => {
font-size: 16px;
font-weight: bold;
margin-bottom: 5px;
cursor: pointer;
}
.lessonlist-item-info .p {
/* font-size: 14px;

@ -2,7 +2,7 @@
import add from '@/assets/images/add.png'
// import tool from '@/utils/oss.js'
import { userChangeService } from '@/api/user/user.js'
import { ref, defineEmits, onMounted } from 'vue'
import { ref, defineEmits, onMounted, reactive } from 'vue'
import { ElMessage } from 'element-plus'
import { Edit } from '@element-plus/icons-vue'
import { tool, client } from '@/utils/alioss.js'
@ -19,7 +19,16 @@ const props = defineProps({
const imageUrl = ref()
//
imageUrl.value = props.data.icon
// console.log(props.data.username, 'img')
// console.log(props.userData, 'img')
const beforeUpload = (file) => {
const validImageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/bmp']
if (!validImageTypes.includes(file.type)) {
ElMessage.error('请上传图片')
return false
}
return true
}
//
const upload = async (option) => {
const res = await tool.oss.upload(option.file)
@ -28,10 +37,9 @@ const upload = async (option) => {
// console.log(imageUrl.value, 'img')
}
//
const emit = defineEmits(['get-avater'])
const emit = defineEmits(['get-avater', 'getInfo'])
let isUploading = ref(false)
const changeInfo = async () => {
// console.log('', imageUrl.value)
if (!isUploading.value) {
isUploading.value = true
const userInfo = {
@ -49,23 +57,48 @@ const changeInfo = async () => {
isUploading.value = false
}
}
// onMounted(() => {
// console.log(props.data.icon, 'props.icon')
// })
//
const dialog = ref(false)
const radio = ref(3)
const form = ref({})
const formLabelWidth = '68px'
const form = ref({
name: '',
sex: '',
emergencyContact: '',
nationality: '',
professionalTitle: '',
politicalStatus: '',
profession: '',
education: '',
academicDegree: '',
})
form.value = { ...props.userData }
// console.log(props.userData, '')
// console.log(form.value, '')
form.value.sex === '男' ? 0 : 1
const value = ref('')
value.value = form.value.politicalStatus
const openInfo = () => {
dialog.value = true
}
const onCancel = () => {
dialog.value = false
}
const onsubmit = async () => {}
const formLabelWidth = '60px'
const loading = ref(false)
//
const onSubmit = async () => {
// const jsonData = JSON.stringify(form.value)
console.log(form.value, 'jj')
await userChangeService(form).then(() => {
ElMessage.success('修改成功')
console.log(form.value, 'aaaa')
emit('getInfo', form.value)
dialog.value = false
})
}
</script>
<template>
<div class="ident" style="width: 100%; height: 100%; background: #375fff">
@ -81,9 +114,10 @@ const loading = ref(false)
</div>
<el-upload
class="click"
:http-request="upload"
:show-file-list="false"
auto-upload="false"
:before-upload="beforeUpload"
:http-request="upload"
>
<img :src="add" />
</el-upload>
@ -101,25 +135,88 @@ const loading = ref(false)
<el-drawer v-model="dialog" title="个人信息" class="demo-drawer">
<div class="content">
<el-form :model="form">
<el-form-item label="姓名" :label-width="formLabelWidth">
<el-form-item label="姓名" :label-width="formLabelWidth" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="性别" :label-width="formLabelWidth">
<el-radio-group v-model="radio">
<el-radio :value="3"></el-radio>
<el-radio :value="6"></el-radio>
<el-form-item label="性别" :label-width="formLabelWidth" prop="sex">
<el-radio-group v-model="form.sex">
<el-radio value="男"></el-radio>
<el-radio value="女"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="民族" :label-width="formLabelWidth">
<el-input v-model="form.email" autocomplete="off"></el-input>
<el-form-item
label="手机号"
:label-width="formLabelWidth"
prop="emergencyContact"
>
<el-input
v-model="form.emergencyContact"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item
label="民族"
:label-width="formLabelWidth"
prop="nationality"
>
<el-input v-model="form.nationality" autocomplete="off"></el-input>
</el-form-item>
<el-form-item
label="职位"
:label-width="formLabelWidth"
prop="professionalTitle"
>
<el-input
v-model="form.professionalTitle"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item
label="政治面貌"
:label-width="formLabelWidth"
prop="politicalStatus"
>
<el-select v-model="form.politicalStatus">
<el-option :label="'中共党员'" :value="'中共党员'" />
<el-option :label="'中共预备党员'" :value="'中共预备党员'" />
<el-option :label="'共青团员'" :value="'共青团员'" />
<el-option :label="'群众'" :value="'群众'" />
</el-select>
</el-form-item>
<el-form-item
label="专业"
:label-width="formLabelWidth"
prop="profession"
>
<el-input v-model="form.profession" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="手机号" :label-width="formLabelWidth">
<el-input v-model="form.phone" autocomplete="off"></el-input>
<el-form-item
label="学历"
:label-width="formLabelWidth"
prop="education"
>
<el-select v-model="form.education">
<el-option :label="'专科'" :value="'专科'" />
<el-option :label="'本科'" :value="'本科'" />
<el-option :label="'硕士研究生'" :value="'硕士研究生'" />
<el-option :label="'博士研究生'" :value="'博士研究生'" />
</el-select>
</el-form-item>
<el-form-item
label="学位"
:label-width="formLabelWidth"
prop="academicDegree"
>
<el-select v-model="form.academicDegree">
<el-option :label="'学士'" :value="'专科'" />
<el-option :label="'硕士'" :value="'硕士'" />
<el-option :label="'博士'" :value="'博士'" />
</el-select>
</el-form-item>
</el-form>
<div class="footer">
<el-button @click="onCancel">取消</el-button>
<el-button type="primary" :loading="loading" @click="onsubmit">
<el-button type="primary" :loading="loading" @click="onSubmit">
确认
</el-button>
</div>
@ -179,7 +276,7 @@ const loading = ref(false)
}
.footer {
display: flex;
justify-content: space-around;
justify-content: space-between;
align-items: center;
margin-top: 20px;
}
@ -230,4 +327,7 @@ span {
margin-left: 65px;
margin-top: -50px;
}
/* .el-form el-form--default el-form--label-right {
height: 500px;
} */
</style>

@ -34,7 +34,7 @@ getStuList()
<li class="stu-item" v-for="(item, index) in stuList" :key="index">
<img :src="item.icon || defImg" class="stu-item-img" />
<div class="stu-item-info">
<h4>{{ item.name }}</h4>
<h4 style="font-weight: bold">{{ item.name }}</h4>
<h4 style="color: #666">{{ item.number }}</h4>
</div>
</li>
@ -95,7 +95,7 @@ getStuList()
}
h4 {
margin-left: 15px;
font-weight: bold;
/* font-weight: bold; */
font-size: 14px;
font-family: Inter, Inter;
/* font-weight: 400; */

@ -9,7 +9,7 @@ import {
import useUserStore from '@/store/modules/user'
import { useRouter } from 'vue-router'
import { ElMessage, dayjs } from 'element-plus'
import { Edit } from '@element-plus/icons-vue'
import { Edit, Back } from '@element-plus/icons-vue'
const props = defineProps({
name: {
type: String,
@ -34,23 +34,23 @@ const pwdForm = ref({
const dialogFormVisible = ref(false)
//
const passFormVisible = ref(false)
//dialog
const form = ref({})
const formLabelWidth = '80px'
//dialog
form.value = { ...props.userData, code: '' }
form.value = { ...props.userData, code: '', newphone: '' }
const openInfo = () => {
dialogFormVisible.value = true
codeVisible.value = false
change.value = true
// console.log(form.value, 'form')
}
const openPass = () => {
passFormVisible.value = true
pwdForm.value = {}
}
//
const checkOldSame = (rule, value, callback) => {
if (value === props.userData.password) {
if (value === pwdForm.value.old_pwd) {
callback(new Error('新密码不能与旧密码相同'))
} else {
callback()
@ -58,7 +58,14 @@ const checkOldSame = (rule, value, callback) => {
}
const checkNewSame = (rule, value, cb) => {
if (value !== pwdForm.value.new_pwd) {
cb(new Error('新密码和确认再次输入的新密码不一样!'))
cb(new Error('新密码和确认再次输入的新密码不一样'))
} else {
cb()
}
}
const checkOldPhone = (rule, value, cb) => {
if (value === form.value.phone) {
cb(new Error('新手机号与旧手机号相同'))
} else {
cb()
}
@ -82,6 +89,14 @@ const infoRules = {
trigger: ['change', 'blur'],
},
],
newphone: [
{
pattern: /^1[3-9]\d{9}$/,
message: '手机号格式不正确',
trigger: ['change', 'blur'],
},
{ validator: checkOldPhone, trigger: 'blur' },
],
}
//
const rules = {
@ -119,29 +134,22 @@ const rules = {
const infoRef = ref()
//
const emit = defineEmits(['get-message'])
const change = ref(true)
//
const countdown = ref(0)
//
const codeVisible = ref(false)
//
const phoneValue = form.value.phone
const toggleVisibility = () => {
codeVisible.value = !codeVisible.value
if (codeVisible.value == true) {
//
form.value.phone = ''
} else {
// 'sample text'
form.value.phone = props.userData.phone //
}
// console.log('change')
change.value = false
}
//
const toggleInputValue = () => {}
//
const codecode = ref()
const codeSubmit = async () => {
await infoRef.value.validate()
// console.log('')
const phoness = form.value.phone
const phoness = form.value.newphone
userCodeRegisterService(phoness)
.then((response) => {
codecode.value = response.data
@ -151,12 +159,16 @@ const codeSubmit = async () => {
console.log(error.message, 'error')
})
}
const changePhone = () => {
codeVisible.value = true
}
// console.log(change.value == true, 'toggleVisibility.value == false')
// if (toggleVisibility.value == 'false') {
// console.log(' false')
// } else {
// console.log('')
// }
const changeInfo = async () => {
await infoRef.value.validate()
if (change.value === true) {
// console.log(form.value.phone, '')
await userChangeService({
phone: form.value.phone,
id: form.value.id,
@ -164,6 +176,44 @@ const changeInfo = async () => {
}).then(() => {
ElMessage.success('修改成功')
emit('get-message', form.value.nickName)
form.value.newphone = ''
form.value.code = ''
})
dialogFormVisible.value = false
} else {
if (codecode.value === form.value.code) {
// console.log(form.value.newphone, '')
// console.log('')
await userChangeService({
phone: form.value.newphone,
id: form.value.id,
nickName: form.value.nickName,
}).then(() => {
ElMessage.success('修改成功')
form.value.phone = form.value.newphone
emit('get-phone', form.value.phone)
form.value.newphone = ''
form.value.code = ''
})
dialogFormVisible.value = false
} else {
ElMessage.error('验证码错误')
}
}
}
//
const pwdRef = ref()
const changePassword = async () => {
await pwdRef.value.validate()
await userChangeService({
phone: form.value.phone,
id: form.value.id,
nickName: form.value.nickName,
}).then(() => {
ElMessage.success('修改成功')
emit('get-message', form.value.nickName)
form.value.newphone = ''
form.value.code = ''
})
dialogFormVisible.value = false
}
@ -180,11 +230,11 @@ const onSubmit = async () => {
username: props.userData.username,
})
.then(() => {
ElMessage.success('密码修改成功')
ElMessage.success('修改成功')
passFormVisible.value = false
})
.catch((error) => {
console.log(error, 'error')
// console.log(error, 'error')
ElMessage.error(error.response.data.message)
})
pwdForm.value = {}
@ -209,8 +259,17 @@ const flagVisible = ref(true)
//
const currentDate = new Date()
const formattedDate = ref()
// const formattedDate = dayjs(currentDate).format('YYYY-MM-DD HH:mm:ss')
// const timer = ref()
let currentTime = ref(new Date().toLocaleString())
// 使 setInterval
let timer1 = setInterval(() => {
currentTime.value = new Date().toLocaleString()
}, 1000)
//
onUnmounted(() => {
clearInterval(timer1)
})
//
let timer
@ -233,7 +292,7 @@ onMounted(() => {
daysOnJob.value = Math.floor((currentDate - hireDate) / millisecondsPerDay)
let timer = setInterval(() => {
formattedDate.value = dayjs(currentDate).format('YYYY-MM-DD HH:mm:ss')
}, 100)
}, 1000)
})
onUnmounted(() => {
clearInterval(timer)
@ -260,14 +319,21 @@ onUnmounted(() => {
修改密码
</el-button>
</div>
<div class="time">{{ formattedDate }}</div>
<div class="time">{{ currentTime }}</div>
</div>
<el-dialog
v-model="dialogFormVisible"
title="登录信息"
style="width: 800px; text-align: center"
>
<el-form :model="form" :rules="infoRules" ref="infoRef" size="large">
<!-- <div v-if="change"> -->
<el-form
:model="form"
:rules="infoRules"
ref="infoRef"
size="large"
v-if="change"
>
<el-form-item label="用户名" :label-width="formLabelWidth">
<el-input :disabled="true" v-model="form.username" autocomplete="off" />
</el-form-item>
@ -288,13 +354,25 @@ onUnmounted(() => {
</el-icon>
</el-button>
</el-form-item>
</el-form>
<el-form :model="form" :rules="infoRules" ref="infoRef" size="large" v-else>
<el-form-item>
<el-icon style="margin-left: 20px" size="large" @click="change = true">
<Back />
</el-icon>
</el-form-item>
<el-form-item
label="验证码"
label="新手机号"
:label-width="formLabelWidth"
prop="code"
v-if="codeVisible"
prop="newphone"
>
<el-input
v-model="form.newphone"
autocomplete="off"
placeholder="请输入新手机号"
/>
</el-form-item>
<el-form-item label="验证码" :label-width="formLabelWidth" prop="code">
<el-input
type="text"
v-model="form.code"
@ -316,12 +394,11 @@ onUnmounted(() => {
</el-button>
</el-form-item>
</el-form>
<!-- </div> -->
<template #footer>
<div class="dialog-footer">
<el-button @click="cancleInfo">取消</el-button>
<el-button type="primary" @click="changeInfo, toggleInputValue">
确认
</el-button>
<el-button type="primary" @click="changeInfo">确认</el-button>
</div>
</template>
</el-dialog>

@ -15,7 +15,7 @@ import {
userMaxKnowService,
} from '@/api/user/user'
import useUserStore from '@/store/modules/user'
import fe from '@/assets/images/fe.jpg'
// import fe from '@/assets/images/fe.jpg'
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
// import { Picture } from 'element-plus/icons-vue'
@ -35,11 +35,21 @@ const name = ref()
const getMessage = (msg) => {
name.value = msg
}
const getPhone = (phone) => {
// console.log(msg, 'msg')
userStore.data.phone = phone
// console.log(data.value.icon, 'icon')
}
const getAvater = (avater) => {
// console.log(msg, 'msg')
userStore.data.icon = avater
// console.log(data.value.icon, 'icon')
}
const getInfo = (info) => {
console.log(userStore.userInfo, 'msg')
userStore.userInfo = info
// console.log(userStore.userData, 'icon111')
}
const courselist = ref([])
const img = ref()
const courseName = ref()
@ -74,8 +84,11 @@ onMounted(() => {
// })
//
userNewLikeService(userStore.data.id).then((res) => {
console.log(res.data, '最新收藏的课程')
loading.value = true
// console.log(res.data, '')
courselist.value = res.data
loading.value = false
// console.log(courselist.value.id, 'course')
// img.value = res.data.img
// courseName.value = res.data.name
@ -96,6 +109,7 @@ onMounted(() => {
:userData="data"
:name="name"
@get-message="getMessage"
@get-phone="getPhone"
v-if="flag"
></welcome>
</div>
@ -113,6 +127,7 @@ onMounted(() => {
:data="data"
:userData="infoData"
@get-avater="getAvater"
@getInfo="getInfo"
v-if="flag"
></status>
</div>
@ -165,12 +180,12 @@ onMounted(() => {
</a>
<div class="con">
<ul>
<li class="lessonlist-item" v-for="item in 4" :key="item">
<img :src="fe" class="lessonlist-item-img" />
<li class="lessonlist-item" v-for="(item, index) in 4" :key="item">
<!-- <img :src="fe" class="lessonlist-item-img" /> -->
<div class="lessonlist-item-info">
<p>{{ index + 1 }}</p>
<h5>课程名称</h5>
<p>教师</p>
</div>
</li>
</ul>
@ -178,7 +193,7 @@ onMounted(() => {
</div>
</el-col>
<el-col :span="6">
<div class="lesson" v-loading="loading">
<div class="lesson">
<a
href="#"
style="width: 90%; font-size: 12px; display: flex; margin: 0 auto"
@ -189,13 +204,15 @@ onMounted(() => {
<ul>
<li
class="lessonlist-item"
v-for="item in courselist"
v-for="(item, index) in courselist"
:key="item.id"
v-loading="loading"
>
<img :src="item.img || fe" class="lessonlist-item-img" />
<!-- <img :src="item.img || fe" class="lessonlist-item-img" /> -->
<div class="lessonlist-item-info">
<h5>{{ item.name }}</h5>
<p>{{ item.teacher }}</p>
<p>{{ index + 1 }}</p>
<h5>{{ item.name || '暂无' }}</h5>
<!-- <p>{{ item.teacher }}</p> -->
</div>
</li>
</ul>
@ -250,9 +267,9 @@ onMounted(() => {
background-color: pink;
padding-top: 30px;
// padding-bottom: 30px;
padding: 30px 10px 0px 10px;
padding: 25px 10px 0px 10px;
margin-bottom: 16px;
height: 317px;
height: 312px;
background: #ffffff;
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
border-radius: 6px 6px 6px 6px;
@ -282,8 +299,17 @@ onMounted(() => {
text-align: center;
line-height: 30px;
margin: 5px 10px;
border: 2px solid #ccc;
// border: 2px solid #ccc;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
width: 40%;
padding: 0px 15px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.button :hover {
overflow: visible;
white-space: normal;
}
a {
text-decoration: none;
@ -341,14 +367,17 @@ ul {
height: 40px;
background-color: #ffffff;
display: flex;
flex-direction: column;
// flex-direction: column;
justify-content: space-between;
// align-items: flex-start;
h3 {
font-weight: bold;
align-items: center;
h5 {
// font-weight: bold;
width: 80%;
text-align: center;
}
p {
font-size: small;
width: 20%;
color: #a0a5ab;
}
}

@ -1,44 +1,5 @@
<template>
<div>
<el-input v-model="inputValue" placeholder="Enter value"></el-input>
<el-button @click="toggleInputValue">切换</el-button>
<el-button @click="handleSubmit">Submit</el-button>
</div>
<div>消息</div>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
//
const inputValue = ref('')
//
const toggleInputValue = () => {
if (inputValue.value) {
//
inputValue.value = ''
} else {
// 'sample text'
inputValue.value = 'sample text' //
}
}
//
const handleSubmit = () => {
console.log('Submitted Value:', inputValue.value)
}
return {
inputValue,
toggleInputValue,
handleSubmit,
}
},
}
</script>
<style>
/* 添加一些样式(如果必要的话) */
</style>
<script></script>

@ -1,63 +1,184 @@
<script setup>
import { Search, Edit, Delete } from '@element-plus/icons-vue'
import { ref } from 'vue'
const tableData = [
{
date: '2016-05-03',
name: 'Tom',
state: 'California',
city: 'Los Angeles',
address: 'No. 189, Grove St, Los Angeles',
zip: 'CA 90036',
tag: 'Home',
},
{
date: '2016-05-02',
name: 'Tom',
state: 'California',
city: 'Los Angeles',
address: 'No. 189, Grove St, Los Angeles',
zip: 'CA 90036',
tag: 'Office',
},
{
date: '2016-05-04',
name: 'Tom',
state: 'California',
city: 'Los Angeles',
address: 'No. 189, Grove St, Los Angeles',
zip: 'CA 90036',
tag: 'Home',
},
{
date: '2016-05-01',
name: 'Tom',
state: 'California',
city: 'Los Angeles',
address: 'No. 189, Grove St, Los Angeles',
zip: 'CA 90036',
tag: 'Office',
},
{
date: '2016-05-01',
name: 'Tom',
state: 'California',
city: 'Los Angeles',
address: 'No. 189, Grove St, Los Angeles',
zip: 'CA 90036',
tag: 'Office',
},
{
date: '2016-05-01',
name: 'Tom',
state: 'California',
city: 'Los Angeles',
address: 'No. 189, Grove St, Los Angeles',
zip: 'CA 90036',
tag: 'Office',
},
]
import { ref, onMounted } from 'vue'
import {
stuListService,
stuPageService,
delStuListService,
reStuPassService,
changeStaService,
} from '@/api/user/stud'
import { ElMessage, ElMessageBox } from 'element-plus'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
// console.log(userStore.data.id, 'icon') //
const formLabelWidth = '60px'
const tableData = ref([])
//
const isFirstLoad = ref(true)
const params = ref({
page: 1,
pagesize: 3,
id: userStore.data.id,
name: '',
number: '',
})
//
const getData = async () => {
loading.value = true
await stuPageService(params.value).then((res) => {
tableData.value = res.data.Records
// console.log(tableData.value, 'params')
loading.value = false
console.log(res.data, 'res.data')
isFirstLoad.value = false
})
}
//
// const getData = async () => {
// // id.value = userStore.data.id
// // console.log(id.value, 'id.value')
// stuListService(2).then((res) => {
// tableData.value = res.data
// console.log(res.data, 'res.data')
// })
// }
//
const onSizeChange = (size) => {
//访
loading.value = true
params.value.page = 1
params.value.pagesize = size
//
getData()
loading.value = false
}
//
const onCurrentChange = (page) => {
params.value.page = page
getData()
}
//
const onReset = () => {
params.value.page = 1
getData()
}
//
const onSearch = () => {
params.value.pagenum = 1
// getArticleService()
}
const loading = ref(false)
//
const drawer = ref(false)
//
const editTable = (row) => {
drawer.value = true
console.log(row)
}
//
const delTable = async (row) => {
console.log(row.userId, 'delrow')
await ElMessageBox.confirm('您确定删除这条学生信息吗', '温馨提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
await delStuListService(row.userId).then(() => {
ElMessage({
message: '删除成功',
type: 'success',
})
})
getData()
}
//
const selectedIds = ref([])
function handleSelectionChange(selection) {
selectedIds.value = selection.map((row) => row.userId)
console.log(selectedIds.value, 'selectedIds.value')
}
const onDel = async () => {
await ElMessageBox.confirm('您确定删除这些学生信息吗', '温馨提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
await delStuListService(selectedIds.value).then(() => {
ElMessage({
message: '删除成功',
type: 'success',
})
})
getData()
}
//
const onResetPass = async () => {
await ElMessageBox.confirm('您确定重置这些学生密码吗', '温馨提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
await reStuPassService(selectedIds.value).then(() => {
ElMessage({
message: '重置成功',
type: 'success',
})
})
getData()
}
//
const status = ref()
async function handleStatusChange(row) {
status.value = row.status
// console.log(status.value, 'status')
// console.log(`: ${row.status}`)
// if (!isFirstLoad.value) {
// await changeStaService(status.value, row.userId).then(() => {
// ElMessage({
// message: '',
// type: 'success',
// })
// })
// }
// getData()
}
//
const studentId = ref()
const searchNumber = async () => {
params.value.number = studentId.value
console.log(params.value.number, 'params.value.number')
await stuPageService(params.value).then((res) => {
params.value.page = 1
console.log(res, 'change')
})
// getData()
}
//
const studentName = ref()
const searchInfo = async () => {
params.value.name = studentName.value
console.log(params.value.name, 'params.value.number')
await stuPageService(params.value).then((res) => {
params.value.page = 1
console.log(res, 'change')
})
// getData()
}
function clearInput() {
studentId.value = ''
}
function clearInput1() {
studentName.value = ''
}
const changeStatus = async (row) => {}
onMounted(() => {
getData()
})
</script>
<template>
<page-container title="文章分类">
@ -65,21 +186,43 @@ const loading = ref(false)
<template #header>
<div class="card-header">
<span>学生信息</span>
<el-button type="primary">重置密码</el-button>
<div>
<el-button type="primary" @click="onResetPass">重置密码</el-button>
<el-button type="danger" @click="onDel">批量删除</el-button>
</div>
</div>
</template>
<div class="content">
<el-form style="display: flex">
<el-form-item style="width: 250px">
<el-input class="input_search"></el-input>
<!-- <p>学号</p> -->
<el-input
class="input_search"
v-model="studentId"
@blur="clearInput"
></el-input>
<el-icon><Search /></el-icon>
</el-form-item>
<el-button class="btn_search">搜索</el-button>
<el-button class="btn_search" @click="searchNumber">
学号搜索
</el-button>
<el-form-item style="width: 250px; margin-left: 30px">
<el-input
class="input_search"
@blur="clearInput1"
v-model="studentName"
></el-input>
<el-icon><Search /></el-icon>
</el-form-item>
<el-button class="btn_search" @click="searchInfo">搜索</el-button>
<el-button type="primary" @click="onReset">重置</el-button>
</el-form>
<el-table
class="tableBox"
:data="tableData"
v-loading="loading"
@selection-change="handleSelectionChange"
:header-cell-style="{
background: '#FAFAFA',
color: '#666',
@ -103,21 +246,47 @@ const loading = ref(false)
style="width: 100%"
>
<el-table-column type="selection" width="55" height="100" />
<el-table-column prop="date" label="日期" />
<el-table-column prop="icon" label="头像">
<template v-slot="scope">
<img
:src="scope.row.icon"
alt="头像"
width="40"
height="40"
class="rounded-circle"
/>
</template>
</el-table-column>
<el-table-column prop="name" label="姓名" />
<el-table-column prop="state" label="状态" />
<el-table-column prop="city" label="City" width="300" />
<el-table-column prop="address" label="Address" />
<el-table-column prop="zip" label="Zip" />
<el-table-column prop="number" label="学号" width="120" />
<el-table-column prop="sex" label="性别" />
<el-table-column prop="username" label="用户名" />
<el-table-column prop="nickName" label="昵称" />
<el-table-column prop="phone" label="手机号" width="120" />
<el-table-column prop="major" label="专业" />
<el-table-column prop="yearAge" label="年级" />
<!-- <el-table-column prop="className" label="班级" /> -->
<el-table-column prop="createTime" label="创建时间" width="200" />
<el-table-column prop="status" label="状态">
<template v-slot="scope">
<el-switch
v-model="scope.row.status"
active-value="1"
inactive-value="0"
@change="handleStatusChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="125">
<template #default>
<template #default="{ row }">
<el-button
type="primary"
size="small"
:icon="Edit"
circle
plain
@click="handleClick"
@click="editTable(row)"
></el-button>
<el-button
:icon="Delete"
@ -125,6 +294,7 @@ const loading = ref(false)
size="small"
circle
plain
@click="delTable(row)"
></el-button>
</template>
</el-table-column>
@ -132,47 +302,82 @@ const loading = ref(false)
<el-empty description="没有数据" />
</template>
</el-table>
<!-- <el-table :data="tableData" style="width: 100%">
<el-table-column type="selection" width="65" />
<el-table-column prop="cate_name" label="分类名称" />
<el-table-column prop="cate_alias" label="分类别名" />
<el-table-column prop="address" label="操作">
<template #default="{ row, $index }">
<el-button
@click="onEditChannel(row, $index)"
:icon="Edit"
type="primary"
circle
plain
></el-button>
<el-button
@click="onDelChannel(row)"
:icon="Delete"
type="danger"
circle
plain
></el-button>
</template>
</el-table-column>
<template #empty>
<el-empty description="没有数据" />
</template>
</el-table> -->
<el-pagination
v-model:current-page="currentPage4"
v-model:page-size="pageSize4"
:page-sizes="[10, 20, 30, 40]"
v-model:current-page="params.page"
v-model:page-size="params.pagesize"
:page-sizes="[3, 5, 7, 10]"
:size="small"
:disabled="disabled"
:background="background"
:background="true"
layout="total, sizes, prev, pager, next, jumper"
:total="40"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:total="10"
@size-change="onSizeChange"
@current-change="onCurrentChange"
/>
</div>
</el-card>
<el-drawer v-model="drawer" title="编辑信息" style="">
<el-form :model="tableData" :rules="rules" ref="formRef">
<el-form-item label="头像" prop="icon">
<el-upload
v-model="tableData.icon"
class="avatar-uploader"
:http-request="upload"
:show-file-list="false"
>
<img v-if="imageUrl" :src="imageUrl" class="avatar" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
<template #tip>
<div class="el-upload__tip">
图片文件要为jpg/png格式小于500kb
</div>
</template>
</el-upload>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="tableData.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="学号" prop="number">
<el-input v-model="tableData.number" placeholder="请输入学号" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="tableData.sex">
<el-radio value="1"></el-radio>
<el-radio value="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="姓名" prop="username">
<el-input v-model="tableData.username" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="用户名" prop="nickName">
<el-input v-model="tableData.nickName" />
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input v-model="tableData.nickName" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="tableData.phone" />
</el-form-item>
<el-form-item label="专业" prop="major">
<el-input v-model="tableData.major" placeholder="请输入专业" />
</el-form-item>
<el-form-item label="年级" prop="yearAge">
<el-input v-model="tableData.yearAge" placeholder="请输入年级" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-input v-model="tableData.createTime" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-switch
v-model="tableData.status"
inline-prompt
active-text="启用"
inactive-text="禁用"
/>
<!-- <el-input v-model="tableData.status" placeholder="请输入姓名" /> -->
</el-form-item>
</el-form>
</el-drawer>
</page-container>
</template>
@ -223,6 +428,9 @@ const loading = ref(false)
font-weight: bold;
color: #af4141;
}
.rounded-circle {
border-radius: 50%;
}
::v-deep.el-table td.el-table__cell div {
// margin-left: -6px;
// width: 170px;
@ -238,4 +446,31 @@ const loading = ref(false)
justify-content: end;
font-size: 12px;
}
.avatar-uploader {
:deep() {
.avatar {
width: 178px;
height: 178px;
display: block;
}
.el-upload {
border: 1px dashed var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
}
.el-upload:hover {
border-color: var(--el-color-primary);
}
.el-icon.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
text-align: center;
}
}
}
</style>

Loading…
Cancel
Save