|
|
@@ -3,84 +3,83 @@
|
|
|
<!-- 顶部 -->
|
|
|
<div class="absolute top-0 flex items-center justify-end px-5 h-20 w-full">
|
|
|
<el-switch
|
|
|
- v-model="isDark"
|
|
|
- inline-prompt
|
|
|
- :active-icon="IconEpMoon"
|
|
|
- :inactive-icon="IconEpSunny"
|
|
|
- active-color="var(--el-fill-color-dark)"
|
|
|
- inactive-color="var(--el-color-primary)"
|
|
|
- @change="handleThemeChange"
|
|
|
+ v-model="isDark"
|
|
|
+ inline-prompt
|
|
|
+ :active-icon="IconEpMoon"
|
|
|
+ :inactive-icon="IconEpSunny"
|
|
|
+ active-color="var(--el-fill-color-dark)"
|
|
|
+ inactive-color="var(--el-color-primary)"
|
|
|
+ @change="handleThemeChange"
|
|
|
/>
|
|
|
</div>
|
|
|
<!-- 登录表单 -->
|
|
|
<el-card
|
|
|
- class="z-1 !border-none w-100 !bg-transparent !rounded-4% <sm:w-83"
|
|
|
+ class="z-1 !border-none w-100 !bg-transparent !rounded-4% <sm:w-83"
|
|
|
>
|
|
|
<div class="text-center relative">
|
|
|
- <img :src="webInfo.wedLogo" height="50" alt="印界智程"
|
|
|
- title="登录">
|
|
|
- <span style="display: block;margin-bottom: 5px">{{erpName}}</span>
|
|
|
+ <img :src="webInfo.wedLogo" height="50" alt="印界智程" title="登录" />
|
|
|
+ <span style="display: block; margin-bottom: 5px">{{ erpName }}</span>
|
|
|
</div>
|
|
|
<el-form
|
|
|
- ref="loginFormRef"
|
|
|
- :model="loginData"
|
|
|
- :rules="loginRules"
|
|
|
- class="login-form"
|
|
|
+ ref="loginFormRef"
|
|
|
+ :model="loginData"
|
|
|
+ :rules="loginRules"
|
|
|
+ class="login-form"
|
|
|
>
|
|
|
<el-form-item prop="username">
|
|
|
<div class="p-2">
|
|
|
- <svg-icon icon-class="user"/>
|
|
|
+ <svg-icon icon-class="user" />
|
|
|
</div>
|
|
|
<el-input
|
|
|
- ref="username"
|
|
|
- v-model="loginData.username"
|
|
|
- class="flex-1"
|
|
|
- size="large"
|
|
|
- :placeholder="$t('login.username')"
|
|
|
- name="username"
|
|
|
+ ref="username"
|
|
|
+ v-model="loginData.username"
|
|
|
+ class="flex-1"
|
|
|
+ size="large"
|
|
|
+ :placeholder="$t('login.username')"
|
|
|
+ name="username"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
<div>
|
|
|
<el-form-item prop="password">
|
|
|
<span class="p-2">
|
|
|
- <svg-icon icon-class="password"/>
|
|
|
+ <svg-icon icon-class="password" />
|
|
|
</span>
|
|
|
<el-input
|
|
|
- v-model="loginData.password"
|
|
|
- class="flex-1"
|
|
|
- :placeholder="$t('login.password')"
|
|
|
- :type="passwordVisible === false ? 'password' : 'input'"
|
|
|
- size="large"
|
|
|
- name="password"
|
|
|
- @keyup="checkCapslock"
|
|
|
- @keyup.enter="handleLogin"
|
|
|
+ v-model="loginData.password"
|
|
|
+ class="flex-1"
|
|
|
+ :placeholder="$t('login.password')"
|
|
|
+ :type="passwordVisible === false ? 'password' : 'input'"
|
|
|
+ size="large"
|
|
|
+ name="password"
|
|
|
+ @keyup="checkCapslock"
|
|
|
+ @keyup.enter="handleLogin"
|
|
|
/>
|
|
|
<span class="mr-2" @click="passwordVisible = !passwordVisible">
|
|
|
<svg-icon
|
|
|
- :icon-class="passwordVisible === false ? 'eye' : 'eye-open'"
|
|
|
- class="cursor-pointer"
|
|
|
+ :icon-class="passwordVisible === false ? 'eye' : 'eye-open'"
|
|
|
+ class="cursor-pointer"
|
|
|
/>
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<!-- 验证码 -->
|
|
|
<el-button
|
|
|
- size="large"
|
|
|
- v-throttle
|
|
|
- :loading="loading"
|
|
|
- type="primary"
|
|
|
- class="w-full"
|
|
|
- @click.prevent="handleLogin"
|
|
|
- >{{ $t("login.login") }}
|
|
|
+ size="large"
|
|
|
+ v-throttle
|
|
|
+ :loading="loading"
|
|
|
+ type="primary"
|
|
|
+ class="w-full"
|
|
|
+ @click.prevent="handleLogin"
|
|
|
+ >{{ $t("login.login") }}
|
|
|
</el-button>
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
|
|
|
<!-- ICP备案 -->
|
|
|
<div
|
|
|
- class="absolute bottom-1 text-[10px] text-center"
|
|
|
- v-show="useAppStore().device == 'desktop'"
|
|
|
+ class="absolute bottom-1 text-[10px] text-center"
|
|
|
+ v-show="useAppStore().device == 'desktop'"
|
|
|
>
|
|
|
<p v-html="webInfo.wedFiling"></p>
|
|
|
</div>
|
|
|
@@ -88,27 +87,26 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import {getERPSupplierInfoByCode} from "@/api/system";
|
|
|
-import {removeToken, setToken} from '@/utils/js-cookie'
|
|
|
-import {useI18n} from "vue-i18n";
|
|
|
+import { getERPSupplierInfoByCode } from "@/api/system";
|
|
|
+import { removeToken, setToken } from "@/utils/js-cookie";
|
|
|
+import { useI18n } from "vue-i18n";
|
|
|
import router from "@/router";
|
|
|
import SvgIcon from "@/components/SvgIcon/index.vue";
|
|
|
import IconEpSunny from "~icons/ep/sunny";
|
|
|
import IconEpMoon from "~icons/ep/moon";
|
|
|
-import {useSettingsStore} from "@/store/modules/settings";
|
|
|
-
|
|
|
+import { useSettingsStore } from "@/store/modules/settings";
|
|
|
|
|
|
// 状态管理依赖
|
|
|
-import {useUserStore} from "@/store/modules/user";
|
|
|
-import {useAppStore} from "@/store/modules/app";
|
|
|
+import { useUserStore } from "@/store/modules/user";
|
|
|
+import { useAppStore } from "@/store/modules/app";
|
|
|
|
|
|
// API依赖
|
|
|
-import {LocationQuery, LocationQueryValue, useRoute} from "vue-router";
|
|
|
+import { LocationQuery, LocationQueryValue, useRoute } from "vue-router";
|
|
|
|
|
|
const settingsStore = useSettingsStore();
|
|
|
-const webInfo = settingsStore.webSite.webInfo
|
|
|
+const webInfo = settingsStore.webSite.webInfo;
|
|
|
|
|
|
-let erpName = ref("")
|
|
|
+let erpName = ref("");
|
|
|
/**
|
|
|
* 明亮/暗黑主题切换
|
|
|
*/
|
|
|
@@ -126,7 +124,7 @@ const handleThemeChange = (isDark: any) => {
|
|
|
*/
|
|
|
const appStore = useAppStore();
|
|
|
const WIDTH = 992; // 响应式布局容器固定宽度 大屏(>=1200px) 中屏(>=992px) 小屏(>=768px)
|
|
|
-const {width} = useWindowSize();
|
|
|
+const { width } = useWindowSize();
|
|
|
watchEffect(() => {
|
|
|
if (width.value < WIDTH) {
|
|
|
appStore.toggleDevice("mobile");
|
|
|
@@ -143,10 +141,10 @@ const loginFormRef = ref(ElForm); // 登录表单ref
|
|
|
const loginData = ref({
|
|
|
username: "",
|
|
|
password: "",
|
|
|
- supplierId:""
|
|
|
+ supplierId: "",
|
|
|
});
|
|
|
|
|
|
-const {t} = useI18n();
|
|
|
+const { t } = useI18n();
|
|
|
const loginRules = computed(() => {
|
|
|
const prefix = appStore.language === "en" ? "Please enter" : "请输入";
|
|
|
return {
|
|
|
@@ -170,7 +168,7 @@ const loginRules = computed(() => {
|
|
|
},
|
|
|
message: `${prefix}${t("login.password")}`,
|
|
|
},
|
|
|
- ]
|
|
|
+ ],
|
|
|
};
|
|
|
});
|
|
|
|
|
|
@@ -178,7 +176,7 @@ const loginRules = computed(() => {
|
|
|
* 检查输入大小写状态
|
|
|
*/
|
|
|
function checkCapslock(e: any) {
|
|
|
- const {key} = e;
|
|
|
+ const { key } = e;
|
|
|
isCapslock.value = key && key.length === 1 && key >= "A" && key <= "Z";
|
|
|
}
|
|
|
|
|
|
@@ -193,70 +191,72 @@ function handleLogin() {
|
|
|
if (valid) {
|
|
|
loading.value = true;
|
|
|
userStore
|
|
|
- .login(loginData.value)
|
|
|
- .then(() => {
|
|
|
- const query: LocationQuery = route.query;
|
|
|
+ .login(loginData.value)
|
|
|
+ .then(() => {
|
|
|
+ const query: LocationQuery = route.query;
|
|
|
|
|
|
- const redirect = (query.redirect as LocationQueryValue) ?? "/";
|
|
|
+ // const redirect = (query.redirect as LocationQueryValue) ?? "/";
|
|
|
+ //默认转跳
|
|
|
+ const redirect = (query.redirect as LocationQueryValue) ?? "/design/designFront";
|
|
|
|
|
|
- const otherQueryParams = Object.keys(query).reduce(
|
|
|
- (acc: any, cur: string) => {
|
|
|
- if (cur !== "redirect") {
|
|
|
- acc[cur] = query[cur];
|
|
|
- }
|
|
|
- return acc;
|
|
|
- },
|
|
|
- {}
|
|
|
- );
|
|
|
+ const otherQueryParams = Object.keys(query).reduce(
|
|
|
+ (acc: any, cur: string) => {
|
|
|
+ if (cur !== "redirect") {
|
|
|
+ acc[cur] = query[cur];
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ },
|
|
|
+ {}
|
|
|
+ );
|
|
|
|
|
|
- router.push({path: redirect, query: otherQueryParams});
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- loading.value = false;
|
|
|
- });
|
|
|
+ router.push({ path: redirect, query: otherQueryParams });
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-function getERPCode(){
|
|
|
+
|
|
|
+function getERPCode() {
|
|
|
const params = {
|
|
|
- "code": ''
|
|
|
- }
|
|
|
+ code: "",
|
|
|
+ };
|
|
|
getERPSupplierInfoByCode(params).then((response) => {
|
|
|
if (response.httpCode == 200) {
|
|
|
- const { data } = response
|
|
|
+ const { data } = response;
|
|
|
// console.log(data);
|
|
|
- erpName.value = data.itemName
|
|
|
- loginData.value.supplierId = data.id
|
|
|
- if(data.saasFlag==1){
|
|
|
- setToken("dataBaseAlias", data.dataBaseAlias)
|
|
|
- setToken("shardingKey", data.shardingKey)
|
|
|
- setToken("supplierId", data.id)
|
|
|
- }else {
|
|
|
- removeToken("dataBaseAlias");//清除dataBaseAlias
|
|
|
- removeToken("shardingKey");//清除shardingKey
|
|
|
- setToken("supplierId", data.id)
|
|
|
+ erpName.value = data.itemName;
|
|
|
+ loginData.value.supplierId = data.id;
|
|
|
+ if (data.saasFlag == 1) {
|
|
|
+ setToken("dataBaseAlias", data.dataBaseAlias);
|
|
|
+ setToken("shardingKey", data.shardingKey);
|
|
|
+ setToken("supplierId", data.id);
|
|
|
+ } else {
|
|
|
+ removeToken("dataBaseAlias"); //清除dataBaseAlias
|
|
|
+ removeToken("shardingKey"); //清除shardingKey
|
|
|
+ setToken("supplierId", data.id);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
//进入登录页面清除cookie
|
|
|
- removeToken("Access-Token")//清除token
|
|
|
- removeToken("dataBaseAlias")//清除dataBaseAlias
|
|
|
- removeToken("shardingKey")//清除shardingKey
|
|
|
- removeToken("supplierId")//清除supplierId
|
|
|
+ removeToken("Access-Token"); //清除token
|
|
|
+ removeToken("dataBaseAlias"); //清除dataBaseAlias
|
|
|
+ removeToken("shardingKey"); //清除shardingKey
|
|
|
+ removeToken("supplierId"); //清除supplierId
|
|
|
// 主题初始化
|
|
|
const theme = useSettingsStore().theme;
|
|
|
- useSettingsStore().changeSetting({key: "theme", value: theme});
|
|
|
+ useSettingsStore().changeSetting({ key: "theme", value: theme });
|
|
|
if (theme == "dark") {
|
|
|
document.documentElement.classList.add("dark");
|
|
|
} else {
|
|
|
document.documentElement.classList.remove("dark");
|
|
|
}
|
|
|
- getERPCode()
|
|
|
+ getERPCode();
|
|
|
});
|
|
|
</script>
|
|
|
|