update code

master
bettleChen 1 year ago
parent 7614aa0d70
commit 4cbbdf88f6

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,19 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ignoredPackages">
<value>
<list size="0" />
</value>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="NetworkAnalog.test.createPyCore" />
</list>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/EduSystemFront.iml" filepath="$PROJECT_DIR$/.idea/EduSystemFront.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="a7b16338-e02b-4c72-ae80-f67f6a090b4f" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/front/src/components/login.vue" beforeDir="false" afterPath="$PROJECT_DIR$/front/src/components/login.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/front/src/plugins/axios.js" beforeDir="false" afterPath="$PROJECT_DIR$/front/src/plugins/axios.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/front/src/router/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/front/src/router/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/front/src/views/student/studentInfo.vue" beforeDir="false" afterPath="$PROJECT_DIR$/front/src/views/student/studentInfo.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/front/src/views/teacher/home.vue" beforeDir="false" afterPath="$PROJECT_DIR$/front/src/views/teacher/home.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/front/src/views/teacher/teacherInfo.vue" beforeDir="false" afterPath="$PROJECT_DIR$/front/src/views/teacher/teacherInfo.vue" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2V5wYC5KIYNo5p6HmfzXLGOIx17" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"last_opened_file_path": "D:/头哥/教务管理系统/EduSystem",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="a7b16338-e02b-4c72-ae80-f67f6a090b4f" name="Changes" comment="" />
<created>1694139293678</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1694139293678</updated>
<workItem from="1694139294790" duration="8000" />
</task>
<servers />
</component>
</project>

@ -67,8 +67,7 @@
const that = this const that = this
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
if (that.ruleForm.type == "student"){ this.$axios.post("http://127.0.0.1:8000/login", {
this.$axios.post("http://127.0.0.1:8000/login", {
username: this.ruleForm.username, username: this.ruleForm.username,
password: this.ruleForm.password, password: this.ruleForm.password,
type: this.ruleForm.type type: this.ruleForm.type
@ -77,18 +76,18 @@
sessionStorage.setItem("username", this.ruleForm.username) sessionStorage.setItem("username", this.ruleForm.username)
sessionStorage.setItem("type", this.ruleForm.type) sessionStorage.setItem("type", this.ruleForm.type)
sessionStorage.setItem("name", resp.data.data.name) sessionStorage.setItem("name", resp.data.data.name)
this.$router.push("/student/home") if (that.ruleForm.type == "student"){
this.$router.push("/student/home")
}else if (that.ruleForm.type == "teacher") {
this.$router.push("/teacher/home")
}else{
this.$router.push("/admin/home")
}
this.$message({message: resp.data.message, type: "success"}) this.$message({message: resp.data.message, type: "success"})
}else{ }else{
this.$message({message: resp.data.message, type: "error"}) this.$message({message: resp.data.message, type: "error"})
} }
}) })
}else if (that.ruleForm.type == "teacher") {
this.$router.push("/teacher/home")
}else{
this.$router.push("/admin/home")
}
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
return false; return false;

@ -7,7 +7,7 @@ import axios from "axios";
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
let config = { let config = {
// bashURL: "http://127.0.0.1:8000",
// timeout: 60 * 1000, // Timeout // timeout: 60 * 1000, // Timeout
withCredentials: true, // Check cross-site Access-Control withCredentials: true, // Check cross-site Access-Control
}; };

