diff --git a/public/images/favicon.ico b/public/images/favicon.ico new file mode 100644 index 00000000..36c0e7ca Binary files /dev/null and b/public/images/favicon.ico differ diff --git a/src/api/initHome.ts b/src/api/initHome.ts index daf6d767..3b339a74 100644 --- a/src/api/initHome.ts +++ b/src/api/initHome.ts @@ -31,7 +31,7 @@ export const getSystemPermission = () =>server.get(`/system/resources/permission export const saveNetwork = (data: any) => server.post(`/network/config`, data) // 保存协议 -export const saveProtocol = () => server.post(`/protocol/default-protocol/_save`,) +export const saveProtocol = () => server.post(`/protocol/default-protocol/_save`) // 新增设备接入网关 export const saveAccessConfig = (data: any) => server.post(`/gateway/device`, data) diff --git a/src/views/init-home/Basic/index.vue b/src/views/init-home/Basic/index.vue index fc2c7eea..55401fab 100644 --- a/src/views/init-home/Basic/index.vue +++ b/src/views/init-home/Basic/index.vue @@ -83,15 +83,15 @@
点击修改 @@ -162,15 +162,15 @@
点击修改 @@ -221,15 +221,15 @@
点击修改 @@ -256,6 +256,7 @@ import { modalState, formState, logoState } from '../data/interface'; import { getImage } from '@/utils/comm.ts'; import { Form } from 'ant-design-vue'; +import { FILE_UPLOAD } from '@/api/comm'; import { getSystemPermission, save, @@ -275,18 +276,18 @@ import { } from '@/api/initHome'; import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface'; import { message } from 'ant-design-vue'; +import { LocalStore } from '@/utils/comm'; +import { TOKEN_KEY } from '@/utils/variable'; const formRef = ref(); const menuRef = ref(); const formBasicRef = ref(); const useForm = Form.useForm; -const iconValue = ref('/public/favicon.ico'); -const backValue = ref('/public/images/login.png'); -const logoValue = ref('/public/logo.png'); const logoLoading = ref(false); const backLoading = ref(false); const iconLoading = ref(false); const imageTypes = ref(['image/jpeg', 'image/png']); const iconTypes = ref(['image/x-icon']); +const headers = ref({ 'X-Access-Token': LocalStore.get(TOKEN_KEY) }); /** * 表单数据 */ @@ -295,17 +296,11 @@ const form = ref({ headerTheme: 'light', apikey: '', basePath: `${window.location.origin}/api`, - logo: '', - icon: '', + logo: getImage('/logo.png'), + ico: getImage('/favicon.ico'), + background:getImage('/login.png') }); const rulesFrom = ref({ - title: [ - { - required: true, - message: '请输入系统名称', - trigger: 'change', - }, - ], headerTheme: [ { required: true, @@ -328,14 +323,15 @@ const { resetFields, validate, validateInfos } = useForm( /** * 提交数据 */ -const saveBasicInfo = async () => { +const saveBasicInfo = () =>{ + return new Promise( async (resolve) => { validate() .then(async () => { const item = [ { scope: 'front', properties: { - ...form, + ...form.value, apikey: '', 'base-path': '', }, @@ -343,32 +339,32 @@ const saveBasicInfo = async () => { { scope: 'amap', properties: { - api: form.apikey, + api: form.value.apikey, }, }, { scope: 'paths', properties: { - 'base-path': form.basePath, + 'base-path': form.value.basePath, }, }, ]; const res = await save(item); if (res.status === 200) { + resolve(true); const ico: any = document.querySelector('link[rel="icon"]'); if (ico !== null) { - ico.href = form.icon; + ico.href = form.value.ico; } + }else { + resolve(false); } - // basicData.isSucessBasic = 3; - // } else { - // basicData.isSucessBasic = 2; - // } }) .catch((error: ValidateErrorEntity) => { - // basicData.isSucessBasic = 2; + resolve(false); }); -}; +}) +} /** * logo格式校验 */ @@ -395,14 +391,41 @@ const handleChangeLogo = (info: any) => { if (info.file.status === 'done') { info.file.url = info.file.response?.result; logoLoading.value = false; - logoValue.value = info.file.response?.result; + form.value.logo = info.file.response?.result; } }; - +/** + * 浏览器页签上传之前 + */ +const beforeIconUpload = (file:any) => { + const isType = iconTypes.value.includes(file.type); + if(!isType){ + message.error('请上传ico格式的图片'); + return false; + } + const isSize = file.size / 1024 / 1024 < 1; + if(!isSize){ + message.error('支持1M以内的图片'); + } + return isType && isSize; +} +/** + * 浏览器页签发生改变 + */ + const changeIconUpload = (info: any) => { + if (info.file.status === 'uploading') { + iconLoading.value = true; + } + if (info.file.status === 'done') { + info.file.url = info.file.response?.result; + iconLoading.value = false; + form.value.ico = info.file.response?.result; + } +} /** * 背景图片上传之前 */ -const beforeBackUpload = (file: any) => { + const beforeBackUpload = (file: any) => { const isType = imageTypes.value.includes(file.type); if (!isType) { message.error(`请上传.jpg.png.jfif.pjp.pjpeg.jpeg格式的图片`); @@ -424,7 +447,7 @@ const changeBackUpload = (info: any) => { if (info.file.status === 'done') { info.file.url = info.file.response?.result; backLoading.value = false; - backValue.value = info.file.response?.result; + form.value.background = info.file.response?.result; } }; defineExpose({ diff --git a/src/views/init-home/InitData/index.vue b/src/views/init-home/InitData/index.vue new file mode 100644 index 00000000..2a5ada80 --- /dev/null +++ b/src/views/init-home/InitData/index.vue @@ -0,0 +1,349 @@ + + + + \ No newline at end of file diff --git a/src/views/init-home/Menu/index.vue b/src/views/init-home/Menu/index.vue new file mode 100644 index 00000000..2f7aa748 --- /dev/null +++ b/src/views/init-home/Menu/index.vue @@ -0,0 +1,80 @@ + + + + \ No newline at end of file diff --git a/src/views/init-home/Role/index.vue b/src/views/init-home/Role/index.vue new file mode 100644 index 00000000..35d3f6b5 --- /dev/null +++ b/src/views/init-home/Role/index.vue @@ -0,0 +1,204 @@ + + + + \ No newline at end of file diff --git a/src/views/init-home/data/interface.ts b/src/views/init-home/data/interface.ts index f059d631..ae9a01f7 100644 --- a/src/views/init-home/data/interface.ts +++ b/src/views/init-home/data/interface.ts @@ -16,7 +16,8 @@ export interface formState { apikey: string; // 高德 API key basePath: string; // 系统后台访问的URL logo: string; // 系统logo - icon: string; // 浏览器页签 + ico: string; // 浏览器页签 + background:string; //登录背景 } /** diff --git a/src/views/init-home/index.vue b/src/views/init-home/index.vue index ca732ea1..86253051 100644 --- a/src/views/init-home/index.vue +++ b/src/views/init-home/index.vue @@ -18,113 +18,23 @@ - + - + - + -
- -
-
-
- -
- 设备接入岗 -
-
-
- -
-
-
- -
- 运维管理岗 -
-
-
- -
-
-
- -
- 综合管理岗 -
-
-
- -
-
-
-
+
-
- -
- - -
-

- - 初始化数据包括MQTT产品、MQTT设备、MQTT类型设备接入网关、MQTT网络组件、Jetlinks - 官方协议 -

-
-
- - - - - - - - - - - - - - - - - - {{ - item.label - }} - - - - - - - - - -
-
+
@@ -310,11 +51,7 @@ type="primary" class="btn-style" @click="submitData" - :loading=" - isSucessBasic === 2 || - isSucessInit === 2 || - isSucessRole === 2 - " + :loading="loading" >确定
@@ -325,155 +62,32 @@