Compare commits

..

6 Commits

9 changed files with 93 additions and 63 deletions

View File

@ -10,7 +10,8 @@ export const reqGetRegionAndCity = () => request({ url: `/WRD-admin/sys/user/Rei
// export const reqSelectEngiStatus = (year, month, page, limit) => request({ url: `/WRD-admin/sys/workorder/page`, method: 'get', params: { year, month, page, limit } });
// 带部门
export const reqSelectEngiStatusByDept = (year, month, deptId, page, limit) => request({ url: `/WRD-admin/sys/workorder/pageSelect`, method: 'get', params: { year, month, deptId, page, limit }})
// export const reqSelectEngiStatusByDept = (year, month, deptId, page, limit) => request({ url: `/WRD-admin/sys/workorder/pageSelect`, method: 'get', params: { year, month, deptId, page, limit }})
export const reqSelectEngiStatusByDept = (year, month, deptId, page, limit, gids) => request({ url: `/WRD-admin/sys/workorder/pageSelectV2`, method: 'get', params: { year, month, deptId, page, limit, gids }})
// 工程师状态查询
export const reqSelectEngiStatusByMap = (year, month, page, limit) => request({ url: `/WRD-admin/sys/workorder/pageSelect`, method: 'get', params: { year, month, page, limit }})

View File

@ -9,6 +9,18 @@ export function login(data) {
})
}
// ONEID登录功能通过code获取对应的用户token
export function getOneIdToken(param) {
return request({
// 本地测试接口
// url: '/WRD-admin/oneIDLocalLogin',
// 线上正式接口
url: '/WRD-admin/oneIDLogin',
method: 'get',
params: { param }
})
}
export function getInfo() {
return request({
url: '/WRD-admin/sys/user/info',

View File

@ -101,7 +101,8 @@ export default {
async logout() {
await this.$store.dispatch('user/logout')
// this.$router.push(`/login?redirect=${this.$route.fullPath}`);
this.$router.push(`/login`)
// this.$router.push(`/login`)
window.location.href = 'https://oneid.siemens.com.cn/frontend/login?idaasAppId=siemens_ciam2'
},
//
updatePersonalPassword() {

View File

@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login'] // no redirect whitelist
const whiteList = ['/login', '/callback'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
// start progress bar
@ -21,7 +21,7 @@ router.beforeEach(async(to, from, next) => {
const hasToken = getToken()
if (hasToken) {
if (to.path === '/login') {
if (to.path === '/login' || to.path === '/callback') {
// if is logged in, redirect to the home page
next({ path: '/nav' })
NProgress.done()
@ -47,13 +47,14 @@ router.beforeEach(async(to, from, next) => {
}
} else {
/* has no token*/
if (whiteList.indexOf(to.path) !== -1) {
// in the free login whitelist, go directly
next()
} else {
// other pages that do not have permission to access are redirected to the login page.
next(`/login?redirect=${to.path}`)
// next(`/login?redirect=${to.path}`)
window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://csdc.siemens.com.cn:8001/callback&scope=openid%20phone'
// window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://localhost:9528/callback&scope=openid%20phone'
NProgress.done()
}
}

View File

@ -183,7 +183,7 @@ export const asyncRoutes = [
export const anyRoutes = { path: '*', redirect: '/404', hidden: true }
const createRouter = () => new Router({
mode: 'hash',
mode: 'history',
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})

View File

@ -143,6 +143,17 @@ const actions = {
})
},
// set token
commitToken({ commit }, token) {
return new Promise(resolve => {
commit('SET_TOKEN', token)
setToken(token)
const data = getToken()
console.log(data)
resolve()
})
},
// remove token
resetToken({ commit }) {
return new Promise(resolve => {

View File

@ -13,7 +13,6 @@
])
},
async mounted() {
debugger
// URL code
// const urlParams = new URLSearchParams(window.location.hash.substring(1))
// const code = urlParams.get('code')
@ -23,25 +22,27 @@
const code = urlParams.get('code')
// code
if (code) {
// 123
// code
const response = await getOneIdToken(code)
console.log(response)
if (response) {
// console.log('response.Token:' + response.Token)
console.log('response.Token:' + response.data.token)
// token
this.$store.dispatch('user/commitToken', response)
this.$store.dispatch('user/commitToken', response.data.token)
//
// resetRouter()
// console.log(this.$store.state.user, this.$store.state.token)
this.$router.push({ path: '/nav' })
} else {
console.log('No token found with code')
// window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://csdc.siemens.com.cn:8001/#/callback&scope=openid phone email profile user:ciam:commonapi'
window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://csdc.siemens.com.cn:8001/callback&scope=openid%20phone'
// window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://localhost:9528/callback&scope=openid%20phone'
}
} else {
// code,
console.error('No code found in URL parameters.')
// window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://csdc.siemens.com.cn:8001/#/callback&scope=openid phone email profile user:ciam:commonapi'
window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://csdc.siemens.com.cn:8001/callback&scope=openid%20phone'
// window.location.href = 'https://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=http://localhost:9528/callback&scope=openid%20phone'
// window.location.href = 'https://oneid.siemens.com.cn/frontend/login?idaasAppId=siemens_ciam2'
}
}
@ -50,10 +51,9 @@
<style lang="scss" scoped>
.main-box {
background-image: url("../../assets/dashboard-background.png");
//background-image: url("../../assets/dashboard-background.png");
background-size: 100% 100%;
background-repeat: no-repeat;
height: 100vh;
}
</style>

View File

@ -1293,15 +1293,19 @@ export default {
}
this.engiArray = resultOfSelectEngisByDept.data.list
this.total = resultOfSelectEngisByDept.data.total
console.log(this.engiArray.map(item => item.gid))
}
const gids = this.engiArray.map(item => item.gid).join(',')
console.log(gids)
const resOfSelectEngiStatusByMap =
await this.$API.select.reqSelectEngiStatusByDept(
year,
month,
departmentId,
page,
limit
limit,
gids
)
console.log(this.engiArray, resOfSelectEngiStatusByMap)
if (resOfSelectEngiStatusByMap.code === 0) {

View File

@ -24,7 +24,7 @@ module.exports = {
* In most cases please use '/' !!!
* Detail: https://cli.vuejs.org/config/#publicpath
*/
publicPath: './',
publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',