|
@@ -488,15 +488,21 @@
|
|
|
</div>
|
|
</div>
|
|
|
<span class="submenu-label">{{ lang.ssUploadWebpageLink }}</span>
|
|
<span class="submenu-label">{{ lang.ssUploadWebpageLink }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="submenu-item" @click="handleToolClick('createWebpage')">
|
|
|
|
|
- <div class="submenu-icon">
|
|
|
|
|
|
|
+ <!-- @click="handleToolClick('createWebpage')" -->
|
|
|
|
|
+ <div class="submenu-item" :class="{ 'loading-state': create_app_loading }" @click="!create_app_loading && handle_add_aiWeb()">
|
|
|
|
|
+ <div class="submenu-icon" v-if="!create_app_loading">
|
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
|
<rect x="3" y="3" width="18" height="14" rx="2"></rect>
|
|
<rect x="3" y="3" width="18" height="14" rx="2"></rect>
|
|
|
<path d="M12 8v6"></path>
|
|
<path d="M12 8v6"></path>
|
|
|
<path d="M9 11h6"></path>
|
|
<path d="M9 11h6"></path>
|
|
|
</svg>
|
|
</svg>
|
|
|
</div>
|
|
</div>
|
|
|
- <span class="submenu-label">{{ lang.ssNewWebpage }}</span>
|
|
|
|
|
|
|
+ <div class="submenu-icon loading-icon" v-else>
|
|
|
|
|
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="spin">
|
|
|
|
|
+ <circle cx="12" cy="12" r="10" stroke-dasharray="32" stroke-dashoffset="12"></circle>
|
|
|
|
|
+ </svg>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span class="submenu-label">{{ create_app_loading ? lang.ssCreating : lang.ssNewWebpage }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="submenu-item" @click="handleToolClick('uploadCode')">
|
|
<div class="submenu-item" @click="handleToolClick('uploadCode')">
|
|
|
<div class="submenu-icon">
|
|
<div class="submenu-icon">
|
|
@@ -702,7 +708,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <AiWeb :visible="showAiWebModal" :web-id="webId" @close="showAiWebModal = false" @add="addAiWeb" :is-loading="isLoading" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -715,14 +721,14 @@ import { useSlidesStore } from '@/store'
|
|
|
import { useSpeakingStore } from '@/store/speaking'
|
|
import { useSpeakingStore } from '@/store/speaking'
|
|
|
import FileInput from '@/components/FileInput.vue'
|
|
import FileInput from '@/components/FileInput.vue'
|
|
|
import AiChat from './componets/aiChat.vue'
|
|
import AiChat from './componets/aiChat.vue'
|
|
|
|
|
+import AiWeb from './componets/aiWeb.vue'
|
|
|
import SpeakingPanel from '@/views/Editor/EnglishSpeaking/SpeakingPanel.vue'
|
|
import SpeakingPanel from '@/views/Editor/EnglishSpeaking/SpeakingPanel.vue'
|
|
|
import { lang } from '@/main'
|
|
import { lang } from '@/main'
|
|
|
import toolChoice from '@/assets/img/tool_choice.jpeg'
|
|
import toolChoice from '@/assets/img/tool_choice.jpeg'
|
|
|
import toolAnswer from '@/assets/img/tool_answer.png'
|
|
import toolAnswer from '@/assets/img/tool_answer.png'
|
|
|
import toolVote from '@/assets/img/tool_vote.png'
|
|
import toolVote from '@/assets/img/tool_vote.png'
|
|
|
import toolPhoto from '@/assets/img/tool_photo.png'
|
|
import toolPhoto from '@/assets/img/tool_photo.png'
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+import axios from '@/services/config'
|
|
|
|
|
|
|
|
interface ContentItem {
|
|
interface ContentItem {
|
|
|
tool?: number
|
|
tool?: number
|
|
@@ -741,6 +747,16 @@ const props = withDefaults(defineProps<{
|
|
|
userid: null,
|
|
userid: null,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+const userJson = ref<any>({})
|
|
|
|
|
+watch(() => props.userid, async (newVal) => {
|
|
|
|
|
+ if (!newVal) return
|
|
|
|
|
+ const res = await axios.get('https://pbl.cocorobo.cn/api/pbl/selectUser', {
|
|
|
|
|
+ params: { userid: newVal }
|
|
|
|
|
+ })
|
|
|
|
|
+ userJson.value = res[0][0] || {}
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
|
(e: 'toggle', collapsed: boolean): void
|
|
(e: 'toggle', collapsed: boolean): void
|
|
|
}>()
|
|
}>()
|
|
@@ -1339,6 +1355,59 @@ const handleUploadCode = async () => {
|
|
|
codeInput.value = ''
|
|
codeInput.value = ''
|
|
|
isLoading.value = false
|
|
isLoading.value = false
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// AI Web 相关状态
|
|
|
|
|
+const create_app_loading = ref(false)
|
|
|
|
|
+const webId = ref('')
|
|
|
|
|
+const showAiWebModal = ref(false)
|
|
|
|
|
+
|
|
|
|
|
+const handle_add_aiWeb = _.throttle(async () => {
|
|
|
|
|
+ create_app_loading.value = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const elements = currentSlide.value?.elements || []
|
|
|
|
|
+ console.log(elements)
|
|
|
|
|
+ const existingWebElement = elements.find((el: any) => el.toolType === 73 && el.webId && el.type === 'frame')
|
|
|
|
|
+
|
|
|
|
|
+ if (existingWebElement && existingWebElement.webId) {
|
|
|
|
|
+ webId.value = existingWebElement.webId
|
|
|
|
|
+ create_app_loading.value = false
|
|
|
|
|
+ showAiWebModal.value = true
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const res = await axios.post('https://appapi.cocorobo.cn/api/agents/ai_edit', {
|
|
|
|
|
+ userid: props.userid || '',
|
|
|
|
|
+ username: userJson.value.name || '',
|
|
|
|
|
+ muti_name: lang.ssAddWebH5,
|
|
|
|
|
+ description: lang.ssAddWebH5,
|
|
|
|
|
+ headUrl: 'https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/default%2F%E9%BB%98%E8%AE%A4%E5%A4%B4%E5%83%8F51741770599274.svg',
|
|
|
|
|
+ organizeid: userJson.value.organizeid || '',
|
|
|
|
|
+ content: ''
|
|
|
|
|
+ })
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ webId.value = res.id || ''
|
|
|
|
|
+
|
|
|
|
|
+ create_app_loading.value = false
|
|
|
|
|
+ showAiWebModal.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (error) {
|
|
|
|
|
+ console.log(error)
|
|
|
|
|
+ create_app_loading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+}, 3000)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const addAiWeb = async (code: string) => {
|
|
|
|
|
+ if (!code) return
|
|
|
|
|
+ const file = new File([code], 'index.html', { type: 'text/html' })
|
|
|
|
|
+ isLoading.value = true
|
|
|
|
|
+ const url = await uploadFileToS3(file)
|
|
|
|
|
+ createSlide()
|
|
|
|
|
+ createFrameElement(url, 73, webId.value)
|
|
|
|
|
+ isLoading.value = false
|
|
|
|
|
+ showAiWebModal.value = false
|
|
|
|
|
+ webId.value = ''
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -2398,14 +2467,19 @@ const handleUploadCode = async () => {
|
|
|
cursor: not-allowed;
|
|
cursor: not-allowed;
|
|
|
opacity: 0.8;
|
|
opacity: 0.8;
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- &.error {
|
|
|
|
|
- background-color: #ff4d4f;
|
|
|
|
|
- color: white;
|
|
|
|
|
|
|
+ .loading-state {
|
|
|
|
|
+ opacity: 0.7;
|
|
|
|
|
+ cursor: not-allowed;
|
|
|
|
|
+ pointer-events: none;
|
|
|
|
|
|
|
|
- &:hover:not(:disabled) {
|
|
|
|
|
- background-color: #ff7875;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .submenu-icon {
|
|
|
|
|
+ animation: pulse 1s infinite;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .spin {
|
|
|
|
|
+ animation: spin 1s linear infinite;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|