@ -90,3 +90,17 @@ const router = new VueRouter({
export default router export default router
router.beforeEach((to, from, next) => {
if (to.path === "/login") {
next()
}else {
if (sessionStorage.getItem("username") && sessionStorage.getItem("type")) {
const _type = sessionStorage.getItem("type")
next()
}else{
console.log("fdsafd")
next({path: "/login"})
}
}
})

@ -3,42 +3,43 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>修改信息</span> <span>修改信息</span>
</div> </div>
<el-form ref="form" :model="form" label-width="80px" size="mini"> <el-form ref="form" :model="form" label-width="80px" size="mini">
<el-form-item label="学号"> <el-form-item label="学号">
<el-input v-model="form.sid" disabled></el-input> <el-input v-model="form.sid" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="账号"> <el-form-item label="账号">
<el-input v-model="form.username" disabled></el-input> <el-input v-model="form.username" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码"> <el-form-item label="密码">
<el-input v-model="form.password"></el-input> <el-input v-model="form.password" type="password"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="form.name" disabled></el-input> <el-input v-model="form.name" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="性别"> <el-form-item label="性别">
<el-radio-group v-model="form.sex" size="medium" disabled> <el-radio-group v-model="form.sex" size="medium" disabled>
<el-radio border label="男" icon="el-icon-female"></el-radio> <el-radio border label="男" icon="el-icon-female"></el-radio>
<el-radio border label="女" icon="el-icon-male"></el-radio> <el-radio border label="女" icon="el-icon-male"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="班级"> <el-form-item label="班级">
<el-input v-model="form.class_name" disabled></el-input> <el-input v-model="form.class_name" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="年级"> <el-form-item label="年级">
<el-input v-model="form.grade" disabled></el-input> <el-input v-model="form.grade" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="专业"> <el-form-item label="专业">
<el-input v-model="form.major" disabled></el-input> <el-input v-model="form.major" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item size="large"> <el-form-item size="large">
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
</template> </template>
<script> <script>
import axios from 'axios';
export default { export default {
name: "studentInfo", name: "studentInfo",
data() { data() {
@ -57,8 +58,33 @@ export default {
}, },
methods: { methods: {
onSubmit() { onSubmit() {
console.log('submit!'); axios.post("http://127.0.0.1:8000/student/", this.form).then(resp => {
if (resp.data.code === 0 ){
this.$message({message: resp.data.message, type: "success"})
sessionStorage.clear()
this.$router.push("/login")
}else {
this.$message({message: resp.data.message, type: "error"})
}
})
} }
},
mounted() {
axios("http://127.0.0.1:8000/userinfo?username="+sessionStorage.getItem('username')+"&type="+sessionStorage.getItem("type")).then(resp => {
if (resp.data.code === 0 ){
const data = resp.data.data
this.form.sid = data.sid
this.form.username = data.username
this.form.password = data.password
this.form.name = data.name
this.form.sex = data.sex
this.form.grade = data.grade
this.form.class_name = data.class_name
this.form.major = data.major
}else {
this.$message({message: resp.data.message, type: "error"})
}
})
} }
} }
</script> </script>

@ -1,10 +1,84 @@
<template> <template>
<h1>老师界面</h1> <el-descriptions class="margin-top" :column="3" border>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
编号
</template>
{{ info.tid }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
用户名
</template>
{{ info.username }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-mobile-phone"></i>
姓名
</template>
{{ info.name }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-location-outline"></i>
职称
</template>
{{ info.title }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-tickets"></i>
性别
</template>
<el-tag size="small">{{ info.sex }}</el-tag>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-office-building"></i>
学历
</template>
{{ info.education }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-office-building"></i>
院系
</template>
{{ info.dept }}
</el-descriptions-item>
</el-descriptions>
</template> </template>
<script> <script>
export default { export default {
name: "home" name: "home",
data() {
return {
info: {
tid: "",
username: "",
password: "",
name: "",
sex: "",
title: "",
education: "",
dept: ""
}
}
},
mounted() {
axios("http://127.0.0.1:8000/userinfo?username="+sessionStorage.getItem('username')+"&type="+sessionStorage.getItem("type")).then(resp => {
if (resp.data.code === 0 ){
this.info = resp.data.data
}else {
this.$message({message: resp.data.message, type: "error"})
}
})
}
} }
</script> </script>

@ -19,7 +19,7 @@
<el-menu-item index="/teacher/home"><template slot="title"><i class="el-icon-info"></i>老师主页</template></el-menu-item> <el-menu-item index="/teacher/home"><template slot="title"><i class="el-icon-info"></i>老师主页</template></el-menu-item>
<el-menu-item index="/teacher/teacherInfo"><template slot="title"><i class="el-icon-setting"></i>信息编辑</template></el-menu-item> <el-menu-item index="/teacher/teacherInfo"><template slot="title"><i class="el-icon-setting"></i>信息编辑</template></el-menu-item>
<el-menu-item index="/teacher/studentManage"><template slot="title"><i class="el-icon-menu"></i>学生管理</template></el-menu-item> <el-menu-item index="/teacher/studentManage"><template slot="title"><i class="el-icon-menu"></i>学生管理</template></el-menu-item>
<el-menu-item index="/teacher/courseManage"><template slot="title"><i class="el-icon-tickets"></i>管理</template></el-menu-item> <el-menu-item index="/teacher/courseManage"><template slot="title"><i class="el-icon-tickets"></i>课管理</template></el-menu-item>
</el-menu> </el-menu>
</el-aside> </el-aside>
<el-main> <el-main>

@ -1,13 +1,313 @@
<template> <template>
<h1>学生管理</h1> <div>
<el-card class="box-card">
<el-form ref="form" :model="form" label-width="80px" size="mini" class="demo-form-inline" :inline="true">
<el-form-item label="学号">
<el-input v-model="form.sid" ></el-input>
</el-form-item>
<el-form-item label="姓名">
<el-input v-model="form.name" ></el-input>
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="form.sex" size="medium" >
<el-radio border label="男" icon="el-icon-female"></el-radio>
<el-radio border label="女" icon="el-icon-male"></el-radio>
<el-radio border label="" icon="el-icon-male"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="班级">
<el-input v-model="form.class_name" ></el-input>
</el-form-item>
<el-form-item label="年级">
<el-input v-model="form.grade" ></el-input>
</el-form-item>
<el-form-item label="专业">
<el-input v-model="form.major" ></el-input>
</el-form-item>
<el-form-item size="large">
<el-button type="primary" @click="search"></el-button>
</el-form-item>
<el-form-item size="large">
<el-button type="primary" icon="el-icon-plus" @click="dialog = !dialog;isAdd=true">新增学生</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card" style="margin-top: 10px;">
<el-table
:data="tableData"
style="width: 100%">
<el-table-column
label="学号"
width="80">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.pk }}</span>
</template>
</el-table-column>
<el-table-column
label="姓名"
width="120">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium">{{ scope.row.fields.name }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column
label="用户名"
width="150">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fields.username }}</span>
</template>
</el-table-column>
<el-table-column
label="密码"
width="150">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fields.password }}</span>
</template>
</el-table-column>
<el-table-column
label="性别"
width="80">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fields.sex }}</span>
</template>
</el-table-column>
<el-table-column
label="年级"
width="150">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fields.grade }}</span>
</template>
</el-table-column>
<el-table-column
label="班级"
width="150">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fields.class_name }}</span>
</template>
</el-table-column>
<el-table-column
label="专业"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.fields.major }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
style="text-align: center;margin-top: 10px;"
hide-on-single-page
background
:current-page="currentPage"
:page-size="10"
@current-change="handleCurrentChange"
layout="prev, pager, next, total"
:total="total">
</el-pagination>
</el-card>
<el-drawer
:title="isAdd ? '新增':'编辑'"
:before-close="handleClose"
:visible.sync="dialog"
direction="rtl"
custom-class="demo-drawer"
ref="drawer"
>
<div class="demo-drawer__content">
<el-form ref="addForm" :model="addForm" label-width="80px" size="mini">
<el-form-item label="学号" >
<el-input v-model="addForm.sid" disabled></el-input>
</el-form-item>
<el-form-item label="账号">
<el-input v-model="addForm.username" ></el-input>
</el-form-item>
<el-form-item label="密码">
<el-input v-model="addForm.password" type="password"></el-input>
</el-form-item>
<el-form-item label="姓名">
<el-input v-model="addForm.name" ></el-input>
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="addForm.sex" size="medium" >
<el-radio border label="男" icon="el-icon-female"></el-radio>
<el-radio border label="女" icon="el-icon-male"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="班级">
<el-input v-model="addForm.class_name" ></el-input>
</el-form-item>
<el-form-item label="年级">
<el-input v-model="addForm.grade" ></el-input>
</el-form-item>
<el-form-item label="专业">
<el-input v-model="addForm.major" ></el-input>
</el-form-item>
</el-form>
<div class="demo-drawer__footer">
<el-button @click="cancelForm"> </el-button>
<el-button type="primary" @click="$refs.drawer.closeDrawer()" :loading="loading">{{ loading ? '提交中 ...' : "保存" }}</el-button>
</div>
</div>
</el-drawer>
</div>
</template> </template>
<script> <script>
export default { import axios from 'axios';
export default {
data() {
return {
currentPage: 1,
total: 0,
isAdd: true,
dialog: false,
loading: false,
title: "新增学生",
tableData: [{
sid: "",
username: "",
password: "",
name: "",
sex: "",
grade: "",
class_name: "",
major: ""
}],
form: {
sid: '',
name: '',
sex: '',
grade: '',
class_name: '',
major: '',
},
addForm: {
sid: "",
username: '',
password: '',
name: '',
sex: '男',
grade: '',
class_name: '',
major: '',
}
}
},
methods: {
handleEdit(index, row) {
console.log(row)
this.addForm = new Object(row.fields)
this.addForm.sid = row.pk
this.dialog = true
this.isAdd = false
},
handleDelete(index, row) {
this.$confirm('此操作将永久删除该学生, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.get("http://127.0.0.1:8000/student/delete?sid=" + row.pk).then(resp => {
if (resp.data.code === 0){
this.$message({
type: 'success',
message: resp.data.message
});
this.getAllStudent()
}else {
this.$message({
type: 'error',
message: resp.data.message
});
}
})
} }).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
handleCurrentChange(val){
this.currentPage = val
this.getAllStudent()
},
getAllStudent() {
axios.post("http://127.0.0.1:8000/student/search?currentPage="+this.currentPage+"&pageSize=10", this.form).then(resp => {
if (resp.data.code === 0) {
this.total = resp.data.pageTotal
this.tableData = resp.data.data
}
})
},
search(){
this.getAllStudent()
},
handleClose(done) {
if (this.loading) {
return;
}
this.$confirm('确定要提交表单吗?')
.then(_ => {
this.loading = true;
this.timer = setTimeout(() => {
done();
axios.post(this.addForm.sid === '' ? "http://127.0.0.1:8000/student/add" : "http://127.0.0.1:8000/student/", this.addForm).then(resp => {
if(resp.data.code === 0){
this.$message({message: resp.data.message, type: "sucess"})
this.getAllStudent()
this.loading = false
this.addForm = {
sid: "",
username: '',
password: '',
name: '',
sex: '男',
grade: '',
class_name: '',
major: '',
}
}else{
this.$message({message: resp.data.message, type: "error"})
}
})
}, 1000);
})
.catch(_ => {});
console.log("close")
},
cancelForm() {
this.loading = false;
this.dialog = false;
this.addForm = {
sid: "",
username: '',
password: '',
name: '',
sex: '男',
grade: '',
class_name: '',
major: '',
}
clearTimeout(this.timer);
}
},
mounted() {
this.getAllStudent()
}
}
</script> </script>
<style>
</style>

