Navbar.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  1. <template>
  2. <div>
  3. <div class="navbar">
  4. <!-- 菜单展开缩起 -->
  5. <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
  6. <div class="menu_module">
  7. <div class="menu_module_view">
  8. <v-scroll-view
  9. :x="true"
  10. :y="false"
  11. slidingBgClassName="slidingBgClassName"
  12. slidingBlockClassName="slidingBlockClassName"
  13. >
  14. <div class="menu_module_fj">
  15. <div
  16. v-for="(item, index) in routes"
  17. :key="index"
  18. :class="{ item: true, select: path === item.path }"
  19. @click="tizhuanyemian(item)"
  20. >
  21. {{ item.meta.title }}
  22. </div>
  23. </div>
  24. </v-scroll-view>
  25. </div>
  26. </div>
  27. <!-- 右侧 -->
  28. <div class="right-menu">
  29. <div class="right-menu-item" v-if="bigViewsBool" @click="goBigViews">
  30. <el-button size="mini">数据大屏</el-button>
  31. </div>
  32. <div class="right-menu-item" v-if="bigViews2Bool" @click="goBigViews2">
  33. <el-button size="mini">NEW 数据大屏</el-button>
  34. </div>
  35. <div class="right-menu-item">
  36. <el-autocomplete
  37. v-model="pathurl"
  38. :fetch-suggestions="querySearchAsync"
  39. s
  40. placeholder="搜索菜单"
  41. @select="handleSelect"
  42. ></el-autocomplete>
  43. </div>
  44. <div
  45. style="margin-right: 20px; cursor: pointer"
  46. @click="
  47. getList()
  48. isShow = true
  49. "
  50. >
  51. <i class="el-icon-message-solid"></i>
  52. <el-badge :is-dot="isDot1 || isDot2"></el-badge>
  53. </div>
  54. <shortcut />
  55. <template v-if="device !== 'mobile'">
  56. <!-- 全屏控制 -->
  57. <screenfull id="screenfull" class="right-menu-item hover-effect" />
  58. </template>
  59. <el-dropdown class="user-container" trigger="click">
  60. <div class="user right-menu-item hover-effect">
  61. <div class="flex">
  62. {{ Vue_Translation_Of_Text_Type }}
  63. </div>
  64. </div>
  65. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  66. <el-dropdown-item divided @click.native="$setLanguage('zh')">
  67. <span style="display: block">中文</span>
  68. </el-dropdown-item>
  69. <el-dropdown-item divided @click.native="$setLanguage('ru')">
  70. <span style="display: block">俄文</span>
  71. </el-dropdown-item>
  72. <el-dropdown-item divided @click.native="$setLanguage('en')">
  73. <span style="display: block">英文</span>
  74. </el-dropdown-item>
  75. <el-dropdown-item divided @click.native="$setLanguage('ja')">
  76. <span style="display: block">日文</span>
  77. </el-dropdown-item>
  78. <el-dropdown-item divided @click.native="$setLanguage('ar')">
  79. <span style="display: block">阿拉伯文</span>
  80. </el-dropdown-item>
  81. <el-dropdown-item divided @click.native="$setLanguage('tr')">
  82. <span style="display: block">土耳其</span>
  83. </el-dropdown-item>
  84. </el-dropdown-menu>
  85. </el-dropdown>
  86. <el-dropdown class="user-container" trigger="click">
  87. <div class="user right-menu-item hover-effect">
  88. <div class="flex">
  89. <i class="el-icon-user-solid" />
  90. <span :class="name.length > 5 ? 'ellipsis' : ''">{{ name }}</span>
  91. </div>
  92. </div>
  93. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  94. <router-link :to="{ name: 'profile' }">
  95. <el-dropdown-item>个人信息</el-dropdown-item>
  96. </router-link>
  97. <el-dropdown-item divided @click.native="logout">
  98. <span style="display: block">退出登录</span>
  99. </el-dropdown-item>
  100. </el-dropdown-menu>
  101. </el-dropdown>
  102. </div>
  103. </div>
  104. <notice-bar />
  105. <el-drawer
  106. title="系统消息"
  107. :visible.sync="isShow"
  108. :append-to-body="true"
  109. :with-header="false"
  110. direction="rtl"
  111. size="405px"
  112. >
  113. <div class="message">
  114. <div class="head">
  115. <div class="flex_asb">
  116. <el-radio-group size="small" v-model="messageType" @change="getList">
  117. <el-badge :is-dot="isDot1" class="item">
  118. <el-radio-button
  119. :label="[
  120. 'WBI',
  121. 'WBK',
  122. 'CRE_ORDER',
  123. 'SEND_MALL',
  124. 'RP_MALL',
  125. 'CR_SALES',
  126. 'ENGIN_PAY_ORDER',
  127. 'CR_ES_SALES'
  128. ]"
  129. >系统消息</el-radio-button
  130. >
  131. </el-badge>
  132. <el-badge :is-dot="isDot2" class="item">
  133. <el-radio-button :label="['NOTICE']">平台公告</el-radio-button>
  134. </el-badge>
  135. <el-badge :is-dot="isDot3" class="item" v-if="shenfentype == 0">
  136. <el-radio-button :label="['WDTZ']">网点通知</el-radio-button>
  137. </el-badge>
  138. </el-radio-group>
  139. <el-switch
  140. v-model="isOpen"
  141. @change="updateIsNotice"
  142. inactive-text="消息弹窗"
  143. active-color="#13ce66"
  144. inactive-color="#ff4949"
  145. >
  146. </el-switch>
  147. </div>
  148. <el-radio-group size="mini" v-model="dateType" @change="getList" style="margin: 10px 0">
  149. <el-radio-button label="">全部</el-radio-button>
  150. <el-radio-button :label="0">今天</el-radio-button>
  151. <el-radio-button :label="1">昨天</el-radio-button>
  152. <el-radio-button :label="6">近7天</el-radio-button>
  153. <el-radio-button :label="29">近30天</el-radio-button>
  154. </el-radio-group>
  155. <div class="flex_asb">
  156. <el-radio-group size="mini" v-model="readFlag" @change="getList">
  157. <el-radio-button label="">全部</el-radio-button>
  158. <el-badge :hidden="count > 0 ? false : true" :value="count" class="item" style="margin: 0 10px">
  159. <el-radio-button label="NO">未读</el-radio-button>
  160. </el-badge>
  161. <el-badge :value="count" :hidden="true" class="item">
  162. <el-radio-button label="YES">已读</el-radio-button>
  163. </el-badge>
  164. </el-radio-group>
  165. <div style="color: #409eff; cursor: pointer" @click="confirmRead">
  166. <i class="el-icon-message-solid"></i>
  167. <span style="font-size: 14px">全部已读</span>
  168. </div>
  169. </div>
  170. </div>
  171. <el-card class="box-card" v-for="(item, index) in messageData" :key="index" style="margin-top: 10px">
  172. <div
  173. @click="
  174. isShow = false
  175. toDetail(
  176. item.adminNoticeType,
  177. item.paidType,
  178. messageType.includes('WDTZ')
  179. ? item.noticeWebsitId
  180. : item.adminNoticeType == 'NOTICE'
  181. ? item.noticeId
  182. : item.orderId,
  183. item.id,
  184. item
  185. )
  186. "
  187. >
  188. <div v-if="messageType.includes('WDTZ')">
  189. <div class="flex_asb item">
  190. <div>
  191. <span>公告类型:</span>
  192. <span>网点通知</span>
  193. </div>
  194. <div class="read1" v-if="item.readFlag == 'NO'">未读</div>
  195. <div class="read2" v-if="item.readFlag == 'YES'">已读</div>
  196. </div>
  197. <div class="item">
  198. <div>
  199. <span>文件标题:</span>
  200. <span style="color: #409eff">{{ item.title }}</span>
  201. </div>
  202. </div>
  203. <div class="item">
  204. <div>
  205. <span>发布人:</span>
  206. <span>{{ item.issueNickName || '' }}</span>
  207. </div>
  208. </div>
  209. <div class="item">
  210. <div>
  211. <span>发布时间:</span>
  212. <span>{{ item.issueTime }}</span>
  213. </div>
  214. </div>
  215. <div v-if="item.readFlag == 'YES'" class="item">
  216. <span>阅读人:</span>
  217. <span>{{ item.adminWebsitName }} </span>
  218. </div>
  219. <div v-if="item.readFlag == 'YES'" class="item">
  220. <span>阅读时间:</span>
  221. <span>{{ item.readTime }}</span>
  222. </div>
  223. </div>
  224. <div v-else-if="item.adminNoticeType == 'NOTICE'">
  225. <div class="flex_asb item">
  226. <div>
  227. <span>公告类型:</span>
  228. <span>{{ statusFilter(item.adminNoticeType) }}</span>
  229. </div>
  230. <div class="read1" v-if="item.readFlag == 'NO'">未读</div>
  231. <div class="read2" v-if="item.readFlag == 'YES'">已读</div>
  232. </div>
  233. <div class="item">
  234. <div>
  235. <span>文件标题:</span>
  236. <span style="color: #409eff">{{ item.title }}</span>
  237. </div>
  238. </div>
  239. <div class="item">
  240. <div>
  241. <span>发布人:</span>
  242. <span>{{ item.issueNickName | '' }}</span>
  243. </div>
  244. </div>
  245. <div class="item">
  246. <div>
  247. <span>发布时间:</span>
  248. <span>{{ item.issueTime }}</span>
  249. </div>
  250. </div>
  251. <div v-if="item.readFlag == 'YES'" class="item">
  252. <span>阅读人:</span>
  253. <span>{{ item.adminNickName }} {{ item.readTime }}</span>
  254. </div>
  255. </div>
  256. <div v-else>
  257. <div class="flex_asb item">
  258. <div>
  259. <span>消息类型:</span>
  260. <span>{{ statusFilter(item.adminNoticeType) }}</span>
  261. </div>
  262. <div class="read1" v-if="item.readFlag == 'NO'">未读</div>
  263. <div class="read2" v-if="item.readFlag == 'YES'">已读</div>
  264. </div>
  265. <div class="item">
  266. <div>
  267. <span>订单编号:</span>
  268. <span style="color: #409eff">{{ item.orderId }}</span>
  269. </div>
  270. </div>
  271. <div class="item">
  272. <div>
  273. <span>消息内容:</span>
  274. <span>{{ item.content }}</span>
  275. </div>
  276. </div>
  277. <div class="item">
  278. <div>
  279. <span>创建时间:</span>
  280. <span>{{ item.createTime }}</span>
  281. </div>
  282. </div>
  283. <div v-if="item.readFlag == 'YES'" class="item">
  284. <span>阅读人:</span>
  285. <span>{{ item.adminNickName }} {{ item.readTime }}</span>
  286. </div>
  287. </div>
  288. </div>
  289. </el-card>
  290. <el-empty v-if="messageData.length == 0" description="暂无数据"></el-empty>
  291. <div class="flex_ac bottom">
  292. <el-pagination
  293. @current-change="handleCurrentChange"
  294. :current-page="currentPage"
  295. :page-size="pageSize"
  296. layout="prev, pager, next"
  297. background
  298. :total="listTotal"
  299. ></el-pagination>
  300. </div>
  301. </div>
  302. </el-drawer>
  303. </div>
  304. </template>
  305. <script>
  306. import { mapGetters } from 'vuex'
  307. import Hamburger from '@/components/Hamburger'
  308. import Shortcut from '@/components/Shortcut'
  309. import Screenfull from '@/components/Screenfull'
  310. import NavMenu from '@/components/NavMenu'
  311. import vScrollView from 'v-scroll-view'
  312. import NoticeBar from '@/components/NoticeBar'
  313. import { pages } from '@/settings'
  314. import request from '@/utils/request'
  315. import { bigDataJsmLogin } from '@/api/bigView.js'
  316. function getc(obj) {
  317. if (!obj.children || !obj.children.length) {
  318. return obj
  319. } else {
  320. return getc(obj.children[0])
  321. }
  322. }
  323. export default {
  324. components: {
  325. NoticeBar,
  326. Hamburger,
  327. Screenfull,
  328. NavMenu,
  329. Shortcut,
  330. vScrollView
  331. },
  332. data() {
  333. return {
  334. Vue_Translation_Of_Text_Type: window?.Vue_Translation_Of_Text_Type || 'zh',
  335. pathurl: '',
  336. visible: false,
  337. noticeCount: 0,
  338. path: `/${this.$route.path.split('/')[1] || ''}`,
  339. isShow: false,
  340. isOpen: true,
  341. checked: false,
  342. messageType: ['WBI', 'WBK', 'CRE_ORDER', 'SEND_MALL', 'RP_MALL', 'CR_SALES', 'ENGIN_PAY_ORDER', 'CR_ES_SALES'],
  343. messageData: [],
  344. dateType: '',
  345. readFlag: '',
  346. timer: null,
  347. listTotal: 0,
  348. currentPage: 1, // 当前页码
  349. pageSize: 10, // 每页数量
  350. count: 0,
  351. isDot1: false,
  352. isDot2: false,
  353. isDot3: false,
  354. shenfentype: JSON.parse(localStorage.getItem('greemall_user')).type
  355. }
  356. },
  357. computed: {
  358. routes() {
  359. return global.antRouter.filter(item => item.meta)
  360. },
  361. bigViewsBool() {
  362. return !!global.antRouter.find(item => item.code == 'bigViews')
  363. },
  364. bigViews2Bool() {
  365. return !!global.antRouter.find(item => item.code == 'bigViews2')
  366. },
  367. noticeVisible() {
  368. return this.noticeCount > 0
  369. },
  370. ...mapGetters(['sidebar', 'avatar', 'device', 'name', 'isNotice', 'userid']),
  371. filterTime() {
  372. if (this.dateType === '') {
  373. return ['', '']
  374. } else {
  375. var date = new Date()
  376. var base = Date.parse(date) // 转换为时间戳
  377. var year = date.getFullYear() //获取当前年份
  378. var mon = date.getMonth() + 1 //获取当前月份
  379. var day = date.getDate() //获取当前日
  380. var oneDay = 24 * 3600 * 1000
  381. var daytimeArr = []
  382. var now = new Date(base - oneDay * this.dateType)
  383. var myear = now.getFullYear()
  384. var month = now.getMonth() + 1
  385. var mday = now.getDate()
  386. if (this.dateType == 1) {
  387. return [
  388. `${myear}-${month > 9 ? month : '0' + month}-${mday > 9 ? mday : '0' + mday} 00:00:00`,
  389. `${myear}-${month > 9 ? month : '0' + month}-${mday > 9 ? mday : '0' + mday} 23:59:59`
  390. ]
  391. } else {
  392. return [
  393. `${myear}-${month > 9 ? month : '0' + month}-${mday > 9 ? mday : '0' + mday} 00:00:00`,
  394. `${year}-${mon > 9 ? mon : '0' + mon}-${day > 9 ? day : '0' + day} 23:59:59`
  395. ]
  396. }
  397. }
  398. },
  399. statusFilter() {
  400. return function (val) {
  401. const MAP = {
  402. NOTICE: '平台公告',
  403. WBI: '维保消息费用申请',
  404. WBK: '维保费用申请审批',
  405. CRE_ORDER: '创建工单',
  406. SEND_MALL: '商城订单发货',
  407. RP_MALL: '商城订单维权',
  408. CR_SALES: '订单支付成功',
  409. ENGIN_PAY_ORDER: '工程收款单',
  410. CR_ES_SALES: '二手商品订单'
  411. }
  412. return MAP[val]
  413. }
  414. },
  415. typeFilter() {
  416. return function (val, paidType) {
  417. const MAP = {
  418. NOTICE: 'systemMessage',
  419. WBI: 'applicationWithoutFee',
  420. WBK: 'applicationWithoutFee',
  421. CRE_ORDER: window.isWorkOrderPoolPath,
  422. SEND_MALL: 'order_detail',
  423. RP_MALL: 'order_refund_detail',
  424. CR_SALES:
  425. paidType == 'M'
  426. ? 'auxiliarySalesOrder'
  427. : paidType == 'P'
  428. ? 'attachmentSalesOrder'
  429. : paidType == 'YB'
  430. ? 'orderSettleManag'
  431. : paidType == 'MALL'
  432. ? 'order_detail'
  433. : '',
  434. ENGIN_PAY_ORDER: 'projectCollectionManagement',
  435. CR_ES_SALES: 'orderManagement'
  436. }
  437. return MAP[val]
  438. }
  439. }
  440. },
  441. watch: {
  442. $route() {
  443. this.path = `/${this.$route.path.split('/')[1] || ''}`
  444. },
  445. path(newVal) {
  446. this.$store.commit('app/SET_L1_PATH', newVal)
  447. if (
  448. !~this.$route.path
  449. .split('/')
  450. .map(str => `/${str}`)
  451. .indexOf(newVal)
  452. ) {
  453. var item = getc(this.routes.find(item => item.path === newVal))
  454. if (item) {
  455. this.$router.push(item.path)
  456. }
  457. }
  458. }
  459. },
  460. created() {
  461. console.log(global.antRouter)
  462. clearInterval(this.timer)
  463. this.getUserInfo()
  464. this.redDot()
  465. },
  466. mounted() {
  467. this.$store.commit('app/SET_L1_PATH', this.path)
  468. },
  469. methods: {
  470. tizhuanyemian(item) {
  471. if (item.type == 4) {
  472. this.$router.push({ name: item.name })
  473. } else {
  474. this.path = item.path
  475. }
  476. },
  477. goBigViews() {
  478. this.$router.push({
  479. name: 'bigViews'
  480. })
  481. },
  482. goBigViews2() {
  483. bigDataJsmLogin().then(res => {
  484. if (res.data) {
  485. window.open(`${process.env.VUE_APP_NEW_BIG_VIEW}${res.data}`, '_blank')
  486. }
  487. })
  488. },
  489. querySearchAsync(queryString, cb) {
  490. var data = pages.filter(
  491. item =>
  492. !~item.path.indexOf(':pageName?/:pageType?/:pageCode?/:pagePam?') && !!~item.meta.title.indexOf(queryString)
  493. )
  494. cb(
  495. data.map(item => ({
  496. value: item.meta.title,
  497. path: item.path
  498. }))
  499. )
  500. },
  501. handleSelect(item) {
  502. if (item.path) {
  503. this.$router.push({
  504. path: item.path
  505. })
  506. }
  507. this.pathurl = ''
  508. },
  509. async logout() {
  510. await this.$store.dispatch('user/logout')
  511. this.$store.commit('tagsView/SET_RESET_VIES')
  512. this.$router.push(`/login`)
  513. },
  514. toggleSideBar() {
  515. this.$store.dispatch('app/toggleSideBar')
  516. },
  517. getUserInfo() {
  518. request({
  519. url: `/admin/user/detail`,
  520. method: 'get',
  521. params: {
  522. adminUserId: this.userid
  523. }
  524. }).then(res => {
  525. this.isOpen = res.data.isNotice == 'YES' ? true : false
  526. if (res.data.isNotice == 'NO') {
  527. clearInterval(this.timer)
  528. } else {
  529. clearInterval(this.timer)
  530. this.getMessageTips()
  531. }
  532. })
  533. },
  534. getCount() {
  535. if (this.messageType.includes('WDTZ')) {
  536. request({
  537. url: `/noticeWebsit/list/count`,
  538. method: 'post',
  539. params: {
  540. readFlag: 'NO'
  541. }
  542. }).then(res => {
  543. this.count = res.data
  544. })
  545. } else {
  546. request({
  547. url: `/notice/list/count`,
  548. method: 'get',
  549. params: {
  550. noticeType: this.messageType.join(','),
  551. readFlag: 'NO'
  552. }
  553. }).then(res => {
  554. this.count = res.data
  555. })
  556. }
  557. },
  558. redDot() {
  559. if (this.messageType.includes('WDTZ')) {
  560. } else {
  561. request({
  562. url: `/notice/list/count`,
  563. method: 'get',
  564. params: {
  565. noticeType: ['WBI', 'WBK', 'CRE_ORDER', 'SEND_MALL', 'RP_MALL', 'CR_SALES'].join(','),
  566. readFlag: 'NO'
  567. }
  568. }).then(res => {
  569. this.isDot1 = res.data > 0 ? true : false
  570. })
  571. request({
  572. url: `/notice/list/count`,
  573. method: 'get',
  574. params: {
  575. noticeType: ['NOTICE'].join(','),
  576. readFlag: 'NO'
  577. }
  578. }).then(res => {
  579. this.isDot2 = res.data > 0 ? true : false
  580. })
  581. }
  582. },
  583. //全部已读
  584. confirmRead() {
  585. this.$confirm('是否全部设为已读, 是否继续?', '提示', {
  586. confirmButtonText: '确定',
  587. cancelButtonText: '取消',
  588. type: 'warning'
  589. })
  590. .then(() => {
  591. if (this.messageType.includes('WDTZ')) {
  592. request({
  593. url: `/noticeWebsit/mark/read/all`,
  594. method: 'post',
  595. data: {}
  596. }).then(res => {
  597. if (res.code == 200) {
  598. this.getList()
  599. this.$message.success('全部已读成功!')
  600. }
  601. })
  602. } else {
  603. request({
  604. url: `/notice/mark/read/all`,
  605. method: 'post',
  606. data: {}
  607. }).then(res => {
  608. if (res.code == 200) {
  609. this.getList()
  610. this.$message.success('全部已读成功!')
  611. }
  612. })
  613. }
  614. })
  615. .catch(() => {
  616. this.$message({
  617. type: 'info',
  618. message: '已取消'
  619. })
  620. })
  621. },
  622. getList() {
  623. if (this.messageType.includes('WDTZ')) {
  624. request({
  625. url: `/noticeWebsit/listWebsit`,
  626. method: 'post',
  627. data: {
  628. pageNum: this.currentPage,
  629. pageSize: this.pageSize,
  630. params: [
  631. { param: 'b.read_flag', compare: '=', value: this.readFlag },
  632. { param: 'a.issue_time', compare: '>=', value: this.filterTime[0] },
  633. { param: 'a.issue_time', compare: '<=', value: this.filterTime[1] }
  634. ]
  635. }
  636. }).then(res => {
  637. this.getCount()
  638. this.redDot()
  639. this.listTotal = res.data.total
  640. this.messageData = res.data.records
  641. })
  642. } else {
  643. request({
  644. url: `/notice/list`,
  645. method: 'post',
  646. data: {
  647. pageNum: this.currentPage,
  648. pageSize: this.pageSize,
  649. params: [
  650. { param: 'nr.read_flag', compare: '=', value: this.readFlag },
  651. { param: 'nr.admin_notice_type', compare: '=', value: this.messageType },
  652. { param: 'nr.issue_time', compare: '>=', value: this.filterTime[0] },
  653. { param: 'nr.issue_time', compare: '<=', value: this.filterTime[1] }
  654. ]
  655. }
  656. }).then(res => {
  657. this.getCount()
  658. this.redDot()
  659. this.listTotal = res.data.total
  660. this.messageData = res.data.records
  661. })
  662. }
  663. },
  664. // 更改当前页
  665. handleCurrentChange(val) {
  666. this.currentPage = val
  667. this.getList()
  668. },
  669. toDetail(type, paidType, orderId, id, item) {
  670. if (this.messageType.includes('WDTZ') || paidType == 'WDTZ') {
  671. if (item.readFlag == 'NO') {
  672. request({
  673. url: `/noticeWebsit/mark/readOne`,
  674. method: 'post',
  675. params: {
  676. id: id
  677. }
  678. }).then(res => {})
  679. }
  680. this.$router.push({
  681. name: 'networkNotification',
  682. params: {
  683. pageName: orderId,
  684. pageType: 'detail',
  685. pageCode: orderId
  686. }
  687. })
  688. } else {
  689. this.read(id)
  690. this.$router.push({
  691. name: this.typeFilter(type, paidType),
  692. params: {
  693. pageName: orderId,
  694. pageType: 'detail',
  695. pageCode: orderId
  696. },
  697. query: {
  698. id: orderId,
  699. orderId: orderId
  700. }
  701. })
  702. }
  703. },
  704. //获取最新消息并弹窗
  705. getMessageTips() {
  706. const that = this
  707. this.timer = setInterval(() => {
  708. request({
  709. url: `/notice/list/out`,
  710. method: 'get',
  711. params: {
  712. num: 30
  713. }
  714. }).then(res => {
  715. res.data.forEach(item => {
  716. if (item.adminNoticeType == 'WDTZ') {
  717. this.$notify({
  718. title: '新消息',
  719. position: 'bottom-right',
  720. duration: 30000,
  721. message: that.$createElement(
  722. 'div',
  723. {
  724. style: 'cursor: pointer;text-align: left;',
  725. on: {
  726. click: () => {
  727. this.$router.push({
  728. name: 'networkNotification',
  729. params: {
  730. pageName: item.id,
  731. pageType: 'detail',
  732. pageCode: item.id
  733. }
  734. })
  735. }
  736. }
  737. },
  738. [
  739. that.$createElement(
  740. 'span',
  741. null,
  742. { GL: '管理', JS: '技术', QT: '其他', ZC: '政策', ZX: '资讯' }[item.type] + ':'
  743. ),
  744. that.$createElement(
  745. 'span',
  746. {
  747. style: 'color: #409EFF;'
  748. },
  749. ` ` + item.title
  750. )
  751. ]
  752. )
  753. })
  754. } else {
  755. this.$notify({
  756. title: '新消息',
  757. position: 'bottom-right',
  758. duration: 30000,
  759. message: that.$createElement(
  760. 'div',
  761. {
  762. style: 'cursor: pointer;text-align: left;',
  763. on: {
  764. click: that.toDetail.bind(
  765. that,
  766. item.adminNoticeType,
  767. item.paidType,
  768. item.adminNoticeType == 'NOTICE' ? item.noticeId : item.orderId,
  769. item.id
  770. )
  771. }
  772. },
  773. [
  774. that.$createElement('span', null, that.statusFilter(item.adminNoticeType) + ' '),
  775. that.$createElement(
  776. 'span',
  777. {
  778. style: 'color: #409EFF;'
  779. },
  780. ' ' + item.adminNoticeType == 'NOTICE' ? item.title : item.orderId
  781. ),
  782. that.$createElement('span', null, item.adminNoticeType == 'NOTICE' ? '' : item.content)
  783. ]
  784. )
  785. })
  786. }
  787. })
  788. })
  789. }, 30000)
  790. },
  791. //点击不再弹窗新消息
  792. updateIsNotice(e) {
  793. request({
  794. url: `/notice/updateIsNotice`,
  795. method: 'post',
  796. params: {
  797. isNotice: e ? 'YES' : 'NO'
  798. }
  799. }).then(res => {
  800. if (res.code == 200) {
  801. this.getUserInfo()
  802. this.$message.success(e ? '已开启弹窗消息提醒' : '已关闭弹窗消息提醒')
  803. if (!e) {
  804. clearInterval(this.timer)
  805. }
  806. }
  807. })
  808. },
  809. read(id) {
  810. if (this.messageType.includes('WDTZ')) {
  811. request({
  812. url: `/noticeWebsit/mark/readOne`,
  813. method: 'post',
  814. params: {
  815. id: id
  816. }
  817. }).then(res => {})
  818. } else {
  819. request({
  820. url: `/notice/mark/read`,
  821. method: 'post',
  822. params: {
  823. noticeIds: id
  824. }
  825. }).then(res => {})
  826. }
  827. }
  828. }
  829. }
  830. </script>
  831. <style lang="scss" scoped>
  832. @import '~@/styles/variables.scss';
  833. // ::v-deep .el-drawer__container{
  834. // top: 50px;
  835. // }
  836. ::v-deep .is-fixed {
  837. right: 10px !important;
  838. }
  839. ::v-deep .slidingBgClassName {
  840. background: rgba(0, 0, 0, 0.01) !important;
  841. }
  842. ::v-deep .slidingBlockClassName {
  843. background: rgba(0, 0, 0, 0.05) !important;
  844. }
  845. .flex_asb {
  846. display: flex;
  847. justify-content: space-between;
  848. align-items: center;
  849. }
  850. .flex_ac {
  851. display: flex;
  852. justify-content: center;
  853. }
  854. .message {
  855. padding: 20px;
  856. position: relative;
  857. min-height: 100%;
  858. padding-bottom: 60px;
  859. padding-top: 150px;
  860. box-sizing: border-box;
  861. .head {
  862. width: 405px;
  863. position: fixed;
  864. top: 0;
  865. right: 0;
  866. background: #ffffff;
  867. padding: 20px;
  868. }
  869. .bottom {
  870. width: 405px;
  871. position: fixed;
  872. bottom: 0;
  873. right: 0;
  874. background: #ffffff;
  875. padding: 10px 0;
  876. }
  877. }
  878. .box-card {
  879. .item {
  880. cursor: pointer;
  881. margin-bottom: 6px;
  882. }
  883. .read1 {
  884. color: #f5680e;
  885. background: #fff2da;
  886. padding: 2px 4px;
  887. border-radius: 4px;
  888. font-size: 14px;
  889. }
  890. .read2 {
  891. color: #42b983;
  892. background: #d7fdde;
  893. padding: 2px 4px;
  894. border-radius: 4px;
  895. font-size: 14px;
  896. }
  897. }
  898. .navbar {
  899. width: 100%;
  900. height: 50px;
  901. overflow: hidden;
  902. background: #{$navbarBg};
  903. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  904. display: flex;
  905. flex-direction: row;
  906. align-items: center;
  907. .hamburger-container {
  908. line-height: 46px;
  909. height: 100%;
  910. color: #{$navbarText};
  911. cursor: pointer;
  912. transition: background 0.3s;
  913. -webkit-tap-highlight-color: transparent;
  914. border-right: 1px solid #eaeaea;
  915. &:hover {
  916. background: rgba(0, 0, 0, 0.025);
  917. }
  918. }
  919. .menu_module {
  920. height: 100%;
  921. flex: 1;
  922. position: relative;
  923. .menu_module_view {
  924. position: absolute;
  925. top: 0;
  926. left: 0;
  927. bottom: 0;
  928. right: 0;
  929. .menu_module_fj {
  930. height: 100%;
  931. width: fit-content;
  932. white-space: nowrap;
  933. box-sizing: border-box;
  934. padding: 0 10px;
  935. .item {
  936. display: inline-block;
  937. height: 100%;
  938. line-height: 50px;
  939. box-sizing: border-box;
  940. padding: 0 10px;
  941. cursor: pointer;
  942. font-size: 14px;
  943. }
  944. .select {
  945. border-bottom: 1px solid #000;
  946. }
  947. }
  948. }
  949. }
  950. .flex {
  951. display: flex;
  952. align-items: center;
  953. }
  954. .ellipsis {
  955. display: inline-block;
  956. width: (16px * 6);
  957. white-space: nowrap;
  958. overflow: hidden;
  959. text-overflow: ellipsis;
  960. }
  961. .right-menu {
  962. height: 100%;
  963. line-height: 50px;
  964. & > div {
  965. float: left;
  966. }
  967. &:focus {
  968. outline: none;
  969. }
  970. .user-container {
  971. height: 50px;
  972. .user {
  973. i {
  974. font-size: 18px;
  975. margin-right: 5px;
  976. }
  977. span {
  978. font-size: 16px;
  979. }
  980. }
  981. }
  982. .right-menu-item {
  983. display: inline-block;
  984. padding: 0 15px;
  985. height: 100%;
  986. font-size: 18px;
  987. color: #{$navbarText};
  988. vertical-align: text-bottom;
  989. border-left: 1px solid #eaeaea;
  990. &.hover-effect {
  991. cursor: pointer;
  992. transition: background 0.3s;
  993. &:hover {
  994. background: rgba(0, 0, 0, 0.025);
  995. }
  996. }
  997. .notice-icon {
  998. padding-top: 0;
  999. padding-bottom: 0;
  1000. }
  1001. .right-menu-item {
  1002. .notice-icon > i {
  1003. font-size: 18px;
  1004. }
  1005. sup {
  1006. top: 12px;
  1007. right: 25px;
  1008. }
  1009. }
  1010. }
  1011. }
  1012. }
  1013. ::v-deep .el-badge__content.is-fixed {
  1014. z-index: 99;
  1015. }
  1016. </style>