feat:移除ElMessage组件
This commit is contained in:
@@ -15,7 +15,8 @@ import {checkAndUpgradeSaveDict, checkAndUpgradeSaveSetting, shakeCommonDict} fr
|
||||
import {GITHUB} from "@/config/ENV.ts";
|
||||
import dayjs from "dayjs";
|
||||
import BasePage from "@/pages/pc/components/BasePage.vue";
|
||||
import {ElSwitch, ElSelect, ElOption, ElSlider, ElRadioGroup, ElRadio, ElInputNumber,ElMessage} from 'element-plus'
|
||||
import {ElSwitch, ElSelect, ElOption, ElSlider, ElRadioGroup, ElRadio, ElInputNumber} from 'element-plus'
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
|
||||
const emit = defineEmits<{
|
||||
toggleDisabledDialogEscKey: [val: boolean]
|
||||
@@ -60,7 +61,7 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||
for (const [k, v] of Object.entries(settingStore.shortcutKeyMap)) {
|
||||
if (v === shortcutKey && k !== editShortcutKey) {
|
||||
settingStore.shortcutKeyMap[editShortcutKey] = DefaultShortcutKeyMap[editShortcutKey]
|
||||
return ElMessage.warning('快捷键重复!')
|
||||
return Toast.warning('快捷键重复!')
|
||||
}
|
||||
}
|
||||
settingStore.shortcutKeyMap[editShortcutKey] = shortcutKey
|
||||
@@ -71,7 +72,7 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||
function resetShortcutKeyMap() {
|
||||
editShortcutKey = ''
|
||||
settingStore.shortcutKeyMap = cloneDeep(DefaultShortcutKeyMap)
|
||||
ElMessage.success('恢复成功')
|
||||
Toast.success('恢复成功')
|
||||
}
|
||||
|
||||
function exportData() {
|
||||
@@ -90,7 +91,7 @@ function exportData() {
|
||||
}
|
||||
let blob = new Blob([JSON.stringify(data)], {type: "text/plain;charset=utf-8"});
|
||||
saveAs(blob, `${APP_NAME}-User-Data-${dayjs().format('YYYY-MM-DD HH-mm-ss')}.json`);
|
||||
ElMessage.success('导出成功!')
|
||||
Toast.success('导出成功!')
|
||||
}
|
||||
|
||||
function importData(e) {
|
||||
@@ -115,9 +116,9 @@ function importData(e) {
|
||||
settingStore.setState(settingState)
|
||||
let baseState = checkAndUpgradeSaveDict(data.dict)
|
||||
store.setState(baseState)
|
||||
ElMessage.success('导入成功!')
|
||||
Toast.success('导入成功!')
|
||||
} catch (err) {
|
||||
return ElMessage.error('导入失败!')
|
||||
return Toast.error('导入失败!')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ import {DictResource, DictType} from "@/types/types.ts";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import Book from "@/pages/pc/components/Book.vue";
|
||||
import {ElMessage, ElProgress} from 'element-plus';
|
||||
import {ElProgress} from 'element-plus';
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
import PopConfirm from "@/pages/pc/components/PopConfirm.vue";
|
||||
import {onMounted, watch} from "vue";
|
||||
@@ -34,7 +35,7 @@ async function init() {
|
||||
function startStudy() {
|
||||
if (base.sbook.id) {
|
||||
if (!base.sbook.articles.length) {
|
||||
return ElMessage.warning('没有文章可学习!')
|
||||
return Toast.warning('没有文章可学习!')
|
||||
}
|
||||
window.umami?.track('startStudyArticle', {
|
||||
name: base.sbook.name,
|
||||
@@ -45,7 +46,7 @@ function startStudy() {
|
||||
nav('/study-article')
|
||||
} else {
|
||||
window.umami?.track('no-book')
|
||||
ElMessage.warning('请先选择一本书籍')
|
||||
Toast.warning('请先选择一本书籍')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ function handleBatchDel() {
|
||||
}
|
||||
})
|
||||
selectIds = []
|
||||
ElMessage.success("删除成功!")
|
||||
Toast.success("删除成功!")
|
||||
}
|
||||
|
||||
function toggleSelect(item) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import {nanoid} from "nanoid";
|
||||
import EditArticle from "@/pages/pc/article/components/EditArticle.vue";
|
||||
import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import {getDefaultArticle} from "@/types/func.ts";
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -111,7 +111,7 @@ function saveArticle(val: Article): boolean {
|
||||
} else {
|
||||
let has = runtimeStore.editDict.articles.find((item: Article) => item.title === val.title)
|
||||
if (has) {
|
||||
ElMessage.error('已存在同名文章!')
|
||||
Toast.error('已存在同名文章!')
|
||||
return false
|
||||
}
|
||||
val.id = nanoid(6)
|
||||
@@ -122,7 +122,7 @@ function saveArticle(val: Article): boolean {
|
||||
}
|
||||
article = cloneDeep(val)
|
||||
//TODO 保存完成后滚动到对应位置
|
||||
ElMessage.success('保存成功!')
|
||||
Toast.success('保存成功!')
|
||||
syncBookInMyStudyList()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {Article, ArticleItem, ArticleWord, ShortcutKey, Word} from "@/types/types.ts";
|
||||
import {useOnKeyboardEventListener, useStartKeyboardEventListener} from "@/hooks/event.ts";
|
||||
import useTheme from "@/hooks/theme.ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import {cloneDeep} from "@/utils";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import {useArticleOptions} from "@/hooks/dict.ts";
|
||||
@@ -58,7 +58,7 @@ function repeat() {
|
||||
function prev() {
|
||||
// console.log('next')
|
||||
if (store.sbook.lastLearnIndex === 0) {
|
||||
ElMessage.warning('已经在第一章了~')
|
||||
Toast.warning('已经在第一章了~')
|
||||
} else {
|
||||
store.sbook.lastLearnIndex--
|
||||
getCurrentPractice()
|
||||
|
||||
@@ -9,7 +9,8 @@ import {genArticleSectionData, splitCNArticle2, splitEnArticle2, usePlaySentence
|
||||
import {_nextTick, _parseLRC, cloneDeep, last} from "@/utils";
|
||||
import {watch} from "vue";
|
||||
import Empty from "@/components/Empty.vue";
|
||||
import {ElInputNumber, ElMessage, ElOption, ElPopover, ElSelect, ElUpload, UploadProps} from "element-plus";
|
||||
import {ElInputNumber, ElOption, ElPopover, ElSelect, ElUpload, UploadProps} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import * as Comparison from "string-comparison"
|
||||
import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import Dialog from "@/pages/pc/components/dialog/Dialog.vue";
|
||||
@@ -62,7 +63,7 @@ function apply(isHandle: boolean = true) {
|
||||
// text = `While it is yet to be seen what direction the second Trump administration will take globally in its China policy, VOA traveled to the main island of Mahe in Seychelles to look at how China and the U.S. have impacted the country, and how each is fairing in that competition for influence there.`
|
||||
// text = "It was Sunday. I never get up early on Sundays. I sometimes stay in bed until lunchtime. Last Sunday I got up very late. I looked out of the window. It was dark outside. 'What a day!' I thought. 'It's raining again.' Just then, the telephone rang. It was my aunt Lucy. 'I've just arrived by train,' she said. 'I'm coming to see you.'\n\n 'But I'm still having breakfast,' I said.\n\n 'What are you doing?' she asked.\n\n 'I'm having breakfast,' I repeated.\n\n 'Dear me,' she said. 'Do you always get up so late? It's one o'clock!'"
|
||||
editArticle.sections = []
|
||||
ElMessage.error('请填写原文!')
|
||||
Toast.error('请填写原文!')
|
||||
return
|
||||
}
|
||||
failCount = genArticleSectionData(editArticle)
|
||||
@@ -91,10 +92,10 @@ function splitTranslateText() {
|
||||
//TODO
|
||||
async function startNetworkTranslate() {
|
||||
if (!editArticle.title.trim()) {
|
||||
return ElMessage.error('请填写标题!')
|
||||
return Toast.error('请填写标题!')
|
||||
}
|
||||
if (!editArticle.text.trim()) {
|
||||
return ElMessage.error('请填写正文!')
|
||||
return Toast.error('请填写正文!')
|
||||
}
|
||||
apply()
|
||||
//注意!!!
|
||||
@@ -132,11 +133,11 @@ function save(option: 'save' | 'saveAndNext') {
|
||||
editArticle.textTranslate = editArticle.textTranslate.trim()
|
||||
|
||||
if (!editArticle.title) {
|
||||
ElMessage.error('请填写标题!')
|
||||
Toast.error('请填写标题!')
|
||||
return resolve(false)
|
||||
}
|
||||
if (!editArticle.text) {
|
||||
ElMessage.error('请填写正文!')
|
||||
Toast.error('请填写正文!')
|
||||
return resolve(false)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
import {Dict, DictId, DictType} from "@/types/types.ts";
|
||||
import {cloneDeep} from "@/utils";
|
||||
|
||||
import {ElForm, ElFormItem, ElInput, ElSelect, ElOption, FormInstance, FormRules, ElMessage} from "element-plus";
|
||||
import {ElForm, ElFormItem, ElInput, ElSelect, ElOption, FormInstance, FormRules} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import {onMounted, reactive} from "vue";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
@@ -54,13 +55,13 @@ async function onSubmit() {
|
||||
if (props.isAdd) {
|
||||
data.id = 'custom-dict-' + Date.now()
|
||||
if (source.bookList.find(v => v.name === data.name)) {
|
||||
ElMessage.warning('已有相同名称!')
|
||||
Toast.warning('已有相同名称!')
|
||||
return
|
||||
} else {
|
||||
source.bookList.push(cloneDeep(data))
|
||||
runtimeStore.editDict = data
|
||||
emit('submit')
|
||||
ElMessage.success('添加成功')
|
||||
Toast.success('添加成功')
|
||||
}
|
||||
} else {
|
||||
let rIndex = source.bookList.findIndex(v => v.id === data.id)
|
||||
@@ -68,15 +69,15 @@ async function onSubmit() {
|
||||
if (rIndex > -1) {
|
||||
source.bookList[rIndex] = cloneDeep(data)
|
||||
emit('submit')
|
||||
ElMessage.success('修改成功')
|
||||
Toast.success('修改成功')
|
||||
} else {
|
||||
source.bookList.push(cloneDeep(data))
|
||||
ElMessage.success('修改成功并加入我的词典')
|
||||
Toast.success('修改成功并加入我的词典')
|
||||
}
|
||||
}
|
||||
console.log('submit!', data)
|
||||
} else {
|
||||
ElMessage.warning('请填写完整')
|
||||
Toast.warning('请填写完整')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<script setup lang="ts">
|
||||
import {ref, useTemplateRef} from 'vue'
|
||||
import QuestionItem from './QuestionItem.vue'
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
|
||||
interface IProps {
|
||||
questions: Array,
|
||||
@@ -90,7 +91,7 @@ const submitAll = () => {
|
||||
const wrongCount = results.length - correctCount
|
||||
|
||||
console.log('最终结果:', results)
|
||||
ElMessage({message: `共 ${results.length} 题,答对 ${correctCount},答错 ${wrongCount}`})
|
||||
Toast.success(`共 ${results.length} 题,答对 ${correctCount},答错 ${wrongCount}`)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {getTranslateText} from "@/hooks/article.ts";
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
import QuestionForm from "@/pages/pc/article/components/QuestionForm.vue";
|
||||
import {getDefaultArticle} from "@/types/func.ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
|
||||
interface IProps {
|
||||
article: Article,
|
||||
@@ -319,10 +319,7 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j) {
|
||||
label: "复制",
|
||||
onClick: () => {
|
||||
navigator.clipboard.writeText(sentence.text).then(r => {
|
||||
ElMessage({
|
||||
message: '已复制',
|
||||
type: 'success',
|
||||
})
|
||||
Toast.success('已复制')
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -330,11 +327,7 @@ function onContextMenu(e: MouseEvent, sentence: Sentence, i, j) {
|
||||
label: "语法分析",
|
||||
onClick: () => {
|
||||
navigator.clipboard.writeText(sentence.text).then(r => {
|
||||
ElMessage({
|
||||
message: '已复制!随后将打开语法分析网站!',
|
||||
type: 'success',
|
||||
duration: 3000
|
||||
})
|
||||
Toast.success('已复制!随后将打开语法分析网站!')
|
||||
setTimeout(() => {
|
||||
window.open('https://enpuz.com/')
|
||||
}, 1000)
|
||||
|
||||
@@ -11,6 +11,7 @@ import PopConfirm from "@/pages/pc/components/PopConfirm.vue";
|
||||
import Empty from "@/components/Empty.vue";
|
||||
import {Icon} from "@iconify/vue";
|
||||
import {ElCheckbox, ElPagination} from 'element-plus'
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
|
||||
let list = defineModel('list')
|
||||
|
||||
@@ -94,11 +95,11 @@ let showSearchInput = $ref(false)
|
||||
|
||||
function sort(type: Sort) {
|
||||
if (type === Sort.reverse) {
|
||||
ElMessage.success('已翻转排序')
|
||||
Toast.success('已翻转排序')
|
||||
list.value = reverse(cloneDeep(list.value))
|
||||
}
|
||||
if (type === Sort.random) {
|
||||
ElMessage.success('已随机排序')
|
||||
Toast.success('已随机排序')
|
||||
list.value = shuffle(cloneDeep(list.value))
|
||||
}
|
||||
showSortDialog = false
|
||||
|
||||
@@ -10,7 +10,8 @@ import BaseIcon from "@/components/BaseIcon.vue";
|
||||
import BaseTable from "@/pages/pc/components/BaseTable.vue";
|
||||
import WordItem from "@/pages/pc/components/WordItem.vue";
|
||||
import type {FormInstance, FormRules} from "element-plus";
|
||||
import {ElForm, ElFormItem, ElInput, ElMessage} from "element-plus";
|
||||
import {ElForm, ElFormItem, ElInput} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import PopConfirm from "@/pages/pc/components/PopConfirm.vue";
|
||||
import BackIcon from "@/pages/pc/components/BackIcon.vue";
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
@@ -88,9 +89,9 @@ async function onSubmitWord() {
|
||||
let r = list.find(v => v.id === data.id)
|
||||
if (r) {
|
||||
Object.assign(r, data)
|
||||
ElMessage.success('修改成功')
|
||||
Toast.success('修改成功')
|
||||
} else {
|
||||
ElMessage.success('修改失败,未找到单词')
|
||||
Toast.success('修改失败,未找到单词')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@@ -98,15 +99,15 @@ async function onSubmitWord() {
|
||||
data.checked = false
|
||||
let r = list.find(v => v.word === wordForm.word)
|
||||
if (r) {
|
||||
ElMessage.warning('已有相同名称单词!')
|
||||
Toast.warning('已有相同名称单词!')
|
||||
return
|
||||
} else list.push(data)
|
||||
ElMessage.success('添加成功')
|
||||
Toast.success('添加成功')
|
||||
wordForm = getDefaultFormWord()
|
||||
}
|
||||
syncDictInMyStudyList()
|
||||
} else {
|
||||
ElMessage.warning('请填写完整')
|
||||
Toast.warning('请填写完整')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import Empty from "@/components/Empty.vue";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
import {usePracticeStore} from "@/stores/practice.ts";
|
||||
import {dictionaryResources} from "@/assets/dictionary.ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import {getDefaultWord} from "@/types/func.ts";
|
||||
import ConflictNotice from "@/pages/pc/components/ConflictNotice.vue";
|
||||
|
||||
@@ -100,7 +100,7 @@ watch(() => studyData, () => {
|
||||
data.words = studyData.write
|
||||
statStore.step = 4
|
||||
} else {
|
||||
ElMessage.warning('没有可学习的单词!')
|
||||
Toast.warning('没有可学习的单词!')
|
||||
router.push('/word')
|
||||
}
|
||||
}
|
||||
@@ -275,7 +275,7 @@ function repeat() {
|
||||
|
||||
function prev() {
|
||||
if (data.index === 0) {
|
||||
ElMessage.warning('已经是第一个了~')
|
||||
Toast.warning('已经是第一个了~')
|
||||
} else {
|
||||
data.index--
|
||||
}
|
||||
|
||||
@@ -4,17 +4,16 @@ import {getDefaultSettingState} from "@/stores/setting.ts";
|
||||
import {Dict, DictId, DictResource, DictType} from "@/types/types.ts";
|
||||
import {useRouter} from "vue-router";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import {nanoid} from "nanoid";
|
||||
import dayjs from 'dayjs'
|
||||
import axios from "axios";
|
||||
import {env} from "@/config/ENV.ts";
|
||||
import {nextTick} from "vue";
|
||||
import {dictionaryResources, enArticle} from "@/assets/dictionary.ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Toast from '@/pages/pc/components/Toast/Toast.ts'
|
||||
import {getDefaultArticle, getDefaultDict, getDefaultWord} from "@/types/func.ts";
|
||||
|
||||
export function no() {
|
||||
ElMessage.warning('未现实')
|
||||
Toast.warning('未现实')
|
||||
}
|
||||
|
||||
//检测多余字段,防止人为删除数据,导致数据不完整报错
|
||||
@@ -52,7 +51,7 @@ export function checkAndUpgradeSaveDict(val: any) {
|
||||
} else {
|
||||
if (version === 3) {
|
||||
localStorage.setItem('type-word-dict-v3',JSON.stringify(state))
|
||||
|
||||
|
||||
let studyDictId = ''
|
||||
if (state.current.index >= 0) {
|
||||
let dict = state.myDictList[state.current.index]
|
||||
@@ -151,7 +150,7 @@ export function checkAndUpgradeSaveDict(val: any) {
|
||||
if (r) {
|
||||
formatWord(v)
|
||||
let dict = getDefaultDict(r)
|
||||
checkRiskKey(dict, v)
|
||||
checkRiskKey(dict, v)
|
||||
dict.id = r.id
|
||||
defaultState.word.bookList.push(dict)
|
||||
if (currentDictId === studyDictId) defaultState.word.studyIndex = defaultState.word.bookList.length - 1
|
||||
@@ -172,7 +171,7 @@ export function checkAndUpgradeSaveDict(val: any) {
|
||||
if (r) {
|
||||
formatWord(v)
|
||||
let dict = getDefaultDict(r)
|
||||
checkRiskKey(dict, v)
|
||||
checkRiskKey(dict, v)
|
||||
dict.id = r.id
|
||||
defaultState.article.bookList.push(dict)
|
||||
if (currentDictId === studyDictId) defaultState.article.studyIndex = defaultState.article.bookList.length - 1
|
||||
|
||||
Reference in New Issue
Block a user