4da6832b44
- 命名重构:tenant → customer(对齐后端 R1 重构) - Tenant → Customer / tenant_id → customerId - tenantStore → customerStore / getTenant/setTenant → getCustomer/setCustomer - cookie key tenant → customer, HTTP header tenantId → customerId - 后端契约更新:AuthResponse 加 sub 字段 - 接口 URL 修复:/auth/oidc/callback → /api/v1/auth/oidc/callback - 依赖升级:vue 3.5 / element-plus 2.8 / vite 5 / typescript 5.6 / sass 1.79 - 删 node-sass / scss / sass-loader / moment / mock/index.ts - 配置文件拆分:.env.development / .env.production / .env.example - 删除冗余 view/auth/auth/callback.vue 副本 - .gitignore 增加 dist / .opencode / tmp - 新增 AGENT.md 与后端风格对齐
85 lines
2.4 KiB
TypeScript
85 lines
2.4 KiB
TypeScript
import { Customer } from '@/entity';
|
|
import { customerStore } from '@/store/modules/customer';
|
|
import router from '../router'
|
|
import { setToken, setCustomer } from '../utils/auth'
|
|
|
|
// config/index.js
|
|
const env = process.env.NODE_ENV!;
|
|
|
|
const configObj: any = {
|
|
production: {
|
|
BAIDU_CLOUD_URL: 'http://openapi.baidu.com/oauth/2.0/authorize',
|
|
RESPONSE_TYPE: '?response_type=' + 'code',
|
|
CLIENT_ID: '&client_id=' + 'WksD0FOVAp8zSRV62qNKxtnCexArVPOf',
|
|
REDIRECT_URI: '&redirect_uri=' + 'https://www.violin-home.cn/auth/api/v1/authorize/baidu',
|
|
SCOPE: '&scope=basic,netdisk',
|
|
DEVICE_ID: '&device_id=26202308',
|
|
QR_CODE: '&qrcode=' + '1',
|
|
DISPLAY: '&display=popup'
|
|
},
|
|
development: {
|
|
BAIDU_CLOUD_URL: 'http://openapi.baidu.com/oauth/2.0/authorize',
|
|
RESPONSE_TYPE: '?response_type=' + 'code',
|
|
CLIENT_ID: '&client_id=' + 'BIukdHDXeNPmIXe96GA6OOXGgnP5GEhM',
|
|
REDIRECT_URI: '&redirect_uri=' + 'http://localhost:8080/auth/api/v1/authorize/baidu',
|
|
SCOPE: '&scope=basic,netdisk',
|
|
DEVICE_ID: '&device_id=27103657',
|
|
QR_CODE: '&qrcode=' + '1',
|
|
DISPLAY: '&display=popup'
|
|
},
|
|
test: {
|
|
BAIDU_CLOUD_URL: 'http://openapi.baidu.com/oauth/2.0/authorize',
|
|
RESPONSE_TYPE: '?response_type=' + 'code',
|
|
CLIENT_ID: '&client_id=' + 'BIukdHDXeNPmIXe96GA6OOXGgnP5GEhM',
|
|
REDIRECT_URI: '&redirect_uri=' + 'http://localhost:8080/auth/api/v1/authorize/baidu',
|
|
SCOPE: '&scope=basic,netdisk',
|
|
DEVICE_ID: '&device_id=27103657',
|
|
QR_CODE: '&qrcode=' + '1',
|
|
DISPLAY: '&display=popup'
|
|
},
|
|
}
|
|
|
|
const scan_method: any = {
|
|
production: (qrcode: string) => {
|
|
window.location.href = qrcode
|
|
},
|
|
development: async () => {
|
|
|
|
const useCustomerStore = customerStore()
|
|
const customer: Customer = {
|
|
customerId: '7788',
|
|
account: '小小的测试账户'
|
|
}
|
|
let token = 'ABCDEFG'
|
|
|
|
await useCustomerStore.login(customer, token).then(() => {
|
|
const { href } = router.resolve({
|
|
path: '/'
|
|
})
|
|
window.open(href, '_self')
|
|
}).catch((error) => {
|
|
const { href } = router.resolve({
|
|
path: '/login'
|
|
})
|
|
window.open(href, '_self')
|
|
})
|
|
|
|
setToken("token")
|
|
setCustomer(
|
|
{
|
|
customerId: "111"
|
|
}
|
|
)
|
|
router.push({
|
|
path: '/home'
|
|
})
|
|
},
|
|
test: async (qrcode: string) => {
|
|
window.location.href = qrcode
|
|
},
|
|
}
|
|
|
|
const scan = scan_method[env]
|
|
const config = configObj[env]
|
|
|
|
export { scan, config } |