From 57057fb78d417d1b85e823391e9b77185fb9c828 Mon Sep 17 00:00:00 2001 From: ww Date: Thu, 18 Jul 2024 11:39:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9E=83=E5=9C=BE=E7=89=88=20for=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/components/Info keep.vue | 287 ++++++++++++++++++ src/views/home/components/Info.vue | 194 +++--------- src/views/home/components/Status.vue | 42 ++- src/views/home/components/Welcome.vue | 21 +- .../home/components/infoContainer/index.vue | 47 +++ src/views/home/components/myDrawer/index.vue | 120 ++++++++ src/views/home/index.vue | 15 +- 7 files changed, 559 insertions(+), 167 deletions(-) create mode 100644 src/views/home/components/Info keep.vue create mode 100644 src/views/home/components/infoContainer/index.vue create mode 100644 src/views/home/components/myDrawer/index.vue diff --git a/src/views/home/components/Info keep.vue b/src/views/home/components/Info keep.vue new file mode 100644 index 0000000..d0c638b --- /dev/null +++ b/src/views/home/components/Info keep.vue @@ -0,0 +1,287 @@ + + + diff --git a/src/views/home/components/Info.vue b/src/views/home/components/Info.vue index ca1866a..05f4894 100644 --- a/src/views/home/components/Info.vue +++ b/src/views/home/components/Info.vue @@ -1,52 +1,20 @@ diff --git a/src/views/home/components/Status.vue b/src/views/home/components/Status.vue index 863458d..db53eda 100644 --- a/src/views/home/components/Status.vue +++ b/src/views/home/components/Status.vue @@ -3,17 +3,15 @@ import add from '@/assets/images/add.png' // import { Plus } from '@element-plus/icons-vue' import tool from '@/utils/oss.js' import { userChangeService } from '@/api/user/user.js' -const dialogFormVisible = ref(false) -import { ref } from 'vue' +import { ref, defineEmits } from 'vue' +import { ElMessage } from 'element-plus' const props = defineProps({ data: { type: Object, }, }) -// const data = ref(props.data, 'dsfd') const imageUrl = ref('') -//盒子隐藏 -const form = ref() +const dialogFormVisible = ref(false) //表单校验 // const rules = { // username: [ @@ -37,7 +35,13 @@ const form = ref() // ], // code: [{ message: '验证码不能为空', trigger: 'blur' }], // } -form.value = props.data +const form = ref() +// { +// username: '', +// nickName: '', +// phone: '', +// } +form.value = { ...props.data } const formLabelWidth = '70px' //设置头像显示 imageUrl.value = props.data.icon @@ -48,7 +52,11 @@ const upload = async (option) => { imageUrl.value = url changeInfo() } +const openInfo = () => { + dialogFormVisible.value = true +} //修改用户信息 +const emit = defineEmits(['get-message']) const changeInfo = async () => { const userInfo = { phone: form.value.phone, @@ -57,8 +65,18 @@ const changeInfo = async () => { icon: imageUrl.value, } const jsonData = JSON.stringify(userInfo) - await userChangeService(jsonData) + await userChangeService(jsonData).then(() => { + ElMessage.success('修改成功') + console.log(form.value.nickName, 'nickN') + emit('get-message', form.value.nickName) + }) + dialogFormVisible.value = false +} +const cancleInfo = () => { dialogFormVisible.value = false + form.value = { + ...props.data, + } }