Browse Source

优化

master
陈裕财 4 years ago
parent
commit
e716110366
  1. 14
      src/api/login.js
  2. 14
      src/views/myWork/set/index.vue

14
src/api/login.js

@ -22,6 +22,20 @@ export function doLoginByUserloginid(userloginid, password,grantType,authType,de
data data
}) })
} }
export function switchUser(userloginid, password,grantType,authType,deptid,userid) {
const data = {
userloginid: userloginid,
password: password,
authType:authType,
deptid:deptid,
userid:userid,
}
return axios({
url: base+'/login/token?grantType='+grantType,
method: 'post',
data
})
}
export function checkUserid(userid ) { export function checkUserid(userid ) {
removeToken(); removeToken();
const data = { const data = {

14
src/views/myWork/set/index.vue

@ -136,10 +136,12 @@
<script> <script>
import { editUser,changePassword } from '@/api/mdp/sys/user'; import { editUser,changePassword } from '@/api/mdp/sys/user';
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { sendEmail,validEmailCode,queryMyUsers } from '@/api/login';
import { sendEmail,validEmailCode,queryMyUsers,switchUser } from '@/api/login';
import SingleShearUpload from "@/components/Image/Single/Index"; import SingleShearUpload from "@/components/Image/Single/Index";
import VueQr from 'vue-qr' import VueQr from 'vue-qr'
import BranchAdd from "@/views/mdp/sys/branch/BranchEdit"; import BranchAdd from "@/views/mdp/sys/branch/BranchEdit";
import { getToken, setToken, removeToken,getCacheUserInfo,setCacheUserInfo,removeCacheUserInfo} from '@/utils/auth'
import md5 from "js-md5"; import md5 from "js-md5";
export default { export default {
@ -349,9 +351,12 @@ import md5 from "js-md5";
authType:'password_display_userid' , authType:'password_display_userid' ,
grantType:"password" grantType:"password"
} }
this.$store.dispatch("LoginByUserloginid",params).then(res => {
//userloginid, password,grantType,authType,deptid,userid
switchUser(params.userloginid,params.password,params.grantType,params.authType,'',params.userloginid).then(res => {
this.phonenoUsersVisible=false; this.phonenoUsersVisible=false;
if(res.data.tips.isOk==true){
if(res.data.tips.isOk==true){
setToken( res.data.data.accessToken.tokenValue)
removeCacheUserInfo();
this.$store.dispatch('GetUserInfo').then((res2)=>{ this.$store.dispatch('GetUserInfo').then((res2)=>{
this.$router.push({ path: '/' }); this.$router.push({ path: '/' });
}).catch(err=>{ }).catch(err=>{
@ -367,6 +372,9 @@ import md5 from "js-md5";
this.phonenoUsersVisible=false; this.phonenoUsersVisible=false;
}); });
}, },
afterAddSubmit(){
}
}, },
components: { components: {
SingleShearUpload,VueQr,BranchAdd SingleShearUpload,VueQr,BranchAdd

Loading…
Cancel
Save