diff --git a/package.json b/package.json index dc11924..57e2d16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "noob-mengyxu", - "version": "0.4.2", + "version": "0.4.6", "main": "index.ts", "module": "index.ts", "keywords": [ diff --git a/packages/base/data/modify-form.vue b/packages/base/data/modify-form.vue index 937581f..022a029 100644 --- a/packages/base/data/modify-form.vue +++ b/packages/base/data/modify-form.vue @@ -6,8 +6,8 @@ + :max-value="item.maxValue" full + :placeholder="t('rule.pleaseSelect') + (item.name || t(item.i18n))" :disabled="item.disabled" /> @@ -17,8 +17,8 @@ - {{ t('base.confirm') }} - {{ t('base.cancel') }} + {{ t(confirm) }} + {{ t(cancel) }} @@ -60,6 +60,14 @@ const prop = defineProps({ type: Array(), default: [], }, + confirm: { + type: String, + default: 'base.confirm' + }, + cancel: { + type: String, + default: 'base.cancel' + } }); const emit = defineEmits(["confirm", "cancel"]); const modifyForm = ref(); diff --git a/packages/manage/common/login.vue b/packages/manage/common/login.vue index e8103d5..2fa57b6 100644 --- a/packages/manage/common/login.vue +++ b/packages/manage/common/login.vue @@ -63,11 +63,12 @@ const loginConfirm = user => { param.password = md5(param.password); Api.pub.login(param).then(rsp => { if (rsp) { - state.size.headHeight = state.size.head + 'px'; - state.size.asideWidth = state.size.aside + 'px'; - commit("initSize"); - dispatch("getMenus"); - router.back(); + if (window.history.length <= 1) { + router.push('/'); + } else { + router.back(); + } + dispatch('login') document.removeEventListener('keyup', enter_up); } }) diff --git a/packages/manage/common/login2.vue b/packages/manage/common/login2.vue index f8365b7..eed8714 100644 --- a/packages/manage/common/login2.vue +++ b/packages/manage/common/login2.vue @@ -62,11 +62,8 @@ const loginConfirm = user => { param.password = md5(param.password); Api.pub.login(param).then(rsp => { if (rsp) { - state.size.headHeight = state.size.head + 'px'; - state.size.asideWidth = state.size.aside + 'px'; - commit("initSize"); - dispatch("getMenus"); - router.back(); + router.push('/'); + dispatch('login') document.removeEventListener('keyup', enter_up); } }) @@ -83,8 +80,6 @@ const login = () => { } const enter_up = (e) => { - console.log(e); - if (e.keyCode == 13 || e.keyCode == 100) { login(); } diff --git a/packages/manage/router/index.vue b/packages/manage/router/index.vue index ac71dc9..8bc1cb7 100644 --- a/packages/manage/router/index.vue +++ b/packages/manage/router/index.vue @@ -161,8 +161,8 @@ body { .app-main { box-shadow: 2px 2px 5px 3px #e5e6eb; border-radius: 4px; - margin: 3px 0px 0px 3px !important; - padding: v-bind('state.size.mainPad') !important; + margin: 0px 0px 0px 3px !important; + padding: 0 !important; height: v-bind('state.size.mainHeight'); } diff --git a/plugs/api/base.ts b/plugs/api/base.ts index 80796ab..048e965 100644 --- a/plugs/api/base.ts +++ b/plugs/api/base.ts @@ -85,7 +85,7 @@ export const update = (url, role) => { export const deleteById = (url, id) => { return new Promise((resolve, reject) => { - delate(url + '/' + id).then( + delate(url, id).then( (rsp: any) => { if (rsp) { resolve(rsp); diff --git a/plugs/api/public.ts b/plugs/api/public.ts index 7c01dc7..899c469 100644 --- a/plugs/api/public.ts +++ b/plugs/api/public.ts @@ -5,6 +5,7 @@ const urls = { login: 'public/login', logout: 'public/logout', menu: 'public/menu', + actions: 'public/actions', }; export const getByCodes = (codes) => { @@ -83,3 +84,19 @@ export const getMenus = () => { ); }); }; +export const getActions = (content) => { + return new Promise((resolve, reject) => { + get(urls.actions + '/' + content, null, true, true).then( + (rsp: any) => { + if (rsp) { + resolve(rsp); + } else { + resolve([]); + } + }, + (err) => { + resolve([]); + } + ); + }); +}; diff --git a/plugs/store/index.ts b/plugs/store/index.ts index f42aa90..bb3e150 100644 --- a/plugs/store/index.ts +++ b/plugs/store/index.ts @@ -1,6 +1,6 @@ import { createStore as create } from 'vuex'; import { Styles, Size } from '../config'; -import { getByCodes, getMenus, logout } from '../api/public'; +import { getByCodes, getMenus, logout, getActions } from '../api/public'; import { mapping } from '../api/role'; export class State { @@ -15,6 +15,7 @@ export class State { roleRefresh = true; style = Styles.plain; size = Size.normal; + actions = []; } export class Actions { @@ -55,6 +56,16 @@ export class Actions { getMenus = ({ state, commit }) => { getMenus().then((rsp) => commit('updateState', ['menus', rsp])); }; + getMyActions = ({ state, commit }, content) => { + getActions(content).then((rsp) => commit('updateState', ['actions', rsp])); + }; + login = (store) => { + const { state, commit } = store; + state.size.headHeight = state.size.head + 'px'; + state.size.asideWidth = state.size.aside + 'px'; + commit("initSize"); + this.getMenus(store) + }; } export class Mutations { diff --git a/yarn.lock b/yarn.lock index 0100820..83e9d33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2824,10 +2824,10 @@ electron-to-chromium@^1.4.284: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.356.tgz#b75a8a8c31d571f6024310cc980a08cd6c15a8c5" integrity sha512-nEftV1dRX3omlxAj42FwqRZT0i4xd2dIg39sog/CnCJeCcL1TRd2Uh0i9Oebgv8Ou0vzTPw++xc+Z20jzS2B6A== -element-plus@2.2.20: - version "2.2.20" - resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.2.20.tgz#f4395c276c0945cc8dbb8e6ed4a8d97f173a1ca2" - integrity sha512-ludShd3f5kNRY4FLzeoNitLcwZ4qs2M/zwKeyeE7rUzZJAQ0BZtcT3SvZoEoBLmgxw9jHoonl4WIwon4UzhyRA== +element-plus@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.4.0.tgz#e79249ac4c0a606d377c2f31ad553aa992286fe3" + integrity sha512-yJEa8LXkGOOgkfkeqMMEdeX/Dc8EH9qPcRuX91dlhSXxgCKKbp9tH3QFTOG99ibZsrN/Em62nh7ddvbc7I1frw== dependencies: "@ctrl/tinycolor" "^3.4.1" "@element-plus/icons-vue" "^2.0.6"