MainHeader.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <div class="header-inside col"
  3. :class="{'isHomePage': isHomePage}">
  4. <div class="user-top-menu"
  5. :class="{'isHomePage': isHomePage}">
  6. <div class="right-side">
  7. <q-toolbar>
  8. <q-btn class="lt-md q-mr-md"
  9. icon="menu"
  10. color="primary"
  11. round
  12. flat
  13. text-color="gray"
  14. dense
  15. unelevated
  16. @click="toggleLeftDrawer" />
  17. <q-btn flat
  18. round
  19. dense
  20. class="top-menu-item top-menu-logo gt-sm"
  21. :to="{name: 'Public.Home'}">
  22. <q-img src="/assets/images/web/user-top-menu-logo.png"
  23. width="53" />
  24. </q-btn>
  25. <div class="gt-sm">
  26. <q-btn stretch
  27. flat
  28. label="اخبار و اطلاعیه ها"
  29. :to="{ name: 'Public.Post.List.News' }"
  30. class="top-menu-item" />
  31. <q-btn stretch
  32. flat
  33. label="راهنما"
  34. :to="{ name: 'Public.Post.List.Guide' }"
  35. class="top-menu-item" />
  36. <q-btn stretch
  37. flat
  38. label="فروشگاه"
  39. class="top-menu-item">
  40. <q-menu>
  41. <q-list style="min-width: 100px">
  42. <q-item v-close-popup
  43. href="https://formafzar.com/form/iv9cq"
  44. target="_blank"
  45. clickable>
  46. <q-item-section>کتب سطح یک</q-item-section>
  47. </q-item>
  48. <q-item v-close-popup
  49. href="https://formafzar.com/form/zmvhh"
  50. target="_blank"
  51. clickable>
  52. <q-item-section>کتب سطح دو</q-item-section>
  53. </q-item>
  54. <q-item v-close-popup
  55. href="https://formafzar.com/form/9949w"
  56. target="_blank"
  57. clickable>
  58. <q-item-section>کتب سطح سه</q-item-section>
  59. </q-item>
  60. <q-item v-close-popup
  61. href="https://formafzar.com/form/dttpf"
  62. target="_blank"
  63. clickable>
  64. <q-item-section>کتب سطح چهار</q-item-section>
  65. </q-item>
  66. <q-item v-close-popup
  67. href="https://formafzar.com/form/qlif0"
  68. target="_blank"
  69. clickable>
  70. <q-item-section>کتب سطح پنج</q-item-section>
  71. </q-item>
  72. <q-item v-close-popup
  73. href="https://formafzar.com/form/ch1om"
  74. target="_blank"
  75. clickable>
  76. <q-item-section>کتب جریان‌شناسی</q-item-section>
  77. </q-item>
  78. <q-item v-close-popup
  79. href="https://formafzar.com/form/xskmo"
  80. target="_blank"
  81. clickable>
  82. <q-item-section>جریان‌شناسی سطح دو</q-item-section>
  83. </q-item>
  84. <q-item v-close-popup
  85. href="https://formafzar.com/form/j3x1d"
  86. target="_blank"
  87. clickable>
  88. <q-item-section>کتاب تشکیلات بهشتی</q-item-section>
  89. </q-item>
  90. </q-list>
  91. </q-menu>
  92. </q-btn>
  93. <q-btn stretch
  94. flat
  95. label="درباره ما"
  96. :to="{ name: 'Public.AboutUs' }"
  97. class="top-menu-item" />
  98. <q-btn stretch
  99. flat
  100. label="تماس با ما"
  101. :to="{ name: 'Public.ContactUs' }"
  102. class="top-menu-item" />
  103. <q-btn stretch
  104. flat
  105. label="سوالات متداول"
  106. :to="{ name: 'Public.FAQ' }"
  107. class="top-menu-item" />
  108. </div>
  109. </q-toolbar>
  110. </div>
  111. <q-btn flat
  112. round
  113. dense
  114. class="center-logo lt-md"
  115. :to="{name: 'Public.Home'}">
  116. <q-img src="/assets/images/web/homepage-first-section-logo.png" />
  117. </q-btn>
  118. <div class="left-side">
  119. <q-btn v-if="user && user.id !== null"
  120. color="primary"
  121. @click="goToProperPanel">
  122. <svg id="_000000ff"
  123. data-name="#000000ff"
  124. xmlns="http://www.w3.org/2000/svg"
  125. width="19.995"
  126. height="19.995"
  127. viewBox="0 0 19.995 19.995">
  128. <path id="Path_29101"
  129. data-name="Path 29101"
  130. d="M5.87,0h8.253a6.009,6.009,0,0,1,5.509,3.949A6.133,6.133,0,0,1,20,5.873v8.214a6.011,6.011,0,0,1-4.645,5.752A6.293,6.293,0,0,1,14.124,20H5.873A6.008,6.008,0,0,1,0,14.085V5.872A6.012,6.012,0,0,1,5.87,0M5.526,1.356a4.673,4.673,0,0,0-4.195,4.66q0,4,0,8.005a4.676,4.676,0,0,0,4.684,4.643q4,0,8,0a4.675,4.675,0,0,0,4.645-4.644q0-4.024,0-8.047a4.673,4.673,0,0,0-3.974-4.589,8.038,8.038,0,0,0-1.257-.053H6.288A7.085,7.085,0,0,0,5.526,1.356Z"
  131. fill="#fff" />
  132. <path id="Path_29102"
  133. data-name="Path 29102"
  134. d="M157.367,85.315a4,4,0,1,1-2.651,1.25,4,4,0,0,1,2.651-1.25m-.228,1.373a2.666,2.666,0,1,0,1.776.286A2.674,2.674,0,0,0,157.139,86.688Z"
  135. transform="translate(-147.63 -81.975)"
  136. fill="#fff" />
  137. <path id="Path_29103"
  138. data-name="Path 29103"
  139. d="M122.8,324.315c.815-.016,1.63,0,2.446-.007a5.976,5.976,0,0,1,4.042,1.606.67.67,0,0,1,.145.733.651.651,0,0,1-.749.385,1.129,1.129,0,0,1-.5-.325,4.66,4.66,0,0,0-2.94-1.081q-1.093,0-2.187,0a4.66,4.66,0,0,0-3.1,1.23.694.694,0,0,1-.528.214.668.668,0,0,1-.457-1.121A5.994,5.994,0,0,1,122.8,324.315Z"
  140. transform="translate(-114.152 -311.642)"
  141. fill="#fff" />
  142. </svg>
  143. <span class="btn-label">
  144. حساب کاربری
  145. </span>
  146. <q-menu v-if="canSeeAdminPanel"
  147. fit>
  148. <q-list>
  149. <q-item v-close-popup
  150. clickable
  151. :to="{ name: 'UserPanel.Profile.UserInfo' }">
  152. <q-item-section>
  153. پنل کاربری
  154. </q-item-section>
  155. </q-item>
  156. <q-item v-close-popup
  157. clickable
  158. :to="{ name: 'Admin' }">
  159. <q-item-section>
  160. پنل ادمین
  161. </q-item-section>
  162. </q-item>
  163. <q-item v-close-popup
  164. clickable
  165. @click="logOut">
  166. <q-item-section>
  167. خروج
  168. </q-item-section>
  169. </q-item>
  170. </q-list>
  171. </q-menu>
  172. </q-btn>
  173. <q-btn v-else
  174. color="primary"
  175. :to="{name: 'Login'}">
  176. <span class="btn-label">
  177. ورود / ثبت نام
  178. </span>
  179. <svg id="Login"
  180. xmlns="http://www.w3.org/2000/svg"
  181. width="18.479"
  182. height="20"
  183. viewBox="0 0 18.479 20">
  184. <path id="Combined_Shape"
  185. data-name="Combined Shape"
  186. d="M9.157,0A4.429,4.429,0,0,0,4.733,4.424v.942a.75.75,0,0,0,1.5,0V4.424A2.928,2.928,0,0,1,9.157,1.5h4.885a2.939,2.939,0,0,1,2.936,2.937V15.575A2.929,2.929,0,0,1,14.053,18.5H9.169a2.938,2.938,0,0,1-2.935-2.934v-.932a.75.75,0,1,0-1.5,0v.932A4.44,4.44,0,0,0,9.169,20h4.884a4.431,4.431,0,0,0,4.425-4.425V4.436A4.442,4.442,0,0,0,14.042,0Zm.176,6.556a.75.75,0,0,0,0,1.06L10.975,9.25H.75a.75.75,0,1,0,0,1.5H10.976L9.334,12.385a.75.75,0,1,0,1.058,1.062l2.929-2.916a.747.747,0,0,0,0-1.062L10.393,6.554a.75.75,0,0,0-1.06,0Z"
  187. transform="translate(18.479 20) rotate(180)"
  188. fill="#fff" />
  189. </svg>
  190. </q-btn>
  191. </div>
  192. </div>
  193. </div>
  194. </template>
  195. <script>
  196. import { User } from 'src/models/User.js'
  197. import { mapGetters, mapMutations } from 'vuex'
  198. export default {
  199. name: 'templateHeader',
  200. data () {
  201. return {
  202. user: new User(),
  203. topMenuItems: [
  204. ]
  205. }
  206. },
  207. computed: {
  208. canSeeAdminPanel () {
  209. return this.user.isAdmin() || this.user.isSuperUser() || this.user.isEducationalDepartmentHead() || this.user.isFinancialDepartmentHead()
  210. },
  211. isAdminPage () {
  212. return this.$route.name && this.$route.name.includes('Admin.')
  213. },
  214. isProfilePage () {
  215. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  216. },
  217. isHomePage () {
  218. return this.$route.name && this.$route.name === 'Public.Home'
  219. },
  220. ...mapGetters('AppLayout', [
  221. 'breadcrumbs',
  222. 'windowSize'
  223. ])
  224. },
  225. mounted () {
  226. this.loadAuthData()
  227. },
  228. methods: {
  229. ...mapMutations('AppLayout', [
  230. 'updateLayoutLeftDrawerVisible'
  231. ]),
  232. loadAuthData () {
  233. this.user = this.$store.getters['Auth/user']
  234. },
  235. goToProperPanel () {
  236. if (this.canSeeAdminPanel) {
  237. // this.$router.push({ name: 'Admin.User.Index' })
  238. } else {
  239. this.$router.push({ name: 'UserPanel.Profile.UserInfo' })
  240. }
  241. },
  242. goToHome () {
  243. this.$router.push({ name: 'Public.Home' })
  244. },
  245. goToAdminDashboard () {
  246. this.$router.push({ name: 'Admin.Content.Index' })
  247. },
  248. logOut () {
  249. this.$store.dispatch('Auth/logOut')
  250. },
  251. toggleLeftDrawer () {
  252. this.updateLayoutLeftDrawerVisible(true)
  253. },
  254. hasRoute (route) {
  255. if (!route) {
  256. return
  257. }
  258. return !!(route.name || route.path)
  259. },
  260. getRoute (route) {
  261. if (!this.hasRoute(route)) {
  262. return { name: null }
  263. }
  264. if (route.name) {
  265. return { name: route.name }
  266. } else if (route.path) {
  267. return { path: route.path }
  268. } else {
  269. return { name: null }
  270. }
  271. }
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. .drawer-btn {
  277. display: none;
  278. @media screen and (max-width: 1439px) {
  279. display: block;
  280. }
  281. @media screen and (max-width: 599px) {
  282. margin-bottom: 10px;
  283. }
  284. }
  285. .right-side {
  286. display: flex;
  287. align-items: center;
  288. @media screen and (max-width: 1023px) {
  289. margin-left: 42px;
  290. }
  291. @media screen and (max-width: 599px) {
  292. margin-left: 0;
  293. }
  294. .breadcrumbs {
  295. &:deep(> *) {
  296. font-style: normal;
  297. font-weight: bold;
  298. font-size: 16px;
  299. line-height: 31px;
  300. text-align: right;
  301. color: #23263B;
  302. div:first-child {
  303. font-size: 18px;
  304. }
  305. }
  306. }
  307. }
  308. .left-side {
  309. display: flex;
  310. justify-content: flex-end;
  311. @media screen and (max-width: 1439px) {
  312. position: absolute;
  313. right: 0;
  314. }
  315. @media screen and (max-width: 1023px) {
  316. .q-btn {
  317. width: 40px;
  318. padding: 0;
  319. .btn-label {
  320. display: none;
  321. }
  322. }
  323. }
  324. @media screen and (max-width: 599px) {
  325. right: 16px;
  326. margin-bottom: 10px;
  327. }
  328. }
  329. </style>
  330. <style scoped lang="scss">
  331. .header-inside {
  332. height: 120px;
  333. background-color: #FBF4EA;
  334. color: #212121;
  335. @media only screen and (max-width: 1023px) {
  336. height: 70px;
  337. }
  338. //border-bottom: solid 1px #DFE1EC;
  339. &.isHomePage {
  340. background: transparent;
  341. @media only screen and (max-width: 1023px) {
  342. background-color: #FBF4EA;
  343. }
  344. }
  345. .admin-top-menu {
  346. display: flex;
  347. flex-flow: row;
  348. height: 100%;
  349. .top-menu-items {
  350. width: calc( 100% - 240px );
  351. display: flex;
  352. flex-flow: row;
  353. justify-content: space-between;
  354. .q-btn {
  355. height: 40px;
  356. svg {
  357. margin-right: 10px;
  358. }
  359. }
  360. .right-side {
  361. display: flex;
  362. flex-flow: row;
  363. align-items: center;
  364. padding-left: 50px;
  365. }
  366. .left-side {
  367. display: flex;
  368. flex-flow: row;
  369. align-items: center;
  370. padding-right: 50px;
  371. }
  372. }
  373. .logo {
  374. width: 240px;
  375. height: 100%;
  376. background: #FBF4EA;
  377. border-right: solid 1px #DFE1EC;
  378. display: flex;
  379. align-items: center;
  380. justify-content: center;
  381. .logo-image {
  382. width: 106px;
  383. height: auto;
  384. }
  385. }
  386. }
  387. .user-top-menu {
  388. padding-top: 30px;
  389. margin-right: 100px;
  390. margin-left: 100px;
  391. margin-bottom: 22px;
  392. @media only screen and (max-width: 1500px) {
  393. margin-right: 10px;
  394. margin-left: 10px;
  395. }
  396. @media only screen and (max-width: 1023px) {
  397. padding-top: 0;
  398. margin-bottom: 0;
  399. }
  400. display: flex;
  401. flex-flow: row;
  402. justify-content: space-between;
  403. .q-btn {
  404. height: 40px;
  405. svg {
  406. margin-right: 10px;
  407. margin-left: 10px;
  408. }
  409. }
  410. .right-side {
  411. display: flex;
  412. flex-flow: row;
  413. align-items: center;
  414. .q-toolbar {
  415. min-height: 68px;
  416. .q-btn {
  417. align-self: center;
  418. }
  419. }
  420. }
  421. .center-logo {
  422. $width: 100px;
  423. $height: 55px;
  424. position: absolute;
  425. width: $width;
  426. height: 100%;
  427. top: 0;
  428. left: calc( 50% - (#{$width} / 2));
  429. }
  430. .left-side {
  431. display: flex;
  432. flex-flow: row;
  433. align-items: center;
  434. padding-right: 50px;
  435. @media only screen and (max-width: 1023px) {
  436. height: 100%;
  437. }
  438. @media only screen and (max-width: 599px) {
  439. padding-right: 0;
  440. }
  441. }
  442. &.isHomePage {
  443. .q-toolbar {
  444. .top-menu-item {
  445. color: white;
  446. }
  447. }
  448. }
  449. }
  450. }
  451. .top-menu-items {
  452. border-radius: 10px;
  453. @media only screen and (max-width: 1439px) {
  454. & {
  455. display: none !important;
  456. }
  457. }
  458. @media only screen and (max-width: 500px) {
  459. .q-btn__content {
  460. margin: 4px;
  461. font-size: 0.7rem;
  462. }
  463. }
  464. @media only screen and (max-width: 400px) {
  465. .q-btn__content {
  466. margin: 3px;
  467. font-size: 0.6rem;
  468. }
  469. }
  470. }
  471. .breadcrumbs {
  472. .q-breadcrumbs__separator {
  473. .q-icon {
  474. font-size: 22px;
  475. }
  476. }
  477. }
  478. .drawer-btn {
  479. .q-btn {
  480. flex-direction: row !important;
  481. &.toolbar-button {
  482. margin-left: 0 !important;
  483. }
  484. }
  485. }
  486. .q-btn {
  487. &.toolbar-button {
  488. margin-left: 12px;
  489. height: 48px;
  490. width: 48px;
  491. box-shadow: -2px -4px 10px rgba(255, 255, 255, 0.6), 2px 4px 10px rgba(112, 108, 162, 0.05);
  492. border-radius: 16px;
  493. border: solid 1px #c5c5c5;
  494. }
  495. }
  496. .left-side {
  497. .q-btn {
  498. &.toolbar-button {
  499. .q-btn__content {
  500. .q-btn-dropdown__arrow {
  501. display: none !important;
  502. }
  503. }
  504. }
  505. }
  506. }
  507. </style>