auth and checkbox and permission

pull/1/head
saeid_01 5 years ago
parent f2bb4a68ad
commit 8069f82bd2

@ -1,7 +1,7 @@
{
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=f5fb638c433d6693293e",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=7779873442778964e2ec",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=1dfb9aebca08b2326107",
"/js/vue/Modules/Reservation/app.js": "/js/vue/Modules/Reservation/app.js?id=afa817b12d26db1dd668",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=5aecdd3181f2c8ff8f34"
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=dfec734f6a8269341342",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=9f7b5df53789693aae62",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=252b52bb78d06845370f",
"/js/vue/Modules/Reservation/app.js": "/js/vue/Modules/Reservation/app.js?id=1fd7d081faa5afc1e968",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=caa37176d181f1cabcd1"
}

@ -20,7 +20,7 @@
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title class="Name"> علیرضا حسنی </v-list-tile-title>
<v-list-tile-title class="Name"> {{ user.name }} </v-list-tile-title>
<div class="Role"> مدیریت </div>
<a class="LogOut">
<v-tooltip bottom color="black">
@ -34,11 +34,10 @@
<v-list class="pt-0" dense>
<v-divider class="Divider"></v-divider>
<a href="/User/List">
<wm-list-tile TitleFa=" حساب کاربری من " TitleEn="My Profile"></wm-list-tile>
</a>
<a href="/User/List">
<wm-list-tile TitleFa=" کاربران مجموعه ی من " TitleEn=" My Users "></wm-list-tile>
<a :href="item.href" v-for="(item, key) in Items" :key="key" >
<template v-if="$_hasPermission(item.permission)">
<wm-list-tile :TitleFa="item.titleFa" :TitleEn="item.titleEn"></wm-list-tile>
</template>
</a>
</v-list>
</v-navigation-drawer>
@ -49,7 +48,7 @@
import Tile from '@Global/components/Drawer/Tile';
import Notifications from '@Global/components/Drawer/Notifications';
import {mapActions} from 'vuex';
import {UserService} from '@Global/services/storage.services'
export default {
data() {
return {
@ -59,10 +58,11 @@
hints: true,
drawer: false,
Items: [
{ TitleEn: 'My Profile', TitleFa: ' حساب کاربری من ', Icon: 'dashboard' },
{ TitleEn: ' My Messages ', TitleFa: ' پیام های من ', Icon: 'question_answer' },
{ TitleEn: ' My Users ', TitleFa: ' کاربران مجموعه ی من ', Icon: 'question_answer' }
]
{ titleEn: 'My Profile', titleFa: ' حساب کاربری من ', icon: 'dashboard', permission: "", href: '/User/List' },
// { titleEn: ' My Messages ', titleFa: ' پیام های من ', icon: 'question_answer', permission: "", href: '/User/List' },
{ titleEn: ' My Users ', titleFa: ' کاربران مجموعه ی من ', icon: 'question_answer', permission: "", href: '/User/List' }
],
user: {name: ''}
}
},
components: {
@ -71,6 +71,9 @@
},
methods:{
...mapActions('auth', ['logout'])
},
created() {
this.user = UserService.get();
}
}
</script>

@ -1,10 +1,18 @@
<template>
<div class="WM-Checkbox c-toggle-hide RTL WM-Align-R">
<input type="checkbox" :id="ItemID" class="c-check">
<input
type="checkbox"
:id="ItemID"
class="c-check"
:value="ItemID"
v-model="values"
@change="changeValue"
/>
<label :for="ItemID">
<span class="inc"></span>
<span class="check"></span>
<span class="box"></span> {{ ItemText }}
<span class="box"></span>
{{ ItemText }}
</label>
</div>
</template>
@ -15,12 +23,30 @@ export default {
ItemID: { default: "Checkbox" },
ItemText: { default: " مقدار پیش فرض " },
Color: { default: "Red" },
value: {type: Array}
},
data: function() {
return {
IconClass: 'WMi-' + this.Icon,
IconClass: "WMi-" + this.Icon,
values: this.value
};
},
methods:{
changeValue($event) {
if (this.value) {
if ($event.target.checked) {
this.value.push(this.ItemID);
} else {
let index = this.value.findIndex(x => x == this.ItemID);
this.value.splice(index, 1);
}
}
}
},
watch:{
value(value) {
this.values = value;
}
}
};
</script>

@ -2,6 +2,7 @@ import qs from 'qs';
const TOKEN_KEY = 'access_token'
const USER = 'user'
const PERMISSION = 'permission'
/**
* Manage the how Access Tokens are being stored and retreived from storage.
*
@ -23,18 +24,33 @@ const TokenService = {
}
const UserService = {
getUser() {
get() {
return qs.parse(localStorage.getItem(USER))
},
saveUser(user = null) {
save(user = null) {
user = qs.stringify(user);
localStorage.setItem(USER, user)
},
removeUser() {
remove() {
localStorage.removeItem(USER)
},
}
export { TokenService, UserService }
const PermissionService = {
get() {
return qs.parse(localStorage.getItem(PERMISSION))
},
save(permission = null) {
permission = qs.stringify(permission);
localStorage.setItem(PERMISSION, permission)
},
remove() {
localStorage.removeItem(PERMISSION)
},
}
export { TokenService, UserService, PermissionService }

@ -54,7 +54,8 @@ export default {
updateDepartment: 'update-department',
destroyDepartment: 'destroy-department',
indexRole: 'index-role',
indexRole: 'assign-role',
assignRole: 'assign-role',
storeRole: 'store-role',
updateRole: 'update-role',
destroyRole: 'destroy-role',
@ -63,4 +64,7 @@ export default {
storePermission: 'store-permission',
updatePermission: 'update-permission',
destroyPermission: 'destroy-permission',
sendEmail: 'send-email',
sendSMS: 'send-sms',
}
Loading…
Cancel
Save