<template> <div class=“card” style=“width: 50%;”> <div>个人中心</div> <el-form ref=“formRef” :model=“data.user” label-width=“110px” style=“padding-right: 60px; padding-top: 20px” > <el-form-item prop="username" label="账号" > <el-input v-model="data.user.username" autocomplete="off" placeholder="请输入账号"/> </el-form-item> <el-form-item label="姓名" prop="name"> <el-input v-model="data.user.name" autocomplete="off" placeholder="请输入姓名" /> </el-form-item> <el-form-item label="手机号" prop="phone"> <el-input v-model="data.user.phone" autocomplete="off" placeholder="请输入手机号" /> </el-form-item> <el-form-item label="头像" prop="avatar"> <el-upload action="http://localhost:8080/files/upload" :headers="{token:data.user.token}" :on-success="handleFileSuccess" list-type="picture" > <el-button type="primary">上传头像</el-button> </el-upload> </el-form-item> </el-form> <div style="text-align: center;"> <el-button type=“primary” style=“padding: 14px 18px;” @click=“update”>保存</el-button> </div> </div> </template> <script setup> import request from ‘@/utils/request’ import { ElMessage } from ‘element-plus’ const data=reactive({ user: JSON.parse(localStorage.getItem(‘xm-pro-user’)||‘{}’),//跟自己的文件名一致 }) const handleFileSuccess=(res)=>{ data.form.avatar=res.data } const emit=defineEmits([‘updateUser’]) const update=()=>{ let url if(data.user.role===‘ADMIN’){ url=‘/admin/update’ } if(data.user.role===‘TEACHER’){ url=‘/teacher/update’ } if(data.user.role===‘STUDENT’){ url=‘/student/update’ } request.put(url,data.user).then(res=>{ if(res.code==='200'){ ElMessage.success('更新成功') localStorage.setItem("xm-pro-user",JSON.stringify(data.user)) emit('updateUser') } }) } </script>为什么点击上传头像的时候有问题
相关推荐








<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
学习计划表
<form>
学习科目<input type="text"
class="form-control" placeholder="请输入学习科目">
学习内容<textarea
class="form-control" placeholder="请输入学习内容" style="height: 32px;"></textarea>
学习地点<select
class="form-select form-select-sm">
<option value="自习室">自习室</option>
<option value="图书馆">图书馆</option>
<option value="宿舍">宿舍</option>
</select>
<button type="submit" class="btn btn-primary">添加</button>
</form>
序号
学习科目
学习内容
学习地点
完成状态
操作
1
Vue.js前端实战开发
学习指令,例如v-if、v-for、v-model等
自习室
<input class="form-check-input" type="checkbox" role="switch"
id="cb1"><label class="form-check-label" for="cb1">未完成</label>
删除
2
1
自习室
<input class="form-check-input" type="checkbox" role="switch"
id="cb2"><label class="form-check-label" for="cb2">未完成</label>
删除
</body>用vue3寫一個學習計劃表




<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>入库模块</title> <style> body { background-color: #f8f9fa; font-family: Arial, sans-serif; } .container { max-width: 1000px; min-height: 600px; /* 可根据需求调整这个值来改变整体框的最小高度 */ } .header { margin: 20px 0; color: #343a40; font-weight: bold; } .form-group { margin-bottom: 1.5rem; /* 增加表单组之间的间距 */ } .list-group-item { display: grid; grid-template-columns: repeat(3, 1fr); justify-content: space-between; align-items: center; width: 100%; padding: 5px 10px; border: 1px solid #dee2e6; border-radius: 5px; box-sizing: border-box; } .list-group-item span { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .card { border: none; border-radius: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); padding: 20px; background-color: #ffffff; } .btn-primary { background-color: #007bff; border: none; width: 200px; /* 设置按钮宽度为 50 像素 */ } .btn-primary:hover { background-color: #0056b3; } footer { margin-top: 20px; padding: 10px 0; background-color: #343a40; color: white; border-radius: 0 0 15px 15px; } /* 为查询按钮添加左外边距 */ .btn-query { margin-left: 100px; } /* 新增的按钮容器样式 */ .button-container { text-align: center; } /* 新增的样式,设置入库编号文本框的尺寸 */ .small-input { width: 150px; /* 你可以根据需要调整宽度 */ } /* 新增样式,使入库编号输入框在同一行显示 */ .id-inputs { display: flex; flex-wrap: wrap; align-items: center; } .id-inputs label { margin-right: 5px; } .id-row { display: flex; flex-wrap: wrap; align-items: center; width: 100%; } </style> </head> <body> 金铜线入库模块 <form method="POST"> <label for="item">整半卷类型</label> <select class="form-control" id="category" name="category" required> <option value="" disabled selected>请选择入库类型</option> <option value="整卷">整卷</option> <option value="半卷">半卷</option> {% if category %} <option value="{{ category }}" selected>{{ category }}</option> {% endif %} </select> <label for="item">入库型号</label> <select class="form-control" id="type" name="item" required> <option value="" disabled selected>请选择物品编号</option> <option value="70694">70694 - AU</option> <option value="70704">70704 - AU</option> <option value="70774">70774 - AU</option> <option value="70794">70794 - CU</option> <option value="70804">70708 - CU</option> <option value="70784">7058779 - CU</option> </select> <label for="batchNumber">入库批号</label> <input type="text" class="form-control" id="batchNumber" name="batchNumber" required> <label for="ID1">编号#1</label> <input type="text" class="form-control small-input" id="ID1" name="ID1"> <label for="ID2">编号#2</label> <input type="text" class="form-control small-input" id="ID2" name="ID2"> <label for="ID3">编号#3</label> <input type="text" class="form-control small-input" id="ID3" name="ID3"> <label for="ID4">编号#4</label> <input type="text" class="form-control small-input" id="ID4" name="ID4"> <label for="ID5">编号#5</label> <input type="text" class="form-control small-input" id="ID5" name="ID5"> <label for="ID6">编号#6</label> <input type="text" class="form-control small-input" id="ID6" name="ID6"> <label for="ID7">编号#7</label> <input type="text" class="form-control small-input" id="ID7" name="ID7"> <label for="ID8">编号#8</label> <input type="text" class="form-control small-input" id="ID8" name="ID8"> <label for="ID9">编号#9</label> <input type="text" class="form-control small-input" id="ID9" name="ID9"> <label for="ID10">编号#10</label> <input type="text" class="form-control small-input" id="ID10" name="ID10"> <label for="ID11">编号#11</label> <input type="text" class="form-control small-input" id="ID11" name="ID11"> <label for="ID12">编号#12</label> <input type="text" class="form-control small-input" id="ID12" name="ID12"> <label for="quantity">入库数量</label> <input type="number" class="form-control" id="quantity" name="quantity" value="1" required> <label for="date">入库日期</label> <input type="datetime-local" class="form-control" id="date" name="date" required value="{{ date }}"> <label for="shift">入库班次</label> <select class="form-control" id="shift" name="shift" required> <option value="" disabled selected>请选择班次</option> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> <option value="D">D</option> {% if shift %} <option value="{{ shift }}" selected>{{ shift }}</option> {% endif %} </select> <label for="barge">员工工号</label> <input type="text" class="form-control small-input" id="barge" name="barge" required value="{{ username }}"> <button type="submit" class="btn btn-primary">入库</button> <button type="button" class="btn btn-primary btn-query" id="queryButton">查询</button> </form> 当前库存 入库类型 在库型号 在库数量 {% for data in inventory_data %} {{ data.category }} {{ data.item }} {{ data.quantity }} {% endfor %} 返回首页 <script> function submitForm(event) { event.preventDefault(); // 阻止表单默认提交行为 // 获取表单数据 const data = { category: document.getElementById('category').value, type: document.getElementById('type').value, batchNumber: document.getElementById('batchNumber').value, ID1: document.getElementById('ID1').value, ID2: document.getElementById('ID2').value, ID3: document.getElementById('ID3').value, ID4: document.getElementById('ID4').value, ID5: document.getElementById('ID5').value, ID6: document.getElementById('ID6').value, ID7: document.getElementById('ID7').value, ID8: document.getElementById('ID8').value, ID9: document.getElementById('ID9').value, ID10: document.getElementById('ID10').value, ID11: document.getElementById('ID11').value, ID12: document.getElementById('ID12').value, quantity: document.getElementById('quantity').value, date: document.getElementById('date').value, shift: document.getElementById('shift').value, barge: document.getElementById('barge').value }; console.log(data) fetch('/into_storage', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(result => { alert(result.message); // 简单提示结果 if (result.status === 'success') { // 重置表单(可选) document.getElementById('batchNumber').value = ''; for(let i=1; i<=12; i++) { document.getElementById(ID${i}).value = ''; } } }) .catch(error => alert('网络错误: ' + error)); } // 绑定表单提交事件 document.querySelector('form').addEventListener('submit', submitForm); </script> </body> </html> 帮忙优化一下修改,要求绑定入库按钮id来触发传输数据到后端flask框架,使用fetch交互,其它按钮先不用管


### 丰富蜡笔小新主题网页设计的详细方案
以下是一个基于现有要求和更丰富内容的设计方案,增加了标题、段落、图片、列表、表格等元素,并保持HTML和CSS分离,代码清晰且带注释。
---
#### 文件结构
project/
│
├── index.html # 首页
├── about.html # 关于蜡笔小新的页面
├── characters.html # 角色介绍页面
├── gallery.html # 图片画廊页面
├── contact.html # 联系我们页面
├── css/
│ └── styles.css # 样式文件
└── images/ # 图片资源目录
---
### 1. index.html (首页)
html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>蜡笔小新 - 首页</title>
</head>
<body>
首页
关于蜡笔小新
角色介绍
图片画廊
联系我们
欢迎来到蜡笔小新世界!
这是一个关于蜡笔小新的多页面网站。
主要角色列表
角色名
年龄
特点
野原新之助
5岁
调皮可爱
野原美伢
28岁
温柔贤惠
</body>
</html>
---
### 2. about.html (关于蜡笔小新的页面)
html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>蜡笔小新 - 关于蜡笔小新</title>
</head>
<body>
首页
关于蜡笔小新
角色介绍
图片画廊
联系我们
关于蜡笔小新
蜡笔小新是由臼井仪人创作的漫画作品,讲述了五岁男孩野原新之助的生活故事。
作者:臼井仪人
首次出版年份:1990年
类型:喜剧
</body>
</html>
---
### 3. characters.html (角色介绍页面)
html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>蜡笔小新 - 角色介绍</title>
</head>
<body>
首页
关于蜡笔小新
角色介绍
图片画廊
联系我们
角色介绍
野原新之助:五岁的调皮男孩,喜欢恶作剧。
野原美伢:新之助的母亲,温柔但有时严厉。
野原广志:新之助的父亲,工作努力但有点懒散。
小白:家里的宠物狗,聪明伶俐。
</body>
</html>
---
### 4. gallery.html (图片画廊页面)
html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>蜡笔小新 - 图片画廊</title>
</head>
<body>
首页
关于蜡笔小新
角色介绍
图片画廊
联系我们
图片画廊
</body>
</html>
---
### 5. contact.html (联系我们页面)
html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>蜡笔小新 - 联系我们</title>
</head>
<body>
首页
关于蜡笔小新
角色介绍
图片画廊
联系我们
联系我们
<form action="#" method="post">
<label for="name">姓名:</label>
<input type="text" id="name" name="name" required>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required>
<label for="message">留言:</label>
<textarea id="message" name="message" rows="5" cols="30" required></textarea>
<input type="submit" value="提交">
</form>
</body>
</html>
---
### 6. styles.css (样式文件)
css
/* 全局样式 */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
line-height: 1.6;
}
/* 导航栏样式 */
.navbar ul {
list-style-type: none;
background-color: #f4f4f4;
padding: 0;
overflow: hidden;
}
.navbar li {
float: left;
}
.navbar li a {
display: block;
color: #333;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.navbar li a:hover {
background-color: #ddd;
}
/* 主内容区样式 */
.main-content {
padding: 20px;
min-height: 100vh; /* 页面高度大于一屏 */
}
.main-content h1 {
text-align: center;
}
.main-content .image {
max-width: 100%;
height: auto;
display: block;
margin: auto;
}
/* 表格样式 */
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table caption {
font-size: 1.2em;
margin-bottom: 10px;
}
/* 脚注样式 */
footer {
text-align: center;
padding: 10px;
background-color: #f4f4f4;
position: relative;
bottom: 0;
width: 100%;
}
你给的这些html代码还是内容不够丰富,能不能多一点





