移除未使用引用

This commit is contained in:
不做码农 2022-04-27 16:58:44 +08:00
parent bacc55df0b
commit 845f0aca95
5 changed files with 76 additions and 93 deletions

View File

@ -7,10 +7,10 @@
<script setup>
import { useFullscreen } from '@vueuse/core'
const { isFullscreen, enter, exit, toggle } = useFullscreen();
const { isFullscreen, enter, exit, toggle } = useFullscreen()
</script>
<style lang='scss' scoped>
<style lang="scss" scoped>
.screenfull-svg {
display: inline-block;
cursor: pointer;

View File

@ -16,8 +16,6 @@
</template>
<script setup>
import { ElMessage } from "element-plus";
const store = useStore();
const size = computed(() => store.getters.size);
const route = useRoute();

View File

@ -83,8 +83,7 @@
<script setup>
import variables from '@/assets/styles/variables.module.scss'
import originElementPlus from 'element-plus/theme-chalk/index.css'
import axios from 'axios'
import { ElLoading, ElMessage } from 'element-plus'
import { useDynamicTitle } from '@/utils/dynamicTitle'
const { proxy } = getCurrentInstance()

View File

@ -14,29 +14,17 @@
>
{{ tag.title }}
<span v-if="!isAffix(tag)" @click.prevent.stop="closeSelectedTag(tag)">
<close class="el-icon-close" style="width: 1em; height: 1em;vertical-align: middle;" />
<close class="el-icon-close" style="width: 1em; height: 1em; vertical-align: middle" />
</span>
</router-link>
</scroll-pane>
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)">
<refresh-right style="width: 1em; height: 1em;" /> 刷新页面
</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
<close style="width: 1em; height: 1em;" /> 关闭当前
</li>
<li @click="closeOthersTags">
<circle-close style="width: 1em; height: 1em;" /> 关闭其他
</li>
<li v-if="!isFirstView()" @click="closeLeftTags">
<back style="width: 1em; height: 1em;" /> 关闭左侧
</li>
<li v-if="!isLastView()" @click="closeRightTags">
<right style="width: 1em; height: 1em;" /> 关闭右侧
</li>
<li @click="closeAllTags(selectedTag)">
<circle-close style="width: 1em; height: 1em;" /> 全部关闭
</li>
<li @click="refreshSelectedTag(selectedTag)"><refresh-right style="width: 1em; height: 1em" /> 刷新页面</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><close style="width: 1em; height: 1em" /> 关闭当前</li>
<li @click="closeOthersTags"><circle-close style="width: 1em; height: 1em" /> 关闭其他</li>
<li v-if="!isFirstView()" @click="closeLeftTags"><back style="width: 1em; height: 1em" /> 关闭左侧</li>
<li v-if="!isLastView()" @click="closeRightTags"><right style="width: 1em; height: 1em" /> 关闭右侧</li>
<li @click="closeAllTags(selectedTag)"><circle-close style="width: 1em; height: 1em" /> 全部关闭</li>
</ul>
</div>
</template>
@ -45,21 +33,21 @@
import ScrollPane from './ScrollPane'
import { getNormalPath } from '@/utils/ruoyi'
const visible = ref(false);
const top = ref(0);
const left = ref(0);
const selectedTag = ref({});
const affixTags = ref([]);
const scrollPaneRef = ref(null);
const visible = ref(false)
const top = ref(0)
const left = ref(0)
const selectedTag = ref({})
const affixTags = ref([])
const scrollPaneRef = ref(null)
const { proxy } = getCurrentInstance();
const store = useStore();
const route = useRoute();
const router = useRouter();
const { proxy } = getCurrentInstance()
const store = useStore()
const route = useRoute()
const router = useRouter()
const visitedViews = computed(() => store.state.tagsView.visitedViews);
const routes = computed(() => store.state.permission.routes);
const theme = computed(() => store.state.settings.theme);
const visitedViews = computed(() => store.state.tagsView.visitedViews)
const routes = computed(() => store.state.permission.routes)
const theme = computed(() => store.state.settings.theme)
watch(route, () => {
addTags()
@ -81,11 +69,11 @@ function isActive(r) {
return r.path === route.path
}
function activeStyle(tag) {
if (!isActive(tag)) return {};
if (!isActive(tag)) return {}
return {
"background-color": theme.value,
"border-color": theme.value
};
'background-color': theme.value,
'border-color': theme.value,
}
}
function isAffix(tag) {
return tag.meta && tag.meta.affix
@ -106,14 +94,14 @@ function isLastView() {
}
function filterAffixTags(routes, basePath = '') {
let tags = []
routes.forEach(route => {
routes.forEach((route) => {
if (route.meta && route.meta.affix) {
const tagPath = getNormalPath(basePath + '/' + route.path)
tags.push({
fullPath: tagPath,
path: tagPath,
name: route.name,
meta: { ...route.meta }
meta: { ...route.meta },
})
}
if (route.children) {
@ -126,8 +114,8 @@ function filterAffixTags(routes, basePath = '') {
return tags
}
function initTags() {
const res = filterAffixTags(routes.value);
affixTags.value = res;
const res = filterAffixTags(routes.value)
affixTags.value = res
for (const tag of res) {
// Must have tag name
if (tag.name) {
@ -146,7 +134,7 @@ function moveToCurrentTag() {
nextTick(() => {
for (const r of visitedViews.value) {
if (r.path === route.path) {
scrollPaneRef.value.moveToTarget(r);
scrollPaneRef.value.moveToTarget(r)
// when query is different then update
if (r.fullPath !== route.fullPath) {
store.dispatch('tagsView/updateVisitedView', route)
@ -156,7 +144,7 @@ function moveToCurrentTag() {
})
}
function refreshSelectedTag(view) {
proxy.$tab.refreshPage(view);
proxy.$tab.refreshPage(view)
console.log(view)
}
function closeSelectedTag(view) {
@ -167,28 +155,28 @@ function closeSelectedTag(view) {
})
}
function closeRightTags() {
proxy.$tab.closeRightPage(selectedTag.value).then(visitedViews => {
if (!visitedViews.find(i => i.fullPath === route.fullPath)) {
proxy.$tab.closeRightPage(selectedTag.value).then((visitedViews) => {
if (!visitedViews.find((i) => i.fullPath === route.fullPath)) {
toLastView(visitedViews)
}
})
}
function closeLeftTags() {
proxy.$tab.closeLeftPage(selectedTag.value).then(visitedViews => {
if (!visitedViews.find(i => i.fullPath === route.fullPath)) {
proxy.$tab.closeLeftPage(selectedTag.value).then((visitedViews) => {
if (!visitedViews.find((i) => i.fullPath === route.fullPath)) {
toLastView(visitedViews)
}
})
}
function closeOthersTags() {
router.push(selectedTag.value).catch(() => { });
router.push(selectedTag.value).catch(() => {})
proxy.$tab.closeOtherPage(selectedTag.value).then(() => {
moveToCurrentTag()
})
}
function closeAllTags(view) {
proxy.$tab.closeAllPage().then(({ visitedViews }) => {
if (affixTags.value.some(tag => tag.path === route.path)) {
if (affixTags.value.some((tag) => tag.path === route.path)) {
return
}
toLastView(visitedViews, view)
@ -234,7 +222,7 @@ function handleScroll() {
}
</script>
<style lang='scss' scoped>
<style lang="scss" scoped>
.tags-view-container {
height: 34px;
width: 100%;
@ -266,7 +254,7 @@ function handleScroll() {
color: #fff;
border-color: #42b983;
&::before {
content: "";
content: '';
background: #fff;
display: inline-block;
width: 8px;

View File

@ -1,9 +1,15 @@
<template>
<el-row>
<el-form class="mt10" ref="formRef" :model="form" label-width="110px" :rules="rules" style="width:600px">
<el-form-item v-for="(domain, index) in form.toEmails" :prop="'toEmails.' + index + '.value'" :label="'收件邮箱' + (index === 0 ? '': index)"
<el-form class="mt10" ref="formRef" :model="form" label-width="110px" :rules="rules">
<el-form-item
v-for="(domain, index) in form.toEmails"
:prop="'toEmails.' + index + '.value'"
:label="'收件邮箱' + (index === 0 ? '' : index)"
:key="domain.key"
:rules="[{ required: true, message: '邮箱不能为空', trigger: 'blur' }, { message: '请输入正确的邮箱地址', trigger: ['blur', 'change'], type: 'email', }]">
:rules="[
{ required: true, message: '邮箱不能为空', trigger: 'blur' },
{ message: '请输入正确的邮箱地址', trigger: ['blur', 'change'], type: 'email' },
]"
>
<el-input v-model="domain.value" style="width: 300px"></el-input>
<el-button class="ml10" @click="addDomain" icon="plus" />
<el-button class="ml10" @click.prevent="removeDomain(domain)" icon="minus" />
@ -18,19 +24,16 @@
<el-switch v-model="form.sendMe" active-text="是" inactive-text="否"></el-switch>
</el-form-item>
<el-form-item label="附件">
<UploadFile v-model="form.fileUrl" :limit="5" :fileSize="15" :data="{ 'fileDir' : 'email', 'uploadType': 1}" column="fileUrl"
@input="uploadSuccess" />
<UploadFile v-model="form.fileUrl" :limit="5" :fileSize="15" :data="{ fileDir: 'email', uploadType: 1 }" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="formSubmit">发送邮件</el-button>
</el-form-item>
</el-form>
</el-row>
</template>
<script setup name="sendEmail">
import { sendEmail } from '@/api/common'
import Editor from '@/components/Editor'
import { getCurrentInstance, reactive, ref, toRefs } from 'vue-demi'
const data = reactive({
form: {
@ -42,14 +45,13 @@ const data = reactive({
},
],
},
uploadActionUrl: import.meta.env.VITE_APP_BASE_API + '/common/uploadFile',
rules: {
subject: [{ required: true, message: '主题不能为空', trigger: 'blur' }],
content: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
},
})
const { form, rules, uploadActionUrl } = toRefs(data)
const { form, rules } = toRefs(data)
const { proxy } = getCurrentInstance()
const formRef = ref(null)
const open = ref(false)
@ -69,10 +71,6 @@ function reset() {
}
proxy.resetForm('formRef')
}
//
function uploadSuccess(columnName, filelist) {
form.value[columnName] = filelist
}
/**
* 提交