├── .editorconfig ├── .gitignore ├── README.md ├── babel.config.js ├── package.json ├── public ├── 1.png ├── 2.png ├── 66.gif ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── close.png │ └── logo.png ├── common │ └── js │ │ └── date.js ├── components │ ├── app-header │ │ └── Header.vue │ ├── fans │ │ └── Fans.vue │ ├── lately │ │ └── Lately.vue │ ├── message │ │ └── Message.vue │ ├── user │ │ └── User.vue │ └── warehouse │ │ └── Warehouse.vue ├── main.js ├── router │ └── index.js ├── store │ └── index.js ├── styles │ ├── container.scss │ ├── index.scss │ └── reset.scss └── views │ ├── Home.vue │ ├── center │ └── HomeLeft.vue │ └── login │ └── login.vue ├── vue.config.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-echarts-datav 2 | 3 | - 使用 vue 结合 v-charts 和 datav 实现一个可视化界面数据展示,所有的接口来源,来自 GitHub 中提供的数据信息 4 | 5 | ### 项目构建 6 | 7 | - 克隆仓库 8 | `https://github.com/MrZHLF/vue-echarts-datav.git` 9 | - 进入目录里面 10 | `cnpm install` 11 | - 启动 12 | `cnpm run dev` 13 | 14 | ## 项目结构 15 | 16 | ``` 17 | |——— public #发模式下静态资源目录 18 | | |——— favicon.ico #图标 19 | | |——— index.html #首页入口文件,你可以添加一些 meta 信息或同统计代码啥的 20 | |——— node_modules #一些常用安装的依赖 21 | |——— src #前端项目源码目录 22 | | |——— common #公共文件 23 | | |——— components #公共组件 24 | | | ———— app-header #头部 25 | | | ———— fans #获取粉丝 26 | | | ———— lately #操作记录 27 | | | ———— user #个人信息 28 | | | ———— warehouse #仓库Stars详情和仓库语言 29 | | |——— styles #静态scss文件 30 | | |——— views #组件 31 | | | ———— center #右边展示内容 32 | | | ———— login #登录页面 33 | | | ———— Home.vue #主页面 34 | | |——— assets #静态文件 35 | | |——— router #路由目录 36 | | |——— store #数据状态管理 37 | | |——— App.vue #项目入口文件 38 | | |——— main.js #项目核心文件 39 | |——— package.json #项目配置文件 40 | |——— babel.config.js #babel配置文件 41 | |——— vue.config.js #vue配置文件 42 | |___ README.md #项目的说明文档 43 | 44 | ``` 45 | 46 | ### 实现功能 47 | 48 | - [x] 用户登录以及个人信息展示 49 | - [x] 公开仓库 50 | - [x] 仓库 Stars 详情 51 | - [x] 仓库语言详情 52 | - [x] 粉丝数量以及粉丝展示 53 | - [x] 最近操作记录 54 | 55 | ### 请求接口介绍 56 | 57 | - 请求个人信息接口 `https://api.github.com/users/用户名` 58 | - 请求粉丝接口 `https://api.github.com/users/用户名/followers` 59 | - 仓库信息 `https://api.github.com/users/用户名/repos` 60 | - 这个接口里面包含个人仓库所有信息 61 | - 包含提交信息 `https://api.github.com/users/用户名/events` 62 | 63 | ### 成果展示 64 | 65 | ![avatar](./public/1.png) 66 | ![avatar](./public/2.png) 67 | ![avatar](./public/66.gif) 68 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-echarts-datav", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.19.2", 12 | "core-js": "^3.6.4", 13 | "echarts": "^4.7.0", 14 | "v-charts": "^1.19.0", 15 | "vue": "^2.6.11", 16 | "vue-router": "^3.1.5", 17 | "vuex": "^3.1.2" 18 | }, 19 | "devDependencies": { 20 | "@vue/cli-plugin-babel": "^4.2.0", 21 | "@vue/cli-plugin-eslint": "^4.2.0", 22 | "@vue/cli-plugin-router": "^4.2.0", 23 | "@vue/cli-plugin-vuex": "^4.2.0", 24 | "@vue/cli-service": "^4.2.0", 25 | "@vue/eslint-config-standard": "^5.1.0", 26 | "babel-eslint": "^10.0.3", 27 | "eslint": "^6.7.2", 28 | "eslint-plugin-import": "^2.20.1", 29 | "eslint-plugin-node": "^11.0.0", 30 | "eslint-plugin-promise": "^4.2.1", 31 | "eslint-plugin-standard": "^4.0.0", 32 | "eslint-plugin-vue": "^6.1.2", 33 | "node-sass": "^4.12.0", 34 | "sass-loader": "^8.0.2", 35 | "vue-particles": "^1.0.9", 36 | "vue-template-compiler": "^2.6.11" 37 | }, 38 | "eslintConfig": { 39 | "root": true, 40 | "env": { 41 | "node": true 42 | }, 43 | "extends": [ 44 | "plugin:vue/essential", 45 | "@vue/standard" 46 | ], 47 | "parserOptions": { 48 | "parser": "babel-eslint" 49 | }, 50 | "rules": {} 51 | }, 52 | "browserslist": [ 53 | "> 1%", 54 | "last 2 versions" 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /public/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZHLF/vue-echarts-datav/f0278df21ade7d77f3807c9e4f6c4a1d185d4e50/public/1.png -------------------------------------------------------------------------------- /public/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZHLF/vue-echarts-datav/f0278df21ade7d77f3807c9e4f6c4a1d185d4e50/public/2.png -------------------------------------------------------------------------------- /public/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZHLF/vue-echarts-datav/f0278df21ade7d77f3807c9e4f6c4a1d185d4e50/public/66.gif -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZHLF/vue-echarts-datav/f0278df21ade7d77f3807c9e4f6c4a1d185d4e50/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | -------------------------------------------------------------------------------- /src/assets/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZHLF/vue-echarts-datav/f0278df21ade7d77f3807c9e4f6c4a1d185d4e50/src/assets/close.png -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrZHLF/vue-echarts-datav/f0278df21ade7d77f3807c9e4f6c4a1d185d4e50/src/assets/logo.png -------------------------------------------------------------------------------- /src/common/js/date.js: -------------------------------------------------------------------------------- 1 | export function formatDate(date, fmt) { 2 | if (/(y+)/.test(fmt)) { 3 | fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)) 4 | } 5 | let o = { 6 | 'M+': date.getMonth() + 1, 7 | 'd+': date.getDate(), 8 | 'h+': date.getHours(), 9 | 'm+': date.getMinutes(), 10 | 's+': date.getSeconds() 11 | } 12 | for (let k in o) { 13 | if (new RegExp(`(${k})`).test(fmt)) { 14 | let str = o[k] + '' 15 | fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : padLeftZero(str)) 16 | } 17 | } 18 | return fmt 19 | } 20 | 21 | function padLeftZero(str) { 22 | return ('00' + str).substr(str.length) 23 | } 24 | -------------------------------------------------------------------------------- /src/components/app-header/Header.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | 36 | -------------------------------------------------------------------------------- /src/components/fans/Fans.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 86 | 87 | -------------------------------------------------------------------------------- /src/components/lately/Lately.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 46 | 47 | -------------------------------------------------------------------------------- /src/components/message/Message.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 43 | 44 | -------------------------------------------------------------------------------- /src/components/user/User.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 37 | 38 | -------------------------------------------------------------------------------- /src/components/warehouse/Warehouse.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 115 | 116 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import VCharts from 'v-charts' 6 | import axios from 'axios' 7 | Vue.use(VCharts) 8 | Vue.prototype.$axios = axios 9 | 10 | 11 | // 将自动注册所有组件为全局组件 12 | import dataV from '@jiaminghi/data-view' 13 | import VueParticles from 'vue-particles' 14 | Vue.use(VueParticles) 15 | Vue.use(dataV) 16 | 17 | 18 | import './styles/index.scss' 19 | Vue.config.productionTip = false 20 | 21 | new Vue({ 22 | router, 23 | store, 24 | render: h => h(App) 25 | }).$mount('#app') 26 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Routerr from 'vue-router' 3 | import Home from '../views/Home.vue' 4 | 5 | Vue.use(Routerr) 6 | 7 | const router = new Routerr({ 8 | routes: [{ 9 | path: '/', 10 | name: 'Home', 11 | component: Home 12 | }, { 13 | path: '/login', 14 | name: 'Login', 15 | component: () => import('../views/login/login.vue') 16 | }] 17 | }) 18 | 19 | // 路由守卫 20 | router.beforeEach((to, from, next) => { 21 | const isLogin = !!sessionStorage.userkey 22 | 23 | if (to.path === '/login') { 24 | next() 25 | } else { 26 | isLogin ? next() : next('/login') 27 | } 28 | }) 29 | 30 | 31 | export default router 32 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /src/styles/container.scss: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #app { 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | .border-box-content { 9 | padding: 20px; 10 | -webkit-box-sizing: border-box; 11 | box-sizing: border-box; 12 | display: -webkit-box; 13 | display: -ms-flexbox; 14 | display: flex; 15 | } -------------------------------------------------------------------------------- /src/styles/index.scss: -------------------------------------------------------------------------------- 1 | @import './reset'; 2 | @import './container'; -------------------------------------------------------------------------------- /src/styles/reset.scss: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, 7 | body, 8 | div, 9 | span, 10 | applet, 11 | object, 12 | iframe, 13 | h1, 14 | h2, 15 | h3, 16 | h4, 17 | h5, 18 | h6, 19 | p, 20 | blockquote, 21 | pre, 22 | a, 23 | abbr, 24 | acronym, 25 | address, 26 | big, 27 | cite, 28 | code, 29 | del, 30 | dfn, 31 | em, 32 | img, 33 | ins, 34 | kbd, 35 | q, 36 | s, 37 | samp, 38 | small, 39 | strike, 40 | strong, 41 | sub, 42 | sup, 43 | tt, 44 | var, 45 | b, 46 | u, 47 | i, 48 | center, 49 | dl, 50 | dt, 51 | dd, 52 | ol, 53 | ul, 54 | li, 55 | fieldset, 56 | form, 57 | label, 58 | legend, 59 | table, 60 | caption, 61 | tbody, 62 | tfoot, 63 | thead, 64 | tr, 65 | th, 66 | td, 67 | article, 68 | aside, 69 | canvas, 70 | details, 71 | embed, 72 | figure, 73 | figcaption, 74 | footer, 75 | header, 76 | hgroup, 77 | menu, 78 | nav, 79 | output, 80 | ruby, 81 | section, 82 | summary, 83 | time, 84 | mark, 85 | audio, 86 | video { 87 | margin: 0; 88 | padding: 0; 89 | border: 0; 90 | font-size: 100%; 91 | font: inherit; 92 | vertical-align: baseline; 93 | } 94 | 95 | /* HTML5 display-role reset for older browsers */ 96 | article, 97 | aside, 98 | details, 99 | figcaption, 100 | figure, 101 | footer, 102 | header, 103 | hgroup, 104 | menu, 105 | nav, 106 | section { 107 | display: block; 108 | } 109 | 110 | body { 111 | line-height: 1; 112 | } 113 | 114 | ol, 115 | ul { 116 | list-style: none; 117 | } 118 | 119 | blockquote, 120 | q { 121 | quotes: none; 122 | } 123 | 124 | blockquote:before, 125 | blockquote:after, 126 | q:before, 127 | q:after { 128 | content: ''; 129 | content: none; 130 | } 131 | 132 | table { 133 | border-collapse: collapse; 134 | border-spacing: 0; 135 | } -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 89 | 159 | -------------------------------------------------------------------------------- /src/views/center/HomeLeft.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 52 | 53 | 79 | -------------------------------------------------------------------------------- /src/views/login/login.vue: -------------------------------------------------------------------------------- 1 | 44 | 103 | 185 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | lintOnSave: false 3 | } 4 | --------------------------------------------------------------------------------