From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/ai/write/index/components/Right.vue | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/src/views/ai/write/index/components/Right.vue b/src/views/ai/write/index/components/Right.vue
new file mode 100644
index 0000000..1eb66a0
--- /dev/null
+++ b/src/views/ai/write/index/components/Right.vue
@@ -0,0 +1,120 @@
+<template>
+ <el-card class="my-card h-full">
+ <template #header>
+ <h3 class="m-0 px-7 shrink-0 flex items-center justify-between">
+ <span>棰勮</span>
+ <!-- 灞曠ず鍦ㄥ彸涓婅 -->
+ <el-button color="#846af7" v-show="showCopy" @click="copyContent" size="small">
+ <template #icon>
+ <Icon icon="ph:copy-bold" />
+ </template>
+ 澶嶅埗
+ </el-button>
+ </h3>
+ </template>
+
+ <div ref="contentRef" class="hide-scroll-bar h-full box-border overflow-y-auto">
+ <div class="w-full min-h-full relative flex-grow bg-white box-border p-3 sm:p-7">
+ <!-- 缁堟鐢熸垚鍐呭鐨勬寜閽� -->
+ <el-button
+ v-show="isWriting"
+ class="absolute bottom-2 sm:bottom-5 left-1/2 -translate-x-1/2 z-36"
+ @click="emits('stopStream')"
+ size="small"
+ >
+ <template #icon>
+ <Icon icon="material-symbols:stop" />
+ </template>
+ 缁堟鐢熸垚
+ </el-button>
+ <el-input
+ id="inputId"
+ type="textarea"
+ v-model="compContent"
+ autosize
+ :input-style="{ boxShadow: 'none' }"
+ resize="none"
+ placeholder="鐢熸垚鐨勫唴瀹光�︹��"
+ />
+ </div>
+ </div>
+ </el-card>
+</template>
+
+<script setup lang="ts">
+import { useClipboard } from '@vueuse/core'
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { copied, copy } = useClipboard({ legacy: true }) // 绮樿创鏉�
+
+const props = defineProps({
+ content: {
+ // 鐢熸垚鐨勭粨鏋�
+ type: String,
+ default: ''
+ },
+ isWriting: {
+ // 鏄惁姝e湪鐢熸垚鏂囩珷
+ type: Boolean,
+ default: false
+ }
+})
+
+const emits = defineEmits(['update:content', 'stopStream'])
+
+/** 閫氳繃璁$畻灞炴�э紝鍙屽悜缁戝畾锛屾洿鏀圭敓鎴愮殑鍐呭锛岃�冭檻鍒扮敤鎴锋兂瑕佹洿鏀圭敓鎴愭枃绔犵殑鎯呭喌 */
+const compContent = computed({
+ get() {
+ return props.content
+ },
+ set(val) {
+ emits('update:content', val)
+ }
+})
+
+/** 婊氬姩 */
+const contentRef = ref<HTMLDivElement>()
+defineExpose({
+ scrollToBottom() {
+ contentRef.value?.scrollTo(0, contentRef.value?.scrollHeight)
+ }
+})
+
+/** 鐐瑰嚮澶嶅埗鐨勬椂鍊欏鍒跺唴瀹� */
+const showCopy = computed(() => props.content && !props.isWriting) // 鏄惁灞曠ず澶嶅埗鎸夐挳锛屽湪鐢熸垚鍐呭瀹屾垚鐨勬椂鍊欏睍绀�
+const copyContent = () => {
+ copy(props.content)
+}
+
+/** 澶嶅埗鎴愬姛鐨勬椂鍊� copied.value 涓� true */
+watch(copied, (val) => {
+ if (val) {
+ message.success('澶嶅埗鎴愬姛')
+ }
+})
+</script>
+
+<style lang="scss" scoped>
+.hide-scroll-bar {
+ -ms-overflow-style: none;
+ scrollbar-width: none;
+
+ &::-webkit-scrollbar {
+ width: 0;
+ height: 0;
+ }
+}
+
+.my-card {
+ display: flex;
+ flex-direction: column;
+
+ :deep(.el-card__body) {
+ box-sizing: border-box;
+ flex-grow: 1;
+ overflow-y: auto;
+ padding: 0;
+ @extend .hide-scroll-bar;
+ }
+}
+</style>
--
Gitblit v1.8.0