header.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <template>
  2. <section id="proginn-header">
  3. <section class="list">
  4. <a href="/" class="nav-item">
  5. <img class="logo" src="https://dev.test.proginn.com/Public/image/common/logo_new.png">
  6. </a>
  7. <a href="/" class="nav-item">首页</a>
  8. <a href="/cloud?from=top_nav" class="nav-item">云端工作</a>
  9. <a href="/users/" class="nav-item">程序员</a>
  10. <a href="/community" class="nav-item">技术圈</a>
  11. <section>
  12. <section style="position: relative;">
  13. <input class="input" autocomplete="off" placeholder="搜索您感兴趣的程序员" v-model="keywork" @keyup.enter="clickInputEnter">
  14. <i class="el-icon-search"></i>
  15. </section>
  16. <div class="dropdown" style="display:none;"></div>
  17. <div class="dropdown" style="display:none;"></div>
  18. </section>
  19. <el-dropdown class="nav-dropdown">
  20. <el-button type="text" style="color: #515151;">
  21. <i class="el-icon-tickets"></i>工作台
  22. </el-button>
  23. <el-dropdown-menu slot="dropdown">
  24. <el-dropdown-item>
  25. <a href="/wo/work_todo"><i class="el-icon-edit"></i>我的待办</a>
  26. </el-dropdown-item>
  27. <el-dropdown-item>
  28. <a href="/wo/work_platform"><i class="el-icon-date"></i>我的项目</a>
  29. </el-dropdown-item>
  30. <el-dropdown-item>
  31. <a href="/wo/work_hire"><i class="el-icon-news"></i>我的雇佣</a>
  32. </el-dropdown-item>
  33. <el-dropdown-item>
  34. <a href="/wo/work_cloud"><i class="el-icon-service"></i>我的云端</a>
  35. </el-dropdown-item>
  36. </el-dropdown-menu>
  37. </el-dropdown>
  38. <el-dropdown class="nav-dropdown">
  39. <el-button type="text" class="message-box" style="color: #515151;">
  40. <i class="el-icon-message"></i>消息
  41. <span class="message-count message-total">{{messageCount.total}}</span>
  42. </el-button>
  43. <el-dropdown-menu slot="dropdown">
  44. <el-dropdown-item class='message-box'>
  45. <i class="circle blue"></i>系统消息
  46. <span v-if="messageCount.system" class="message-count">{{messageCount.system}}</span>
  47. </el-dropdown-item>
  48. <el-dropdown-item class='message-box'>
  49. <i class="circle orange"></i>工作通知
  50. <span v-if="messageCount.work" class="message-count">{{messageCount.work}}</span>
  51. </el-dropdown-item>
  52. <el-dropdown-item class='message-box'>
  53. <i class="circle red"></i>评论回复
  54. <span v-if="messageCount.reply" class="message-count">{{messageCount.reply}}</span>
  55. </el-dropdown-item>
  56. <el-dropdown-item class='message-box'>
  57. <i class="circle green"></i>@我的
  58. <span v-if="messageCount.at" class="message-count">{{messageCount.at}}</span>
  59. </el-dropdown-item>
  60. <el-dropdown-item class='message-box'>
  61. <i class="circle pink"></i>赞及其它
  62. <span v-if="messageCount.community_other" class="message-count">{{messageCount.community_other}}</span>
  63. </el-dropdown-item>
  64. <el-dropdown-item class='message-box'>
  65. <i class="circle yellow"></i>收支信息
  66. <span v-if="messageCount.balance" class="message-count">{{messageCount.balance}}</span>
  67. </el-dropdown-item>
  68. </el-dropdown-menu>
  69. </el-dropdown>
  70. <el-popover class="nav-popover" placement="bottom" width="226" trigger="hover">
  71. <section class="ref" slot="reference">
  72. <a class="nav-header" href="/wo/work_todo">
  73. <img
  74. class="header-user"
  75. src="https://programmerinn.b0.upaiyun.com/useralbum/64168/icon641681476172013.jpg!mediumicon"
  76. alt="header"
  77. >
  78. <img
  79. class="header-vip-icon"
  80. src="https://dev.test.proginn.com/Public/image/h5/vip_icon_com.png?v=v1547884005"
  81. alt="vip-icon"
  82. >
  83. </a>
  84. <span class="nickname dib">yyyy</span>
  85. </section>
  86. <section class="menu">
  87. <section class="vip-info vip-info-com">
  88. <section class="vip-info-top">
  89. <img
  90. class="vip-icon"
  91. src="https://dev.test.proginn.com/Public/image/h5/vip_icon_com.png?v=v1547884005"
  92. alt="vip-icon"
  93. >
  94. <span class="vip-content">
  95. <span class="vip-title">企业会员</span>
  96. <br>
  97. <span class="vip-end-date">2022-08-01到期</span>
  98. </span>
  99. </section>
  100. <section class="vip-arcs">
  101. <a class="vip-arc" href="/type/vip">查看权益</a>
  102. <a class="vip-arc" href="/vip/pay?number=3&amp;product_id=1&amp;next=/type/vip">立即续费</a>
  103. </section>
  104. </section>
  105. <section class="vip-items">
  106. <a class="vip-item divider" href="/wo/work_platform">
  107. <i class="el-icon-date"></i>我的项目
  108. </a>
  109. <a class="vip-item" href="/wo/work_hire">
  110. <i class="el-icon-news"></i>我的雇佣
  111. </a>
  112. <a class="vip-item" href="/wo/work_cloud">
  113. <i class="el-icon-service"></i>我的云端
  114. </a>
  115. <a class="vip-item divider" href="/wo/64168">
  116. <i class="el-icon-document"></i>我的主页
  117. </a>
  118. <a class="vip-item" href="/index/app">
  119. <i class="el-icon-view"></i>关注微信
  120. </a>
  121. <a class="vip-item divider">
  122. <i class="el-icon-back"></i>退出
  123. </a>
  124. </section>
  125. </section>
  126. </el-popover>
  127. </section>
  128. </section>
  129. </template>
  130. <script>
  131. export default {
  132. data() {
  133. return {
  134. // 搜索的关键词
  135. keywork: '',
  136. // 消息数量
  137. messageCount: {},
  138. }
  139. },
  140. mounted() {
  141. this.getMessageCount()
  142. },
  143. methods: {
  144. clickInputEnter() {
  145. this.$router.push({
  146. path: '/search',
  147. query: {
  148. keyword: this.keywork
  149. }
  150. })
  151. },
  152. async getMessageCount() {
  153. let res = await this.$get('/api/message/getUnreadCount')
  154. this.messageCount = res.data
  155. }
  156. }
  157. }
  158. </script>
  159. <style scoped>
  160. #proginn-header {
  161. display: flex;
  162. justify-content: center;
  163. width: 100%;
  164. background: white;
  165. }
  166. .list {
  167. display: flex;
  168. justify-content: space-between;
  169. align-items: center;
  170. width: 1000px;
  171. }
  172. .nav-item {
  173. display: flex;
  174. height: 80px;
  175. align-items: center;
  176. font-size: 15px;
  177. color: #515151;
  178. }
  179. .nav-dropdown,
  180. .nav-popover {
  181. --imgWidth: 28px;
  182. height: 40px;
  183. }
  184. .nav-popover > .ref {
  185. display: flex;
  186. align-items: center;
  187. }
  188. .nav-header {
  189. position: relative;
  190. width: var(--imgWidth);
  191. height: var(--imgWidth);
  192. margin-right: 10px;
  193. }
  194. .logo {
  195. width: 120px;
  196. height: auto;
  197. }
  198. .input {
  199. width: 234px;
  200. height: 40px;
  201. border-radius: 20px;
  202. background: #f6f6f6;
  203. padding: 0 40px;
  204. }
  205. .el-icon-search {
  206. position: absolute;
  207. top: 12px;
  208. right: 20px;
  209. transform: scale(1.5);
  210. color: grey;
  211. }
  212. i {
  213. margin-right: 4px;
  214. }
  215. i.circle {
  216. display: inline-block;
  217. --width: 12px;
  218. width: var(--width);
  219. height: var(--width);
  220. border-radius: calc(var(--width) / 2);
  221. }
  222. i.blue {
  223. background: #3b83c0;
  224. }
  225. i.orange {
  226. background: #e07b53;
  227. }
  228. i.red {
  229. background: #d95c5c;
  230. }
  231. i.green {
  232. background: #5bbd72;
  233. }
  234. i.pink {
  235. background: #d9499a;
  236. }
  237. i.yellow {
  238. background: #f2c61f;
  239. }
  240. .message-box {
  241. position: relative;
  242. display: flex;
  243. align-items: center;
  244. }
  245. .message-count {
  246. color: white;
  247. margin-left: 4px;
  248. display: block;
  249. line-height: 18px;
  250. padding: 0 8px;
  251. border-radius: 9px;
  252. background: grey;
  253. }
  254. .message-count.message-total {
  255. position: absolute;
  256. top: 0px;
  257. right: -10px;
  258. background: #d95c5c;
  259. }
  260. span.other-icon {
  261. display: block;
  262. margin-left: 30px;
  263. }
  264. .vip-info {
  265. display: flex;
  266. flex-direction: column;
  267. justify-content: center;
  268. align-items: center;
  269. width: 206px;
  270. height: 120px;
  271. }
  272. .vip-info-top {
  273. display: flex;
  274. width: 142px;
  275. }
  276. .vip-title {
  277. color: #cb9d53;
  278. font-size: 16px;
  279. line-height: 36px;
  280. }
  281. .vip-icon {
  282. width: 24px;
  283. height: 24px;
  284. margin: 10px 8px 0 0;
  285. }
  286. .vip-end-date {
  287. font-size: 12px;
  288. color: #999;
  289. }
  290. .vip-arcs {
  291. display: flex;
  292. justify-content: space-between;
  293. width: 142px;
  294. margin-top: 11px;
  295. }
  296. .vip-arc {
  297. flex: 1;
  298. font-size: 13px;
  299. color: #cb9d53;
  300. text-align: center;
  301. }
  302. .vip-arc:first-child {
  303. border-right: 1px solid rgba(245, 245, 245, 1);
  304. }
  305. .vip-info-com .vip-title {
  306. color: rgb(113, 177, 253);
  307. }
  308. .vip-info-com .vip-arc {
  309. color: rgb(113, 177, 253);
  310. }
  311. .header-user {
  312. width: var(--imgWidth);
  313. height: var(--imgWidth);
  314. border-radius: 20px;
  315. }
  316. .header-vip-icon {
  317. position: absolute;
  318. top: 16px;
  319. left: 18px;
  320. width: 16px;
  321. height: 16px;
  322. }
  323. .vip-items {
  324. display: flex;
  325. flex-direction: column;
  326. }
  327. .vip-item {
  328. line-height: 32px;
  329. color: #606266;
  330. }
  331. .vip-item > i {
  332. margin: 0 10px;
  333. }
  334. .divider {
  335. border-top: 1px solid rgba(0, 0, 0, 0.05);
  336. margin-top: 10px;
  337. padding-top: 10px;
  338. }
  339. </style>