change
This commit is contained in:
parent
35be5445b6
commit
47d9efd677
|
@ -17,9 +17,6 @@ export const ossCdnBase = import.meta.env.PROD
|
|||
export const apiBase = import.meta.env.PROD
|
||||
? 'https://goosetab.com/api'
|
||||
: 'http://192.168.110.28:8300'
|
||||
|
||||
// 后端 cdn 加速地址
|
||||
export const cdnBase = import.meta.env.PROD ? apiBase : apiBase
|
||||
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NzJkYjg5OGUxMjY5NDc1ODYwMmYwMTgifQ.8fpdr_HPgxyU0yr-8f6nGdbHYjsFRlBa2lvjc0Zhe-A
|
||||
// 图片后缀名
|
||||
export const imgArr = [
|
||||
|
|
|
@ -7,6 +7,7 @@ import { globalToast } from '@/main'
|
|||
import useSortable, { dragging, resetDragging } from './useSortable'
|
||||
import BlockWrapper from './BlockWrapper'
|
||||
import useSettingsStore from '@/settings/useSettingsStore'
|
||||
import { listenParent } from '@/utils/parent'
|
||||
|
||||
addIcons(MdAdd)
|
||||
|
||||
|
@ -19,10 +20,16 @@ export default defineComponent(() => {
|
|||
ref('page')
|
||||
)
|
||||
|
||||
listenParent('openSetting', (d) => {
|
||||
if (d === 'profile') {
|
||||
router.go('settings-user')
|
||||
}
|
||||
if (d === 'setting') {
|
||||
router.go('settings-ai')
|
||||
}
|
||||
})
|
||||
return () => (
|
||||
<div
|
||||
|
||||
|
||||
class="absolute left-0 top-0 w-full h-screen overflow-y-auto no-scrollbar pt-[240px] px-[calc((100%_-_var(--main-width))_/_2)]"
|
||||
onScroll={(e) => {
|
||||
const h = (e.target as any).scrollTop
|
||||
|
@ -59,7 +66,6 @@ export default defineComponent(() => {
|
|||
}}
|
||||
>
|
||||
<div
|
||||
|
||||
class="w-full grid justify-center grid-flow-row-dense pb-[200px]"
|
||||
style="grid-template-columns:repeat(auto-fill, var(--block-size));grid-auto-rows:var(--block-size)"
|
||||
ref={container}
|
||||
|
|
|
@ -4,7 +4,6 @@ import useUserStore from '@/user/useUserStore'
|
|||
import useRouterStore from '@/useRouterStore'
|
||||
import asyncLoader from '@/utils/asyncLoader'
|
||||
import clsx from 'clsx'
|
||||
import { OhVueIcon } from 'oh-vue-icons'
|
||||
import { computed, defineComponent, Transition } from 'vue'
|
||||
import SettingLineImg from '~/icons/settingLine.png'
|
||||
const Content = asyncLoader(() => import('./SettingsOverlayContent'))
|
||||
|
@ -107,7 +106,7 @@ export default defineComponent(() => {
|
|||
onClick={() => {
|
||||
if (profile.id) {
|
||||
router.go('settings-user')
|
||||
}else {
|
||||
} else {
|
||||
router.go('global-login')
|
||||
}
|
||||
// router.go('settings-user')
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
// 发送消息
|
||||
export function sendParent(data: ['openSide'] | ['login', string] | ['logout']) {
|
||||
export function sendParent(
|
||||
data:
|
||||
| ['openSide']
|
||||
| ['login', string]
|
||||
| ['logout']
|
||||
| [
|
||||
'configAI',
|
||||
{
|
||||
autoSearch: true
|
||||
showTabButton: true
|
||||
}
|
||||
]
|
||||
) {
|
||||
parent.window.postMessage(
|
||||
{
|
||||
type: data[0],
|
||||
|
@ -12,7 +24,7 @@ export function sendParent(data: ['openSide'] | ['login', string] | ['logout'])
|
|||
// 接收消息
|
||||
export function listenParent<T>(type: string, cb: (data: T) => void) {
|
||||
window.addEventListener('message', (e) => {
|
||||
if (e.data?.type === 'uitab-' + type) {
|
||||
if (e.data?.type === 'fatfox-' + type) {
|
||||
cb(e.data.data)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { apiBase, cdnBase } from '@/config'
|
||||
import { apiBase } from '@/config'
|
||||
import { UAParser } from 'ua-parser-js'
|
||||
const ua = new UAParser(navigator.userAgent)
|
||||
// 设备型号:例如 Mac Os-Chrome
|
||||
|
@ -12,7 +12,7 @@ const device = ua.getOS().name + '-' + ua.getBrowser().name
|
|||
*/
|
||||
export default function request<R>(
|
||||
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
|
||||
url: `${'/api' | '/cdn'}${string}`,
|
||||
url: `/api${string}`,
|
||||
requestConfig?: {
|
||||
data?: any
|
||||
dataType?: 'json' | 'form'
|
||||
|
@ -40,7 +40,7 @@ export default function request<R>(
|
|||
}
|
||||
}
|
||||
}
|
||||
const path = url.replace(/^\/api/, apiBase).replace(/^\/cdn/, cdnBase)
|
||||
const path = url.replace(/^\/api/, apiBase)
|
||||
return fetch(path, config).then((res) => {
|
||||
if (res.status >= 200 && res.status < 400) {
|
||||
return res[returnType]()
|
||||
|
|
Loading…
Reference in New Issue