liyongli 1 rok temu
rodzic
commit
67fa249e5a

BIN
src/assets/img/jy.png


+ 11 - 0
src/view/allMedia/AIeditor/components/comment.vue

@@ -0,0 +1,11 @@
+<template>
+  <div class="pen_ink">
+  </div>
+</template>
+
+<script setup>
+// 评论
+</script>
+
+<style scoped>
+</style>

Plik diff jest za duży
+ 22 - 0
src/view/allMedia/AIeditor/components/data.js


+ 11 - 0
src/view/allMedia/AIeditor/components/dictionary.vue

@@ -0,0 +1,11 @@
+<template>
+  <div class="pen_ink">
+  </div>
+</template>
+
+<script setup>
+// 字典
+</script>
+
+<style scoped>
+</style>

+ 11 - 0
src/view/allMedia/AIeditor/components/image.vue

@@ -0,0 +1,11 @@
+<template>
+  <div class="pen_ink">
+  </div>
+</template>
+
+<script setup>
+// 图片
+</script>
+
+<style scoped>
+</style>

+ 118 - 0
src/view/allMedia/AIeditor/components/pen_ink.vue

@@ -0,0 +1,118 @@
+<template>
+  <div class="pen_ink">
+    <el-input
+      v-model="search_input"
+      :prefix-icon="Search"
+      placeholder="搜索模板"
+    />
+    <div class="grid_bg">
+      <template v-for="item in pen_ink_list" :key="item.key">
+        <div class="list" v-if="is_show(item.name)">
+          <div class="icon">
+            <el-image
+              style="width: 24px; height: 24px"
+              :src="item.icon"
+              fit="fill"
+            />
+          </div>
+          <div data-v-4a916bec="" class="title" v-text="item.name"></div>
+          <div data-v-4a916bec="" class="sub_title" v-text="item.sub_text"></div>
+        </div>
+      </template>
+    </div>
+  </div>
+</template>
+
+<script setup>
+// AI写作
+import { Search } from '@element-plus/icons-vue';
+import { ref } from 'vue';
+
+import { pen_ink_list } from './data';
+const search_input = ref('');
+
+const is_show = i_name => {
+  const rex = new RegExp(search_input.value);
+  return rex.test(i_name);
+};
+</script>
+
+<style scoped>
+.pen_ink {
+  padding: 2px 10px 10px;
+  overflow: hidden;
+}
+
+.grid_bg {
+  display: grid;
+  grid-template-columns: repeat(2, 1fr);
+  gap: 10px 10px;
+  padding-bottom: 20px;
+  font-size: 14px;
+  padding: 5px;
+  max-height: calc(100vh - 100px);
+  overflow-y: auto;
+}
+.grid_bg::-webkit-scrollbar{
+    width: 0;
+}
+
+.icon {
+  background: #fff;
+  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04),
+    0 4px 10px rgba(0, 0, 0, 0.08);
+  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 4px 10px rgba(0, 0, 0, 0.08);
+  width: 40px;
+  height: 40px;
+  border-radius: 50%;
+  display: -webkit-box;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-box-align: center;
+  -ms-flex-align: center;
+  align-items: center;
+  -webkit-box-pack: center;
+  -ms-flex-pack: center;
+  justify-content: center;
+  -webkit-box-flex: 0;
+  -ms-flex: none;
+  flex: none;
+}
+
+.list {
+  font-size: 14px;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  min-height: 145px;
+  min-width: 150px;
+  padding: 10px 20px;
+  -webkit-box-align: start;
+  -ms-flex-align: start;
+  align-items: flex-start;
+  cursor: pointer;
+  border-radius: 5px;
+  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02), 0 0px 5px rgba(0, 0, 0, 0.04);
+}
+
+.title {
+  height: 22px;
+  line-height: 22px;
+  font-size: 14px;
+  font-weight: 700;
+  color: #4b4b4b;
+  display: -webkit-box;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-box-align: center;
+  -ms-flex-align: center;
+  align-items: center;
+  margin-top: 10px;
+}
+
+.sub_title{
+    line-height: 18px;
+    font-size: 12px;
+    color: #8e8e8e;
+    margin-top: 10px;
+}
+</style>

+ 134 - 0
src/view/allMedia/AIeditor/components/review.vue

