From 6c6b931740aa323fa089b3e7ed49dd67778703c7 Mon Sep 17 00:00:00 2001
From: cys <372127021@qq.com>
Date: Thu, 18 Jul 2024 09:34:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=B4=E5=83=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
src/renderer/index.html | 2 +-
src/renderer/src/views/profile/resetPwd.vue | 4 +-
src/renderer/src/views/profile/userAvatar.vue | 343 +++++++++---------
src/renderer/src/views/profile/userInfo.vue | 185 +++++-----
5 files changed, 279 insertions(+), 257 deletions(-)
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/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
+ proxy.$modal.msgSuccess('修改成功')
+ 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;
+}
+
\ No newline at end of file
diff --git a/src/renderer/src/views/profile/userInfo.vue b/src/renderer/src/views/profile/userInfo.vue
index 6846cfa..c560d39 100644
--- a/src/renderer/src/views/profile/userInfo.vue
+++ b/src/renderer/src/views/profile/userInfo.vue
@@ -1,89 +1,104 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 男
- 女
-
-
-
-
-
- {{ item.itemtitle }}
-
-
-
-
- 保存
- 测验
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ 男
+ 女
+
+
+
+
+
+ {{
+ item.itemtitle
+ }}
+
+
+
+
+ 保存
+
+
+
\ No newline at end of file
+const props = defineProps({
+ user: {
+ type: Object
+ }
+})
+
+const { proxy } = getCurrentInstance()
+
+const rules = ref({
+ nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
+ email: [
+ { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
+ { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
+ ],
+ phonenumber: [
+ { required: true, message: '手机号码不能为空', trigger: 'blur' },
+ { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }
+ ]
+})
+
+const subjectList = ref([])
+
+// 获取基础的学科
+listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => {
+ subjectList.value = res.rows
+})
+
+setTimeout(() => {
+ if (props.user.edudegree != '') {
+ var upcaseName = [
+ '一年级',
+ '二年级',
+ '三年级',
+ '四年级',
+ '五年级',
+ '六年级',
+ '初一',
+ '初二',
+ '初三',
+ '高一',
+ '高二',
+ '高三'
+ ]
+ var d = parseInt(props.user.edudegree.replace('年级', ''))
+ if (d <= 6) {
+ props.user.edustage = '小学'
+ } else if (d >= 7 && d <= 9) {
+ props.user.edustage = '初中'
+ } else if (d >= 9 && d <= 12) {
+ props.user.edustage = '高中'
+ }
+ props.user.stagelabel = upcaseName[d - 1]
+ }
+}, 1000)
+
+/** 提交按钮 */
+function submit() {
+ proxy.$refs.userRef.validate((valid) => {
+ if (valid) {
+ console.log(props.user)
+ updateUserProfile(props.user).then((response) => {
+ proxy.$modal.msgSuccess('修改成功')
+ })
+ }
+ })
+}
+
\ No newline at end of file
--
2.44.0.windows.1