更新代码

master
sunzehua 2 years ago
parent 07ba08bbd2
commit 1bbd76284a

@ -2,5 +2,5 @@ NODE_ENV=production
VUE_APP_PREVIEW=true
//VUE_APP_API_BASE_URL=http://192.168.1.205:25800
//VUE_APP_API_BASE_URL=http://127.0.0.1:5000
VUE_APP_API_BASE_URL=http://60.209.125.238:25805
VUE_APP_API_BASE_URL=http://60.209.125.238:35220
# VUE_APP_API_BASE_URL=http://47.104.85.216:12345/api

@ -1,7 +1,7 @@
NODE_ENV=development
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=http://60.209.125.238:25805
VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:25805
VUE_APP_API_BASE_URL=http://60.209.125.238:35220
VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:35220
# process.env.VUE_APP_API_BASE_URL

@ -1,7 +1,7 @@
NODE_ENV=production
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=http://60.209.125.238:25805
VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:25805
VUE_APP_API_BASE_URL=http://60.209.125.238:35220
VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:35220
# VUE_APP_API_BASE_URL=http://47.104.85.216:12345/api
# VUE_APP_SOCKET_BASE_URL=http://47.104.85.216:12345/api

@ -32,16 +32,18 @@ router.beforeEach((to, from, next) => {
// console.log(JSON.stringify(res))
// console.log('=== 测试跳转页面,获取个人信息 -- end ===')
if (res.menus.length < 1) {
Modal.error({
title: '提示:',
content: '无菜单权限,请联系管理员',
okText: '确定',
onOk: () => {
store.dispatch('Logout').then(() => {
window.location.reload()
})
}
})
next({ path: '/welcome' })
// Modal.error({
// title: '提示:',
// content: '无菜单权限,请联系管理员',
// okText: '确定',
// onOk: () => {
// next({ path: '/welcome' })
// // store.dispatch('Logout').then(() => {
// // window.location.reload()
// // })
// }
// })
return
}
// eslint-disable-next-line camelcase

@ -1,5 +1,5 @@
import Vue from 'vue'
import { login, getLoginUser, logout } from '@/api/modular/system/loginManage'
import { login, getLoginUser, logout, loginWithCode } from '@/api/modular/system/loginManage'
import { sysDictTypeTree } from '@/api/modular/system/dictManage'
import { sysMenuChange } from '@/api/modular/system/menuManage'
import { ACCESS_TOKEN, ALL_APPS_MENU, DICT_TYPE_TREE_DATA, NOTICE_RECEIVED } from '@/store/mutation-types'
@ -54,11 +54,11 @@ const user = {
},
APPEND_NOTICE: (state, notice) => {
notice.publicTime = dateFormat(notice.publicTime, 'YYYY-mm-dd HH:MM:SS')
let notices = state.notices
let temp = notices.rows.filter(m => {
const notices = state.notices
const temp = notices.rows.filter(m => {
return m.value == notice.type
})[0]
let other = notices.rows.filter(m => {
const other = notices.rows.filter(m => {
return m.value != notice.type
})
temp.noticeData.unshift(notice)
@ -105,7 +105,28 @@ const user = {
// eslint-disable-next-line handle-callback-err
})
.catch(error => {
// eslint-disable-next-line prefer-promise-reject-errors
console.log(error)
reject('后端未启动或代理错误')
})
})
},
// 跨平台登录
LoginWithCode({ commit }, userInfo) {
return new Promise((resolve, reject) => {
loginWithCode(userInfo)
.then(response => {
if (!response.success) {
reject(response.message)
return
}
const result = response.data
console.log(response, 1111)
Vue.ls.set(ACCESS_TOKEN, result, 7 * 24 * 60 * 60 * 1000)
commit('SET_TOKEN', result)
resolve()
})
.catch(error => {
console.log(error)
reject('后端未启动或代理错误')
})
})

@ -4,8 +4,6 @@
<script>
// import { isLogin, setToken, removelogin } from '@/utils/auth';
import { ACCESS_TOKEN } from '@/store/mutation-types'
// import { getUrl } from '@/api/getway'
import { loginWithCode } from '@/api/modular/system/loginManage'
export default {
data() {
return {
@ -29,21 +27,28 @@ export default {
this.$message({ message: '参数webid丢失' });
} else {
if (localStorage.getItem(ACCESS_TOKEN)) { //
this.urlgo(webid)
this.$router.push(webid)
} else {
if (code) {
loginWithCode({ code: code }).then(res => {
this.$ls.set(ACCESS_TOKEN, res.data, 7 * 24 * 60 * 60 * 1000)
this.$store.commit('SET_TOKEN', res.data)
})
this.$store.dispatch('LoginWithCode', { code: code })
.then(res => this.loginSuccess(webid, res))
.catch(err => this.requestFailed(err))
} else {
this.msg = '授权登录失败,缺少code';
}
}
}
},
urlgo(webid) {
this.$router.push(webid);
loginSuccess(webid, res) {
// console.log(webid)
this.$router.push({ path: 'bookingLedger' })
// this.isLoginError = false
// //
this.dictTypeData().then(res => {})
},
requestFailed(res) {
console.log(res)
this.$message.error(res)
}
}
};

Loading…
Cancel
Save