@@ -0,0 +1,134 @@
+<template>
+  <div class="review">
+    <el-image style="width: 310px; height: 232.5px" :src="jy" fit="fill" />
+    <template v-if="is_status === 'none'">
+      <div class="none_title">检查完毕,一切都好</div>
+      <ul>
+        <li>实时分析文本内容进行校阅</li>
+        <li>鼠标划选句子进行风格改写,提供写作新思路</li>
+      </ul>
+    </template>
+    <template v-if="is_status === 'load'">
+      <div class="checking_tip_text">
+        为您检查中
+        <div class="dot-flashing"></div>
+      </div>
+    </template>
+  </div>
+</template>
+
+<script setup>
+// 校阅
+import { ref } from 'vue';
+import jy from '@/assets/img/jy.png';
+
+const is_status = ref('none');
+</script>
+
+<style scoped>
+.review {
+  width: 310px;
+  margin: 0 auto;
+}
+.none_title {
+  font-size: 24px;
+  text-align: left;
+  font-weight: 700;
+  margin-bottom: 16px;
+  margin-left: 11.3%;
+}
+ul {
+  margin-left: 20px;
+}
+ul > li {
+  font-size: 14px;
+  color: #2c3e50;
+  margin-bottom: 16px;
+}
+
+.checking_tip_text {
+  font-weight: 400;
+  font-size: 16px;
+  line-height: 24px;
+  display: -webkit-box;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-box-orient: horizontal;
+  -webkit-box-direction: normal;
+  -ms-flex-direction: row;
+  flex-direction: row;
+  -webkit-box-pack: center;
+  -ms-flex-pack: center;
+  justify-content: center;
+  -webkit-box-align: center;
+  -ms-flex-align: center;
+  align-items: center;
+  margin-left: -38px;
+  margin-top: -26px;
+}
+
+.dot-flashing {
+  margin-left: 22px;
+  margin-top: 3px;
+  position: relative;
+  width: 8px;
+  height: 8px;
+  border-radius: 50%;
+  background-color: #2d2d2d;
+  color: #2d2d2d;
+  -webkit-animation: dot-flashing-0833031b 0.6s linear infinite alternate;
+  animation: dot-flashing-0833031b 0.6s linear infinite alternate;
+  -webkit-animation-delay: 0.3s;
+  animation-delay: 0.3s;
+}
+.dot-flashing:after,
+.dot-flashing:before {
+  content: '';
+  display: inline-block;
+  position: absolute;
+  top: 0;
+}
+.dot-flashing:before {
+  left: -14px;
+  width: 8px;
+  height: 8px;
+  border-radius: 50%;
+  background-color: #2d2d2d;
+  color: #2d2d2d;
+  -webkit-animation: dot-flashing-0833031b 0.6s infinite alternate;
+  animation: dot-flashing-0833031b 0.6s infinite alternate;
+  -webkit-animation-delay: 0s;
+  animation-delay: 0s;
+}
+.dot-flashing:after {
+  left: 14px;
+  width: 8px;
+  height: 8px;
+  border-radius: 50%;
+  background-color: #2d2d2d;
+  color: #2d2d2d;
+  -webkit-animation: dot-flashing-0833031b 0.6s infinite alternate;
+  animation: dot-flashing-0833031b 0.6s infinite alternate;
+  -webkit-animation-delay: 0.6s;
+  animation-delay: 0.6s;
+}
+@-webkit-keyframes dot-flashing-0833031b {
+    0% {
+        background-color: #2d2d2d
+    }
+
+    50%,to {
+        background-color: hsla(0,0%,100%,.1)
+    }
+}
+
+@keyframes dot-flashing-0833031b {
+    0% {
+        background-color: #2d2d2d
+    }
+
+    50%,to {
+        background-color: hsla(0,0%,100%,.1)
+    }
+}
+</style>

+ 325 - 33
src/view/allMedia/AIeditor/index.vue

@@ -6,29 +6,117 @@
       :defaultConfig="toolbarConfig"
       mode="default"
     />
