Index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="page-header-index-wide page-header-wrapper-grid-content-main">
  3. <a-row :gutter="24">
  4. <a-col :md="24" :lg="7">
  5. <a-card :bordered="false">
  6. <div class="account-center-avatarHolder">
  7. <div class="avatar">
  8. <img :src="getAvatar()"/>
  9. </div>
  10. <div class="username">{{ nickname() }}</div>
  11. <div class="bio">海纳百川,有容乃大</div>
  12. </div>
  13. <div class="account-center-detail">
  14. <p>
  15. <i class="title"></i>交互专家
  16. </p>
  17. <p>
  18. <i class="group"></i>蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED
  19. </p>
  20. <p>
  21. <i class="address"></i><span>浙江省</span><span>杭州市</span>
  22. </p>
  23. </div>
  24. <a-divider />
  25. <div class="account-center-tags">
  26. <div class="tagsTitle">标签</div>
  27. <div>
  28. <template v-for="(tag, index) in tags">
  29. <a-tooltip v-if="tag.length > 20" :key="tag" :title="tag">
  30. <a-tag :key="tag" :closable="index !== 0" :afterClose="() => handleTagClose(tag)">
  31. {{ `${tag.slice(0, 20)}...` }}
  32. </a-tag>
  33. </a-tooltip>
  34. <a-tag v-else :key="tag" :closable="index !== 0" :afterClose="() => handleTagClose(tag)">{{ tag }}</a-tag>
  35. </template>
  36. <a-input
  37. v-if="tagInputVisible"
  38. ref="tagInput"
  39. type="text"
  40. size="small"
  41. :style="{ width: '78px' }"
  42. :value="tagInputValue"
  43. @change="handleInputChange"
  44. @blur="handleTagInputConfirm"
  45. @keyup.enter="handleTagInputConfirm"
  46. />
  47. <a-tag v-else @click="showTagInput" style="background: #fff; borderStyle: dashed;">
  48. <a-icon type="plus" /> New Tag
  49. </a-tag>
  50. </div>
  51. </div>
  52. <a-divider :dashed="true" />
  53. <div class="account-center-team">
  54. <div class="teamTitle">团队</div>
  55. <a-spin :spinning="teamSpinning">
  56. <div class="members">
  57. <a-row>
  58. <a-col :span="12" v-for="(item, index) in teams" :key="index">
  59. <a>
  60. <a-avatar size="small" :src="item.avatar" />
  61. <span class="member">{{ item.name }}</span>
  62. </a>
  63. </a-col>
  64. </a-row>
  65. </div>
  66. </a-spin>
  67. </div>
  68. </a-card>
  69. </a-col>
  70. <a-col :md="24" :lg="17">
  71. <a-card
  72. style="width:100%"
  73. :bordered="false"
  74. :tabList="tabListNoTitle"
  75. :activeTabKey="noTitleKey"
  76. @tabChange="key => handleTabChange(key, 'noTitleKey')"
  77. >
  78. <article-page v-if="noTitleKey === 'article'"></article-page>
  79. <app-page v-else-if="noTitleKey === 'app'"></app-page>
  80. <project-page v-else-if="noTitleKey === 'project'"></project-page>
  81. </a-card>
  82. </a-col>
  83. </a-row>
  84. </div>
  85. </template>
  86. <script>
  87. import PageLayout from '@/components/page/PageLayout'
  88. import RouteView from "@/components/layouts/RouteView"
  89. import { AppPage, ArticlePage, ProjectPage } from './page'
  90. import { mapGetters } from 'vuex'
  91. export default {
  92. components: {
  93. RouteView,
  94. PageLayout,
  95. AppPage,
  96. ArticlePage,
  97. ProjectPage
  98. },
  99. data() {
  100. return {
  101. tags: ['很有想法的', '专注设计', '辣~', '大长腿', '川妹子', '海纳百川'],
  102. tagInputVisible: false,
  103. tagInputValue: '',
  104. teams: [],
  105. teamSpinning: true,
  106. tabListNoTitle: [{
  107. key: 'article',
  108. tab: '文章(8)',
  109. }, {
  110. key: 'app',
  111. tab: '应用(8)',
  112. }, {
  113. key: 'project',
  114. tab: '项目(8)',
  115. }
  116. ],
  117. noTitleKey: 'app',
  118. }
  119. },
  120. mounted () {
  121. this.getTeams()
  122. },
  123. methods: {
  124. ...mapGetters(["nickname", "avatar"]),
  125. getAvatar(){
  126. return window._CONFIG['staticDomainURL']+"/"+this.avatar();
  127. },
  128. getTeams() {
  129. this.$http.get('/api/workplace/teams')
  130. .then(res => {
  131. this.teams = res.result
  132. this.teamSpinning = false
  133. })
  134. },
  135. handleTabChange (key, type) {
  136. this[type] = key
  137. },
  138. handleTagClose (removeTag) {
  139. const tags = this.tags.filter(tag => tag != removeTag)
  140. this.tags = tags
  141. },
  142. showTagInput () {
  143. this.tagInputVisible = true
  144. this.$nextTick(() => {
  145. this.$refs.tagInput.focus()
  146. })
  147. },
  148. handleInputChange (e) {
  149. this.tagInputValue = e.target.value
  150. },
  151. handleTagInputConfirm () {
  152. const inputValue = this.tagInputValue
  153. let tags = this.tags
  154. if (inputValue && tags.indexOf(inputValue) === -1) {
  155. tags = [...tags, inputValue]
  156. }
  157. Object.assign(this, {
  158. tags,
  159. tagInputVisible: false,
  160. tagInputValue: ''
  161. })
  162. }
  163. },
  164. }
  165. </script>
  166. <style lang="less" scoped>
  167. .page-header-wrapper-grid-content-main {
  168. width: 100%;
  169. height: 100%;
  170. min-height: 100%;
  171. transition: .3s;
  172. .account-center-avatarHolder {
  173. text-align: center;
  174. margin-bottom: 24px;
  175. & > .avatar {
  176. margin: 0 auto;
  177. width: 104px;
  178. height: 104px;
  179. margin-bottom: 20px;
  180. border-radius: 50%;
  181. overflow: hidden;
  182. img {
  183. height: 100%;
  184. width: 100%;
  185. }
  186. }
  187. .username {
  188. color: rgba(0, 0, 0, 0.85);
  189. font-size: 20px;
  190. line-height: 28px;
  191. font-weight: 500;
  192. margin-bottom: 4px;
  193. }
  194. }
  195. .account-center-detail {
  196. p {
  197. margin-bottom: 8px;
  198. padding-left: 26px;
  199. position: relative;
  200. }
  201. i {
  202. position: absolute;
  203. height: 14px;
  204. width: 14px;
  205. left: 0;
  206. top: 4px;
  207. background: url(https://gw.alipayobjects.com/zos/rmsportal/pBjWzVAHnOOtAUvZmZfy.svg)
  208. }
  209. .title {
  210. background-position: 0 0;
  211. }
  212. .group {
  213. background-position: 0 -22px;
  214. }
  215. .address {
  216. background-position: 0 -44px;
  217. }
  218. }
  219. .account-center-tags {
  220. .ant-tag {
  221. margin-bottom: 8px;
  222. }
  223. }
  224. .account-center-team {
  225. .members {
  226. a {
  227. display: block;
  228. margin: 12px 0;
  229. line-height: 24px;
  230. height: 24px;
  231. .member {
  232. font-size: 14px;
  233. color: rgba(0, 0, 0, .65);
  234. line-height: 24px;
  235. max-width: 100px;
  236. vertical-align: top;
  237. margin-left: 12px;
  238. transition: all 0.3s;
  239. display: inline-block;
  240. }
  241. &:hover {
  242. span {
  243. color: #1890ff;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. .tagsTitle, .teamTitle {
  250. font-weight: 500;
  251. color: rgba(0,0,0,.85);
  252. margin-bottom: 12px;
  253. }
  254. }
  255. </style>