MainHeader.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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="Shop"
  39. :to="{ name: 'Public.Shop' }"
  40. class="top-menu-item" />
  41. <q-btn stretch
  42. flat
  43. label="فروشگاه"
  44. class="top-menu-item">
  45. <q-menu>
  46. <q-list style="min-width: 100px">
  47. <q-item v-close-popup
  48. href="https://formafzar.com/form/iv9cq"
  49. target="_blank"
  50. clickable>
  51. <q-item-section>کتب سطح یک</q-item-section>
  52. </q-item>
  53. <q-item v-close-popup
  54. href="https://formafzar.com/form/zmvhh"
  55. target="_blank"
  56. clickable>
  57. <q-item-section>کتب سطح دو</q-item-section>
  58. </q-item>
  59. <q-item v-close-popup
  60. href="https://formafzar.com/form/9949w"
  61. target="_blank"
  62. clickable>
  63. <q-item-section>کتب سطح سه</q-item-section>
  64. </q-item>
  65. <q-item v-close-popup
  66. href="https://formafzar.com/form/dttpf"
  67. target="_blank"
  68. clickable>
  69. <q-item-section>کتب سطح چهار</q-item-section>
  70. </q-item>
  71. <q-item v-close-popup
  72. href="https://formafzar.com/form/qlif0"
  73. target="_blank"
  74. clickable>
  75. <q-item-section>کتب سطح پنج</q-item-section>
  76. </q-item>
  77. <q-item v-close-popup
  78. href="https://formafzar.com/form/ch1om"
  79. target="_blank"
  80. clickable>
  81. <q-item-section>کتب جریان‌شناسی</q-item-section>
  82. </q-item>
  83. <q-item v-close-popup
  84. href="https://formafzar.com/form/xskmo"
  85. target="_blank"
  86. clickable>
  87. <q-item-section>جریان‌شناسی سطح دو</q-item-section>
  88. </q-item>
  89. <q-item v-close-popup
  90. href="https://formafzar.com/form/j3x1d"
  91. target="_blank"
  92. clickable>
  93. <q-item-section>کتاب تشکیلات بهشتی</q-item-section>
  94. </q-item>
  95. </q-list>
  96. </q-menu>
  97. </q-btn>
  98. <q-btn stretch
  99. flat
  100. label="درباره ما"
  101. :to="{ name: 'Public.AboutUs' }"
  102. class="top-menu-item" />
  103. <q-btn stretch
  104. flat
  105. label="تماس با ما"
  106. :to="{ name: 'Public.ContactUs' }"
  107. class="top-menu-item" />
  108. <q-btn stretch
  109. flat
  110. label="سوالات متداول"
  111. :to="{ name: 'Public.FAQ' }"
  112. class="top-menu-item" />
  113. </div>
  114. </q-toolbar>
  115. </div>
  116. <q-btn flat
  117. round
  118. dense
  119. class="center-logo lt-md"
  120. :to="{name: 'Public.Home'}">
  121. <q-img src="/assets/images/web/homepage-first-section-logo.png" />
  122. </q-btn>
  123. <div class="left-side">
  124. <q-btn v-if="user && user.id !== null"
  125. flat
  126. :to="{ name: 'Public.Cart' }"
  127. class="btn-cart">
  128. <q-badge>
  129. 0
  130. </q-badge>
  131. <q-icon name="shopping_cart" />
  132. </q-btn>
  133. <q-btn v-if="user && user.id !== null"
  134. color="primary"
  135. @click="goToProperPanel">
  136. <svg id="_000000ff"
  137. data-name="#000000ff"
  138. xmlns="http://www.w3.org/2000/svg"
  139. width="19.995"
  140. height="19.995"
  141. viewBox="0 0 19.995 19.995">
  142. <path id="Path_29101"
  143. data-name="Path 29101"
  144. 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"
  145. fill="#fff" />
  146. <path id="Path_29102"
  147. data-name="Path 29102"
  148. 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"
  149. transform="translate(-147.63 -81.975)"
  150. fill="#fff" />
  151. <path id="Path_29103"
  152. data-name="Path 29103"
  153. 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"
  154. transform="translate(-114.152 -311.642)"
  155. fill="#fff" />
  156. </svg>
  157. <span class="btn-label">
  158. حساب کاربری
  159. </span>
  160. <q-menu v-if="canSeeAdminPanel"
  161. fit>
  162. <q-list>
  163. <q-item v-close-popup
  164. clickable
  165. :to="{ name: 'UserPanel.Profile.UserInfo' }">
  166. <q-item-section>
  167. پنل کاربری
  168. </q-item-section>
  169. </q-item>
  170. <q-item v-close-popup
  171. clickable
  172. :to="{ name: 'Admin' }">
  173. <q-item-section>
  174. پنل ادمین
  175. </q-item-section>
  176. </q-item>
  177. <q-item v-close-popup
  178. clickable
  179. @click="logOut">
  180. <q-item-section>
  181. خروج
  182. </q-item-section>
  183. </q-item>
  184. </q-list>
  185. </q-menu>
  186. </q-btn>
  187. <q-btn v-else
  188. color="primary"
  189. :to="{name: 'Login'}">
  190. <span class="btn-label">
  191. ورود / ثبت نام
  192. </span>
  193. <svg id="Login"
  194. xmlns="http://www.w3.org/2000/svg"
  195. width="18.479"
  196. height="20"
  197. viewBox="0 0 18.479 20">
  198. <path id="Combined_Shape"
  199. data-name="Combined Shape"
  200. 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"
  201. transform="translate(18.479 20) rotate(180)"
  202. fill="#fff" />
  203. </svg>
  204. </q-btn>
  205. </div>
  206. </div>
  207. </div>
  208. </template>
  209. <script>
  210. import { User } from 'src/models/User.js'
  211. import { mapGetters, mapMutations } from 'vuex'
  212. export default {
  213. name: 'templateHeader',
  214. data () {
  215. return {
  216. user: new User(),
  217. topMenuItems: [
  218. ]
  219. }
  220. },
  221. computed: {
  222. canSeeAdminPanel () {
  223. return this.user.isAdmin() || this.user.isSuperUser() || this.user.isEducationalDepartmentHead() || this.user.isFinancialDepartmentHead()
  224. },
  225. isAdminPage () {
  226. return this.$route.name && this.$route.name.includes('Admin.')
  227. },
  228. isProfilePage () {
  229. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  230. },
  231. isHomePage () {
  232. return this.$route.name && this.$route.name === 'Public.Home'
  233. },
  234. ...mapGetters('AppLayout', [
  235. 'breadcrumbs',
  236. 'windowSize'
  237. ])
  238. },
  239. mounted () {
  240. this.loadAuthData()
  241. },
  242. methods: {
  243. ...mapMutations('AppLayout', [
  244. 'updateLayoutLeftDrawerVisible'
  245. ]),
  246. loadAuthData () {
  247. this.user = this.$store.getters['Auth/user']
  248. },
  249. goToProperPanel () {
  250. if (this.canSeeAdminPanel) {
  251. // this.$router.push({ name: 'Admin.User.Index' })
  252. } else {
  253. this.$router.push({ name: 'UserPanel.Profile.UserInfo' })
  254. }
  255. },
  256. goToHome () {
  257. this.$router.push({ name: 'Public.Home' })
  258. },
  259. goToAdminDashboard () {
  260. this.$router.push({ name: 'Admin.Content.Index' })
  261. },
  262. logOut () {
  263. this.$store.dispatch('Auth/logOut')
  264. },
  265. toggleLeftDrawer () {
  266. this.updateLayoutLeftDrawerVisible(true)
  267. },
  268. hasRoute (route) {
  269. if (!route) {
  270. return
  271. }
  272. return !!(route.name || route.path)
  273. },
  274. getRoute (route) {
  275. if (!this.hasRoute(route)) {
  276. return { name: null }
  277. }
  278. if (route.name) {
  279. return { name: route.name }
  280. } else if (route.path) {
  281. return { path: route.path }
  282. } else {
  283. return { name: null }
  284. }
  285. }
  286. }
  287. }
  288. </script>
  289. <style lang="scss" scoped>
  290. .drawer-btn {
  291. display: none;
  292. @media screen and (max-width: 1439px) {
  293. display: block;
  294. }
  295. @media screen and (max-width: 599px) {
  296. margin-bottom: 10px;
  297. }
  298. }
  299. .right-side {
  300. display: flex;
  301. align-items: center;
  302. @media screen and (max-width: 1023px) {
  303. margin-left: 42px;
  304. }
  305. @media screen and (max-width: 599px) {
  306. margin-left: 0;
  307. }
  308. .breadcrumbs {
  309. &:deep(> *) {
  310. font-style: normal;
  311. font-weight: bold;
  312. font-size: 16px;
  313. line-height: 31px;
  314. text-align: right;
  315. color: #23263B;
  316. div:first-child {
  317. font-size: 18px;
  318. }
  319. }
  320. }
  321. }
  322. .left-side {
  323. display: flex;
  324. justify-content: flex-end;
  325. @media screen and (max-width: 1439px) {
  326. position: absolute;
  327. right: 0;
  328. }
  329. @media screen and (max-width: 1023px) {
  330. .q-btn {
  331. width: 40px;
  332. padding: 0;
  333. .btn-label {
  334. display: none;
  335. }
  336. }
  337. }
  338. @media screen and (max-width: 599px) {
  339. right: 16px;
  340. margin-bottom: 10px;
  341. }
  342. }
  343. </style>
  344. <style scoped lang="scss">
  345. .header-inside {
  346. height: 120px;
  347. background-color: #FBF4EA;
  348. color: #212121;
  349. @media only screen and (max-width: 1023px) {
  350. height: 70px;
  351. }
  352. //border-bottom: solid 1px #DFE1EC;
  353. &.isHomePage {
  354. background: transparent;
  355. @media only screen and (max-width: 1023px) {
  356. background-color: #FBF4EA;
  357. }
  358. }
  359. .admin-top-menu {
  360. display: flex;
  361. flex-flow: row;
  362. height: 100%;
  363. .top-menu-items {
  364. width: calc( 100% - 240px );
  365. display: flex;
  366. flex-flow: row;
  367. justify-content: space-between;
  368. .q-btn {
  369. height: 40px;
  370. svg {
  371. margin-right: 10px;
  372. }
  373. }
  374. .right-side {
  375. display: flex;
  376. flex-flow: row;
  377. align-items: center;
  378. padding-left: 50px;
  379. }
  380. .left-side {
  381. display: flex;
  382. flex-flow: row;
  383. align-items: center;
  384. padding-right: 50px;
  385. }
  386. }
  387. .logo {
  388. width: 240px;
  389. height: 100%;
  390. background: #FBF4EA;
  391. border-right: solid 1px #DFE1EC;
  392. display: flex;
  393. align-items: center;
  394. justify-content: center;
  395. .logo-image {
  396. width: 106px;
  397. height: auto;
  398. }
  399. }
  400. }
  401. .user-top-menu {
  402. padding-top: 30px;
  403. margin-right: 100px;
  404. margin-left: 100px;
  405. margin-bottom: 22px;
  406. @media only screen and (max-width: 1500px) {
  407. margin-right: 10px;
  408. margin-left: 10px;
  409. }
  410. @media only screen and (max-width: 1023px) {
  411. padding-top: 0;
  412. margin-bottom: 0;
  413. }
  414. display: flex;
  415. flex-flow: row;
  416. justify-content: space-between;
  417. .q-btn {
  418. height: 40px;
  419. svg {
  420. margin-right: 10px;
  421. margin-left: 10px;
  422. }
  423. }
  424. .right-side {
  425. display: flex;
  426. flex-flow: row;
  427. align-items: center;
  428. .q-toolbar {
  429. min-height: 68px;
  430. .q-btn {
  431. align-self: center;
  432. }
  433. }
  434. }
  435. .center-logo {
  436. $width: 100px;
  437. $height: 55px;
  438. position: absolute;
  439. width: $width;
  440. height: 100%;
  441. top: 0;
  442. left: calc( 50% - (#{$width} / 2));
  443. }
  444. .left-side {
  445. display: flex;
  446. flex-flow: row;
  447. align-items: center;
  448. padding-right: 50px;
  449. @media only screen and (max-width: 1023px) {
  450. height: 100%;
  451. }
  452. @media only screen and (max-width: 599px) {
  453. padding-right: 0;
  454. }
  455. }
  456. &.isHomePage {
  457. .q-toolbar {
  458. .top-menu-item {
  459. color: white;
  460. }
  461. }
  462. }
  463. }
  464. }
  465. .top-menu-items {
  466. border-radius: 10px;
  467. @media only screen and (max-width: 1439px) {
  468. & {
  469. display: none !important;
  470. }
  471. }
  472. @media only screen and (max-width: 500px) {
  473. .q-btn__content {
  474. margin: 4px;
  475. font-size: 0.7rem;
  476. }
  477. }
  478. @media only screen and (max-width: 400px) {
  479. .q-btn__content {
  480. margin: 3px;
  481. font-size: 0.6rem;
  482. }
  483. }
  484. }
  485. .breadcrumbs {
  486. .q-breadcrumbs__separator {
  487. .q-icon {
  488. font-size: 22px;
  489. }
  490. }
  491. }
  492. .drawer-btn {
  493. .q-btn {
  494. flex-direction: row !important;
  495. &.toolbar-button {
  496. margin-left: 0 !important;
  497. }
  498. }
  499. }
  500. .q-btn {
  501. &.toolbar-button {
  502. margin-left: 12px;
  503. height: 48px;
  504. width: 48px;
  505. box-shadow: -2px -4px 10px rgba(255, 255, 255, 0.6), 2px 4px 10px rgba(112, 108, 162, 0.05);
  506. border-radius: 16px;
  507. border: solid 1px #c5c5c5;
  508. }
  509. }
  510. .left-side {
  511. .q-btn {
  512. &.toolbar-button {
  513. .q-btn__content {
  514. .q-btn-dropdown__arrow {
  515. display: none !important;
  516. }
  517. }
  518. }
  519. &.btn-cart {
  520. background: white;
  521. color: $primary;
  522. margin-right: 20px;
  523. .q-badge {
  524. background: #FBF4EA;
  525. color: $primary;
  526. }
  527. }
  528. }
  529. }
  530. </style>