mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-04-27 05:24:32 +08:00
个人中心,data挪目录
This commit is contained in:
parent
2c77cd057a
commit
d60ef3f8ef
@ -5,16 +5,16 @@
|
||||
"groupId" : "1952f25c81084e24b55b11385767dc38",
|
||||
"name" : "登录",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1642773955109,
|
||||
"updateTime" : 1643710774934,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/login",
|
||||
"parameters" : [ ],
|
||||
"option" : "[{\"name\":\"require_login\",\"value\":\"false\",\"description\":\"该接口需要登录才允许访问\"}]",
|
||||
"requestBody" : "{\r\n \"username\": \"admin\",\r\n \"password\": \"1\"\r\n}",
|
||||
"requestBody" : "{\r\n \"username\": \"admin\",\r\n \"password\": \"123456\"\r\n}",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 0,\n \"message\": \"用户名或密码错误\",\n \"data\": null,\n \"timestamp\": 1642321857211,\n \"executeTime\": 3\n}",
|
||||
"responseBody" : "{\n \"code\": 0,\n \"message\": \"用户名或密码错误\",\n \"data\": null,\n \"timestamp\": 1643710761990,\n \"executeTime\": 6\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : {
|
||||
"name" : "",
|
||||
@ -41,7 +41,7 @@
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "password",
|
||||
"value" : "1",
|
||||
"value" : "123456",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
@ -102,7 +102,7 @@
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1642321857211",
|
||||
"value" : "1643710761990",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
@ -114,7 +114,7 @@
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "3",
|
||||
"value" : "6",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "fd3d225a1cf141bf9998c4ec4bf4a6ab",
|
||||
"name" : "上传",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1635075982440,
|
||||
"updateTime" : 1643706737853,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/upload",
|
||||
@ -21,7 +21,7 @@
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
import 'org.ssssssss.magicboot.utils.FileUtils'
|
||||
import org.ssssssss.magicboot.utils.FileUtils
|
||||
import request;
|
||||
|
||||
var map = FileUtils.saveFile(request.getFile('file'));
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "fd3d225a1cf141bf9998c4ec4bf4a6ab",
|
||||
"name" : "删除",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1635075573670,
|
||||
"updateTime" : 1643706734133,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/delete",
|
||||
@ -21,9 +21,10 @@
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
import 'java.net.URLDecoder'
|
||||
import 'org.ssssssss.magicboot.model.Global'
|
||||
import 'org.ssssssss.magicboot.utils.FileUtils'
|
||||
import java.net.URLDecoder
|
||||
import org.ssssssss.magicboot.model.Global
|
||||
import org.ssssssss.magicboot.utils.FileUtils
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
|
||||
url = URLDecoder.decode(url, "UTF-8");
|
||||
|
@ -4,8 +4,8 @@
|
||||
"script" : null,
|
||||
"groupId" : "fd3d225a1cf141bf9998c4ec4bf4a6ab",
|
||||
"name" : "排序",
|
||||
"createTime" : 1635074732708,
|
||||
"updateTime" : 1635074732708,
|
||||
"createTime" : null,
|
||||
"updateTime" : 1643706726137,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/resort",
|
||||
@ -21,7 +21,7 @@
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
import 'java.net.URLDecoder'
|
||||
import java.net.URLDecoder
|
||||
|
||||
for(index,url in urls.split(',')){
|
||||
url = URLDecoder.decode(url, "UTF-8")
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "fd3d225a1cf141bf9998c4ec4bf4a6ab",
|
||||
"name" : "裁剪",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1635075977442,
|
||||
"updateTime" : 1643706719537,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/cropper",
|
||||
@ -21,8 +21,11 @@
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
import 'org.ssssssss.magicboot.model.Global'
|
||||
import 'org.ssssssss.magicboot.utils.FileUtils'
|
||||
import org.ssssssss.magicboot.model.Global
|
||||
import org.ssssssss.magicboot.utils.FileUtils
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import java.net.URLDecoder
|
||||
import request;
|
||||
|
||||
url = URLDecoder.decode(url, "UTF-8");
|
||||
String realPath = Global.getUserFilesBaseDir() + "/" + url;
|
34
data/magic-api/api/后台/用户管理/个人信息修改.ms
Normal file
34
data/magic-api/api/后台/用户管理/个人信息修改.ms
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "ebe40a0cf4b84192b6bbe923a0ecbd9c",
|
||||
"script" : null,
|
||||
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||
"name" : "个人信息修改",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1643710989215,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/center/update",
|
||||
"parameters" : [ ],
|
||||
"option" : "[]",
|
||||
"requestBody" : "{\r\n\t\r\n}",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
|
||||
var data = {
|
||||
id,
|
||||
phone,
|
||||
headPortrait
|
||||
}
|
||||
if(newPassword){
|
||||
data.password = newPassword ? SaSecureUtil.sha256(newPassword) : ''
|
||||
}
|
||||
return db.table('sys_user').primary('id').update(data)
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||
"name" : "保存",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1642085497821,
|
||||
"updateTime" : 1643710594405,
|
||||
"lock" : "0",
|
||||
"method" : "POST",
|
||||
"path" : "/save",
|
||||
@ -21,7 +21,7 @@
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
import 'cn.dev33.satoken.secure.SaSecureUtil';
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import org.ssssssss.magicapi.cache.SqlCache
|
||||
|
||||
password = password ? SaSecureUtil.sha256(password) : ''
|
@ -4,8 +4,8 @@
|
||||
"script" : null,
|
||||
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||
"name" : "获取用户信息",
|
||||
"createTime" : 1634724871155,
|
||||
"updateTime" : 1634724871155,
|
||||
"createTime" : null,
|
||||
"updateTime" : 1643710783720,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/info",
|
||||
@ -14,7 +14,7 @@
|
||||
"requestBody" : "{}",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1634093332235,\n \"executeTime\": null\n}",
|
||||
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1643710751531,\n \"executeTime\": null\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
@ -66,7 +66,7 @@
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1634093332235",
|
||||
"value" : "1643710751531",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
@ -51,7 +51,7 @@
|
||||
</i>
|
||||
</el-upload>
|
||||
</vuedraggable>
|
||||
<mb-dialog :visible.sync="cropperDialogVisible" @confirm-click="cropper">
|
||||
<mb-dialog ref="cropperDialog" @confirm-click="cropper">
|
||||
<template #content>
|
||||
<div class="cropper-content">
|
||||
<div class="cropper" style="text-align:center">
|
||||
@ -128,7 +128,6 @@ export default {
|
||||
disabled: false,
|
||||
isUploading: false,
|
||||
cropperOption: {},
|
||||
cropperDialogVisible: false,
|
||||
urls: [],
|
||||
fileList: []
|
||||
}
|
||||
@ -221,7 +220,7 @@ export default {
|
||||
beforeCropper(url) {
|
||||
this.cropperOption.img = this.$filePrefix + url
|
||||
this.cropperOption.relativeImg = url
|
||||
this.cropperDialogVisible = true
|
||||
this.$refs.cropperDialog.show()
|
||||
},
|
||||
cropper() {
|
||||
this.$refs.cropper.getCropBlob((data) => {
|
||||
@ -237,7 +236,7 @@ export default {
|
||||
this.urls.forEach((it, i) => {
|
||||
if (this.cropperOption.img.indexOf(it) !== -1) {
|
||||
this.$set(this.urls, i, res.data.url)
|
||||
this.cropperDialogVisible = false
|
||||
this.$refs.cropperDialog.hide()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -24,6 +24,9 @@
|
||||
<router-link to="/">
|
||||
<el-dropdown-item>首页</el-dropdown-item>
|
||||
</router-link>
|
||||
<router-link to="/user-center">
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item divided @click.native="logout">
|
||||
<span style="display:block;">退出</span>
|
||||
</el-dropdown-item>
|
||||
|
@ -18,6 +18,7 @@ export const constantRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
@ -30,6 +31,19 @@ export const constantRoutes = [
|
||||
}]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/user-center',
|
||||
redirect: '/system/user/user-center',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [{
|
||||
path: '/system/user/user-center',
|
||||
name: '个人中心',
|
||||
component: () => import('@/views/system/user/user-center'),
|
||||
meta: { title: '个人中心' }
|
||||
}]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('@/views/login/index'),
|
||||
|
@ -124,11 +124,13 @@ common.uuid = () => {
|
||||
return uuidv4().replace(/-/g, '')
|
||||
}
|
||||
|
||||
common.objAssign = (obj1, obj2) => {
|
||||
common.objAssign = (obj1, obj2, exclude) => {
|
||||
for (var o1 in obj1) {
|
||||
for (var o2 in obj2) {
|
||||
if (o1 === o2) {
|
||||
obj1[o1] = obj2[o2]
|
||||
if(exclude.indexOf(o1) == -1){
|
||||
obj1[o1] = obj2[o2]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ const getters = {
|
||||
avatar: state => state.user.avatar,
|
||||
name: state => state.user.name,
|
||||
username: state => state.user.username,
|
||||
userInfo: state => state.user.info,
|
||||
roles: state => state.user.roles,
|
||||
permission_routes: state => state.permission.routes,
|
||||
errorLogs: state => state.errorLog.logs
|
||||
|
@ -25,6 +25,9 @@ const mutations = {
|
||||
},
|
||||
SET_USERNAME: (state, username) => {
|
||||
state.username = username
|
||||
},
|
||||
SET_INFO: (state, info) => {
|
||||
state.info = info
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +60,7 @@ const actions = {
|
||||
authorities_.push(data.authorities[i])
|
||||
}
|
||||
Vue.prototype.$authorities = authorities_
|
||||
commit('SET_INFO', data)
|
||||
commit('SET_NAME', data.name)
|
||||
commit('SET_USERNAME', data.username)
|
||||
resolve()
|
||||
|
100
magic-boot-ui/src/views/system/user/user-center.vue
Normal file
100
magic-boot-ui/src/views/system/user/user-center.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px" style="width: 800px">
|
||||
<el-form-item label="头像" prop="headPortrait">
|
||||
<mb-upload-image v-model="temp.headPortrait" />
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名/昵称" prop="name">
|
||||
<el-input v-model="temp.name" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model.integer="temp.phone" maxlength="11" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原密码" prop="password">
|
||||
<el-input v-model="temp.password" type="password" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPassword">
|
||||
<el-input v-model="temp.newPassword" type="password" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword">
|
||||
<el-input v-model="temp.confirmPassword" type="password" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button class="filter-item" type="primary" @click="save">
|
||||
提交
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'UserCenter',
|
||||
data() {
|
||||
var validatePass2 = (rule, value, callback) => {
|
||||
if(this.temp.newPassword){
|
||||
if (value === '') {
|
||||
callback(new Error('请再次输入密码'));
|
||||
} else if (value !== this.temp.newPassword) {
|
||||
callback(new Error('两次输入密码不一致!'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}else{
|
||||
callback();
|
||||
}
|
||||
}
|
||||
return {
|
||||
rules: {
|
||||
password: [{ required: true, message: '请输入原密码', trigger: 'change' }, { min: 6, message: '密码不少于6位' }],
|
||||
phone: [{ min: 11, message: '请输入11位手机号', trigger: 'change' }],
|
||||
newPassword: [{ min: 6, message: '密码不少于6位' }],
|
||||
confirmPassword: [{ min: 6, message: '密码不少于6位' }, { validator: validatePass2 }],
|
||||
},
|
||||
temp: this.getTemp()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$common.objAssign(this.temp, this.$store.getters.userInfo, ['password'])
|
||||
},
|
||||
methods: {
|
||||
getTemp() {
|
||||
return {
|
||||
id: '',
|
||||
name: '',
|
||||
password: '',
|
||||
phone: '',
|
||||
headPortrait: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
}
|
||||
},
|
||||
resetTemp() {
|
||||
this.temp = this.getTemp()
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
save() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$request({
|
||||
url: 'user/center/update',
|
||||
method: 'post',
|
||||
params: this.temp
|
||||
}).then((response) => {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '修改成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -44,7 +44,7 @@ magic-api:
|
||||
enable: true #开启缓存,默认是不开启的
|
||||
ttl: 3600000 #有效期1小时,默认-1 即永不过期
|
||||
resource:
|
||||
location: classpath:data/magic-api
|
||||
location: data/magic-api
|
||||
response-code-config:
|
||||
success: 200 #执行成功的code值
|
||||
invalid: 400 #参数验证未通过的code值
|
||||
|
Loading…
x
Reference in New Issue
Block a user