| | |
| | | <div class="info"> |
| | | <div style="position: relative"> |
| | | <el-upload |
| | | :disabled="true" |
| | | class="avatar-uploader" |
| | | action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" |
| | | action="#" |
| | | :show-file-list="false" |
| | | :on-success="handleAvatarSuccess" |
| | | :before-upload="beforeAvatarUpload" |
| | | > |
| | | <img v-if="imageUrl" :src="imageUrl" class="avatar" /> |
| | | <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> |
| | | <el-image |
| | | style="width: 100px; height: 100px" |
| | | :src="'http://192.168.0.80:5000' + userInfo.headImageUrl" |
| | | :fit="fit" |
| | | /> |
| | | <!-- <img |
| | | v-if="userInfo.headImageUrl" |
| | | :src="'http://192.168.0.80:5000' + userInfo.headImageUrl" |
| | | class="avatar" |
| | | /> |
| | | <el-icon v-else class="avatar-uploader-icon"> |
| | | <Plus /> |
| | | </el-icon> --> |
| | | </el-upload> |
| | | <span |
| | | style=" |
| | |
| | | /></span> |
| | | </div> |
| | | <el-form |
| | | :model="formInline" |
| | | :model="userInfo" |
| | | style="flex: 1" |
| | | class="demo-form-inline" |
| | | label-position="right" |
| | |
| | | </el-col> |
| | | <el-col :span="3" |
| | | ><el-form-item label="ç¨æ·åç»:"> |
| | | <span>ç»´ä¿é¨</span> |
| | | <span>{{ userInfo.roleName }}</span> |
| | | </el-form-item></el-col |
| | | > |
| | | </el-row> |
| | |
| | | > |
| | | <el-col :span="3"> |
| | | <el-form-item label="ç¨æ·è§è²:"> |
| | | <span>2021-06-30</span> |
| | | <span>{{ userInfo.roleName }}</span> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | <el-input |
| | | size="small" |
| | | v-model="form.userName" |
| | | v-model="form.usertruename" |
| | | placeholder="请è¾å
¥" |
| | | style="width: 18.375rem" |
| | | /> |
| | |
| | | > |
| | | </template> |
| | | <el-input |
| | | v-model="form.phoneNo" |
| | | v-model="form.phone" |
| | | size="small" |
| | | placeholder="请è¾å
¥" |
| | | style="width: 18.375rem" |
| | |
| | | <span style="color: red; margin-right: 0.2rem">*</span> |
| | | <span style="font-size: 0.88rem; color: black; font-weight: bold" |
| | | >人è¸å¾ç</span |
| | | ><span |
| | | > |
| | | <!-- <span |
| | | style=" |
| | | color: rgba(255, 0, 0, 1); |
| | | font-size: 0.75rem; |
| | | margin-left: 0.5rem; |
| | | " |
| | | >æ³¨ï¼æå¤å¯ä¸ä¼ ä¸å¼ ï¼å¾çéè¦æ£è§ç人åè¯ä»¶ç
§</span |
| | | > |
| | | > --> |
| | | </div> |
| | | </template> |
| | | <el-upload |
| | | ref="upload" |
| | | name="fileInput" |
| | | class="avatar-uploader" |
| | | action="#" |
| | | action="http://115.159.85.185:9098/api/User/SaveFiles" |
| | | list-type="picture-card" |
| | | :auto-upload="false" |
| | | :limit="3" |
| | | :auto-upload="true" |
| | | limit="1" |
| | | @before-upload="beforeAvatarUpload" |
| | | :on-success="handleAvatarSuccess" |
| | | :file-list="fileList != [] ? fileList : []" |
| | | > |
| | | <el-icon><Plus /></el-icon> |
| | | <el-icon> |
| | | <Plus /> |
| | | </el-icon> |
| | | |
| | | <template #file="{ file }"> |
| | | <div> |
| | |
| | | class="el-upload-list__item-delete" |
| | | @click="handleDownload(file)" |
| | | > |
| | | <el-icon size="15"><Download /></el-icon> |
| | | <el-icon size="15"> |
| | | <Download /> |
| | | </el-icon> |
| | | </span> |
| | | <span |
| | | v-if="!disabled" |
| | | class="el-upload-list__item-delete" |
| | | @click="handleRemove(file)" |
| | | > |
| | | <el-icon size="15"><Delete /></el-icon> |
| | | <el-icon size="15"> |
| | | <Delete /> |
| | | </el-icon> |
| | | </span> |
| | | </span> |
| | | </div> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ¥çå¾çå¼¹åºæ¡ --> |
| | | <el-dialog v-model="imgdialogVisible" center width="980"> |
| | | <img w-full :src="dialogImageUrl" alt="Preview Image" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import { ref, reactive } from "vue"; |
| | | import { GetUserInfo, UpdatePassword, UpdateUser } from "@/api/user"; |
| | | import { |
| | | GetUserInfo, |
| | | UpdatePassword, |
| | | UpdateUser, |
| | | Upuserbase, |
| | | } from "@/api/user"; |
| | | import { ElMessage } from "element-plus"; |
| | | const formInline = reactive({ |
| | | user: "", |
| | | region: "", |
| | | date: "", |
| | | }); |
| | | const form = ref({}); |
| | | const newPwd = ref(""); |
| | | const onSubmit = () => { |
| | | // UpdateUser().then((res) => {}); |
| | | console.log(form.value); |
| | | |
| | | console.log("submit!"); |
| | | }; |
| | | const upload = ref(); |
| | | const form = ref({ |
| | | id: JSON.parse(localStorage.getItem("user")).id, |
| | | usertruename: "", |
| | | phone: "", |
| | | files: "", |
| | | }); |
| | | const newPwd = ref(""); |
| | | const dialogVisible = ref(false); |
| | | //æ¥çå¾ç |
| | | const imgdialogVisible = ref(false); |
| | | const fileList = ref([]); |
| | | |
| | | const rules = reactive({ |
| | | oldPwd: [{ required: true, message: "请è¾å
¥æ§å¯ç ", trigger: "blur" }], |
| | | newPwd: [{ required: true, message: "请è¾å
¥æ°å¯ç ", trigger: "blur" }], |
| | |
| | | }); |
| | | }; |
| | | |
| | | const dialogVisible = ref(false); |
| | | const userInfo = ref({}); |
| | | const dialogImageUrl = ref(); |
| | | |
| | | GetUserInfo({}).then((res) => { |
| | | userInfo.value = res.data; |
| | | form.value = res.data; |
| | | console.log(res); |
| | | userInfo.value = Object.assign({}, res.data); |
| | | form.value.usertruename = res.data.userTrueName; |
| | | form.value.phone = res.data.phoneNo; |
| | | }); |
| | | //å¾çé¢è§ |
| | | const handlePictureCardPreview = (url) => { |
| | | dialogImageUrl.value = url.url; |
| | | imgdialogVisible.value = true; |
| | | }; |
| | | |
| | | //å¾çå é¤ |
| | | const handleRemove = (file) => { |
| | | upload.value.handleRemove(file); |
| | | }; |
| | | const onSubmit = () => { |
| | | |
| | | if (form.value.files == "") { |
| | | ElMessage({ message: "å¾çä¸è½ä¸ºç©º", type: "warning" }); |
| | | return; |
| | | } |
| | | if (form.value.usertruename == "") { |
| | | ElMessage({ message: "å§åä¸è½ä¸ºç©º", type: "warning" }); |
| | | return; |
| | | } |
| | | if (form.value.phone == "") { |
| | | ElMessage({ message: "çµè¯ä¸è½ä¸ºç©º", type: "warning" }); |
| | | return; |
| | | } |
| | | Upuserbase(form.value).then((res) => { |
| | | ElMessage({ message: "ä¿®æ¹æå", type: "success" }); |
| | | dialogVisible.value = false; |
| | | initData(); |
| | | }); |
| | | }; |
| | | const beforeAvatarUpload = (val) => { |
| | | console.log(val); |
| | | }; |
| | | const handleAvatarSuccess = (val) => { |
| | | form.value.files = "/image/" + val.data; |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .personal { |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | .info { |
| | | display: flex; |
| | | height: 10rem; |
| | | background-color: #fff; |
| | | align-items: center; |
| | | |
| | | :deep(.avatar-uploader .el-upload) { |
| | | border: 1px dashed var(--el-border-color); |
| | | border-radius: 50%; |
| | |
| | | height: 6.25rem; |
| | | text-align: center; |
| | | } |
| | | |
| | | .el-form { |
| | | .el-row { |
| | | .el-col { |
| | |
| | | :deep(.el-form-item__label) { |
| | | font-size: 0.875rem; |
| | | } |
| | | |
| | | span { |
| | | font-size: 0.875rem; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .mation { |
| | | flex: 1; |
| | | margin-top: 1.25rem; |
| | |
| | | padding: 1.1875rem 2.0625rem; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | :deep(.el-dialog) { |
| | | margin-top: 180px; |
| | | } |
| | | |
| | | :deep(.el-dialog .el-dialog__body) { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | |
| | | .avatar-uploader .avatar { |
| | | width: 7rem; |
| | | height: 7rem; |
| | | display: block; |
| | | } |
| | | |
| | | :deep(.avatar-uploader .el-upload) { |
| | | width: 7rem; |
| | | height: 7rem; |
| | |
| | | overflow: hidden; |
| | | transition: var(--el-transition-duration-fast); |
| | | } |
| | | |
| | | :deep(.el-upload-list__item) { |
| | | width: 7rem; |
| | | height: 7rem; |
| | | } |
| | | |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: var(--el-color-primary); |
| | | } |