-    <el-row :gutter="20" class="main">
-      <el-col :span="20">
-        <div class="bgEditor">
-          <div class="editor">
-            <h1 contenteditable style="padding: 100px 100px 0; outline: none">
-              无标题
-            </h1>
-            <Editor
-              v-model="valueHtml"
-              :defaultConfig="editorConfig"
-              style="padding: 0 90px; height: calc(100% - 150px)"
-              mode="default"
-              @onCreated="handleCreated"
-            />
-          </div>
-          <div class="tool">
-            <el-icon ><MoreFilled style="transform: rotate(180deg);" /></el-icon>
-            123
+    <div class="main">
+      <div class="bgeditor">
+        <div class="editor">
+          <h1 contenteditable style="padding: 100px 100px 0; outline: none">
+            无标题
+          </h1>
+          <Editor
+            v-model="valueHtml"
+            :defaultConfig="editorConfig"
+            style="padding: 0 90px; height: calc(100% - 150px)"
+            mode="default"
+            @onCreated="handleCreated"
+          />
+          <Transition name="toolCol">
+            <div class="tool" v-if="toolShow">
+              <el-icon color="#cacaca" :size="25">
+                <MoreFilled style="transform: rotate(90deg)" />
+              </el-icon>
+              <el-button
+                type="primary"
+                style="
+                  border-top-right-radius: 0;
+                  border-bottom-right-radius: 0;
+                "
+              >
+                写内容
+              </el-button>
+              <el-button
+                type="primary"
+                style="
+                  border-top-left-radius: 0;
+                  border-bottom-left-radius: 0;
+                  margin-left: 0;
+                "
+              >
+                写大纲
+              </el-button>
+              <div>
+                <el-button v-if="load" :loading="load">
+                  <svg class="circular" viewBox="-10, -10, 50, 50">
+                    <path
+                      class="path"
+                      d="
+                        M 30 15
+                        L 28 17
+                        M 25.61 25.61
+                        A 15 15, 0, 0, 1, 15 30
+                        A 15 15, 0, 1, 1, 27.99 7.5
+                        L 15 15
+                    "
+                      style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"
+                    />
+                  </svg>
+                </el-button>
+              </div>
+              <div
+                class="btnType"
+                :class="{ btnTypeAct: btnType === 0 }"
+                @click="btnType = 0"
+              >
+                短
+              </div>
+              <div
+                class="btnType"
+                :class="{ btnTypeAct: btnType === 1 }"
+                @click="btnType = 1"
+              >
+                中
+              </div>
+              <div
+                class="btnType"
+                :class="{ btnTypeAct: btnType === 2 }"
+                @click="btnType = 2"
+              >
+                长
+              </div>
+              <div style="amrgin-right: 10px" @click="toolShow = false">
+                <el-icon color="#cacaca" :size="25"><ArrowRight /></el-icon>
+              </div>
+            </div>
+          </Transition>
+          <Transition name="toolBtn">
+            <el-icon
+              v-if="!toolShow"
+              @click="toolShow = true"
+              class="toolBtnClass"
+              :size="22"
+              color="#3b82f6"
+              ><ArrowLeft
+            /></el-icon>
+          </Transition>
         </div>
+      </div>
+
+      <div class="operate" v-if="statusPage[1]">
+        <div class="toolHead">
+          <div
+            class="toolHeadItem"
+            v-for="(v, i) in select_right_btn_list"
+            :key="'ttt' + i"
+            :style="{ left: v.left + 'px' }"
+            @click="() => change_select_right_btn_type(i)"
+            :class="{ toolAct: v.index === 0 }"
+          >
+            {{ v.text }}
+            <div class="line"></div>
+          </div>
         </div>
-      </el-col>
-      <el-col :span="4">1</el-col>
-    </el-row>
+        <component :is="componment_list[select_right_btn_type]"></component>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -36,14 +124,61 @@
 import '@wangeditor/editor/dist/css/style.css'; // 引入 css
 import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue';
 import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
+
+import pen_ink from './components/pen_ink.vue';
+import review from './components/review.vue';
+import image from './components/image.vue';
+import dictionary from './components/dictionary.vue';
+import comment from './components/comment.vue';
+
+const componment_list = [pen_ink, review, image, dictionary, comment];
+
 // 编辑器实例,必须用 shallowRef
 const editorRef = shallowRef();
 
 // 内容 HTML
 const valueHtml = ref('<p>hello</p>');
+const select_right_btn_type = ref(0);
+const select_right_btn_list = ref([
+  {
+    text: 'AI写作',
+    width: 56,
+    left: 0,
+    index: 0,
+  },
+  {
+    text: '校阅',
+    width: 42,
+    left: 75,
+    index: 1,
+  },
+  {
+    text: '图片',
+    width: 42,
+    left: 136,
+    index: 2,
+  },
+  {
+    text: '词典',
+    width: 42,
+    left: 197,
+    index: 3,
+  },
+  {
+    text: '评论',
+    width: 42,
+    left: 258,
+    index: 4,
+  },
+]);
 
 onMounted(() => {});
 
