Skip to content

Commit

Permalink
fix: 体验问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri0528 committed Jan 10, 2024
1 parent 6a5a189 commit 43a11dd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/pages/src/components/ChangePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const changePassword = () => {
const confirm = async () => {
try {
await formRef.value.validate();
if (formData.newPassword === formData.confirmPassword) {
if (formData.newPassword !== formData.confirmPassword) {
return isError.value = true;
}
isLoading.value = true;
Expand Down
1 change: 1 addition & 0 deletions src/pages/src/hooks/useTableFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const useTableFields = () => {
],
checked: ['username', 'full_name', 'phone', 'email', 'departments'],
size: 'small',
trigger: 'click',
});

const handleSettingChange = ({ checked, size }) => {
Expand Down
38 changes: 18 additions & 20 deletions src/pages/src/views/data-source/local-details/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,16 @@ const handleExportTemplate = () => {
const url = `${window.AJAX_BASE_URL}/api/v1/web/data-sources/${props.dataSourceId}/operations/download_template/`;
window.open(url);
};
// 导入用户
const confirmImportUsers = async () => {
if (!uploadInfo.file.name) {
return Message({ theme: 'warning', message: '请选择文件再上传' });
}
if (isError.value) {
return Message({ theme: 'warning', message: '文件大小超出限制,请重新上传' });
};
try {
if (!uploadInfo.file.name) {
return Message({ theme: 'warning', message: '请选择文件再上传' });
}
if (isError.value) {
return Message({ theme: 'warning', message: '文件大小超出限制,请重新上传' });
};
importDialog.loading = true;
const formData = new FormData();
formData.append('file', uploadInfo.file);
Expand All @@ -563,24 +564,21 @@ const confirmImportUsers = async () => {
'X-CSRFToken': Cookies.get(window.CSRF_COOKIE_NAME),
'x-requested-with': 'XMLHttpRequest',
},
withCredentials: true,
};
axios.defaults.withCredentials = true;
const url = `${window.AJAX_BASE_URL}/api/v1/web/data-sources/${props.dataSourceId}/operations/import/`;
const res = await axios.post(url, {
overwrite: uploadInfo.overwrite,
incremental: uploadInfo.incremental,
file: formData.get('file'),
}, config);
const theme = res.data.data.status === 'success' ? 'success' : 'error';
Message({ theme, message: res.data.data.summary });
importDialog.isShow = false;
getUsers();
const res = await axios.post(url, formData, config);
Message({
theme: res.data.data.status === 'success' ? 'success' : 'error',
message: res.data.data.summary
});
} catch (e) {
const { message } = e.response.data.error;
Message({ theme: 'error', message });
Message({ theme: 'error', message: e.response.data.error.message });
} finally {
router.push({ name: 'syncRecords', params: { type: 'import' } });
importDialog.loading = false;
importDialog.isShow = false;
getUsers();
router.push({ name: 'syncRecords', params: { type: 'import' } });
}
};
Expand Down

0 comments on commit 43a11dd

Please sign in to comment.