优化若干功能

This commit is contained in:
zjl 2024-12-14 14:39:11 +08:00
parent 3832fdbe53
commit 12f45e31c6
44 changed files with 149 additions and 218 deletions

View File

@ -15,7 +15,6 @@ VITE_DROP_CONSOLE = true
# 跨域代理,可以配置多个,请注意不要换行
#VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]]
# VITE_PROXY=[["/api","https://naive-ui-admin"]]
VITE_PROXY=[["/api","http://192.168.124.203:8081/api"]]
# API 接口地址

View File

@ -123,7 +123,6 @@
"keywords": [
"vue",
"naive-ui",
"naive-ui-admin",
"vue3",
"ts",
"tsx",

View File

@ -65,7 +65,7 @@
const cropper = ref<Nullable<Cropper>>();
const isReady = ref(false);
const prefixCls = 'naive-ui-admin';
const prefixCls = 'naive-ui';
const debounceRealTimeCroppered = useDebounceFn(realTimeCroppered, 80);
const getImageStyle = computed((): CSSProperties => {

View File

@ -38,7 +38,7 @@
<n-descriptions-item label="QQ交流群">
<div class="flex items-center">
<a href="https://www.baidu.com" class="py-2" target="_blank"
>点击链接加入群聊Naive Admin</a
>点击链接加入群聊</a
>
</div>
</n-descriptions-item>

View File

@ -76,7 +76,6 @@
const editVisible = ref(false);
const adId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -60,6 +60,9 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();

View File

@ -76,7 +76,6 @@
const editVisible = ref(false);
const adSortId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -130,11 +130,11 @@
const editorRef = ref();
const categoryList = ref([]);
const fwbHeight = document.body.clientHeight - 180;
const message = useMessage();
/**
* 定义表单参数
*/
const message = useMessage();
const formData = reactive({
id: '',
categoryId: '',

View File

@ -76,7 +76,6 @@
const editVisible = ref(false);
const articleId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -184,6 +184,11 @@
const handleClose = () => {
emit('update:visible', false);
};
/**
* 执行更新
* @param show 参数
*/
const handleUpdate = (show) => {
if (!show) {
handleClose();

View File

@ -76,7 +76,6 @@
const editVisible = ref(false);
const layoutId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -76,7 +76,6 @@
const editVisible = ref(false);
const tagId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -182,6 +182,10 @@
lng: '',
lat: '',
});
/**
* 定义模态
*/
const [modalRegister, { openModal, setSubLoading }] = useModal({
title: props.cityId ? '编辑' : '添加',
subBtuText: '确定',

View File

@ -66,6 +66,9 @@
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();

View File

@ -94,11 +94,11 @@
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();
/**
* 定义表单参数
*/
const message = useMessage();
const formData = reactive({
id: '',
title: '',

View File

@ -69,13 +69,16 @@
import { useModal } from '@/components/Modal';
import UploadFile from '@/components/Upload/file.vue';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();
/**
* 定义表单参数
*/
const message = useMessage();
const formData = reactive({
id: '',
name: '',

View File

@ -89,13 +89,16 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();
/**
* 定义表单参数
*/
const message = useMessage();
const formData = reactive({
id: '',
title: '',

View File

@ -85,13 +85,16 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();
/**
* 定义表单参数
*/
const message = useMessage();
const formData = reactive({
id: '',
title: '',

View File

@ -70,6 +70,9 @@
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -77,7 +80,6 @@
const editVisible = ref(false);
const smsId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -67,7 +67,6 @@
const editVisible = ref(false);
const emailLogId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -67,7 +67,6 @@
const editVisible = ref(false);
const fileLogId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -67,7 +67,6 @@
const editVisible = ref(false);
const smsLogId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -61,29 +61,39 @@
key: string;
}
/**
* 定义参数
*/
const formRef = ref();
const loading = ref(false);
const message = useMessage();
const codeMsg: any = ref('获取验证码');
const isGetCode = ref(false);
const autoLogin = ref(true);
const LOGIN_NAME = PageEnum.BASE_LOGIN_NAME;
const userStore = useUserStore();
const router = useRouter();
const route = useRoute();
/**
* 定义表单参数
*/
const formInline = reactive({
mobile: '',
code: '',
key: '',
});
/**
* 定义验证规则
*/
const rules: FormRules = {
mobile: { key: 'a', required: true, message: '请输入手机号码', trigger: 'blur' },
code: { required: true, message: '请输入验证码', trigger: 'blur' },
};
const userStore = useUserStore();
const router = useRouter();
const route = useRoute();
/**
* 获取验证码
*/
function getCode() {
if (!formInline.mobile) {
formRef.value?.validate(
@ -105,6 +115,10 @@
}
}, 1000);
}
/**
* 执行提交表单
*/
const handleSubmit = () => {
if (!formRef.value) return;
formRef.value.validate(async (valid) => {
@ -146,7 +160,6 @@
formInline.key = key;
captchaImg.value = captcha;
};
getCaptcha();
</script>

View File

@ -92,6 +92,9 @@
LockOutlined,
} from '@vicons/antd';
/**
* 定义参数
*/
const formRef = ref();
const message = useMessage();
const loading = ref(false);
@ -100,6 +103,9 @@
const emit = defineEmits(['backLogin']);
/**
* 定义表单参数
*/
const formInline = reactive({
username: '',
password: '',
@ -109,6 +115,11 @@
agreement: false,
});
/**
* 验证码手机号
* @param _rule 规则
* @param value 参数值
*/
const validatePhone = async (_rule, value: string) => {
var isPhone = /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
if (!value) {
@ -119,6 +130,10 @@
return Promise.resolve();
}
};
/**
* 自定义验证规则
*/
const rules = {
username: { required: true, message: '请输入用户名', trigger: 'blur' },
mobile: [{ key: 'a', required: true, validator: validatePhone, trigger: 'blur' }],
@ -139,6 +154,9 @@
},
};
/**
* 执行提交表单
*/
const handleSubmit = () => {
formRef.value
.validate()
@ -152,10 +170,16 @@
});
};
/**
* 返回登录
*/
const backLogin = () => {
emit('backLogin', true);
};
/**
* 获取验证码
*/
function getCode() {
if (!formInline.mobile) {
formRef.value?.validate(

View File

@ -1,155 +0,0 @@
<template>
<div class="account-root">
<div class="account-root-item">
<transition name="fade-bottom" appear mode="out-in">
<div class="account-root-item-img">
<img src="~@/assets/images/login-bg.svg" alt="" />
</div>
</transition>
</div>
<div class="account-root-item root-right-item">
<transition name="fade-bottom" appear mode="out-in">
<div class="account-form">
<div class="account-top">
<div class="account-top-logo">
<img src="~@/assets/images/account-logo.png" alt="" />
</div>
<div class="account-top-desc">Naive Ui Admin中台前端/设计解决方案</div>
</div>
<n-tabs v-model:value="tab" size="large" justify-content="space-evenly">
<n-tab-pane name="login" tab="登录">
<transition name="fade-bottom" appear mode="out-in">
<LoginForm ref="LoginFormRef" @goRegister="changeGoRegister" />
</transition>
</n-tab-pane>
<n-tab-pane name="register" tab="注册">
<transition name="fade-bottom" appear mode="out-in">
<RegisterForm ref="RegisterFormRef" @backLogin="changeBackLogin" />
</transition>
</n-tab-pane>
</n-tabs>
</div>
</transition>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import LoginForm from './LoginForm.vue';
import RegisterForm from './RegisterForm.vue';
const tab = ref('login');
function changeBackLogin() {
tab.value = 'login';
}
function changeGoRegister() {
tab.value = 'register';
}
</script>
<style lang="less" scoped>
.account-root {
box-sizing: border-box;
display: flex;
flex-flow: row wrap;
width: 100%;
height: 100vh;
justify-content: center;
&-item {
box-sizing: border-box;
margin: 0px;
flex-direction: row;
flex-basis: 100%;
flex-grow: 0;
max-width: 100%;
background: #2d8cf0;
&-img {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
img {
width: 70%;
display: inline-block;
margin: 0 auto;
}
}
}
.root-right-item {
background: #fff;
box-sizing: border-box;
flex-flow: row wrap;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
.account-form {
flex-basis: 45%;
flex-grow: 0;
max-width: 45%;
.account-top {
text-align: center;
margin: 20px 0;
&-logo {
text-align: center;
img {
width: 100%;
margin: 0 auto;
}
}
&-desc {
font-size: 14px;
color: #808695;
}
}
}
}
@media (min-width: 600px) {
&-item {
flex-basis: 100%;
flex-grow: 0;
max-width: 100%;
}
}
@media (min-width: 320px) {
.root-right-item {
.account-form {
flex-basis: 60%;
flex-grow: 0;
max-width: 60%;
}
}
}
@media (min-width: 1200px) {
&-item {
flex-basis: 50%;
flex-grow: 0;
max-width: 50%;
}
.root-right-item {
.account-form {
flex-basis: 45%;
flex-grow: 0;
max-width: 45%;
}
}
}
}
</style>

View File

@ -11,8 +11,7 @@
:row-key="(row) => row.cacheName"
:checked-row-keys="cacheName"
@update:checked-row-keys="handleNameChange"
>
</n-data-table>
/>
</n-card>
<n-card title="键名列表">
<n-data-table

View File

@ -93,6 +93,9 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();

View File

@ -130,6 +130,9 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const message = useMessage();

View File

@ -31,6 +31,10 @@
import { getOnlineList, onlineOut } from '@/api/monitor/online';
import { useMessage, useDialog } from 'naive-ui';
import { TableAction } from '@/components/Table';
/**
* 定义参数
*/
const onlineTableData = ref([]);
const message = useMessage();
const dialog = useDialog();
@ -136,7 +140,7 @@
};
/**
* 注册
* 执行注册
*/
const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },

View File

@ -48,8 +48,7 @@
v-model:value="formData[item.code]"
:multiple="item.type == 'selects' ? true : false"
:options="item.param"
>
</n-select>
/>
</template>
<template v-else-if="item.type == 'date' || item.type == 'datetime'">
<n-date-picker

View File

@ -24,6 +24,10 @@
import { getWebInfo } from '@/api/setting/web';
import { PageWrapper } from '@/components/Page';
import BasicSetting from './BasicSetting.vue';
/**
* 定义参数
*/
const activeName = ref();
const tabData = ref([]);

View File

@ -9,7 +9,6 @@
>
<n-input v-model:value="formData.realname" placeholder="请输入名称" clearable />
</n-form-item>
<n-form-item label="性别" path="sex" class="flex-1">
<n-radio-group v-model:value="formData.gender" name="gender">
<n-radio :value="1"></n-radio>
@ -107,8 +106,12 @@
import { getUserInfo } from '@/api/system/user';
import { updateProfile } from '@/api/setting/profile';
/**
* 定义参数
*/
const formRef: any = ref(null);
const message = useMessage();
/**
* 定义表单参数
*/
@ -146,6 +149,7 @@
}
}
};
/**
* 钩子函数
*/

View File

@ -12,7 +12,6 @@
<script lang="ts" setup>
import { PageWrapper } from '@/components/Page';
import BasicSetting from './BasicSetting.vue';
import SafetySetting from './SafetySetting.vue';
</script>
<style lang="less" scoped>
.thing-cell {

View File

@ -40,6 +40,9 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();

View File

@ -96,6 +96,9 @@
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -105,7 +108,6 @@
const rowKeys = ref([]);
const importVisible = ref(false);
const exportLoading = ref(false);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -129,6 +129,16 @@
import { useModal } from '@/components/Modal';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const dataSource = ref([]);
const componentsOptions = ref(getModulesKey());
const menuOptions = ref<any[]>([]);
/**
* 定义接收的参数
*/
@ -152,12 +162,6 @@
subBtuText: '确定',
width: 600,
});
const message = useMessage();
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();
const dataSource = ref([]);
const componentsOptions = ref(getModulesKey());
/**
* 定义表单参数
@ -187,8 +191,6 @@
status: 0,
});
const menuOptions = ref<any[]>([]);
/**
* 定义Icon组件
* @param icon 图标

View File

@ -40,6 +40,9 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();

View File

@ -66,6 +66,9 @@
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -73,7 +76,6 @@
const editVisible = ref(false);
const positionId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -49,6 +49,9 @@
import { useMessage } from 'naive-ui';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const emit = defineEmits(['success', 'update:visible']);
const formRef = ref();

View File

@ -76,6 +76,9 @@
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -85,7 +88,6 @@
const authVisible = ref(false);
const roleId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -71,6 +71,9 @@
import { schemas } from './querySchemas';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -78,7 +81,6 @@
const editVisible = ref(false);
const tenantId = ref(0);
const rowKeys = ref([]);
const showModal = ref(false);
/**
* 定义查询参数
@ -211,6 +213,7 @@
await nextTick();
createModalRef.value.openModal();
}
/**
* 执行添加账号
* @param recored 参数
@ -219,6 +222,7 @@
await tenantAccount({ tenantId: recored.id });
message.success('创建成功');
};
/**
* 执行删除
* @param id 参数

View File

@ -264,6 +264,17 @@
import { useUserStore } from '@/store/modules/user';
import { useModal } from '@/components/Modal';
/**
* 定义参数
*/
const cropperCircled = ref();
const emit = defineEmits(['success', 'update:visible']);
const message = useMessage();
const formRef = ref();
const uploadHeaders = reactive({
authorization: useUserStore().getToken,
});
/**
* 定义接收的参数
*/
@ -275,11 +286,6 @@
},
});
/**
* 定义参数变量
*/
const emit = defineEmits(['success', 'update:visible']);
/**
* 定义模态
*/
@ -289,12 +295,6 @@
width: 800,
});
const message = useMessage();
const uploadHeaders = reactive({
authorization: useUserStore().getToken,
});
const formRef = ref();
/**
* 定义接收的参数
*/
@ -320,14 +320,6 @@
password: '',
passwordConfirm: '',
});
const cropperCircled = ref();
const passwordConfirmValidator = (rule: object, value: string, callback: any) => {
if (formData.password) {
if (!value) callback(new Error('请再次输入密码'));
if (value !== formData.password) callback(new Error('两次输入密码不一致!'));
}
callback();
};
/**
* 上传成功回调

View File

@ -107,6 +107,9 @@
import { renderIcon } from '@/utils';
import printJS from 'print-js';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();
@ -116,7 +119,6 @@
const rowKeys = ref([]);
const importVisible = ref(false);
const exportLoading = ref(false);
const showModal = ref(false);
/**
* 定义查询参数

View File

@ -50,6 +50,9 @@
import { PlusOutlined, SnippetsOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const message = useMessage();
const dialog = useDialog();
const basicTableRef = ref();