2d3e885abba3eb23ecad5bee5304ff8c70d12347.svn-base 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <page-layout :avatar="avatar">
  3. <div slot="headerContent">
  4. <div class="title">{{ timeFix }},{{ nickname() }}<span class="welcome-text">,{{ welcome() }}</span></div>
  5. <div>前端工程师 | 蚂蚁金服 - 某某某事业群 - VUE平台</div>
  6. </div>
  7. <div slot="extra">
  8. <a-row class="more-info">
  9. <a-col :span="8">
  10. <head-info title="项目数" content="56" :center="false" :bordered="false"/>
  11. </a-col>
  12. <a-col :span="8">
  13. <head-info title="团队排名" content="8/24" :center="false" :bordered="false"/>
  14. </a-col>
  15. <a-col :span="8">
  16. <head-info title="项目访问" content="2,223" :center="false" />
  17. </a-col>
  18. </a-row>
  19. </div>
  20. <div>
  21. <a-row :gutter="24">
  22. <a-col :xl="16" :lg="24" :md="24" :sm="24" :xs="24">
  23. <a-card
  24. class="project-list"
  25. :loading="loading"
  26. style="margin-bottom: 24px;"
  27. :bordered="false"
  28. title="进行中的项目"
  29. :body-style="{ padding: 0 }">
  30. <a slot="extra">全部项目</a>
  31. <div>
  32. <a-card-grid class="project-card-grid" :key="i" v-for="(item, i) in projects">
  33. <a-card :bordered="false" :body-style="{ padding: 0 }">
  34. <a-card-meta>
  35. <div slot="title" class="card-title">
  36. <a-avatar size="small" :src="item.cover"/>
  37. <a>{{ item.title }}</a>
  38. </div>
  39. <div slot="description" class="card-description">
  40. {{ item.description }}
  41. </div>
  42. </a-card-meta>
  43. <div class="project-item">
  44. <a href="/#/">科学搬砖组</a>
  45. <span class="datetime">9小时前</span>
  46. </div>
  47. </a-card>
  48. </a-card-grid>
  49. </div>
  50. </a-card>
  51. <a-card :loading="loading" title="动态" :bordered="false">
  52. <a-list>
  53. <a-list-item :key="index" v-for="(item, index) in activities">
  54. <a-list-item-meta>
  55. <a-avatar slot="avatar" :src="item.user.avatar" />
  56. <div slot="title">
  57. <span>{{ item.user.nickname }}</span>&nbsp;
  58. 在&nbsp;<a href="#">{{ item.project.name }}</a>&nbsp;
  59. <span>{{ item.project.action }}</span>&nbsp;
  60. <a href="#">{{ item.project.event }}</a>
  61. </div>
  62. <div slot="description">{{ item.time }}</div>
  63. </a-list-item-meta>
  64. </a-list-item>
  65. </a-list>
  66. </a-card>
  67. </a-col>
  68. <a-col
  69. style="padding: 0 12px"
  70. :xl="8"
  71. :lg="24"
  72. :md="24"
  73. :sm="24"
  74. :xs="24">
  75. <a-card title="快速开始 / 便捷导航" style="margin-bottom: 24px" :bordered="false" :body-style="{padding: 0}">
  76. <div class="item-group">
  77. <a>操作一</a>
  78. <a>操作二</a>
  79. <a>操作三</a>
  80. <a>操作四</a>
  81. <a>操作五</a>
  82. <a>操作六</a>
  83. <a-button size="small" type="primary" ghost icon="plus">添加</a-button>
  84. </div>
  85. </a-card>
  86. <a-card title="XX 指数" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false" :body-style="{ padding: 0 }">
  87. <div style="min-height: 400px;">
  88. <!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts" -->
  89. <radar :data="radarData" />
  90. </div>
  91. </a-card>
  92. <a-card :loading="loading" title="团队" :bordered="false">
  93. <div class="members">
  94. <a-row>
  95. <a-col :span="12" v-for="(item, index) in teams" :key="index">
  96. <a>
  97. <a-avatar size="small" :src="item.avatar" />
  98. <span class="member">{{ item.name }}</span>
  99. </a>
  100. </a-col>
  101. </a-row>
  102. </div>
  103. </a-card>
  104. </a-col>
  105. </a-row>
  106. </div>
  107. </page-layout>
  108. </template>
  109. <script>
  110. import { timeFix } from "@/utils/util"
  111. import {mapGetters} from "vuex"
  112. import PageLayout from '@/components/page/PageLayout'
  113. import HeadInfo from '@/components/tools/HeadInfo'
  114. import Radar from '@/components/chart/Radar'
  115. import { getRoleList, getServiceList, getFileAccessHttpUrl } from "@/api/manage"
  116. const DataSet = require('@antv/data-set')
  117. export default {
  118. name: "Workplace",
  119. components: {
  120. PageLayout,
  121. HeadInfo,
  122. Radar
  123. },
  124. data() {
  125. return {
  126. timeFix: timeFix(),
  127. avatar: '',
  128. user: {},
  129. projects: [],
  130. loading: true,
  131. radarLoading: true,
  132. activities: [],
  133. teams: [],
  134. // data
  135. axis1Opts: {
  136. dataKey: 'item',
  137. line: null,
  138. tickLine: null,
  139. grid: {
  140. lineStyle: {
  141. lineDash: null
  142. },
  143. hideFirstLine: false
  144. }
  145. },
  146. axis2Opts: {
  147. dataKey: 'score',
  148. line: null,
  149. tickLine: null,
  150. grid: {
  151. type: 'polygon',
  152. lineStyle: {
  153. lineDash: null
  154. }
  155. }
  156. },
  157. scale: [{
  158. dataKey: 'score',
  159. min: 0,
  160. max: 80
  161. }],
  162. axisData: [
  163. { item: '引用', a: 70, b: 30, c: 40 },
  164. { item: '口碑', a: 60, b: 70, c: 40 },
  165. { item: '产量', a: 50, b: 60, c: 40 },
  166. { item: '贡献', a: 40, b: 50, c: 40 },
  167. { item: '热度', a: 60, b: 70, c: 40 },
  168. { item: '引用', a: 70, b: 50, c: 40 }
  169. ],
  170. radarData: []
  171. }
  172. },
  173. computed: {
  174. userInfo() {
  175. return this.$store.getters.userInfo
  176. }
  177. },
  178. created() {
  179. this.user = this.userInfo
  180. this.avatar = getFileAccessHttpUrl(this.userInfo.avatar)
  181. console.log('this.avatar :'+ this.avatar)
  182. getRoleList().then(res => {
  183. console.log('workplace -> call getRoleList()', res)
  184. })
  185. getServiceList().then(res => {
  186. console.log('workplace -> call getServiceList()', res)
  187. })
  188. },
  189. mounted() {
  190. this.getProjects()
  191. this.getActivity()
  192. this.getTeams()
  193. this.initRadar()
  194. },
  195. methods: {
  196. ...mapGetters(["nickname", "welcome"]),
  197. getProjects() {
  198. this.$http.get('/mock/api/list/search/projects')
  199. .then(res => {
  200. this.projects = res.result && res.result.data
  201. this.loading = false
  202. })
  203. },
  204. getActivity() {
  205. this.$http.get('/mock/api/workplace/activity')
  206. .then(res => {
  207. this.activities = res.result
  208. })
  209. },
  210. getTeams() {
  211. this.$http.get('/mock/api/workplace/teams')
  212. .then(res => {
  213. this.teams = res.result
  214. })
  215. },
  216. initRadar() {
  217. this.radarLoading = true
  218. this.$http.get('/mock/api/workplace/radar')
  219. .then(res => {
  220. const dv = new DataSet.View().source(res.result)
  221. dv.transform({
  222. type: 'fold',
  223. fields: ['个人', '团队', '部门'],
  224. key: 'user',
  225. value: 'score'
  226. })
  227. this.radarData = dv.rows
  228. this.radarLoading = false
  229. })
  230. }
  231. }
  232. }
  233. </script>
  234. <style lang="less" scoped>
  235. .project-list {
  236. .card-title {
  237. font-size: 0;
  238. a {
  239. color: rgba(0, 0, 0, 0.85);
  240. margin-left: 12px;
  241. line-height: 24px;
  242. height: 24px;
  243. display: inline-block;
  244. vertical-align: top;
  245. font-size: 14px;
  246. &:hover {
  247. color: #1890ff;
  248. }
  249. }
  250. }
  251. .card-description {
  252. color: rgba(0, 0, 0, 0.45);
  253. height: 44px;
  254. line-height: 22px;
  255. overflow: hidden;
  256. }
  257. .project-item {
  258. display: flex;
  259. margin-top: 8px;
  260. overflow: hidden;
  261. font-size: 12px;
  262. height: 20px;
  263. line-height: 20px;
  264. a {
  265. color: rgba(0, 0, 0, 0.45);
  266. display: inline-block;
  267. flex: 1 1 0;
  268. &:hover {
  269. color: #1890ff;
  270. }
  271. }
  272. .datetime {
  273. color: rgba(0, 0, 0, 0.25);
  274. flex: 0 0 auto;
  275. float: right;
  276. }
  277. }
  278. .ant-card-meta-description {
  279. color: rgba(0, 0, 0, 0.45);
  280. height: 44px;
  281. line-height: 22px;
  282. overflow: hidden;
  283. }
  284. }
  285. .item-group {
  286. padding: 20px 0 8px 24px;
  287. font-size: 0;
  288. a {
  289. color: rgba(0, 0, 0, 0.65);
  290. display: inline-block;
  291. font-size: 14px;
  292. margin-bottom: 13px;
  293. width: 25%;
  294. }
  295. }
  296. .members {
  297. a {
  298. display: block;
  299. margin: 12px 0;
  300. line-height: 24px;
  301. height: 24px;
  302. .member {
  303. font-size: 14px;
  304. color: rgba(0, 0, 0, .65);
  305. line-height: 24px;
  306. max-width: 100px;
  307. vertical-align: top;
  308. margin-left: 12px;
  309. transition: all 0.3s;
  310. display: inline-block;
  311. }
  312. &:hover {
  313. span {
  314. color: #1890ff;
  315. }
  316. }
  317. }
  318. }
  319. .mobile {
  320. .project-list {
  321. .project-card-grid {
  322. width: 100%;
  323. }
  324. }
  325. .more-info {
  326. border: 0;
  327. padding-top: 16px;
  328. margin: 16px 0 16px;
  329. }
  330. .headerContent .title .welcome-text {
  331. display: none;
  332. }
  333. }
  334. </style>