Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
2bd5fb94d9
|
@ -0,0 +1,28 @@
|
||||||
|
module.exports = {
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
rules: {
|
||||||
|
'type-enum': [
|
||||||
|
2,
|
||||||
|
'always',
|
||||||
|
[
|
||||||
|
'build', // 编译相关修改(新版本发布)
|
||||||
|
'feat', // 新功能
|
||||||
|
'fix', // 修复bug
|
||||||
|
'update', // 更新某功能
|
||||||
|
'refactor', // 重构
|
||||||
|
'docs', // 文档
|
||||||
|
'chore', // 增加依赖或库
|
||||||
|
'style', // 格式(不影响代码变动)
|
||||||
|
'revert', // 撤销commit 回滚上一版本
|
||||||
|
'perf', // 性能优化
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'type-case': [0],
|
||||||
|
'type-empty': [0],
|
||||||
|
'scope-empty': [0],
|
||||||
|
'scope-case': [0],
|
||||||
|
'subject-full-stop': [0, 'never'],
|
||||||
|
'subject-case': [0, 'never'],
|
||||||
|
'header-max-length': [0, 'always', 72]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npx --no -- commitlint --edit ${1}
|
19
package.json
19
package.json
|
@ -8,7 +8,9 @@
|
||||||
"build": "vite build --mode production",
|
"build": "vite build --mode production",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"eslint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
|
"eslint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
|
||||||
"prettier": "prettier --write"
|
"lint": "eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx",
|
||||||
|
"prettier": "prettier --write",
|
||||||
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
||||||
|
@ -30,16 +32,31 @@
|
||||||
"jetlinks-store": "^0.0.3"
|
"jetlinks-store": "^0.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@commitlint/cli": "^17.4.1",
|
||||||
|
"@commitlint/config-conventional": "^17.4.0",
|
||||||
"@types/lodash-es": "^4.17.6",
|
"@types/lodash-es": "^4.17.6",
|
||||||
"@types/moment": "^2.13.0",
|
"@types/moment": "^2.13.0",
|
||||||
"@types/node": "^18.11.17",
|
"@types/node": "^18.11.17",
|
||||||
"@vitejs/plugin-vue": "^4.0.0",
|
"@vitejs/plugin-vue": "^4.0.0",
|
||||||
"@vuemap/unplugin-resolver": "^1.0.4",
|
"@vuemap/unplugin-resolver": "^1.0.4",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
|
"commitlint": "^17.4.1",
|
||||||
|
"husky": "^8.0.0",
|
||||||
|
"lint-staged": "^13.1.0",
|
||||||
|
"mrm": "^4.1.13",
|
||||||
"prettier": "^2.8.1",
|
"prettier": "^2.8.1",
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
"vite": "^4.0.0",
|
"vite": "^4.0.0",
|
||||||
"vite-plugin-html": "^3.2.0",
|
"vite-plugin-html": "^3.2.0",
|
||||||
"vue-tsc": "^1.0.11"
|
"vue-tsc": "^1.0.11"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"**/*.{vue,js,jsx,ts,tsx}": [
|
||||||
|
"npm run lint",
|
||||||
|
"prettier --write"
|
||||||
|
],
|
||||||
|
"**/*.{html,css,less,md}": [
|
||||||
|
"prettier --write"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,22 +109,25 @@
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<div style="margin-top: 20">
|
<div style="margin-top: 20px">
|
||||||
<a-divider plain style="height: 12">
|
<a-divider plain style="height: 12px">
|
||||||
<div
|
<div
|
||||||
style="color: '#807676d9', fontSize: 12"
|
style="color: #807676d9, font-size: 12px"
|
||||||
>
|
>
|
||||||
其他方式登录
|
其他方式登录
|
||||||
</div>
|
</div>
|
||||||
</a-divider>
|
</a-divider>
|
||||||
<div
|
<div
|
||||||
style="position: 'relative', bottom: '10px'"
|
style="position: relative, bottom: 10px; text-align: center"
|
||||||
v-for="(item, index) in bindings"
|
|
||||||
:key="index"
|
|
||||||
>
|
>
|
||||||
<Button type="link" @Click="handle">
|
<a-button
|
||||||
|
v-for="(item, index) in bindings"
|
||||||
|
:key="index"
|
||||||
|
type="link"
|
||||||
|
@Click="handleClickOther(item)"
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
style="width: 32, height: 33"
|
style="width: 32px, height: 33px"
|
||||||
:alt="item.name"
|
:alt="item.name"
|
||||||
:src="
|
:src="
|
||||||
iconMap.get(
|
iconMap.get(
|
||||||
|
@ -132,7 +135,7 @@
|
||||||
) || defaultImg
|
) || defaultImg
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</Button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -174,7 +177,7 @@ import {
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import { useUserInfo } from '@/store/userInfo';
|
import { useUserInfo } from '@/store/userInfo';
|
||||||
import { LocalStore } from '@/utils/comm';
|
import { LocalStore } from '@/utils/comm';
|
||||||
import { TOKEN_KEY, Version_Code } from '@/utils/variable';
|
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
|
||||||
|
|
||||||
const store = useUserInfo();
|
const store = useUserInfo();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -203,6 +206,11 @@ const codeConfig = ref(false);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const bindings = ref<any[]>();
|
const bindings = ref<any[]>();
|
||||||
|
|
||||||
|
const defaultImg = getImage('/apply/provider1.png');
|
||||||
|
const iconMap = new Map();
|
||||||
|
iconMap.set('dingtalk-ent-app', getImage('/bind/dingtalk.png'));
|
||||||
|
iconMap.set('wechat-webapp', getImage('/bind/wechat-webapp.png'));
|
||||||
|
|
||||||
const onFinish = async () => {
|
const onFinish = async () => {
|
||||||
form.remember
|
form.remember
|
||||||
? Cookies.set('user', encodeURIComponent(JSON.stringify(form)), {
|
? Cookies.set('user', encodeURIComponent(JSON.stringify(form)), {
|
||||||
|
@ -213,18 +221,20 @@ const onFinish = async () => {
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res: any = await authLogin(form);
|
const res: any = await authLogin(form);
|
||||||
if (res.status === 200) {
|
if (res.success) {
|
||||||
store.$patch({
|
store.$patch({
|
||||||
...res.result,
|
...res.result,
|
||||||
username: form.username,
|
username: form.username,
|
||||||
});
|
});
|
||||||
LocalStore.set(TOKEN_KEY, res?.result.token);
|
LocalStore.set(TOKEN_KEY, res?.result.token);
|
||||||
const resp: any = await getInitSet();
|
const resp: any = await getInitSet();
|
||||||
if (resp.status === 200) {
|
if (resp.success) {
|
||||||
router.push('/demo');
|
router.push('/demo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
form.verifyCode = '';
|
||||||
|
getCode();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -253,11 +263,11 @@ const getCookie = () => {
|
||||||
|
|
||||||
const getOpen = () => {
|
const getOpen = () => {
|
||||||
systemVersion().then((res: any) => {
|
systemVersion().then((res: any) => {
|
||||||
if (res.status === 200 && res.result) {
|
if (res.success && res.result) {
|
||||||
LocalStore.set(Version_Code, res.result.edition);
|
LocalStore.set(Version_Code, res.result.edition);
|
||||||
if (res.result.edition !== 'community') {
|
if (res.result.edition !== 'community') {
|
||||||
bindInfo().then((res: any) => {
|
bindInfo().then((res: any) => {
|
||||||
if (res.status === 200) {
|
if (res.success) {
|
||||||
bindings.value = res.result;
|
bindings.value = res.result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -266,6 +276,16 @@ const getOpen = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClickOther = (item: any) => {
|
||||||
|
LocalStore.set('onLogin', 'no');
|
||||||
|
window.open(`${BASE_API_PATH}/application/sso/${item.id}/login`);
|
||||||
|
window.onstorage = (e) => {
|
||||||
|
if (e.newValue) {
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const screenRotation = (width: number, height: number) => {
|
const screenRotation = (width: number, height: number) => {
|
||||||
LoginWarpStyle.backgroundImage = `url(${bgImage})`;
|
LoginWarpStyle.backgroundImage = `url(${bgImage})`;
|
||||||
};
|
};
|
||||||
|
@ -335,11 +355,12 @@ screenRotation(screenWidth.value, screenHeight.value);
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
// text-align: center;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
height: 44px;
|
height: 44px;
|
||||||
line-height: 44px;
|
line-height: 44px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -371,6 +392,7 @@ screenRotation(screenWidth.value, screenHeight.value);
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
font-family: Avenir, 'Helvetica Neue', Arial, Helvetica,
|
font-family: Avenir, 'Helvetica Neue', Arial, Helvetica,
|
||||||
sans-serif;
|
sans-serif;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
|
@ -426,6 +448,27 @@ screenRotation(screenWidth.value, screenHeight.value);
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.verifyCode {
|
||||||
|
.login-code-input {
|
||||||
|
width: 70%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.login-code {
|
||||||
|
width: 30%;
|
||||||
|
height: 32px;
|
||||||
|
float: left;
|
||||||
|
background-color: #e4e6e7;
|
||||||
|
img {
|
||||||
|
cursor: pointer;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.login-code-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue