Files
2024-06-05 11:36:16 +08:00

104 lines
3.6 KiB
HTML

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="{% static 'js/bootstrap-5.3.0/css/bootstrap.css' %}">
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/echarts.min.js' %}"></script>
<script src="{% static 'js/vue.js' %}"></script>
{# <script src="{% static 'js/elementui.js' %}"></script>#}
{# <link rel="stylesheet" href="{% static 'js/lib-master/theme-chalk/index.css' %}">#}
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<title>123</title>
</head>
<body>
<div id="app">
<el-card class="box-card" style="width: 80%;margin: auto">
<el-descriptions class="margin-top" title="个人信息" :column="2" border>
<template slot="extra">
<el-button @click="change()" type="primary" size="small">更改密码</el-button>
</template>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
用户名
</template>
{{ username }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-tickets"></i>
备注
</template>
<el-tag size="small" v-if="profession==1">
老师
</el-tag>
<el-tag size="small" v-if="profession!=1">
学生
</el-tag>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
当前已提交文件:
</template>
{{ number }}
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-dialog title="更改密码" :visible.sync="dialogFormVisible" style="width: 50%;margin: auto">
<el-form :model="form">
<el-form-item label="密码">
<el-input v-model="form.password" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button id="submit" type="primary" @click="changePassword()">确 定</el-button>
</div>
</el-dialog>
</div>
</body>
<script>
new Vue({
el: "#app",
methods: {
change() {
this.dialogFormVisible = true
},
changePassword() {
this.dialogFormVisible = false
const form = this.form;
$.ajax({
type: 'POST',
url: '/change/',
data: form, // 将表单数据序列化为字符串
success: function (data) {
if (data.result === 1) {
this.$message({
message: '修改密码成功!',
type: 'success'
});
}
}
});
}
},
data() {
return {
profession: {{ profession|safe }},
dialogFormVisible: false,
form: {}
}
},
})
</script>
</html>