shish пре 3 година
родитељ
комит
3d00624c1f
3 измењених фајлова са 185 додато и 0 уклоњено
  1. 170 0
      ghsApp/src/admin/notice/index.vue
  2. 9 0
      ghsApp/src/api/notice/index.js
  3. 6 0
      ghsApp/src/pages.json

+ 170 - 0
ghsApp/src/admin/notice/index.vue

@@ -0,0 +1,170 @@
+<template>
+    <view class="app-content">
+        <view class="allot-ex-page">
+            <view class="tabs">
+                <Tabs :tabs="tabs" :currentTab="tabIndex" @change="changeTabEvent" itemWidth="33%"></Tabs>
+            </view>
+            <scroll-view scroll-y class="allot-list">
+                <block v-if="!$util.isEmpty(list.data)">
+                    <view class="allot-item" v-for="(item, index) in list.data" :key="index" @click="goTo(item)" >
+                        <view class="info">
+                            <view class="info-order-un-read" v-if="item.read == 0">{{ item.title }}</view>
+                            <view class="info-order" v-else>{{ item.title }}</view>
+                            <view class="info-name">{{ item.content }}</view>
+                        </view>
+                    </view>
+                </block>
+                <block v-else>
+                    <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+                </block>
+            </scroll-view>
+        </view>
+    </view>
+</template>
+<script>
+import Tabs from "@/components/plugin/tabs";
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { list } from "@/mixins";
+import { getNotifyList,readNotify } from "@/api/notice";
+export default {
+    name: "index",
+    components: { Tabs, AppWrapperEmpty },
+    mixins: [list],
+    data() {
+        return {
+            tabIndex: 0,
+            tabs: [
+                {
+                    name: "全部",
+                    key: "",
+                    value: 0
+                },
+                {
+                    name: "未读",
+                    key: 0,
+                    value: 0
+                },
+                {
+                    name: "已读",
+                    key: 1,
+                    value: 0
+                }
+            ]
+        };
+    },
+    onPullDownRefresh() {
+        this.resetList()
+        this.getNoticeList().then(res => {
+            uni.stopPullDownRefresh()
+        });
+    },
+    onReachBottom() {
+        if (!this.list.finished) {
+            this.getNoticeList().then((res) => {
+                uni.stopPullDownRefresh()
+            });
+        } else {
+            uni.stopPullDownRefresh()
+        }
+    },
+    methods: {
+        init() {
+            this.getNoticeList();
+        },
+        getNoticeList() {
+            return getNotifyList({read:this.tabs[this.tabIndex].key,page: this.list.page}).then(res => {
+                    this.completes(res);
+            })
+        },
+        changeTabEvent(info) {
+            const { index } = info;
+            if (this.tabIndex == index) {
+                return false;
+            } else {
+                this.tabIndex = index;
+                this.resetList();
+                this.getNoticeList();
+            }
+        },
+        goTo(item) {
+            item.read = 1
+            readNotify({id:item.id})
+            if (item.page && !this.$util.isEmpty(item.page)){
+                this.$util.pageTo({url: item.page})
+            }
+        }
+    }
+};
+</script>
+<style lang="scss" scoped>
+.allot-ex-page {
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+    background-color: #f9fbfc;
+    .allot-list {
+        margin-top: 20upx;
+        flex: 1;
+        padding-bottom: 30upx;
+        .allot-item {
+            margin-bottom: 1upx;
+            padding: 30upx;
+            display: flex;
+            align-items: center;
+
+            box-shadow: 0upx 1upx 0upx 0upx #eeeeee;
+            background-color: #fff;
+            .info {
+                flex: 1;
+                margin-right: 20upx;
+                .info-order {
+                    font-size: 32upx;
+                    font-weight: 600;
+                    color: #666666;
+                }
+                .info-order-un-read {
+                    font-size: 32upx;
+                    font-weight: 600;
+                    color: #3385FF;
+                }
+                .info-name {
+                    margin: 20upx 0 20upx;
+                    font-size: 28upx;
+                    font-weight: 400;
+                    color: #666666;
+                }
+                .info-time {
+                    margin-right: 30upx;
+                    font-size: 28upx;
+                    font-weight: 400;
+                    color: #666666;
+                }
+            }
+            .status {
+                display: flex;
+                flex-direction: column;
+                align-items: center;
+                flex-shrink: 0;
+                width: 100upx;
+                color: #cccccc;
+                .status-name {
+                    margin-top: 10upx;
+                    font-size: 24upx;
+                }
+                .iconfont {
+                    font-size: 46upx;
+                }
+                &.primary {
+                    color: #3385ff;
+                }
+                &.gray {
+                    color: #cccccc;
+                }
+                &.warn {
+                    color: #ffaf1d;
+                }
+            }
+        }
+    }
+}
+</style>   

+ 9 - 0
ghsApp/src/api/notice/index.js

@@ -0,0 +1,9 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+export const getNotifyList = data => {
+	return https.get('/notify/list', data)
+}
+
+export const readNotify = data => {
+	return https.get('/notify/read', data)
+}

+ 6 - 0
ghsApp/src/pages.json

@@ -26,6 +26,12 @@
 				{"path": "blue","style": {"navigationBarTitleText": "标签机管理"}}
 			]
 		},
+		{
+			"root": "admin/notice",
+			"pages": [
+				{"path": "index","style": {"navigationBarTitleText": "通知"}}
+			]
+		},
 		{
 			"root": "admin/ptItem",
 			"pages": [