Explorar el Código

fix: 增加是否开源的表示,来确定是否显示默认账号密码,修复默认TITLE显示SAGOO IOT

yanglzh hace 2 años
padre
commit
d84f524527
Se han modificado 7 ficheros con 38 adiciones y 40 borrados
  1. 4 0
      .env.open
  2. 1 1
      index.html
  3. 2 1
      package.json
  4. 2 2
      src/i18n/pages/login/zh-cn.ts
  5. 17 10
      src/layout/logo/index.vue
  6. 2 2
      src/utils/other.ts
  7. 10 24
      src/views/login/component/account.vue

+ 4 - 0
.env.open

@@ -0,0 +1,4 @@
+VITE_SERVER_PROTOCOL = ''
+VITE_SERVER_HOSTNAME = ''
+# 开源标识
+VITE_ISOPEN = true

+ 1 - 1
index.html

@@ -6,7 +6,7 @@
 	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
 	<link rel="icon" href="/favicon.ico" />
 	<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=sGgaYnGYF87fy9dVDvLF5GemYMH02aax"></script>
-	<title>SAGOO IOT</title>
+	<title></title>
 </head>
 <body>
 	<div id="app"></div>

+ 2 - 1
package.json

@@ -7,6 +7,7 @@
   "scripts": {
     "dev": "vite --force",
     "build": "vite build",
+    "build:open": "vite build --mode open",
     "deploy:zip": "npm run build && npm run zipAndUpload && npm run unzip && npm run success",
     "zipAndUpload": "cd dist && rm -rf zhgy.sagoo.cn.zip && zip -r -q zhgy.sagoo.cn.zip ./ && ssh iot 'sudo rm /www/wwwroot/zhgy.sagoo.cn-old.zip' | ssh iot 'sudo mv /www/wwwroot/zhgy.sagoo.cn.zip /www/wwwroot/zhgy.sagoo.cn-old.zip' | scp -r -O zhgy.sagoo.cn.zip iot:/www/wwwroot",
     "unzip": "ssh iot 'cd /www/wwwroot/ && sudo unzip -q -o -d ./zhgy.sagoo.cn zhgy.sagoo.cn.zip'",
@@ -103,4 +104,4 @@
     "type": "git",
     "url": "https://gitee.com/lyt-top/vue-next-admin.git"
   }
-}
+}

+ 2 - 2
src/i18n/pages/login/zh-cn.ts

@@ -9,8 +9,8 @@ export default {
 		two4: '友情链接',
 	},
 	account: {
-		accountPlaceholder1: '用户名 admin 或不输均为 common',
-		accountPlaceholder2: '密码:123456',
+		accountPlaceholder1: '请输入用户名',
+		accountPlaceholder2: '请输入密码',
 		accountPlaceholder3: '请输入验证码',
 		accountBtnText: '登 录',
 	},

+ 17 - 10
src/layout/logo/index.vue

@@ -1,10 +1,10 @@
 <template>
 	<div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
-		<img :src="logoMini" class="layout-logo-medium-img" />
+		<img :src="sysinfo.systemLogo" class="logo" />
 		<span>{{ sysinfo.systemName }}</span>
 	</div>
 	<div class="layout-logo-size" v-else @click="onThemeConfigChange">
-		<img :src="logoMini" class="layout-logo-size-img" />
+		<img :src="sysinfo.systemLogoMini" class="logo-mini" />
 	</div>
 </template>
 
