YM
2024-05-15 c4a189b86db7328d537a7218d5c5a8cb0c95a320
src/views/home.vue
@@ -92,9 +92,9 @@
      <div class="menuContent" v-if="menuState.open">
        <div class="searchBox">
          <div class="inputBox" v-if="activeMenu !== 2">
            <el-input class="custom-input" placeholder="请输入内容" v-model="searchText">
            <el-input class="custom-input" placeholder="请输入内容" v-model="searchText" @keyup.enter="searchBook">
              <template #prefix>
                <el-icon @click="searchBook"><Search /></el-icon>
                <el-icon><Search /></el-icon>
              </template>
            </el-input>
          </div>
@@ -113,12 +113,14 @@
        <!-- 目录 -->
        <div class="menuList" v-if="activeMenu == 0">
          <el-tree
            ref="catalogTree"
            style="max-width: 600px"
            default-expand-all="true"
            :data="catalogueData"
            :props="defaultProps"
            v-if="catalogueData.length > 0"
            @node-click="handleNodeClick"
            :filter-node-method="filterNode"
          />
          <div v-if="catalogueData.length == 0">
            <el-empty :image-size="60" description="暂无数据" />
@@ -779,7 +781,9 @@
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="screenshotClose">取 消</el-button>
        <el-button type="primary" @click="addScreenshot" :loading="screenshotLoading">确 定</el-button>
        <el-button type="primary" @click="addScreenshot" :loading="screenshotLoading"
          >确 定</el-button
        >
      </span>
    </template>
  </el-dialog>
@@ -1028,11 +1032,12 @@
const catalogueData = ref([])
const getCatalogueData = () => {
  axios
    .get(ctxUrl + '/catalog.json')
    .get(resourceUrl + '/1/information.json?t=123')
    .then(function (response) {
      console.log(response.data)
      var json = response.data
      // 处理获取到的json数据
      catalogueData.value = json
      catalogueData.value = json.data
    })
    .catch(function (error) {
      console.log(error)
@@ -1042,8 +1047,15 @@
  children: 'children',
  label: 'label'
}
const filterNode = (value, data) => {
  if (!value) return true
  return data.label.indexOf(value) !== -1
}
const handleNodeClick = (data) => {
  document.getElementById(data.id).scrollIntoView()
  console.log(data)
  if (window.qiankunState && window.qiankunState.gotoPage)
    window.qiankunState.gotoPage(data.chapter, data.start)
}
//获取资源
@@ -1084,7 +1096,7 @@
const testWord = ref('') //word链接
const getResourceData = () => {
  axios
    .get(ctxUrl + '/resource.json')
    .get(resourceUrl + '/1/resource.json')
    .then(function (response) {
      var json = response.data
      // 处理获取到的json数据
@@ -1280,7 +1292,11 @@
  }
  getNotesList()
}
const catalogTree = ref()
const searchBook = async () => {
  if (activeMenu.value == 0) {
    if (catalogTree) catalogTree.value.filter(searchText.value)
  }
  if (activeMenu.value == 1) {
    getNotesList()
  }
@@ -1591,10 +1607,7 @@
const labelShow = (str) => {}
//标签
const reMark =() => {
}
const reMark = () => {}
//截图
//截图事件
function jitT() {
@@ -1636,16 +1649,18 @@
          }
        ]
      }
    }).then((res) => {
      screenshotLoading.value = false
      getScreenshotList()
      nameData.value = ''
      urlData.value = ''
      floatingToolData.activeToolData = ''
      screenshotVisble.value = false
    }).catch(function (error) {
      screenshotLoading.value = false
    })
      .then((res) => {
        screenshotLoading.value = false
        getScreenshotList()
        nameData.value = ''
        urlData.value = ''
        floatingToolData.activeToolData = ''
        screenshotVisble.value = false
      })
      .catch(function (error) {
        screenshotLoading.value = false
      })
  } else {
    ElMessage.error('截图名称不能为空!')
  }
@@ -1927,14 +1942,15 @@
    case '笔记':
      if (!formData.desc.replace(/^\s*|\s*$/g, '')) {
        ElMessage.error('笔记内容不能为空!')
        return
        return
      }
      if (!noteColorActive.value) {
        ElMessage.error('请选择笔记颜色!')
        return
      }
      dom = 'notes-' + bookId.value
      data = dialogToolData.notesList.length != 0 ? dialogToolData.notesList[dialogToolData.chapter] : []
      data =
        dialogToolData.notesList.length != 0 ? dialogToolData.notesList[dialogToolData.chapter] : []
      data.push({
        id: toolClass.uuid(8),
        txt: dialogToolData.txt,
@@ -1944,7 +1960,7 @@
        createDate: new Date(),
        note: formData.desc.replace(/^\s*|\s*$/g, '')
      })
      break
  }
  request({
@@ -2075,6 +2091,11 @@
  deleteType: '',
  deleteTxt: ''
})
// 划线、笔记、高亮点击回调
window.signClick = (type, id) => {
  console.log('signClick点击事件回调的实例', type, id)
}
window.notesVisbleShow = function (txt) {
  addNoteVisble.value = true
@@ -2217,7 +2238,6 @@
    })
  }
}
//内容区域顶部显示