@ -3,33 +3,33 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>修改信息</span> <span>修改信息</span>
</div> </div>
<el-form-item label="学号">
<el-input v-model="form.sid"></el-input>
</el-form-item>
<el-form ref="form" :model="form" label-width="80px" size="mini"> <el-form ref="form" :model="form" label-width="80px" size="mini">
<el-form-item label="编号">
<el-input v-model="form.tid" disabled></el-input>
</el-form-item>
<el-form-item label="账号"> <el-form-item label="账号">
<el-input v-model="form.s_username" disabled></el-input> <el-input v-model="form.username" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码"> <el-form-item label="密码">
<el-input v-model="form.s_password"></el-input> <el-input v-model="form.password" type="password"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="form.s_name" disabled></el-input> <el-input v-model="form.name" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="性别"> <el-form-item label="性别">
<el-radio-group v-model="form.s_sex" size="medium" disabled> <el-radio-group v-model="form.sex" size="medium" disabled>
<el-radio border label="男" icon="el-icon-female"></el-radio> <el-radio border label="男" icon="el-icon-female"></el-radio>
<el-radio border label="女" icon="el-icon-male"></el-radio> <el-radio border label="女" icon="el-icon-male"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="班级"> <el-form-item label="职称">
<el-input v-model="form.s_class_name" disabled></el-input> <el-input v-model="form.title" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="年级"> <el-form-item label="学历">
<el-input v-model="form.s_grade" disabled></el-input> <el-input v-model="form.education" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="专业"> <el-form-item label="院系">
<el-input v-model="form.s_major" disabled></el-input> <el-input v-model="form.dept" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item size="large"> <el-form-item size="large">
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
@ -44,21 +44,38 @@ export default {
data() { data() {
return { return {
form: { form: {
sid: 1, tid: "",
s_username: '', username: "",
s_password: '', password: "",
s_name: '', name: "",
s_sex: '男', sex: "",
s_grade: '', title: "",
s_class_name: '', education: "",
s_major: '', dept: ""
} }
}; };
}, },
methods: { methods: {
onSubmit() { onSubmit() {
console.log('submit!'); axios.post("http://127.0.0.1:8000/teacher/", this.form).then(resp => {
if (resp.data.code === 0 ){
this.$message({message: resp.data.message, type: "success"})
sessionStorage.clear()
this.$router.push("/login")
}else {
this.$message({message: resp.data.message, type: "error"})
}
})
} }
},
mounted() {
axios("http://127.0.0.1:8000/userinfo?username="+sessionStorage.getItem('username')+"&type="+sessionStorage.getItem("type")).then(resp => {
if (resp.data.code === 0 ){
this.form = resp.data.data
}else {
this.$message({message: resp.data.message, type: "error"})
}
})
} }
} }
</script> </script>

Loading…
Cancel
Save