跳转驿站
This commit is contained in:
parent
b15065a638
commit
28e89d23e7
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
<script>
|
||||
import { isExternal } from '@/utils/validate'
|
||||
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { encryptCBC, decryptCBC } from '@/utils/aescbc';
|
||||
import { decryptWithSM4,encryptWithSM4,hashWithSM3AndSalt } from '@/utils/sm'
|
||||
export default {
|
||||
props: {
|
||||
to: {
|
||||
|
|
@ -28,8 +30,13 @@ export default {
|
|||
methods: {
|
||||
linkProps(to) {
|
||||
if (this.isExternal) {
|
||||
console.log(to)
|
||||
console.log(this.$store.getters.phonenumber)
|
||||
console.log(hashWithSM3AndSalt(this.$store.getters.phonenumber));
|
||||
console.log(encryptWithSM4(this.$store.getters.phonenumber+"|"+hashWithSM3AndSalt(this.$store.getters.phonenumber)))
|
||||
return {
|
||||
href: to,
|
||||
href: to + ( getToken() ? '?token='+ getToken():'')+('&phonenumber='+encryptWithSM4(this.$store.getters.phonenumber+"|"+hashWithSM3AndSalt(this.$store.getters.phonenumber))),
|
||||
// href: to,
|
||||
target: '_blank',
|
||||
rel: 'noopener'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ const getters = {
|
|||
visitedViews: state => state.tagsView.visitedViews,
|
||||
cachedViews: state => state.tagsView.cachedViews,
|
||||
token: state => state.user.token,
|
||||
phonenumber: state => state.user.phonenumber,
|
||||
avatar: state => state.user.avatar,
|
||||
name: state => state.user.name,
|
||||
introduction: state => state.user.introduction,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ const buildPayload = ({ loginMethod, username, password, uuid, code, mobile, ver
|
|||
const user = {
|
||||
state: {
|
||||
token: getToken(),
|
||||
phonenumber: '',
|
||||
id: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
|
|
@ -46,6 +47,9 @@ const user = {
|
|||
SET_TOKEN(state, token) {
|
||||
state.token = token
|
||||
},
|
||||
SET_PHONE(state, phonenumber) {
|
||||
state.phonenumber = phonenumber
|
||||
},
|
||||
SET_EXPIRES_IN(state, time) {
|
||||
state.expires_in = time
|
||||
},
|
||||
|
|
@ -122,6 +126,7 @@ const user = {
|
|||
commit('SET_ROLES', res.roles && res.roles.length > 0 ? res.roles : ['ROLE_DEFAULT'])
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
commit('SET_ID', user.userId)
|
||||
commit('SET_PHONE', user.phonenumber)
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_AVATAR', avatar)
|
||||
return res
|
||||
|
|
|
|||
Loading…
Reference in New Issue