|
|
@@ -1,25 +1,12 @@
|
|
|
<template>
|
|
|
<div class="body-container">
|
|
|
- <!-- <WujieVue
|
|
|
- width="100%"
|
|
|
- height="100%"
|
|
|
- name="sub-app"
|
|
|
- :url="defaultUrl"
|
|
|
- :sandbox="['allow-scripts', 'allow-same-origin', 'allow-forms', 'allow-popups']"
|
|
|
- :debug="true"
|
|
|
- :mode="'iframe'"
|
|
|
- :onError="handleError"
|
|
|
- :onBeforeLoad="beforeLoad"
|
|
|
- :onAfterLoad="afterLoad"
|
|
|
- sync
|
|
|
- ></WujieVue> -->
|
|
|
<iframe id="dify" :src="defaultURL" width="100%" height="100%" frameborder="0"></iframe>
|
|
|
+ <a-spin v-if="loading" dot />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
-import { tokenExchange } from '../../apis/login';
|
|
|
import { kuky_Authorization } from '../../base/storage';
|
|
|
const props = defineProps({
|
|
|
id: {
|
|
|
@@ -27,20 +14,14 @@ const props = defineProps({
|
|
|
required: true
|
|
|
}
|
|
|
});
|
|
|
+const loading = ref(true);
|
|
|
const DIFY_TOKEN = ref('');
|
|
|
const BASE_URL = window.DIFY_BASE_URL;
|
|
|
-const getToken = async () => {
|
|
|
- const res = await tokenExchange();
|
|
|
- if (res.code == 200) {
|
|
|
- DIFY_TOKEN.value = res.data.dify_token;
|
|
|
- }
|
|
|
-};
|
|
|
+const token = kuky_Authorization.get();
|
|
|
const defaultURL = ref('');
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- await getToken();
|
|
|
- defaultURL.value = BASE_URL + 'app/' + props.id + `/workflow?token=${DIFY_TOKEN.value}`;
|
|
|
- console.log('defaultURL', defaultURL.value);
|
|
|
+ defaultURL.value = BASE_URL + '/app/' + props.id + `/workflow?token=${token}`;
|
|
|
const element = document.getElementById('dify');
|
|
|
element.onload = function () {
|
|
|
if (element && element.contentWindow) {
|
|
|
@@ -54,12 +35,20 @@ onMounted(async () => {
|
|
|
defaultURL.value
|
|
|
);
|
|
|
}
|
|
|
+ loading.value = false;
|
|
|
};
|
|
|
});
|
|
|
</script>
|
|
|
<style scoped lang="css">
|
|
|
.body-container {
|
|
|
+ position: relative;
|
|
|
margin-top: 15px;
|
|
|
height: calc(100% - 55px);
|
|
|
}
|
|
|
+.arco-spin {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+}
|
|
|
</style>
|