feat(store): 新增用户和企业信息管理功能
- 在 user store 中添加 userInfo 相关状态和操作 - 创建 enterprise store管理企业信息 - 更新相关组件以使用新的 store 方法
This commit is contained in:
@ -82,13 +82,10 @@ import 'vue-cropper/dist/index.css';
|
||||
import { VueCropper } from 'vue-cropper';
|
||||
import { sendUpdateMobileCaptcha, updateMobile, fetchImageUploadFile, updateMyInfo } from '@/api/all';
|
||||
import axios from 'axios';
|
||||
import { useUserStore } from '@/stores';
|
||||
|
||||
const userInfo = reactive({
|
||||
id: 1,
|
||||
name: 'Jane Doe',
|
||||
head_image: '',
|
||||
mobile: '13600000000',
|
||||
});
|
||||
const store = useUserStore();
|
||||
const userInfo = store.getUserInfo();
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@ -172,7 +169,6 @@ async function handleFileChange(event: Event) {
|
||||
const target = event.target as HTMLInputElement;
|
||||
const file = target.files?.[0];
|
||||
if (file) {
|
||||
console.log('已选择的文件:', file);
|
||||
const fileExtension = getFileExtension(file.name);
|
||||
const res = await fetchImageUploadFile({
|
||||
suffix: fileExtension,
|
||||
@ -195,6 +191,8 @@ function openEditMobileModal() {
|
||||
|
||||
async function handleSubmitUserInfo() {
|
||||
await updateMyInfo(userInfoForm);
|
||||
store.setUserName(userInfoForm.name);
|
||||
store.setUserHeadImage(userInfoForm.file_url);
|
||||
AMessage.success('修改成功!');
|
||||
}
|
||||
|
||||
@ -237,6 +235,7 @@ async function handleUpdateMobile() {
|
||||
const res = await formRef.value.validate();
|
||||
if (res === true || res === undefined) {
|
||||
await updateMobile(form);
|
||||
store.setUserMobile(form.mobile);
|
||||
AMessage.success('修改成功!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user