mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-18 15:26:49 +08:00
Merge branch 'cloud' into dev0731
This commit is contained in:
2
App.vue
2
App.vue
@@ -25,7 +25,7 @@
|
|||||||
var href=location.href;
|
var href=location.href;
|
||||||
//不包含登录页和加载页
|
//不包含登录页和加载页
|
||||||
if(href.indexOf('/pages/login/login')==-1 && href.indexOf('/pages/login/loading')==-1){
|
if(href.indexOf('/pages/login/login')==-1 && href.indexOf('/pages/login/loading')==-1){
|
||||||
console.log('href='+href)
|
//console.log('href='+href)
|
||||||
//先做登录校验
|
//先做登录校验
|
||||||
//每次加载,增加一次对token的验证,直接调用用户中心的接口,如果token不对,这里会直接返回登录
|
//每次加载,增加一次对token的验证,直接调用用户中心的接口,如果token不对,这里会直接返回登录
|
||||||
//apiUserbasic.getUserInfo();
|
//apiUserbasic.getUserInfo();
|
||||||
|
|||||||
@@ -17,8 +17,12 @@ const modifyPassword = function(data) {
|
|||||||
return ajax.postJson('/b1/system/user/update-password',data);
|
return ajax.postJson('/b1/system/user/update-password',data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRsaPublicKey=function(){
|
||||||
|
return ajax.get('/b1/common/secret/rsa-public-key');
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
logout,
|
logout,
|
||||||
modifyPassword
|
modifyPassword,
|
||||||
|
getRsaPublicKey
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,6 @@
|
|||||||
import apiQa from '@/api/modules/qa.js'
|
import apiQa from '@/api/modules/qa.js'
|
||||||
import apiMessage from '@/api/system/message.js'
|
import apiMessage from '@/api/system/message.js'
|
||||||
import {toScore} from '@/utils/tools.js'
|
import {toScore} from '@/utils/tools.js'
|
||||||
import apiBoeCourse from '@/api/boe/course.js'
|
|
||||||
import apiUserGroup from "@/api/modules/usergroup.js";
|
import apiUserGroup from "@/api/modules/usergroup.js";
|
||||||
import apiUserbasic from '@/api/boe/userbasic.js'
|
import apiUserbasic from '@/api/boe/userbasic.js'
|
||||||
import apiOnceMedal from '@/api/phase2/onceMedal.js'
|
import apiOnceMedal from '@/api/phase2/onceMedal.js'
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
import accountApi from '@/api/account';
|
import accountApi from '@/api/account';
|
||||||
import apiLogin from '@/api/boe/login.js';
|
import apiLogin from '@/api/boe/login.js';
|
||||||
import apiUserBasic from '@/api/boe/userbasic.js'
|
import apiUserBasic from '@/api/boe/userbasic.js'
|
||||||
|
import JSEncrypt from '@/utils/jsencrypt.js';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
var testPassword = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,16}$/;
|
var testPassword = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,16}$/;
|
||||||
@@ -96,33 +97,57 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
|
let $this=this;
|
||||||
this.$refs.ruleForm.validate().then(res => {
|
this.$refs.ruleForm.validate().then(res => {
|
||||||
let params = {
|
// let params = {
|
||||||
oldPassword: this.model.oldPass,
|
// oldPassword: this.model.oldPass,
|
||||||
newPassword: this.model.newPass,
|
// newPassword: this.model.newPass,
|
||||||
confirmPassword: this.model.confirmPass
|
// confirmPassword: this.model.confirmPass
|
||||||
};
|
// };
|
||||||
//apiLogin 修改为 apiUserBasic
|
apiLogin.getRsaPublicKey().then(krs=>{
|
||||||
apiUserBasic.modifyPassword(params).then(res => {
|
if(krs.code=='0'){
|
||||||
if (res.status == 200) {
|
let publicKey=krs.data.list.publickey;
|
||||||
let loginPath = this.$config.loginPath;
|
let encryptor = new JSEncrypt();
|
||||||
|
let rsa ='-----BEGIN PUBLIC KEY-----'+publicKey+'-----END PUBLIC KEY-----';
|
||||||
uni.showToast({
|
encryptor.setPublicKey(rsa);
|
||||||
title: '修改成功,请重新登录',
|
let mpdata={
|
||||||
duration: 2000
|
oldPassword:$this.model.oldPass,
|
||||||
});
|
newPassword:encryptor.encrypt($this.model.newPass),
|
||||||
setTimeout(() => {
|
confirmPassword:encryptor.encrypt($this.model.confirmPass)
|
||||||
location.href = loginPath;
|
}
|
||||||
}, 2000);
|
apiUserBasic.modifyPassword(mpdata).then(res=>{
|
||||||
} else {
|
if(res.status==200){
|
||||||
uni.showToast({
|
let loginPath = this.$config.loginPath;
|
||||||
title: res.message,
|
uni.showToast({ title: '修改成功,请重新登录', duration: 2000 });
|
||||||
icon: 'none'
|
setTimeout(() => { location.href = loginPath; }, 2000);
|
||||||
});
|
}else{
|
||||||
|
uni.showToast({ title: res.message, icon: 'none' });
|
||||||
}
|
}
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch(errors => {
|
}else{
|
||||||
|
uni.showToast({ title: '获取公钥错误', icon: 'none' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//apiLogin 修改为 apiUserBasic
|
||||||
|
// apiUserBasic.modifyPassword(params).then(res => {
|
||||||
|
// if (res.status == 200) {
|
||||||
|
// let loginPath = this.$config.loginPath;
|
||||||
|
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '修改成功,请重新登录',
|
||||||
|
// duration: 2000
|
||||||
|
// });
|
||||||
|
// setTimeout(() => {
|
||||||
|
// location.href = loginPath;
|
||||||
|
// }, 2000);
|
||||||
|
// } else {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: res.message,
|
||||||
|
// icon: 'none'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}).catch(errors => {
|
||||||
uni.$u.toast('校验失败:' + errors);
|
uni.$u.toast('校验失败:' + errors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
|||||||
import { getToken, setToken, removeToken } from '@/utils/token'
|
import { getToken, setToken, removeToken } from '@/utils/token'
|
||||||
import app from '@/api/app.js'
|
import app from '@/api/app.js'
|
||||||
import apiLogin from '@/api/login.js'
|
import apiLogin from '@/api/login.js'
|
||||||
import apiBoeLogin from '@/api/boe/login.js'
|
|
||||||
import apiMessage from '@/api/system/message.js'
|
import apiMessage from '@/api/system/message.js'
|
||||||
import config from '@/config/index.js'
|
import config from '@/config/index.js'
|
||||||
import apiUserbasic from '@/api/boe/userbasic.js'
|
import apiUserbasic from '@/api/boe/userbasic.js'
|
||||||
@@ -133,7 +132,7 @@ const user = {
|
|||||||
// 退出系统
|
// 退出系统
|
||||||
LogOut({ commit, state }) {
|
LogOut({ commit, state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
//apiBoeLogin.logout();
|
|
||||||
commit('SET_PERMISSIONS', [])
|
commit('SET_PERMISSIONS', [])
|
||||||
removeToken()
|
removeToken()
|
||||||
//resolve()
|
//resolve()
|
||||||
|
|||||||
2
utils/jsencrypt.js
Normal file
2
utils/jsencrypt.js
Normal file
File diff suppressed because one or more lines are too long
@@ -34,11 +34,12 @@ export function setToken(token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function removeToken() {
|
export function removeToken() {
|
||||||
uni.removeStorageSync(TOKEN_KEY);
|
// uni.removeStorageSync(TOKEN_KEY);
|
||||||
uni.removeStorageSync('returnUrl');
|
// uni.removeStorageSync('returnUrl');
|
||||||
uni.setStorageSync('oh','quit');
|
// //uni.setStorageSync('oh','quit');
|
||||||
uni.removeStorageSync('userInfo');
|
// uni.removeStorageSync('userInfo');
|
||||||
uni.removeStorageSync('inner');
|
// uni.removeStorageSync('inner');
|
||||||
|
uni.clearStorageSync();
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||||
document.cookie = "userInfo=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
document.cookie = "userInfo=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import config from '@/config/index.js'
|
import config from '@/config/index.js'
|
||||||
|
import {removeToken} from '@/utils/token.js'
|
||||||
|
|
||||||
export function toLogin(ajaxUrl) {
|
export function toLogin(ajaxUrl) {
|
||||||
let pageUrl=location.href;
|
let pageUrl=location.href;
|
||||||
@@ -14,6 +15,8 @@ export function toLogin(ajaxUrl) {
|
|||||||
if(ajaxUrl && ajaxUrl.indexOf('/xboe/portal/init')>-1){
|
if(ajaxUrl && ajaxUrl.indexOf('/xboe/portal/init')>-1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//跳转到登录,先把本地的登录信息清空
|
||||||
|
//removeToken();
|
||||||
//http://localhost:8081/mobile/pages/study/courseStudy?id=1028700304503054336
|
//http://localhost:8081/mobile/pages/study/courseStudy?id=1028700304503054336
|
||||||
if(pageUrl.indexOf('returnUrl')>-1){
|
if(pageUrl.indexOf('returnUrl')>-1){
|
||||||
console.log(pageUrl,'to pageUrl')
|
console.log(pageUrl,'to pageUrl')
|
||||||
|
|||||||
Reference in New Issue
Block a user