@@ -70,11 +55,10 @@
v-model="rememberUserNameAndPass"
class="remember-user-name"
>
- {{ $t('message.common.login.remenber') }}
+ {{ $t('message.common.login.remember') }}
-
{
- // if (valid) {
+ handleSubmit() {
this.loading = true;
if (!this.rememberUserNameAndPass) {
storage.remove('saveUserNameAndPass', 'local');
@@ -191,57 +153,43 @@ export default defineComponent({
Object.keys(config.stores).map((key) =>
(db as any).db?.[key]?.clear(),
);
- api.fetch('/user/login', params)
- .then((rst: any) => {
- this.loading = false;
- storage.set('userName', rst.userName, 'session');
+ api.fetch('/user/login', params).then((rst: any) => {
+ this.loading = false;
+ storage.set('userName', rst.userName, 'session');
+ storage.set(
+ 'enableWatermark',
+ rst.enableWatermark,
+ 'session',
+ );
+ // save username(保存用户名)
+ if (this.rememberUserNameAndPass) {
+ storage.set(
+ 'saveUserNameAndPass',
+ `${this.loginForm.user}&${this.loginForm.password}`,
+ 'local',
+ );
+ }
+ if (rst) {
+ this.userName = rst.userName;
+ this.$router.push({ path: '/' });
+ FMessage.success(
+ this.$t('message.common.login.loginSuccess'),
+ );
+ }
+ }).catch((err: any) => {
+ if (this.rememberUserNameAndPass) {
storage.set(
- 'enableWatermark',
- rst.enableWatermark,
- 'session',
+ 'saveUserNameAndPass',
+ `${this.loginForm.user}&${this.loginForm.password}`,
+ 'local',
);
- // save username(保存用户名)
- if (this.rememberUserNameAndPass) {
- storage.set(
- 'saveUserNameAndPass',
- `${this.loginForm.user}&${this.loginForm.password}`,
- 'local',
- );
- }
- if (rst) {
- this.userName = rst.userName;
- this.$router.push({ path: '/' });
- FMessage.success(
- this.$t('message.common.login.loginSuccess'),
- );
- }
- })
- .catch((err: any) => {
- if (this.rememberUserNameAndPass) {
- storage.set(
- 'saveUserNameAndPass',
- `${this.loginForm.user}&${this.loginForm.password}`,
- 'local',
- );
- }
- if (
- err.message.indexOf(
- '已经登录,请先退出再进行登录',
- ) !== -1
- ) {
- // this.getPageHomeUrl().then(() => {
- this.$router.push({ path: '/' });
- // });
- }
- this.loading = false;
- });
+ }
+ if (err.message.indexOf('已经登录,请先退出再进行登录') !== -1) {
+ this.$router.push({ path: '/' });
+ }
+ this.loading = false;
+ });
});
- // }
- // else {
- // console.error(this.$t('message.common.login.vaildFaild'))
- // FMessage.error(this.$t('message.common.login.vaildFaild'))
- // }
- // })
},
// clear local cache
clearSession() {
@@ -255,26 +203,17 @@ export default defineComponent({
.login {
height: 100%;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- background-color: #001c40;
display: flex;
align-items: center;
justify-content: flex-end;
-
.login-bg {
position: fixed;
width: 100%;
height: 100%;
- top: 0;
- left: 0;
background: url('@/dss/assets/images/loginbgc.svg') no-repeat;
background-position: 55% 40%;
background-color: #001c40;
}
-
.login-main {
position: relative;
width: 450px;
@@ -284,23 +223,17 @@ export default defineComponent({
padding: 50px;
border-radius: 6px;
box-shadow: 2px 2px 40px 0px rgba(0, 0, 0, 0.9);
- z-index: 10;
-
.login-title {
font-size: 20px;
- font-weight: 400px;
- display: block;
text-align: center;
color: #044b93;
font-weight: 600;
}
-
.label {
font-size: 14px;
line-height: 22px;
margin-top: 20px;
}
-
.login-input {
height: 50px;
border-radius: 4px;
@@ -308,14 +241,17 @@ export default defineComponent({
color: #515a6e;
border: 1px solid #dee4ec;
}
-
+ .remember-user-name {
+ position: absolute;
+ bottom: 106px;
+ font-size: 12px;
+ }
.login-btn {
position: absolute;
bottom: 50px;
left: 50px;
width: 357px;
}
-
:deep(span.fes-input-inner) {
display: block;
height: 48px;
@@ -324,39 +260,14 @@ export default defineComponent({
padding: auto 6px;
padding: 0;
}
-
:deep(.fes-input.login-input) {
padding: 0;
}
-
:deep(.fes-input-inner-el) {
transform: translateY(-2px);
padding-left: 12px;
height: 100%;
}
-
- .remember-user-name {
- position: absolute;
- bottom: 106px;
- font-size: 12px;
- }
-
- .ivu-form-item {
- margin-bottom: 20px;
- }
- }
-
- :deep(.fes-form-item-label::before) {
- display: none;
- }
-
- .radioGroup {
- padding-left: 20px;
- display: block;
-
- .ivu-radio-group-item {
- width: 100%;
- }
}
}
diff --git a/linkis-web-next/src/helper/db.ts b/linkis-web-next/src/helper/db.ts
index 3e0369d38e..0423f42527 100644
--- a/linkis-web-next/src/helper/db.ts
+++ b/linkis-web-next/src/helper/db.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Dexie } from 'dexie';
+import { Dexie, Table } from 'dexie';
/**
* wrap db operator
* @class DB
@@ -27,7 +27,7 @@ export default class DB {
errHandler: any;
/**
* Creates an instance of DB.
- * @param {*} name
+ * @param {String} name
* @param {Object} stores
* @param {Number} version
* @memberof DB
@@ -39,7 +39,7 @@ export default class DB {
/**
*
* @param {*} stores
- * @param {*} version
+ * @param {Number} version
* @memberof DB
*/
updateVersion(stores: any, version: number) {
@@ -56,17 +56,16 @@ export default class DB {
* If it does not exist, it will be added.
* @param {String} table
* @param {Object | Array} fields
- * @param {*} id
* @memberof DB
*/
- async put(table, fields) {
+ async put(table: keyof Dexie, fields: object[]) {
const promiseArr = [];
if (Array.isArray(fields)) {
fields.forEach((item) => {
- promiseArr.push(this.db[table].put(item));
+ promiseArr.push((this.db[table] as unknown as Table).put(item));
});
} else {
- promiseArr.push(this.db[table].put(fields));
+ promiseArr.push((this.db[table] as unknown as Table).put(fields));
}
try {
return await Promise.all(promiseArr);
@@ -80,14 +79,14 @@ export default class DB {
* @param {Array} keys
* @memberof DB
*/
- async get(table, keys) {
+ async get(table: keyof Dexie, keys: string[]) {
const promiseArr = [];
if (Array.isArray(keys)) {
keys.forEach((item) => {
- promiseArr.push(this.db[table].get(item));
+ promiseArr.push((this.db[table] as unknown as Table).get(item));
});
} else {
- promiseArr.push(this.db[table].get(keys));
+ promiseArr.push((this.db[table] as unknown as Table).get(keys));
}
try {
return await Promise.all(promiseArr);
@@ -97,37 +96,37 @@ export default class DB {
}
/**
*
- * @param {*} table
- * @param {String | Object} clause
+ * @param {String} table
+ * @param {String | Array} clause
* @memberof DB
* @return {this}
*/
- where(table, clause) {
- this.whereClause = this.db[table].where(clause);
+ where(table: keyof Dexie, clause: string | string[]) {
+ this.whereClause = (this.db[table] as unknown as Table).where(clause);
return this;
}
/**
*
- * @param {*} table
+ * @param {String} table
* @param {*} key
* @param {*} changes
* @return {updated}
* @memberof DB
*/
- async update(table, key, changes) {
+ async update(table: keyof Dexie, key: any, changes: {[keyPath: string]: any}) {
try {
- return await this.db[table].update(key, changes);
+ return await (this.db[table] as unknown as Table).update(key, changes);
} catch (e) {
return this._errorCatch(e);
}
}
/**
*
- * @param {String | Object} clause
+ * @param {String | Array} clause
* @memberof DB
* @return {this}
*/
- equals(clause) {
+ equals(clause: string| string[]) {
this.collection = this.whereClause.where(clause);
return this;
}
@@ -137,7 +136,7 @@ export default class DB {
* @memberof DB
* @return {this}
*/
- anyOf(clause) {
+ anyOf(clause: string| string[]) {
this.collection = this.whereClause.where(clause);
return this;
}
@@ -147,7 +146,7 @@ export default class DB {
* @memberof DB
* @return {Promise}
*/
- async first(cb) {
+ async first(cb: Function) {
try {
return await this.collection.first(cb);
} catch (e) {
@@ -159,26 +158,26 @@ export default class DB {
* @memberof DB
* @return {Promise}
*/
- async delete(...args) {
+ async delete(...args: any[]) {
const len = args.length;
- const table = args[0];
+ const table: keyof Dexie = args[0];
let key = args[1];
try {
if (len === 0) {
return await this.collection.delete();
} else if (len === 2) {
- return await this.db[table].delete(key);
+ return await (this.db[table] as unknown as Table).delete(key);
}
} catch (e) {
return this._errorCatch(e);
}
}
/**
- * @param {*} table
+ * @param {String} table
* @memberof DB
* @return {Promise}
*/
- async toArray(table) {
+ async toArray(table: keyof Dexie) {
try {
if (table) {
this.collection = this.db[table];
diff --git a/linkis-web-next/src/helper/storage.ts b/linkis-web-next/src/helper/storage.ts
index 272d3a96ba..e448f9bc79 100644
--- a/linkis-web-next/src/helper/storage.ts
+++ b/linkis-web-next/src/helper/storage.ts
@@ -66,7 +66,7 @@ const docCookies = {
},
setItem: function (
sKey: string,
- sValue: string,
+ sValue: string | boolean,
vEnd?: number | string | Date | boolean,
sPath?: string,
sDomain?: string,
@@ -135,7 +135,7 @@ const docCookies = {
};
export const storageManager = {
- set: function (key: string, value: string, storage: string) {
+ set: function (key: string, value: string | boolean, storage: string) {
try {
window[storage].setItem(key, JSON.stringify(value));
} catch (e) {
@@ -162,7 +162,7 @@ export const storageManager = {
};
export const cookieManager = {
- set: function (key: string, value: string, expired: number | string | Date | boolean) {
+ set: function (key: string, value: string | boolean, expired: number | string | Date | boolean) {
if (expired) docCookies.setItem(key, value, expired);
else docCookies.setItem(key, value);
},
@@ -182,7 +182,7 @@ export const cookieManager = {
export default {
set: function (
key: string,
- value: string,
+ value: string | boolean,
category = SESSION,
expired = false,
) {
diff --git a/linkis-web-next/src/layout.vue b/linkis-web-next/src/layout.vue
index 4cd0ba5b5c..80c49c3645 100644
--- a/linkis-web-next/src/layout.vue
+++ b/linkis-web-next/src/layout.vue
@@ -20,20 +20,32 @@
-
-
+
+
-
+
-
+
@@ -43,14 +55,65 @@