1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <template>
- <view class="uni-app">
- <view class="status-bar" />
- <view class="main-container">
- <!-- #ifdef MP-WEIXIN -->
- <wk-nav-bar
- :command-list="commandList"
- title="消息"
- @command="handleCommand" />
- <!-- #endif -->
- <!-- #ifndef MP-WEIXIN -->
- <wk-nav-bar title="消息">
- <!-- <text
- class="read-all"
- @click="handleReadAll">
- 全部已读
- </text> -->
- </wk-nav-bar>
- <!-- #endif -->
-
- <view class="list-view">
- <message-list v-if="showList" />
- </view>
- </view>
- </view>
- </template>
- <script>
- import { ReadAllMessage } from '@/api/admin.js'
-
- import MessageList from './messageList.vue'
-
- export default {
- name: 'MessageIndex',
- components: {
- MessageList
- },
- data() {
- return {
- showList: false,
-
- commandList: [
- {
- label: '全部已读',
- imgIcon: 'dealStatus',
- value: 'readAll'
- }
- ]
- }
- },
- onShow() {
- this.showList = false
- this.$nextTick(() => {
- this.showList = true
- })
- },
- methods: {
- handleCommand(command) {
- console.log('command: ', command)
- if (command.value === 'readAll') {
- this.handleReadAll()
- }
- },
-
- handleReadAll() {
- ReadAllMessage().then(res => {
- this.$toast('操作成功')
-
- this.showList = false
- this.$nextTick(() => {
- this.showList = true
- })
- }).catch(() => {})
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .list-view {
- flex: 1;
- overflow-y: hidden;
- }
-
- .read-all {
- font-size: $wk-font-base;
- margin-right: 20rpx;
- }
- </style>
|