diff --git a/package.json b/package.json index aff64c5..e1d11d9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "jsencrypt": "^3.3.2", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", - "vue-cropper": "^1.1.3", + "vue-cropper": "^1.0.3", "vue-router": "^4.4.0" }, "devDependencies": { diff --git a/src/renderer/index.html b/src/renderer/index.html index aa01b18..bec0a9f 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -8,7 +8,7 @@ http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" /> --> - + diff --git a/src/renderer/src/api/system/user.js b/src/renderer/src/api/system/user.js index c83e0f6..b7e9e23 100644 --- a/src/renderer/src/api/system/user.js +++ b/src/renderer/src/api/system/user.js @@ -7,7 +7,7 @@ export function getUserProfile() { method: 'get' }) } - + // 修改用户个人信息 export function updateUserProfile(data) { return request({ @@ -16,7 +16,7 @@ export function getUserProfile() { data: data }) } - + // 用户密码重置 export function updateUserPwd(oldPassword, newPassword) { const data = { @@ -29,11 +29,14 @@ export function getUserProfile() { params: data }) } - + // 用户头像上传 export function uploadAvatar(data) { return request({ url: '/system/user/profile/avatar', + headers: { + 'Content-Type': 'multipart/form-data' + }, method: 'post', data: data }) @@ -46,4 +49,4 @@ export function updateUserInfo(data) { method: 'put', data: data }) -} \ No newline at end of file +} diff --git a/src/renderer/src/utils/talkFile/index.js b/src/renderer/src/utils/talkFile/index.js index 61fe003..23495ce 100644 --- a/src/renderer/src/utils/talkFile/index.js +++ b/src/renderer/src/utils/talkFile/index.js @@ -8,3 +8,13 @@ export const isHaveLocalFile = async (fileNewName)=>{ }) }) } + +export const parseCataByNode = (node) => { + if (node.parentNode) { + let arr = parseCataByNode(node.parentNode) + arr.push(node.id) + return arr + } else { + return [node.id] + } +} diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index e03962e..8429c16 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -77,7 +77,7 @@ import FileListItem from '@/views/prepare/container/file-list-item.vue' import { getSmarttalkPage, moveSmarttalk } from '@/api/file' import { toTimeText } from '@/utils/date' import { ElMessage } from 'element-plus' -import { isHaveLocalFile } from '@/utils/talkFile' +import { isHaveLocalFile, parseCataByNode } from '@/utils/talkFile' import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue' const { ipcRenderer } = window.electron || {} export default { @@ -192,7 +192,7 @@ export default { id: ids.join(), textbookId: cataData.textBook.curBookId } - let cata = this.parseCataByNode(cataData.node) + let cata = parseCataByNode(cataData.node) if ( this.uploadData.levelFirstId == cata[0] && this.uploadData.levelSecondId == cata[1] && @@ -250,7 +250,7 @@ export default { nodeClick(data) { if (this.currentNode.id === data.node.id) return this.checkFileList = [] - let cata = this.parseCataByNode(data.node) + let cata = parseCataByNode(data.node) this.currentNode = data.node this.uploadData.levelFirstId = cata[0] this.uploadData.levelSecondId = cata[1] @@ -276,15 +276,6 @@ export default { console.log(res) this.isLoading = false }) - }, - parseCataByNode(node) { - if (node.parentNode) { - let arr = this.parseCataByNode(node.parentNode) - arr.push(node.id) - return arr - } else { - return [node.id] - } } } } diff --git a/src/renderer/src/views/profile/resetPwd.vue b/src/renderer/src/views/profile/resetPwd.vue index 4754ee3..b4d2ccb 100644 --- a/src/renderer/src/views/profile/resetPwd.vue +++ b/src/renderer/src/views/profile/resetPwd.vue @@ -31,10 +31,10 @@ - +} +/** 上传图片 */ +function uploadImg() { + proxy.$refs.cropper.getCropBlob((data) => { + let formData = new FormData() + formData.append('avatarfile', data) + uploadAvatar(formData).then((response) => { + open.value = false + options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl + userStore.avatar = options.img + ElMessage({ + message: '上传成功', + type: 'success', + }) + visible.value = false + }) + }) +} +/** 实时预览 */ +function realTime(data) { + options.previews = data +} +/** 关闭窗口 */ +function closeDialog() { + options.img = userStore.avatar + options.visible = false +} + + \ No newline at end of file +.user-info-head { + position: relative; + display: inline-block; + height: 120px; +} + +.user-info-head:hover:after { + content: '+'; + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + color: #eee; + background: rgba(0, 0, 0, 0.5); + font-size: 24px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + cursor: pointer; + line-height: 110px; + border-radius: 50%; +} +.img-circle { + height: 120px; + width: auto; +} + diff --git a/src/renderer/src/views/profile/userInfo.vue b/src/renderer/src/views/profile/userInfo.vue index 6846cfa..808e344 100644 --- a/src/renderer/src/views/profile/userInfo.vue +++ b/src/renderer/src/views/profile/userInfo.vue @@ -1,89 +1,104 @@ - - \ No newline at end of file +