index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="main-box">
  3. <div class="scroll-box">
  4. <div class="grid-box">
  5. <div v-permission="'dashboard.head'" class="main-card">
  6. <div class="hello-text">{{ getTimeWord() }},{{ user.nickname }}!</div>
  7. <div class="card-content">
  8. <div class="expo-text">
  9. <span v-if="currentExpo">距离{{ currentExpo.expo_name }}结束还有{{ getEndDay(currentExpo.end_date) }}天</span>
  10. <span v-else>没有进行中的展会</span>
  11. </div>
  12. <div class="quick-nav">
  13. <router-link class="nav-item" to="audience">
  14. <span class="icon el-icon-user" />
  15. <span class="text">观众管理</span>
  16. </router-link>
  17. <router-link class="nav-item" to="preRegister">
  18. <span class="icon el-icon-tickets" />
  19. <span class="text">表单管理</span>
  20. </router-link>
  21. <router-link class="nav-item" to="exhibitor">
  22. <span class="icon el-icon-office-building" />
  23. <span class="text">展商管理</span>
  24. </router-link>
  25. <router-link class="nav-item" to="invitation">
  26. <span class="icon el-icon-files" />
  27. <span class="text">模板管理</span>
  28. </router-link>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="starter-box card">
  33. <div class="icon el-icon-position"></div>
  34. <div class="title">创建展会</div>
  35. <div class="desc">十分钟创建一个展会<br/>通过表单系统收集与管理观众信息</div>
  36. </div>
  37. <div class="invitation-box card">
  38. <div class="icon el-icon-notebook-2"></div>
  39. <div class="title">创建邀请函</div>
  40. <div class="desc">十分钟创建一个邀请函<br/>集成表单系统快速填充信息并发送</div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import { getExpoList } from '@/api/expo'
  48. export default {
  49. name: 'Dashboard',
  50. data() {
  51. return {
  52. currentExpo: {}
  53. }
  54. },
  55. computed: {
  56. user() { return this.$store.state.user.user }
  57. },
  58. mounted() {
  59. this.init()
  60. },
  61. methods: {
  62. init() {
  63. getExpoList(1, 20).then(res => {
  64. const expoList = res.data.data
  65. for (const item of expoList) {
  66. if (item.status === 0 && this.getEndDay(item.end_date) >= 0) {
  67. this.currentExpo = item
  68. return
  69. }
  70. }
  71. this.currentExpo = false
  72. }).catch(err => {
  73. this.$notify({
  74. title: '提示',
  75. message: '获取展会列表失败'+err,
  76. type: 'error'
  77. })
  78. })
  79. },
  80. getEndDay(date) {
  81. const endTime = new Date(date)
  82. return Math.ceil((endTime.getTime() - new Date().getTime()) / 86400000)
  83. },
  84. getTimeWord() {
  85. const time = new Date().getHours()
  86. if (time >= 0 && time < 6) return '凌晨好'
  87. if (time >= 6 && time < 9) return '早上好'
  88. if (time >= 9 && time < 12) return '上午好'
  89. if (time >= 12 && time < 14) return '中午好'
  90. if (time >= 14 && time < 17) return '下午好'
  91. if (time >= 17 && time < 19) return '傍晚好'
  92. if (time >= 19 && time < 21) return '晚上好'
  93. return '夜深了'
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. @use '@/styles/variables.scss' as *;
  100. .main-box {
  101. height: 100%;
  102. width: 100%;
  103. //filter: grayscale(1);
  104. .scroll-box {
  105. padding: 2px;
  106. position: absolute;
  107. width: calc(100% - 32px);
  108. height: calc(100% - 32px);
  109. overflow: hidden;
  110. overflow-y: auto;
  111. .grid-box{
  112. display: grid;
  113. grid-gap: 16px;
  114. grid-template-rows: 200px 200px 200px;
  115. grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
  116. .card{
  117. cursor: pointer;
  118. transition-duration: 300ms;
  119. padding: 36px 36px 18px;
  120. border-radius: 8px;
  121. position: relative;
  122. overflow: hidden;
  123. .title{
  124. font-size: 28px;
  125. font-weight: bold;
  126. margin-bottom: 16px;
  127. position: relative;
  128. }
  129. .desc{
  130. width: 80%;
  131. position: relative;
  132. }
  133. .icon{
  134. opacity: 0.1;
  135. font-size: 150px;
  136. position: absolute;
  137. right: 12px;
  138. bottom: -60px;
  139. transition-duration: 300ms;
  140. }
  141. &:hover{
  142. .icon{
  143. transform: scale(1.1) translateY(-20px);
  144. }
  145. }
  146. }
  147. .starter-box{
  148. grid-column: span 2;
  149. background: #e1f8f8;
  150. color: #117878;
  151. &:hover{
  152. box-shadow: inset 0 0 0 2px #117878;
  153. }
  154. }
  155. .invitation-box{
  156. grid-column: span 2;
  157. background: #fbf3e7;
  158. color: #88601f;
  159. &:hover{
  160. box-shadow: inset 0 0 0 2px #88601f;
  161. }
  162. }
  163. .main-card{
  164. grid-column: span 6;
  165. background: $menuActiveBg;
  166. padding: 36px 36px 18px;
  167. border-radius: 8px;
  168. .hello-text{
  169. color: $menuActiveText;
  170. font-size: 28px;
  171. font-weight: bold;
  172. }
  173. .card-content{
  174. margin-top: 16px;
  175. display: grid;
  176. grid-template-columns: 1fr 2fr;
  177. .expo-text{
  178. }
  179. .quick-nav{
  180. display: flex;
  181. justify-content: flex-end;
  182. .nav-item{
  183. transition-duration: 300ms;
  184. padding: 16px 32px;
  185. border-radius: 16px;
  186. text-decoration: unset;
  187. color: $menuActiveText;
  188. display: flex;
  189. flex-direction: column;
  190. .icon{
  191. margin-bottom: 4px;
  192. font-size: 32px;
  193. }
  194. .text{
  195. font-size: 16px;
  196. }
  197. &:hover{
  198. background: #004DFF11;
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. </style>