|
1
2
|
<template>
<CollapseContainer title="基本设置" :canExpan="false">
|
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<a-row :gutter="24">
<a-col :span="14">
<BasicForm @register="register" />
</a-col>
<a-col :span="10">
<div class="change-avatar">
<div class="mb-2">头像</div>
<img width="140" :src="headerImg" />
<Upload :showUploadList="false">
<Button type="ghost" class="ml-5">
<Icon icon="ant-design:upload-outlined" />更换头像
</Button>
</Upload>
</div>
</a-col>
</a-row>
|
|
19
20
21
22
|
<Button type="primary" @click="handleSubmit">更新基本信息</Button>
</CollapseContainer>
</template>
<script lang="ts">
|
|
23
|
import { Button, Upload } from 'ant-design-vue';
|
|
24
25
26
|
import { defineComponent, onMounted } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index';
import { CollapseContainer } from '/@/components/Container/index';
|
|
27
|
import Icon from '/@/components/Icon/index';
|
|
28
29
30
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
31
|
import headerImg from '/@/assets/images/header.jpg';
|
|
32
33
34
35
|
import { accountInfoApi } from '/@/api/demo/account';
import { baseSetschemas } from './data';
export default defineComponent({
|
|
36
|
components: { BasicForm, CollapseContainer, Button, Upload, Icon },
|
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
setup() {
const { createMessage } = useMessage();
const [register, { setFieldsValue }] = useForm({
labelWidth: 120,
schemas: baseSetschemas,
showActionButtonGroup: false,
});
onMounted(async () => {
const data = await accountInfoApi();
setFieldsValue(data);
});
return {
|
|
52
|
headerImg,
|
|
53
54
55
56
57
58
59
60
|
register,
handleSubmit: () => {
createMessage.success('更新成功!');
},
};
},
});
</script>
|
|
61
62
63
64
65
66
67
68
69
70
|
<style lang="less" scoped>
.change-avatar {
img {
display: block;
margin-bottom: 15px;
border-radius: 50%;
}
}
</style>
|