+const statusPage = ref([false, true]); // 0 --> 目录  1 --> operate
+const load = ref(true);
+const toolShow = ref(true);
+const btnType = ref(0);
+
 const toolbarConfig = {
   toolbarKeys: [
     'redo',
@@ -77,9 +212,9 @@ const editorConfig = {
   hoverbarKeys: {
     text: {
       // 如有 match 函数,则优先根据 match 判断,而忽略 element type
-      match: editor => {
+      match: () => {
         // 可参考下文的源码
-        console.log(editor.getConfig());
+        // console.log(editor.getConfig());
       },
       menuKeys: [], // 定义你想要的 menu keys
     },
@@ -94,35 +229,96 @@ onBeforeUnmount(() => {
 const handleCreated = editor => {
   editorRef.value = editor; // 记录 editor 实例,重要!
 };
+
+const change_select_right_btn_type = index => {
+  const oldList = JSON.parse(JSON.stringify(select_right_btn_list.value));
+  const zIndex = oldList[index].index;
+  const zLeft = oldList[index].left;
+  select_right_btn_type.value = index;
+  for (let i = 0; i < oldList.length; i++) {
+    const v = oldList[i];
+    if (v.index === 0) {
+      v.index = zIndex;
+      v.left = zLeft;
+    }
+    if (i === index) {
+      v.index = 0;
+      v.left = 0;
+    }
+  }
+  for (let i = 0; i < oldList.length; i++) {
+    const v = oldList[i];
+    if (v.left === 0) continue;
+    v.left = getLast(v.index, oldList);
+  }
+  select_right_btn_list.value = oldList;
+};
+
+const getLast = (index, li) => {
+  let oldleft = 0;
+  for (let i = 0; i < li.length; i++) {
+    if (li[i].index >= index) continue;
+    oldleft += li[i].width + 19;
+  }
+  return oldleft;
+};
 </script>
 
 <style scoped>
-</style>
+.toolCol-enter-active,
+.toolCol-leave-active {
+  opacity: 1;
+}
+
+.toolCol-enter-from,
+.toolCol-leave-to {
+  transform: translateX(0%) !important;
+  opacity: 0;
+}
 
+.toolBtn-enter-active,
+.toolBtn-leave-active {
+  opacity: 1;
+}
+
+.toolBtn-enter-from,
+.toolBtn-leave-to {
+  opacity: 0;
+  transform: translateX(100%);
+}
+</style>
 
 <style scoped>
 .AIeditor {
   height: 100%;
 }
 
-.AIeditor .main,
-.bgEditor {
-  position: relative;
-  height: calc(100% - 40px);
-}
-
 .AIeditor .main {
+  height: calc(100% - 40px);
   overflow-y: auto;
+  width: 100%;
+  display: flex;
 }
 
 .editor {
-  width: 80%;
+  transition: all 0.2s ease;
+  position: relative;
+  width: 100%;
+  max-width: 816px;
   box-shadow: 0 0 25px #eeeeee;
   height: 100vh;
   margin: 1em auto;
 }
 
+.bgeditor {
+  padding: 0 73px 0 73px;
+  flex: 1;
+  height: 100vh;
+  overflow: hidden;
+}
+
 .tool {
+  transition: all 0.2s ease;
   bottom: 35px;
   align-items: center;
   display: flex;
@@ -135,12 +331,108 @@ const handleCreated = editor => {
   width: 500px;
   -webkit-box-sizing: border-box;
   box-sizing: border-box;
-  border-radius: 3px;
-  border: 1px solid #eee;
   padding: 8px 0 8px 9px;
   background-color: #fff;
   -webkit-box-pack: justify;
   -ms-flex-pack: justify;
   justify-content: space-between;
 }
+
+.btnType {
+  width: 32px;
+  height: 32px;
+  background-color: #f5f5f5;
+  color: #909399;
+  font-size: 12px;
+  border-radius: 3px;
+  line-height: 32px;
+  text-align: center;
+  border: 1px solid transparent;
+  cursor: pointer;
+}
+
+.btnTypeAct {
+  background-color: #e4f2ff;
+  border: 1px solid #3b82f6;
+  color: #3b82f6;
+}
+
+.toolBtnClass {
+  transition: all 0.2s ease;
+  position: absolute;
+  right: 5px;
+  bottom: 55px;
+}
+
+.operate {
+  flex: 1;
+  height: 100vh;
+  overflow-y: auto;
+}
+
+@media screen and (max-width: 1500px) {
+  .bgeditor {
+    padding: 0;
+  }
+
+  .operate {
+    margin-left: 8px;
+  }
+}
+
+.toolHead {
+  position: sticky;
+  top: 0;
+  -webkit-box-flex: 0;
+  -ms-flex: none;
+  flex: none;
+  z-index: 1;
+  position: relative;
+  width: 100%;
+  height: 50px;
+  /* display: flex;
+    flex-wrap: wrap; */
+}
+
+.toolHeadItem {
+  transition: all 0.3s ease;
+  padding: 0.3em 0.5em;
+  color: #8e8e9c;
+  /* margin-right: 19px; */
+  /* transform: scale(0); */
+  font-size: 16px;
+  text-align: center;
+  /* display: inline-block; */
+  position: absolute;
+  line-height: 2;
+  font-size: 14px;
+  font-weight: 700;
+  opacity: 0;
+  cursor: pointer;
+  order: 1;
+}
+.toolHead:hover .toolHeadItem {
+  opacity: 1;
+}
+.toolHeadItem .line {
+  height: 6px;
+  border-radius: 5px;
+  width: 115%;
+  margin-left: -8%;
+  background-color: #e1e1e1;
+}
+.toolAct {
+  color: #1f1f1f;
+  opacity: 1;
+  /* order: 0; */
+}
+.toolAct .line {
+  background-color: #8e8e8e;
+}
+</style>
+
+<style>
+.w-e-bar-show {
+  justify-content: center;
+}
 </style>

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików