| | |
| | | import { NO_AUTH_API_LIST } from '/@/api/ai/chat'; |
| | | import { LOGIN_URL, TEL_LOGIN_URL } from '/@/api/ai/user'; |
| | | import { Local } from '/@/utils/storage'; |
| | | import { isSharePage } from '/@/stores/chatRoom'; |
| | | |
| | | const amisRootRef = ref<HTMLDivElement>(null); |
| | | |
| | | const props = defineProps({ |
| | |
| | | }), |
| | | }, |
| | | locals: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | context:{ |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | |
| | | }); |
| | | } |
| | | |
| | | const context = reactive({ |
| | | siteName: 'AMIS DEMO', |
| | | }); |
| | | |
| | | const current = router.currentRoute.value; |
| | | |
| | | const location = { |
| | |
| | | const updateProps = () => { |
| | | amisInstance.value?.updateProps({ |
| | | data: { |
| | | ...props.locals, |
| | | // ...props.locals, |
| | | }, |
| | | context: context, |
| | | context: props.context, |
| | | ...props.props, |
| | | }); |
| | | }; |
| | |
| | | props.schema, |
| | | { |
| | | data: { |
| | | ...props.locals, |
| | | // ...props.locals, |
| | | }, |
| | | context: context, |
| | | context: props.context, |
| | | location: location, |
| | | |
| | | // todo 下发 location 对象 |
| | |
| | | // api.context 中包含发送请求前的上下文信息 |
| | | // 获取本地的 token |
| | | const accessSession = Local.get(accessSessionKey); |
| | | if (!NO_AUTH_API_LIST.includes(api.url)) { |
| | | if (!NO_AUTH_API_LIST.includes(api.url) && !isSharePage.value) { |
| | | if (accessSession) { |
| | | // 将 token 添加到请求报文头中 |
| | | api.headers['hswatersession'] = accessSession; |