更新代码

master
sunzehua 2 years ago
parent 07ba08bbd2
commit 1bbd76284a

@ -2,5 +2,5 @@ NODE_ENV=production
VUE_APP_PREVIEW=true VUE_APP_PREVIEW=true
//VUE_APP_API_BASE_URL=http://192.168.1.205:25800 //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://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 # VUE_APP_API_BASE_URL=http://47.104.85.216:12345/api

@ -1,7 +1,7 @@
NODE_ENV=development NODE_ENV=development
VUE_APP_PREVIEW=true VUE_APP_PREVIEW=true
VUE_APP_API_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:25805 VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:35220
# process.env.VUE_APP_API_BASE_URL # process.env.VUE_APP_API_BASE_URL

@ -1,7 +1,7 @@
NODE_ENV=production NODE_ENV=production
VUE_APP_PREVIEW=true VUE_APP_PREVIEW=true
VUE_APP_API_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:25805 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_API_BASE_URL=http://47.104.85.216:12345/api
# VUE_APP_SOCKET_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(JSON.stringify(res))
// console.log('=== 测试跳转页面,获取个人信息 -- end ===') // console.log('=== 测试跳转页面,获取个人信息 -- end ===')
if (res.menus.length < 1) { if (res.menus.length < 1) {
Modal.error({ next({ path: '/welcome' })
title: '提示:', // Modal.error({
content: '无菜单权限,请联系管理员', // title: '提示:',
okText: '确定', // content: '无菜单权限,请联系管理员',
onOk: () => { // okText: '确定',
store.dispatch('Logout').then(() => { // onOk: () => {
window.location.reload() // next({ path: '/welcome' })
}) // // store.dispatch('Logout').then(() => {
} // // window.location.reload()
}) // // })
// }
// })
return return
} }
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase

@ -1,5 +1,5 @@
import Vue from 'vue' 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 { sysDictTypeTree } from '@/api/modular/system/dictManage'
import { sysMenuChange } from '@/api/modular/system/menuManage' import { sysMenuChange } from '@/api/modular/system/menuManage'
import { ACCESS_TOKEN, ALL_APPS_MENU, DICT_TYPE_TREE_DATA, NOTICE_RECEIVED } from '@/store/mutation-types' 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) => { APPEND_NOTICE: (state, notice) => {
notice.publicTime = dateFormat(notice.publicTime, 'YYYY-mm-dd HH:MM:SS') notice.publicTime = dateFormat(notice.publicTime, 'YYYY-mm-dd HH:MM:SS')
let notices = state.notices const notices = state.notices
let temp = notices.rows.filter(m => { const temp = notices.rows.filter(m => {
return m.value == notice.type return m.value == notice.type
})[0] })[0]
let other = notices.rows.filter(m => { const other = notices.rows.filter(m => {
return m.value != notice.type return m.value != notice.type
}) })
temp.noticeData.unshift(notice) temp.noticeData.unshift(notice)
@ -105,7 +105,28 @@ const user = {
// eslint-disable-next-line handle-callback-err // eslint-disable-next-line handle-callback-err
}) })
.catch(error => { .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('后端未启动或代理错误') reject('后端未启动或代理错误')
}) })
}) })

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