Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2560d9d529 | |||
| 6534723050 | |||
| f031501286 |
@@ -0,0 +1 @@
|
||||
2K94E8Rn63mn6Nys
|
||||
+2
-2
@@ -8,8 +8,8 @@ const dev = {
|
||||
// 网关地址(vms-gateway,端口 4001)— 用户授权、短信等接口走网关
|
||||
apiGatewayUrl: 'https://gateway.arklinksmart.cn',
|
||||
|
||||
// 授权回调地址(支付宝/微信 OAuth redirect_uri)
|
||||
authRedirectUri: 'https://gateway.arklinksmart.cn/api/v1/user/auth/callback',
|
||||
// 授权回调地址(微信 OAuth redirect_uri,必须 HTTPS,指向前端页面)
|
||||
authRedirectUri: 'https://m.arklinksmart.cn/pages/auth/loading',
|
||||
|
||||
// 开发阶段硬编码 Token(生产环境应从登录流程获取)
|
||||
bearerToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRlZXB2ZW5kaW5nIiwic3ViIjoiMTY0MDI0MTEyNiIsImZyb20iOiJwb3MiLCJyb2xlIjoicG9zIiwibWFpbmJvYXJkX2lkIjoiVDEwMDIiLCJwb3Nfc24iOiIxNjQwMjQxMTI2IiwiaWF0IjoxNzc4NDkxOTA3LCJleHAiOjE3NzkwOTY3MDd9.DjscZtrTCr30XOngToUifxoel4q2EGES_uqGQernkvg',
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ const prod = {
|
||||
// 网关地址(vms-gateway)— 用户授权、短信等接口走网关
|
||||
apiGatewayUrl: 'https://gateway.arklinksmart.cn',
|
||||
|
||||
// 授权回调地址(支付宝/微信 OAuth redirect_uri)
|
||||
authRedirectUri: 'https://gateway.arklinksmart.cn/api/v1/user/auth/callback',
|
||||
// 授权回调地址(微信 OAuth redirect_uri,必须 HTTPS,指向前端页面)
|
||||
authRedirectUri: 'https://m.arklinksmart.cn/pages/auth/loading',
|
||||
|
||||
// 生产环境 Token 从登录流程获取,此处为空
|
||||
bearerToken: '',
|
||||
|
||||
@@ -56,9 +56,9 @@ export default {
|
||||
try {
|
||||
this.statusText = '正在获取授权...';
|
||||
|
||||
// 构建回调地址(当前页面地址)
|
||||
const redirectUri = encodeURIComponent(
|
||||
window.location.origin + window.location.pathname
|
||||
// 回调地址必须是 HTTPS,使用配置文件中的地址
|
||||
const redirectUri = config.authRedirectUri || (
|
||||
window.location.origin.replace(/^http:/, 'https:') + window.location.pathname
|
||||
);
|
||||
|
||||
const res = await gatewayGet('/api/v1/user/auth/url', {
|
||||
|
||||
+25
-1
@@ -1,8 +1,31 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import uni from '@dcloudio/vite-plugin-uni'
|
||||
import { existsSync, readFileSync } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// 开发服务器:显式处理 public 目录下的静态文件,避免被 SPA history 路由拦截
|
||||
function servePublicFiles() {
|
||||
return {
|
||||
name: 'serve-public-files',
|
||||
configureServer(server) {
|
||||
server.middlewares.use((req, res, next) => {
|
||||
if (req.url) {
|
||||
const filePath = resolve(__dirname, 'public', req.url.slice(1))
|
||||
if (existsSync(filePath) && filePath.endsWith('.txt')) {
|
||||
const content = readFileSync(filePath, 'utf-8')
|
||||
res.setHeader('Content-Type', 'text/plain; charset=utf-8')
|
||||
res.end(content)
|
||||
return
|
||||
}
|
||||
}
|
||||
next()
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
plugins: [servePublicFiles(), uni()],
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
@@ -10,4 +33,5 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
publicDir: 'public',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user