UserDashboardItems.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <div class="UserDashboardItems">
  3. <q-list class="side-menu-list"
  4. padding
  5. dark>
  6. <q-item v-for="(item , index) in profileTitlesList"
  7. :key="index"
  8. class="item-list"
  9. :class="{ 'alone-item': !(item.children && item.children.length) }"
  10. :to="{ name: item.routeName, params: item.params }">
  11. <div class="section-title">
  12. <q-item-section class="list-section">
  13. {{ item.title }}
  14. </q-item-section>
  15. <q-item-section class="list-section title-icon"
  16. avatar>
  17. <q-avatar :icon="item.icon"
  18. size="30" />
  19. </q-item-section>
  20. <span class="indicator" />
  21. </div>
  22. </q-item>
  23. <q-item v-if="isUserLogin"
  24. class="item-list alone-item q-mt-lg q-mb-md"
  25. clickable
  26. @click="logOut">
  27. <div class="section-title">
  28. <q-item-section class="list-section">
  29. خروج
  30. </q-item-section>
  31. <q-item-section class="list-section title-icon"
  32. avatar>
  33. <q-avatar icon="isax:logout"
  34. size="30" />
  35. </q-item-section>
  36. <span class="indicator" />
  37. </div>
  38. </q-item>
  39. </q-list>
  40. </div>
  41. </template>
  42. <script>
  43. import { User } from 'src/models/User'
  44. export default {
  45. name: 'UserDashboardItems',
  46. data() {
  47. return {
  48. isAdmin: false,
  49. user: new User(),
  50. isUserLogin: false,
  51. profileTitlesList: [
  52. {
  53. title: 'پروفایل',
  54. icon: 'isax:user',
  55. routeName: 'UserPanel.Profile',
  56. permission: 'all',
  57. active: false,
  58. children: []
  59. },
  60. {
  61. title: 'سفارش های من',
  62. icon: 'isax:stickynote4',
  63. routeName: 'UserPanel.MyOrders',
  64. permission: 'all',
  65. active: false,
  66. children: []
  67. },
  68. {
  69. title: 'فیلم ها و جزوه های من',
  70. icon: 'isax:task-square',
  71. routeName: 'UserPanel.MyPurchases',
  72. params: null,
  73. permission: 'all',
  74. active: false,
  75. children: []
  76. },
  77. {
  78. title: 'علاقه مندی های من',
  79. icon: 'isax:heart',
  80. routeName: 'UserPanel.MyFavorites',
  81. params: null,
  82. permission: 'all',
  83. active: false,
  84. children: []
  85. },
  86. {
  87. title: 'داشبورد راه ابریشم',
  88. icon: 'isax:gps',
  89. routeName: 'UserPanel.Asset.Abrisham.Progress',
  90. permission: 'all',
  91. active: false,
  92. children: []
  93. },
  94. {
  95. title: 'داشبورد راه ابریشم پرو',
  96. icon: 'isax:activity',
  97. routeName: 'UserPanel.Asset.AbrishamPro.Progress',
  98. permission: 'all',
  99. active: false,
  100. children: []
  101. },
  102. {
  103. title: 'داشبورد چترنجات',
  104. icon: 'isax:global',
  105. routeName: 'UserPanel.Asset.TripleTitleSet.Products',
  106. params: { eventName: 'chatre-nejat' },
  107. permission: 'all',
  108. active: false,
  109. children: []
  110. },
  111. {
  112. title: 'داشبورد امتحان نهایی',
  113. icon: 'isax:bill',
  114. routeName: 'UserPanel.Asset.TripleTitleSet.Products',
  115. params: { eventName: 'emtahan-nahaee' },
  116. permission: 'all',
  117. active: false,
  118. children: []
  119. },
  120. {
  121. title: 'کارت هدیه',
  122. icon: 'isax:gift',
  123. routeName: 'UserPanel.Asset.GiftCard.MyGiftCards',
  124. permission: 'all',
  125. active: false,
  126. children: []
  127. },
  128. {
  129. title: 'تیکت',
  130. icon: 'isax:ticket',
  131. routeName: 'UserPanel.Ticket.Index',
  132. permission: 'all',
  133. active: false,
  134. children: []
  135. }
  136. ]
  137. }
  138. },
  139. mounted () {
  140. this.loadAuthData()
  141. },
  142. methods: {
  143. loadAuthData () { // prevent Hydration node mismatch
  144. this.user = this.$store.getters['Auth/user']
  145. this.isAdmin = this.$store.getters['Auth/isAdmin']
  146. this.isUserLogin = this.$store.getters['Auth/isUserLogin']
  147. },
  148. logOut () {
  149. return this.$store.dispatch('Auth/logOut')
  150. },
  151. showMenuItem () {
  152. return (/* item */) => {
  153. return true
  154. // return (item.permission === 'all' || this.user.hasPermission(item.permission))
  155. }
  156. }
  157. }
  158. }
  159. </script>
  160. <style scoped lang="scss">
  161. .Dashboard {
  162. background: #FFFFFF;
  163. border: 1px solid #F2F5F9;
  164. border-radius: 0 16px 16px 16px #{"/* rtl:ignore */"};
  165. display: flex;
  166. flex-direction: column;
  167. color: #6D708B;
  168. .q-list {
  169. color: #6D708B;
  170. padding: 0;
  171. &.side-menu-list {
  172. .top-separator {
  173. margin: 0 40px 32px 40px;
  174. }
  175. .q-item {
  176. padding: 0;
  177. min-height: 0;
  178. &.item-list {
  179. display: flex;
  180. flex-direction: column;
  181. justify-content: center;
  182. font-weight: 400;
  183. font-size: 14px;
  184. line-height: 22px;
  185. cursor: pointer;
  186. padding: 0 14px 0 10px;
  187. border-radius: 14px;
  188. &.alone-item {
  189. height: 40px;
  190. &.active-route-side-mode {
  191. .indicator {
  192. height: 8px;
  193. width: 8px;
  194. background-color: white;
  195. border-radius: 50%;
  196. margin: auto;
  197. }
  198. }
  199. }
  200. &.alone-item-mode-drawer {
  201. &.active-route-side-mode {
  202. .indicator {
  203. background-color: #6D708B6B !important;
  204. }
  205. }
  206. }
  207. .section-title {
  208. height: 30px;
  209. display: flex;
  210. flex-direction: row;
  211. align-items: center;
  212. .title-icon {
  213. margin-left: 12px;
  214. }
  215. .q-item__section--side {
  216. padding: 0;
  217. }
  218. }
  219. .list-section {
  220. display: flex;
  221. flex-direction: row;
  222. justify-content: flex-start;
  223. .q-avatar {
  224. height: 22px;
  225. width: 22px;
  226. }
  227. }
  228. }
  229. }
  230. .side-expansion-list {
  231. &.top-expansion {
  232. margin-bottom: 10px;
  233. }
  234. .expansion-body {
  235. display: flex;
  236. margin-left: 8px;
  237. }
  238. .q-expansion-item__content {
  239. .vertical-separator {
  240. margin: 6px 9px 9px 9px;
  241. }
  242. }
  243. .q-list {
  244. &.list-expansion {
  245. margin-bottom: 0;
  246. .item-list-expansion {
  247. height: 30px;
  248. margin: 5px;
  249. .item-list-expansion-title {
  250. justify-content: start;
  251. }
  252. }
  253. .top-expansion-separator {
  254. }
  255. .list-child-item {
  256. height: 30px;
  257. justify-content: right;
  258. margin-bottom: 8px;
  259. width: 157px;
  260. border-radius: 10px;
  261. padding: 0 14px;
  262. &:last-child {
  263. margin-bottom: 0;
  264. }
  265. .list-child-section {
  266. font-size: 14px !important;
  267. justify-content: center;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. .active-route-side-mode {
  274. background-color: #8075DC;
  275. .indicator {
  276. height: 6px;
  277. width: 6px;
  278. border-radius: 50%;
  279. margin: auto;
  280. }
  281. }
  282. .item-mode-drawer {
  283. background: #F6F9FF;
  284. .indicator {
  285. height: 6px;
  286. width: 6px;
  287. border-radius: 50%;
  288. margin: auto;
  289. background-color: #6D708B6B ;
  290. }
  291. }
  292. }
  293. .q-item__section--avatar {
  294. min-width: 0 !important;
  295. }
  296. a {
  297. text-decoration: none;
  298. padding: 0;
  299. }
  300. }
  301. &.list-side-mode {
  302. color: white;
  303. .q-list {
  304. a {
  305. color: white;
  306. }
  307. }
  308. }
  309. &.list-drawer-mode {
  310. color: #6D708B;
  311. .q-list {
  312. a {
  313. color: #6D708B;
  314. }
  315. }
  316. }
  317. .log-out {
  318. font-weight: 400;
  319. font-size: 14px;
  320. line-height: 22px;
  321. cursor: pointer;
  322. height: 40px !important;
  323. padding: 0 6px;
  324. //width: 232px;
  325. border-radius: 14px;
  326. display: flex;
  327. align-items: center;
  328. margin-top: 15px;
  329. //@media screen and (max-width: 1439px) {
  330. // margin: 0 31px 33px 31px;
  331. //}
  332. //@media screen and (max-width: 599px) {
  333. // margin: 0 30px 30px 30px;
  334. // //padding: 0 0 0 10px;
  335. //}
  336. &:hover {
  337. background-color: rgba(255, 255, 255, 0.1);
  338. }
  339. .q-avatar {
  340. height: 22px;
  341. width: 22px;
  342. margin-right: 12px;
  343. transform: matrix(-1, 0, 0, 1, 0, 0);
  344. }
  345. }
  346. }
  347. </style>