Skip to content

Commit

Permalink
feat(other): 密码修改支持
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Oct 22, 2021
1 parent a85a91e commit 14f8646
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"eslint.format.enable": true,
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"liveServer.settings.port": 5501,
// 以下为stylus配置
"stylusSupremacy.insertColons": false, // 是否插入冒号
Expand Down
1 change: 1 addition & 0 deletions src/layout/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export default defineComponent({
// clear()
sessionStorage.removeItem('auth')
sessionStorage.removeItem('accessToken')
localStorage.removeItem('role')
router.replace('/login')
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/permission/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import request from '@/utils/request';
import request2 from '@/utils/axios';

const permissionApi={
queryAuthedRoutes: '/user/admin/routes',
queryAuthedRoutes: '/user/routes',
queryPermissions:'/api/auth/permission/permissions'
}

Expand Down
43 changes: 12 additions & 31 deletions src/views/Login/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const loginApi={
sendCaptcha:'/api/auth/email/sendCaptcha',
forgetPassword:'/api/auth/email/forgot-password',
resetPassword:`/api/auth/user/reset-password`,
permissionRoutes:'/api/auth/permission/routes',
userInfo:'/api/auth/user/userInfo'
}

Expand All @@ -22,19 +21,19 @@ class Service{
/**
* @descript POST 用户注册
*/
static postRegister(data: any) {
return request({
url: loginApi.userRegister,
method: 'POST',
json: true,
data
}).then((res) => {
if (res.status === 0) {
return Promise.resolve(res)
}
return Promise.reject(res)
})
static postRegister(data: any) {
return request({
url: loginApi.userRegister,
method: 'POST',
json: true,
data
}).then((res) => {
if (res.status === 0) {
return Promise.resolve(res)
}
return Promise.reject(res)
})
}

/**
* @description POST 发送验证码 /auth/email/sendCaptcha
Expand Down Expand Up @@ -87,24 +86,6 @@ class Service{
})
}

/**
* @description POST 保存授权菜单权限
*/
static postAuthPermission(data: any) {
return request({
url: loginApi.permissionRoutes,
method: 'POST',
json: true,
data
}).then((res) => {
console.log(res);
if (res.status === 0) {
return Promise.resolve(res)
}
return Promise.reject(res)
})
}

/**
* @description POST 查询用户信息
*/
Expand Down
5 changes: 1 addition & 4 deletions src/views/Login/components/loginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ export default defineComponent({
if (auth) {
// 将角色存储到全局vuex roles
console.log(userInfo)
if (userInfo.status === 0) {
store.dispatch('permissionModule/getPermissonRoles', userInfo.data)
}
// 先进行异步路由处理
store.dispatch('permissionModule/getPermissonRoutes', userInfo.data)
store.dispatch('permissionModule/getPermissions')
Expand Down Expand Up @@ -247,7 +244,7 @@ export default defineComponent({
message: err.message
})
})
} catch (err) {
} catch (err:any) {
ElMessage({
type: 'error',
message: err.message
Expand Down
7 changes: 4 additions & 3 deletions src/views/Personal/personalSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
></el-input>
</el-form-item>-->

<!-- <el-form-item label="联系电话" prop="mobile">
<el-input v-model="settingForm.mobile" placeholder="请输入11位大陆手机号码"></el-input>
</el-form-item>-->
<el-form-item label="密码" prop="password">
<el-input v-model="settingForm.password" placeholder="密码"></el-input>
</el-form-item>

<el-form-item>
<el-button type="primary" :loading="updateLoading" @click="submitForm()">更新</el-button>
Expand Down Expand Up @@ -195,6 +195,7 @@ export default defineComponent({
const settingForm = reactive({
email: '',
nickname: '',
password: '',
desc: '',
mobile: '',
avatar: '../../assets/avatar-default.jpg'
Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import legacy from '@vitejs/plugin-legacy'
import { resolve } from 'path';
import styleImport from 'vite-plugin-style-import'

// const API = 'http://127.0.0.1:8080'
const API = 'https://test.cuit.api.jysafe.cn'
const API = 'http://127.0.0.1:8080'
// const API = 'https://test.cuit.api.jysafe.cn'

// https://vitejs.dev/config/
export default defineConfig({
Expand Down Expand Up @@ -50,7 +50,7 @@ export default defineConfig({
open: false, // 类型: boolean | string在服务器启动时自动在浏览器中打开应用程序;
cors: true, // 类型: boolean | CorsOptions 为开发服务器配置 CORS。默认启用并允许任何源
proxy: { // 类型: Record<string, string | ProxyOp 为开发服务器配置自定义代理规则
'/admin': {
'/admin/': {
target: `${API }`,
changeOrigin: true,
secure: false
Expand Down

0 comments on commit 14f8646

Please sign in to comment.