fix: 修改聊天机器人链接 增加地址变更

This commit is contained in:
Zhao Zhao Shen 2025-01-15 10:25:29 +08:00
parent f6c8b6b3cb
commit 3bf41364ab
4 changed files with 53 additions and 16 deletions

View File

@ -11,14 +11,14 @@ export default {
// console.log('') // console.log('')
// //
window.difyChatbotConfig = { window.difyChatbotConfig = {
token: 'pEaqgEzss5GXwtBk', token: 'FwKMmP8HLst0WSG0',
baseUrl: 'http://9552chyh1609.vicp.fun' baseUrl: 'https://dell.ezangao.cn'
}; };
// //
const script = document.createElement('script'); const script = document.createElement('script');
script.src = 'http://9552chyh1609.vicp.fun/embed.min.js'; script.src = 'https://dell.ezangao.cn/embed.min.js';
script.id = 'pEaqgEzss5GXwtBk'; script.id = 'FwKMmP8HLst0WSG0';
script.defer = true; script.defer = true;
document.head.appendChild(script); document.head.appendChild(script);
}, },

View File

@ -5,12 +5,13 @@ import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie import { getToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title' import getPageTitle from '@/utils/get-page-title'
import { MessageBox } from 'element-ui'
NProgress.configure({ showSpinner: false }) // NProgress Configuration NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login', '/callback'] // no redirect whitelist const whiteList = ['/login', '/callback'] // no redirect whitelist
router.beforeEach(async(to, from, next) => { router.beforeEach(async (to, from, next) => {
// start progress bar // start progress bar
NProgress.start() NProgress.start()
@ -28,12 +29,47 @@ router.beforeEach(async(to, from, next) => {
// 开发环境不启用ONEID // 开发环境不启用ONEID
if (isDevelopment) { if (isDevelopment) {
console.log('开发环境,启用某些代码') console.log('开发环境,启用某些代码')
// 启用某些代码 // 启用某些代码
} else if (isProduction) { } else if (isProduction) {
console.log('生产环境,禁用某些代码') console.log('生产环境,禁用某些代码')
// 禁用某些代码 // 禁用某些代码
} }
// 提示用户新网址并进行重定向
// 添加一个开关变量
const showMigrationAlert = false; // 设置为 false 可以禁用通知
const newUrl = 'https://cs-vsc.siemens.com.cn:444'
if (showMigrationAlert && to.path !== '/new-site') {
MessageBox.alert(
`<div style="text-align: center;">
<h3 style="color: #409EFF; margin-bottom: 15px;">重要通知</h3>
<p style="margin-bottom: 10px;">本站点已迁移至新网址</p>
<a href="${newUrl}" target="_blank" style="color: #409EFF; text-decoration: none; font-weight: bold;">${newUrl}</a>
<p style="color: #F56C6C; margin-top: 10px;">本站点预计一月份底失效请及时收藏新网址</p>
</div>`,
'站点迁移通知',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '收藏新网址',
showClose: false,
callback: action => {
if (action === 'confirm') {
const bookmark = document.createElement('a')
bookmark.href = newUrl
bookmark.title = '新网址'
bookmark.rel = 'sidebar'
bookmark.click()
}
window.location.href = newUrl
}
}
)
return
}
if (hasToken) { if (hasToken) {
if (to.path === '/login' || to.path === '/callback') { if (to.path === '/login' || to.path === '/callback') {
// if is logged in, redirect to the home page // if is logged in, redirect to the home page
@ -70,11 +106,14 @@ router.beforeEach(async(to, from, next) => {
} else { } else {
// other pages that do not have permission to access are redirected to the login page. // other pages that do not have permission to access are redirected to the login page.
if (isDevelopment) { if (isDevelopment) {
// 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=https://cs-vsc.siemens.com.cn:444/callback&scope=openid%20phone'
next(`/login?redirect=${to.path}`) next(`/login?redirect=${to.path}`)
} else { } else {
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://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://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://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=https://cs-vsc.siemens.com.cn:444/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=https://cs-vsc.siemens.com.cn:444/callback&scope=openid%20phone'
next(`/login?redirect=${to.path}`)
} }
NProgress.done() NProgress.done()
} }

View File

@ -14,10 +14,6 @@ export default {
}, },
async mounted() { async mounted() {
// URL code // URL code
// const urlParams = new URLSearchParams(window.location.hash.substring(1))
// const code = urlParams.get('code')
// alert('callback page')
// this.$router.push({ path: '/nav' })
const urlParams = new URLSearchParams(window.location.search) const urlParams = new URLSearchParams(window.location.search)
const code = urlParams.get('code') const code = urlParams.get('code')
// code // code
@ -27,8 +23,8 @@ export default {
const response = await getOneIdToken(code) const response = await getOneIdToken(code)
if (response) { if (response) {
console.log('🐱one自动登录接口状态', response.code) console.log('🐱one自动登录接口状态', response.code)
console.log('response.Token:' + response.data.token)
if (response.code === 200) { if (response.code === 200) {
console.log('response.Token:' + response.data.token)
// token // token
this.$store.dispatch('user/commitToken', response.data.token) this.$store.dispatch('user/commitToken', response.data.token)
// //
@ -40,14 +36,16 @@ export default {
} }
} else { } else {
console.log('No token found with code') 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%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://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://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://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=https://cs-vsc.siemens.com.cn:444/callback&scope=openid%20phone'
} }
} else { } else {
// code, // code,
console.error('No code found in URL parameters.') 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%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://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://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://api.oneid.siemens.com.cn/api/bff/v1.2/developer/ciam/oauth/authorize?client_id=1b867769c8cb221fb7fdb0f8beba6138TwXkI4mX8um&response_type=code&redirect_uri=https://cs-vsc.siemens.com.cn:444/callback&scope=openid%20phone'
// window.location.href = 'https://oneid.siemens.com.cn/frontend/login?idaasAppId=siemens_ciam2' // window.location.href = 'https://oneid.siemens.com.cn/frontend/login?idaasAppId=siemens_ciam2'
} }
} }

View File

@ -38,7 +38,7 @@ module.exports = {
}, },
proxy: { proxy: {
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: 'http://139.219.4.195:8003', target: 'http://cs-vsc.siemens.com.cn:8003',//'http://139.219.4.195:8003',
// 测试地址 // 测试地址
// target: 'http://192.168.237.154:8003', // target: 'http://192.168.237.154:8003',
pathRewrite: { pathRewrite: {