header.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="header">
  3. <div class="header-left">
  4. <img src="@/assets/imgs/OA/zdww.png" alt="" />
  5. <p>{{ titleName }} </p>
  6. <div class="tips">
  7. <div class="left">
  8. <img src="../../../assets/imgs/OA/notify_icon.png" />
  9. <div>
  10. <ul :class="`scroll_ani${dailyNotifyList.length}`">
  11. <li v-for="(item, index) in dailyNotifyList" :key="index" @click="onLookDetail(item)">
  12. {{ item['content'] }}
  13. </li>
  14. </ul>
  15. </div>
  16. </div>
  17. <div class="more" @click="toMoreHandle">更多<span class="arrow">></span></div>
  18. </div>
  19. </div>
  20. <div class="header-right">
  21. <Weather />
  22. <div class="hx"></div>
  23. <!-- <div class="message">
  24. <el-badge :value="3" class="item">
  25. <img src="@/assets/imgs/OA/xxts.png" alt="" />
  26. </el-badge>
  27. </div> -->
  28. <div class="offLogin" @click="offClick">
  29. <img src="@/assets/imgs/OA/offLogin.png" alt="" />
  30. </div>
  31. </div>
  32. <el-dialog v-model="dialogVisible" width="500px" title="每日速递详情">
  33. <div class="dailyNotifyDetail">
  34. <div>
  35. <span class="dialog_label_icon">
  36. <el-icon class="icon" size="18"><UserFilled /></el-icon>
  37. 发布人:
  38. </span>
  39. <span>{{ formData.nickname }}</span>
  40. </div>
  41. <div>
  42. <span class="dialog_label_icon">
  43. <el-icon class="icon" size="18"><BellFilled /></el-icon>
  44. 发布时间:
  45. </span>
  46. <span>{{ formData.createTime }}</span>
  47. </div>
  48. <div>
  49. <span class="dialog_label_icon">
  50. <el-icon class="icon" size="18"><Comment /></el-icon>
  51. 发布内容:
  52. </span>
  53. <span>{{ formData.content }}</span>
  54. </div>
  55. </div>
  56. <template #footer>
  57. <div class="dialog-footer">
  58. <el-button type="primary" @click="dialogVisible = false"> 关闭 </el-button>
  59. </div>
  60. </template>
  61. </el-dialog>
  62. </div>
  63. </template>
  64. <script setup lang="ts">
  65. import { ElMessageBox } from 'element-plus'
  66. import { useAppStore } from '@/store/modules/app'
  67. import { useUserStore } from '@/store/modules/user'
  68. import request from '@/config/axios'
  69. import Cookies from 'js-cookie'
  70. import Weather from './weather.vue'
  71. const { replace } = useRouter()
  72. import { useTagsViewStore } from '@/store/modules/tagsView'
  73. defineOptions({ name: 'Header' })
  74. const appStore = useAppStore()
  75. const titleName = ref(appStore.title)
  76. const userStore = useUserStore()
  77. const tagsViewStore = useTagsViewStore()
  78. const offClick = () => {
  79. ElMessageBox.confirm('清除缓存并退出登录?', '警告', {
  80. confirmButtonText: '确定',
  81. cancelButtonText: '取消',
  82. type: 'warning'
  83. }).then(async () => {
  84. await userStore.loginOut()
  85. tagsViewStore.delAllViews()
  86. removeCokLog()
  87. replace('/login?redirect=/home')
  88. })
  89. }
  90. const removeCokLog = () => {
  91. var cookiesAll = document.cookie.split(';')
  92. for (var i = 0; i < cookiesAll.length; i++) {
  93. console.log(cookiesAll[i])
  94. Cookies.remove(cookiesAll[i])
  95. }
  96. }
  97. const dailyNotifyList = ref([])
  98. async function queryNotifyByNewThree() {
  99. const urlApi = `/adm/noticeAndLearn/query/page`
  100. const sendData = {
  101. pageNo: 1,
  102. pageSize: 3,
  103. type: 3,
  104. nickname: '',
  105. title: '',
  106. readType: 2
  107. }
  108. const result = await request.post({ url: urlApi, data: sendData })
  109. if (result) {
  110. dailyNotifyList.value = result.list
  111. }
  112. }
  113. queryNotifyByNewThree()
  114. const formData = ref({
  115. id: '',
  116. nickname: '',
  117. createTime: '',
  118. content: ''
  119. })
  120. const dialogVisible = ref(false)
  121. const onLookDetail = (item) => {
  122. if (item) {
  123. formData.value['id'] = item['id']
  124. formData.value['nickname'] = item?.['nickname']
  125. formData.value['createTime'] = item?.['createTime']
  126. formData.value['content'] = item?.['content']
  127. dialogVisible.value = true
  128. }
  129. }
  130. const router = useRouter()
  131. const toMoreHandle = () => {
  132. router.push({
  133. path: '/dailyNotify'
  134. })
  135. }
  136. /** 初始化 **/
  137. onMounted(() => {})
  138. </script>
  139. <style lang="scss" scoped>
  140. :deep(.el-dialog) {
  141. border-radius: 10px;
  142. overflow: hidden;
  143. .el-dialog__header {
  144. background: #f3f7fe;
  145. margin-right: 0px;
  146. padding: 15px 20px;
  147. > span {
  148. font-weight: bold;
  149. }
  150. }
  151. }
  152. .header {
  153. width: calc(100%);
  154. height: 60px;
  155. margin-bottom: 4px;
  156. // background: #183868;
  157. display: flex;
  158. align-items: center;
  159. justify-content: space-between;
  160. box-sizing: border-box;
  161. .header-left {
  162. display: flex;
  163. align-items: center;
  164. min-width: 466px;
  165. > .tips {
  166. background: rgba(255, 255, 255, 0.6);
  167. border-radius: 10px;
  168. display: flex;
  169. align-items: center;
  170. padding: 5px 10px;
  171. margin-left: 20px;
  172. > .left {
  173. display: flex;
  174. align-items: center;
  175. color: #0e1f38;
  176. font-size: 14px;
  177. > img {
  178. width: 15px;
  179. height: 15px;
  180. margin-right: 4px;
  181. }
  182. > div {
  183. height: 22px;
  184. overflow: hidden;
  185. > ul {
  186. &.scroll_ani2 {
  187. animation: scroll2 6s infinite;
  188. }
  189. &.scroll_ani3 {
  190. animation: scroll3 9s infinite;
  191. }
  192. > li {
  193. max-width: 460px;
  194. white-space: nowrap;
  195. text-overflow: ellipsis;
  196. overflow: hidden;
  197. cursor: pointer;
  198. }
  199. }
  200. }
  201. @keyframes scroll2 {
  202. 0%,
  203. 37% {
  204. transform: translateY(0);
  205. }
  206. 50%,
  207. 87% {
  208. transform: translateY(-20px);
  209. }
  210. 100% {
  211. transform: translateY(0);
  212. }
  213. }
  214. @keyframes scroll3 {
  215. 0%,
  216. 25% {
  217. transform: translateY(0);
  218. }
  219. 33.33%,
  220. 58.33% {
  221. transform: translateY(-20px);
  222. }
  223. 66.66%,
  224. 91.66% {
  225. transform: translateY(-41px);
  226. }
  227. 100% {
  228. transform: translateY(0);
  229. }
  230. }
  231. }
  232. > .more {
  233. margin-left: 20px;
  234. font-size: 12px;
  235. color: #333333;
  236. cursor: pointer;
  237. > .arrow {
  238. margin-left: 3px;
  239. }
  240. }
  241. }
  242. img {
  243. width: 48px;
  244. height: 48px;
  245. margin-right: 15px;
  246. }
  247. p {
  248. font-size: 34px;
  249. color: #333f56;
  250. font-family: AlibabaPuHuiTiB;
  251. }
  252. }
  253. .offLogin {
  254. cursor: pointer;
  255. }
  256. .header-right {
  257. display: flex;
  258. align-items: center;
  259. height: 100%;
  260. min-width: 328px;
  261. .hx {
  262. width: 1px;
  263. height: 30px;
  264. background-color: #ccd4dd;
  265. margin: 0 30px;
  266. }
  267. .message {
  268. margin-right: 30px;
  269. > .item {
  270. :deep(.el-badge__content--danger) {
  271. background-color: #e92727;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. .dailyNotifyDetail {
  278. padding: 0px 20px;
  279. padding-bottom: 20px;
  280. .dialog_label_icon {
  281. display: inline-block;
  282. width: 120px;
  283. display: flex;
  284. align-items: center;
  285. > .icon {
  286. color: #0079ee;
  287. margin-right: 4px;
  288. }
  289. }
  290. > div {
  291. padding: 8px;
  292. display: flex;
  293. align-items: flex-start;
  294. > span {
  295. color: #333;
  296. font-size: 17px;
  297. &:nth-child(2) {
  298. flex: 1;
  299. }
  300. }
  301. }
  302. }
  303. </style>