|
@@ -155,12 +155,12 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
- <CropperDialog ref="cropperDialogRef" :title="state.cropperTitle" />
|
|
|
|
|
|
|
+ <CropperDialog ref="cropperDialogRef" :title="state.cropperTitle" @uploadCropperImg="uploadCropperImg" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup name="sysUserCenter">
|
|
<script lang="ts" setup name="sysUserCenter">
|
|
|
-import { onMounted, onUnmounted, watch, reactive, ref } from 'vue';
|
|
|
|
|
|
|
+import { onMounted, watch, reactive, ref } from 'vue';
|
|
|
import { storeToRefs } from 'pinia';
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { ElForm, ElMessageBox, genFileId } from 'element-plus';
|
|
import { ElForm, ElMessageBox, genFileId } from 'element-plus';
|
|
|
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
|
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus';
|
|
@@ -169,13 +169,11 @@ import { base64ToFile } from '/@/utils/base64Conver';
|
|
|
import OrgTree from '/@/views/system/user/component/orgTree.vue';
|
|
import OrgTree from '/@/views/system/user/component/orgTree.vue';
|
|
|
import CropperDialog from '/@/components/cropper/index.vue';
|
|
import CropperDialog from '/@/components/cropper/index.vue';
|
|
|
import VueGridLayout from 'vue-grid-layout';
|
|
import VueGridLayout from 'vue-grid-layout';
|
|
|
-import mittBus from '/@/utils/mitt';
|
|
|
|
|
|
|
|
|
|
import { clearAccessTokens, getAPI } from '/@/utils/axios-utils';
|
|
import { clearAccessTokens, getAPI } from '/@/utils/axios-utils';
|
|
|
import { SysFileApi, SysUserApi } from '/@/api-services/api';
|
|
import { SysFileApi, SysUserApi } from '/@/api-services/api';
|
|
|
import { ChangePwdInput, SysUser } from '/@/api-services/models';
|
|
import { ChangePwdInput, SysUser } from '/@/api-services/models';
|
|
|
|
|
|
|
|
-const baseUrl = import.meta.env.VITE_API_URL;
|
|
|
|
|
const stores = useUserInfo();
|
|
const stores = useUserInfo();
|
|
|
const { userInfos } = storeToRefs(stores);
|
|
const { userInfos } = storeToRefs(stores);
|
|
|
const uploadSignRef = ref<UploadInstance>();
|
|
const uploadSignRef = ref<UploadInstance>();
|
|
@@ -207,15 +205,6 @@ onMounted(async () => {
|
|
|
var res = await getAPI(SysUserApi).apiSysUserBaseInfoGet();
|
|
var res = await getAPI(SysUserApi).apiSysUserBaseInfoGet();
|
|
|
state.ruleFormBase = res.data.result ?? { account: '' };
|
|
state.ruleFormBase = res.data.result ?? { account: '' };
|
|
|
state.loading = false;
|
|
state.loading = false;
|
|
|
-
|
|
|
|
|
- mittBus.on('uploadCropperImg', async (e) => {
|
|
|
|
|
- var res = await getAPI(SysFileApi).apiSysFileUploadAvatarPostForm(e.img);
|
|
|
|
|
- userInfos.value.avatar = baseUrl + '/' + res.data.result?.filePath + '/' + res.data.result?.name;
|
|
|
|
|
- });
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-onUnmounted(() => {
|
|
|
|
|
- mittBus.off('uploadCropperImg', () => {});
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
watch(state.signOptions, () => {
|
|
watch(state.signOptions, () => {
|
|
@@ -223,6 +212,12 @@ watch(state.signOptions, () => {
|
|
|
signaturePadRef.value.signaturePad.minWidth = state.signOptions.minWidth;
|
|
signaturePadRef.value.signaturePad.minWidth = state.signOptions.minWidth;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 上传头像图片
|
|
|
|
|
+const uploadCropperImg = async (e: any) => {
|
|
|
|
|
+ var res = await getAPI(SysFileApi).apiSysFileUploadAvatarPostForm(e.img);
|
|
|
|
|
+ userInfos.value.avatar = res.data.result?.filePath + '/' + res.data.result?.name;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 打开电子签名页面
|
|
// 打开电子签名页面
|
|
|
const openSignDialog = () => {
|
|
const openSignDialog = () => {
|
|
|
state.signDialogVisible = true;
|
|
state.signDialogVisible = true;
|
|
@@ -234,7 +229,7 @@ const saveUploadSign = async () => {
|
|
|
if (isEmpty) return;
|
|
if (isEmpty) return;
|
|
|
|
|
|
|
|
var res = await getAPI(SysFileApi).apiSysFileUploadSignaturePostForm(base64ToFile(data, userInfos.value.account + '.png'));
|
|
var res = await getAPI(SysFileApi).apiSysFileUploadSignaturePostForm(base64ToFile(data, userInfos.value.account + '.png'));
|
|
|
- userInfos.value.signature = baseUrl + '/' + res.data.result?.filePath + '/' + res.data.result?.name;
|
|
|
|
|
|
|
+ userInfos.value.signature = res.data.result?.filePath + '/' + res.data.result?.name;
|
|
|
|
|
|
|
|
clearSign();
|
|
clearSign();
|
|
|
state.signDialogVisible = false;
|
|
state.signDialogVisible = false;
|
|
@@ -261,13 +256,6 @@ const handleChangeSignFile = (_file: any, fileList: []) => {
|
|
|
state.signFileList = fileList;
|
|
state.signFileList = fileList;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// // 上传头像文件回调
|
|
|
|
|
-// const uploadAvatarFile = async (file: any) => {
|
|
|
|
|
-// var res = await getAPI(SysFileApi).apiSysFileUploadAvatarPostForm(file.raw);
|
|
|
|
|
-// userInfos.value.avatar = res.data.result?.url + '';
|
|
|
|
|
-// uploadAvatarRef.value?.clearFiles();
|
|
|
|
|
-// };
|
|
|
|
|
-
|
|
|
|
|
// 修改个人信息
|
|
// 修改个人信息
|
|
|
const submitUserBase = () => {
|
|
const submitUserBase = () => {
|
|
|
ruleFormBaseRef.value?.validate(async (valid: boolean) => {
|
|
ruleFormBaseRef.value?.validate(async (valid: boolean) => {
|