123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <view>
- <cu-custom ref="Dustom" id="custom"
- bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png">
- <block slot="content">
- 消息列表
- </block>
- </cu-custom>
- <u-tabs :list="list1" :current="current" :activeStyle="{ fontWeight: 'bold' }" @change="tabChange" />
- <view />
- <My_listbox ref="List" @getlist="getlist" :empty='empty'>
- <List :list="list" @onReadMsg="onReadMsg" />
- <view class="cu-bar tabbar" style="margin-top: 10px;" />
- </My_listbox>
- </view>
- </template>
- <script>
- let login = false;
- import List from "../../message/list.vue"
- export default {
- name: 'Message',
- components: { List },
- data() {
- return {
- uninitialized: true,
- empty: true,
- list1: [{
- name: '应用消息'
- }, {
- name: '系统消息'
- }],
- current: 1,
- list: [],
- "content": {
- "nocache": true,
- "pageNumber": 1,
- "pageTotal": 1,
- "pageSize": 20,
- "type": "应用",
- "where": {}
- }
- };
- },
- methods: {
- init(forcedUpdating = true) {
- this.uninitialized = false;
- this.getlist(true)
- setTimeout(() => {
- this.current = 0
- }, 100)
- },
- tabChange(e) {
- let type = e.index == 0 ? '应用' : '系统';
- if (this.content.type == type) return;
- this.content.type = type;
- this.current = e.index;
- this.getlist(true)
- },
- getlist(init) {
- if (login) return;
- login = true;
- let content = this.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- this.$Http.basic({
- "classname": "system.message.Message",
- "method": "queryMessage",
- content
- }).then(res => {
- console.log("消息列表", res)
- login = false;
- this.$refs.List.RefreshToComplete();
- res.pageNumber == 1 ? this.$refs.List.setHeight() : "";
- if (this.cutoff(res.msg)) return;
- this.empty = res.data.length == 0;
- this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- this.content = content;
- })
- },
- onReadMsg({ messageid }) {
- this.list[this.list.findIndex(v => v.messageid == messageid)].isread = 1;
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- /deep/.u-tabs {
- height: 44px;
- .u-tabs__wrapper__nav {
- height: 44px;
- .u-tabs__wrapper__nav__item {
- height: 44px !important;
- .u-tabs__wrapper__nav__item__text {
- color: #fff !important;
- }
- }
- }
- }
- </style>
|