@@ -19,10 +19,9 @@ export default defineComponent({
 	data() {
 		return {
 			sysinfo: {
-				buildVersion: '',
 				systemName: '',
-				buildTime: '',
-				systemCopyright: '',
+				systemLogo: '',
+				systemLogoMini: '',
 			},
 		};
 	},
@@ -68,26 +67,34 @@ export default defineComponent({
 	font-size: 20px;
 	cursor: pointer;
 	animation: logoAnimation 0.3s ease-in-out;
+
 	&:hover {
 		span {
 			color: var(--color-primary-light-2);
 		}
 	}
-	&-medium-img {
-		width: 35px;
+
+	.logo {
+		height: 32px;
+		width: auto;
 		padding-right: 5px;
 	}
 }
+
 .layout-logo-size {
 	width: 100%;
 	height: 50px;
 	display: flex;
 	cursor: pointer;
 	animation: logoAnimation 0.3s ease-in-out;
-	&-img {
-		width: 20px;
-		margin: auto;
+	align-items: center;
+
+	.logo-mini {
+		height: 32px;
+		width: auto;
+		margin: 0 auto;
 	}
+
 	&:hover {
 		img {
 			animation: logoAnimation 0.3s ease-in-out;

+ 2 - 2
src/utils/other.ts

@@ -29,11 +29,11 @@ export function useTitle() {
 	nextTick(() => {
 		let webTitle = '';
 		// let globalTitle: string = store.state.themeConfig.themeConfig.globalTitle;
-		let globalTitle: string = JSON.parse(localStorage.sysinfo || '{}').systemName;
+		let globalTitle: string = JSON.parse(localStorage.sysinfo || '{}').systemName || '';
 		router.currentRoute.value.path === '/login'
 			? (webTitle = router.currentRoute.value.meta?.title as any)
 			: (webTitle = i18n.global.t(router.currentRoute.value.meta?.title as any));
-		document.title = `${webTitle} - ${globalTitle}` || globalTitle;
+		document.title = `${webTitle} - ${globalTitle || ''}` || globalTitle;
 	});
 }
 

+ 10 - 24
src/views/login/component/account.vue

@@ -10,39 +10,21 @@
 			</el-input>
 		</el-form-item>
 		<el-form-item class="login-animation2" prop="password">
-			<el-input
-				:type="isShowPassword ? 'text' : 'password'"
-				:placeholder="$t('message.account.accountPlaceholder2')"
-				v-model="ruleForm.password"
-				autocomplete="off"
-				@keyup.enter="onSignIn"
-			>
+			<el-input :type="isShowPassword ? 'text' : 'password'" :placeholder="$t('message.account.accountPlaceholder2')" v-model="ruleForm.password" autocomplete="off" @keyup.enter="onSignIn">
 				<template #prefix>
 					<el-icon class="el-input__icon">
 						<ele-Unlock />
 					</el-icon>
 				</template>
 				<template #suffix>
-					<i
-						class="iconfont el-input__icon login-content-password"
-						:class="isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'"
-						@click="isShowPassword = !isShowPassword"
-					>
+					<i class="iconfont el-input__icon login-content-password" :class="isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'" @click="isShowPassword = !isShowPassword">
 					</i>
 				</template>
 			</el-input>
 		</el-form-item>
 		<el-form-item class="login-animation3" prop="captcha">
 			<el-col :span="15">
-				<el-input
-					type="text"
-					maxlength="4"
-					:placeholder="$t('message.account.accountPlaceholder3')"
-					v-model="ruleForm.captcha"
-					clearable
-					autocomplete="off"
-					@keyup.enter="onSignIn"
-				>
+				<el-input type="text" maxlength="4" :placeholder="$t('message.account.accountPlaceholder3')" v-model="ruleForm.captcha" clearable autocomplete="off" @keyup.enter="onSignIn">
 					<template #prefix>
 						<el-icon class="el-input__icon">
 							<ele-Position />
@@ -76,6 +58,10 @@ import { useStore } from '/@/store/index';
 import { Session } from '/@/utils/storage';
 import { formatAxis } from '/@/utils/formatTime';
 import api from '/@/api/system';
+
+// 是否是开源版本
+const ISOPEN = import.meta.env.VITE_ISOPEN
+
 export default defineComponent({
 	name: 'loginAccount',
 	setup() {
@@ -87,8 +73,8 @@ export default defineComponent({
 		const state = reactive({
 			isShowPassword: false,
 			ruleForm: {
-				userName: 'demo',
-				password: 'demo123456',
+				userName: ISOPEN ? 'demo' : '',
+				password: ISOPEN ? 'demo123456' : '',
 				captcha: '',
 				VerifyKey: '',
 			},
@@ -143,7 +129,7 @@ export default defineComponent({
 							});
 					}
 				})
-				.catch(() => {});
+				.catch(() => { });
 		};
 		// 获取登录用户信息
 		const currentUser = async () => {