1. <template>
  2. <div class="dashboard-container">
  3. <!-- 头部内容 -->
  4. <el-card class="header-card">
  5. <div>
  6. <div class="fl headL">
  7. <div class="headImg">
  8. <img src="@/assets/common/head.jpg">
  9. </div>
  10. <div class="headInfoTip">
  11. <p class="firstChild">早安,管理员,祝你开心每一天!</p>
  12. <p class="lastChild">早安,管理员,祝你开心每一天!</p>
  13. </div>
  14. </div>
  15. <div class="fr" />
  16. </div>
  17. </el-card>
  18. <!-- 主要内容 -->
  19. <el-row type="flex" justify="space-between">
  20. <!-- 左侧内容 -->
  21. <el-col :span="15" style="padding-right: 26px">
  22. <!-- 工作日历 -->
  23. <el-card class="box-card">
  24. <div slot="header" class="header">
  25. <span>工作日历</span>
  26. </div>
  27. <!-- 放置日历组件 -->
  28. </el-card>
  29. <!-- 公告 -->
  30. <el-card class="box-card">
  31. <div class="advContent">
  32. <div class="title">公告</div>
  33. <div class="contentItem">
  34. <ul class="noticeList">
  35. <li>
  36. <div class="item">
  37. <img src="@/assets/common/img.jpeg" alt="">
  38. <div>
  39. <p>
  40. <span class="col">朱继柳</span> 发布了
  41. 第1期“传智大讲堂”互动讨论获奖名单公布
  42. </p>
  43. <p>2018-07-21 15:21:38</p>
  44. </div>
  45. </div>
  46. </li>
  47. <li>
  48. <div class="item">
  49. <img src="@/assets/common/img.jpeg" alt="">
  50. <div>
  51. <p>
  52. <span class="col">朱继柳</span> 发布了
  53. 第2期“传智大讲堂”互动讨论获奖名单公布
  54. </p>
  55. <p>2018-07-21 15:21:38</p>
  56. </div>
  57. </div>
  58. </li>
  59. <li>
  60. <div class="item">
  61. <img src="@/assets/common/img.jpeg" alt="">
  62. <div>
  63. <p>
  64. <span class="col">朱继柳</span> 发布了
  65. 第3期“传智大讲堂”互动讨论获奖名单公布
  66. </p>
  67. <p>2018-07-21 15:21:38</p>
  68. </div>
  69. </div>
  70. </li>
  71. </ul>
  72. </div>
  73. </div>
  74. </el-card>
  75. </el-col>
  76. <!-- 右侧内容 -->
  77. <el-col :span="9">
  78. <el-card class="box-card">
  79. <div class="header headTit">
  80. <span>流程申请</span>
  81. </div>
  82. <div class="sideNav">
  83. <el-button class="sideBtn">加班离职</el-button>
  84. <el-button class="sideBtn">请假调休</el-button>
  85. <el-button class="sideBtn">审批列表</el-button>
  86. <el-button class="sideBtn">我的信息</el-button>
  87. </div>
  88. </el-card>
  89. <!-- 绩效指数 -->
  90. <el-card class="box-card">
  91. <div slot="header" class="header">
  92. <span>绩效指数</span>
  93. </div>
  94. <!-- 放置雷达图 -->
  95. </el-card>
  96. <!-- 帮助连接 -->
  97. <el-card class="box-card">
  98. <div class="header headTit">
  99. <span>帮助链接</span>
  100. </div>
  101. <div class="sideLink">
  102. <el-row>
  103. <el-col :span="8">
  104. <a href="#">
  105. <span class="icon iconGuide" />
  106. <p>入门指南</p>
  107. </a>
  108. </el-col>
  109. <el-col :span="8">
  110. <a href="#">
  111. <span class="icon iconHelp" />
  112. <p>在线帮助手册</p>
  113. </a>
  114. </el-col>
  115. <el-col :span="8">
  116. <a href="#">
  117. <span class="icon iconTechnology" />
  118. <p>联系技术支持</p>
  119. </a>
  120. </el-col>
  121. </el-row>
  122. </div>
  123. </el-card>
  124. </el-col>
  125. </el-row>
  126. </div>
  127. </template>
  128. <script>
  129. import { mapGetters } from 'vuex'
  130. export default {
  131. name: 'Dashboard',
  132. computed: {
  133. ...mapGetters([
  134. 'name'
  135. ])
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .dashboard-container {
  141. margin: 10px;
  142. li {
  143. list-style: none;
  144. }
  145. .headImg {
  146. float: left;
  147. width: 100px;
  148. height: 100px;
  149. border-radius: 50%;
  150. background: #999;
  151. img {
  152. width: 100%;
  153. height: 100%;
  154. border-radius: 50%;
  155. }
  156. }
  157. .headInfoTip {
  158. padding: 25px 0 0;
  159. margin-left: 120px;
  160. p {
  161. padding: 0 0 15px;
  162. margin: 0;
  163. &.firstChild {
  164. font-size: 20px;
  165. }
  166. &.lastChild {
  167. font-size: 16px;
  168. color: #7f8c8d;
  169. }
  170. }
  171. }
  172. }
  173. .box-card {
  174. padding: 5px 10px;
  175. margin-top: 20px;
  176. .header {
  177. span {
  178. color: #2c3e50;
  179. font-size: 20px;
  180. }
  181. .item {
  182. color: #97a8be;
  183. float: right;
  184. padding: 3px 0;
  185. }
  186. }
  187. .headTit {
  188. span {
  189. border-bottom: 4px solid #8a97f8;
  190. padding-bottom: 10px;
  191. }
  192. }
  193. }
  194. .header-card {
  195. position: relative;
  196. .header {
  197. position: absolute;
  198. right: 20px;
  199. top: 15px;
  200. z-index: 1;
  201. }
  202. }
  203. .advContent {
  204. background: #fff;
  205. border-radius: 5px 5px 0px 0px;
  206. .title {
  207. font-size: 16px;
  208. padding: 20px;
  209. font-weight: bold;
  210. border-bottom: solid 1px #ccc;
  211. }
  212. .contentItem {
  213. padding: 0 30px;
  214. min-height: 350px;
  215. .item {
  216. display: flex;
  217. padding: 18px 0 10px;
  218. border-bottom: solid 1px #ccc;
  219. .col {
  220. color: #8a97f8;
  221. }
  222. img {
  223. width: 56px;
  224. height: 56px;
  225. border-radius: 50%;
  226. margin-right: 10px;
  227. }
  228. p {
  229. padding: 0 0 8px;
  230. }
  231. }
  232. }
  233. }
  234. .noticeList {
  235. margin: 0;
  236. padding: 0;
  237. }
  238. .sideNav,
  239. .sideLink {
  240. padding: 30px 0 12px;
  241. .sideBtn {
  242. padding: 16px 26px;
  243. font-size: 16px;
  244. margin: 10px 5px;
  245. }
  246. }
  247. .sideLink {
  248. text-align: center;
  249. .icon {
  250. display: inline-block;
  251. width: 76px;
  252. height: 76px;
  253. background: url("./../../assets/common/icon.png") no-repeat;
  254. }
  255. .iconGuide {
  256. background-position: 0 0;
  257. }
  258. .iconHelp {
  259. background-position: -224px 0;
  260. }
  261. .iconTechnology {
  262. background-position: -460px 0;
  263. }
  264. }
  265. </style>

导入全局getter

Echart

依赖于原生dom的渲染方式初始化必须放在mounted钩子函数里面

安装依赖:npm i echarts --save

全屏功能

使用到浏览器支持的两个api document.exitFullscreen()退出全屏 document.documentElement.requestFullscreen()打开全屏 使用一个

  1. <template>
  2. <div class="fullBox">
  3. <!-- 全局svg图表组件 icon-class指定渲染的图标 exit-fullscreen-->
  4. <svg-icon
  5. :icon-class="isFullScreen?'exit-fullscreen':'fullscreen'"
  6. class="fullscreen"
  7. @click="toggleScreen"
  8. />
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. isFullScreen: false // 不是全屏
  16. }
  17. },
  18. mounted() {
  19. document.addEventListener('fullscreenchange', () => {
  20. if (document.fullscreenElement === null) {
  21. this.isFullScreen = false
  22. }
  23. })
  24. },
  25. methods: {
  26. toggleScreen () {
  27. if (this.isFullScreen) {
  28. // 退出全屏
  29. document.exitFullscreen()
  30. } else {
  31. // 打开全屏
  32. document.documentElement.requestFullscreen()
  33. }
  34. this.isFullScreen = !this.isFullScreen
  35. }
  36. }
  37. }
  38. </script>
  39. <style scoped>
  40. .fullBox{
  41. display: inline-block;
  42. margin-right: 20px;
  43. color: #fff;
  44. }
  45. </style>

使用插件

网址:https://github.com/sindresorhus/screenfull#readme
下载:npm i screenfull@5 需要装一个稳定的v5版本