Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
be1307db94 | ||
![]() |
a6c879ce09 | ||
![]() |
ff14f46fe0 | ||
![]() |
03ea4759af |
@@ -58,16 +58,16 @@ trait UserRelations
|
||||
|
||||
/* @var Permissions $permissionsModel */
|
||||
$permissionsModel = app($this->getPermissionsModel());
|
||||
|
||||
if ($this->isSuperAdmin()) {
|
||||
$permissions = $permissionsModel->get();
|
||||
} else {
|
||||
$permissions = Collection::make();
|
||||
$permissionIds = Collection::make();
|
||||
$this->roles()->with('permissions')->get()
|
||||
->each(function ($role) use (&$permissions) {
|
||||
$permissions = $permissions->concat($role->permissions);
|
||||
->each(function ($role) use (&$permissionIds) {
|
||||
$permissionIds = $permissionIds->concat($role->permissions?->pluck('id'));
|
||||
});
|
||||
$permissions = $permissions->unique();
|
||||
|
||||
$permissions = $permissionsModel->whereIn('id', $permissionIds->unique())->get();
|
||||
}
|
||||
|
||||
$this->setAttribute('permissions', $permissions->each(fn ($permission) => $permission->setAttribute('hidden', $permission->isHidden())));
|
||||
|
@@ -96,7 +96,7 @@ class User extends Model implements AuthenticatableContract
|
||||
*/
|
||||
public function updateBy($id, array $data): mixed
|
||||
{
|
||||
if (isset($data['password']) && ! $data['password']) {
|
||||
if (empty($data['password'])) {
|
||||
unset($data['password']);
|
||||
}
|
||||
|
||||
|
@@ -13,13 +13,16 @@
|
||||
<el-icon>
|
||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||
</el-icon>
|
||||
<span>{{ menu?.meta?.title }}</span>
|
||||
<span v-if="menu?.path.indexOf('https://') !== -1 || menu?.path.indexOf('http://') !== -1">
|
||||
<span @click="openUrl(menu?.path as string)">{{ menu?.meta?.title }}</span>
|
||||
</span>
|
||||
<span v-else>{{ menu?.meta?.title }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="MenuItem" setup>
|
||||
<script lang="ts" setup>
|
||||
import { Menu } from '/admin/types/Menu'
|
||||
import { onMounted, PropType, ref } from 'vue'
|
||||
import { PropType } from 'vue'
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
import { isMiniScreen } from '/admin/support/helper'
|
||||
|
||||
@@ -37,6 +40,12 @@ defineProps({
|
||||
require: true,
|
||||
},
|
||||
})
|
||||
|
||||
const openUrl = (path: string) => {
|
||||
const start = path.indexOf('https://') || path.indexOf('http://')
|
||||
window.open(path.substring(start))
|
||||
return false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
@@ -7,22 +7,15 @@
|
||||
:collapse="!appStore.isExpand"
|
||||
:collapse-transition="false"
|
||||
:router="true"
|
||||
@select="selectMenu"
|
||||
:unique-opened="true"
|
||||
>
|
||||
<slot />
|
||||
</el-menu>
|
||||
</template>
|
||||
<script lang="ts" setup name="menus">
|
||||
<script lang="ts" setup>
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const selectMenu = (index: string) => {
|
||||
if (index.startsWith('http') || index.startsWith('https')) {
|
||||
window.open(index)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Reference in New Issue
Block a user