智慧保安互联网APP
shuishen
2021-07-31 da9c872e36667467aed056c5a3e51d704cabd1b7
页面逻辑完善
6 files modified
438 ■■■■ changed files
pages/company/company.vue 100 ●●●● patch | view | raw | blame | history
pages/report/initiate.vue 2 ●●● patch | view | raw | blame | history
pages/report/receive.vue 168 ●●●● patch | view | raw | blame | history
pages/report/send.vue 165 ●●●● patch | view | raw | blame | history
store/actions.js 1 ●●●● patch | view | raw | blame | history
utils/func.js 2 ●●● patch | view | raw | blame | history
pages/company/company.vue
@@ -1,8 +1,9 @@
<template>
    <view class="container">
        <u-search v-model='keyValue' placeholder='请输入公司名称' shape="round" class="u-search" input-align="center" height="70"
            @search='searchValue' @custom='searchValue' @clear='clearValue' @change='changeValue'></u-search>
        <u-search v-model='keyValue' placeholder='请输入公司名称' shape="round" class="u-search" input-align="center"
            height="70" @search='searchValue' @custom='searchValue' @clear='clearValue' @change='changeValue'>
        </u-search>
        <view v-if="newsList.length > 0">
            <view class="inTmain" v-for="(item,index) in newsList">
@@ -39,6 +40,7 @@
                status: 'loadmore',
                keyValue: '',
                pagelist: 0,
                flag: true
            };
        },
        onLoad() {
@@ -46,33 +48,38 @@
        },
        onReachBottom() {
            var that = this;
            if (that.dataList.length - 1 == that.pagelist) {
            if (that.dataList.length - 1 == that.pagelist && this.status != 'nomore' && that.flag == true) {
                that.newsList.push(that.dataList[that.pagelist]);
                this.status = 'nomore';
                that.flag = false;
                return;
            }
            // 后续将改为与后端联动
            this.status = 'loading';
            setTimeout(() => {
                for (var i = 0; i < 5; i++) {
                    if (that.pagelist <= that.dataList.length - 1) {
                        that.newsList.push(that.dataList[that.pagelist])
                        if (that.pagelist <= that.dataList.length - 2) {
                            that.pagelist += 1
                            if (that.dataList.length - 1 == that.pagelist) {
                                that.newsList.push(that.dataList[that.pagelist])
                            }
                        }
                    }
            } else {
                if (that.flag == false) {
                    this.status = 'nomore';
                    return
                }
            }, 2000);
                // 后续将改为与后端联动
                this.status = 'loading';
                setTimeout(() => {
                    var flag = true;
                    for (var i = 0; i < 5; i++) {
                        if (that.pagelist <= that.dataList.length - 2 && flag == true) {
                            that.newsList.push(that.dataList[that.pagelist++])
                            if (that.dataList.length - 1 == that.pagelist) flag == false
                        }
                    }
                }, 2000);
            }
        },
        mounted() {
            this.getCompany();
@@ -90,27 +97,25 @@
                        var resdata = res.data.data.records;
                        that.dataList = resdata;
                        var flag = true;
                        for (var i = 0; i < 5; i++) {
                            if (that.pagelist <= that.dataList.length - 1) {
                            if (that.pagelist <= that.dataList.length - 2) {
                                that.newsList.push(that.dataList[that.pagelist])
                                that.newsList.push(that.dataList[that.pagelist++]);
                                if (that.pagelist <= that.dataList.length - 2) {
                                    that.pagelist += 1
                            } else {
                                    if (that.dataList.length - 1 == that.pagelist) {
                                        that.newsList.push(that.dataList[that.pagelist])
                                    }
                                if (that.dataList.length - 1 == that.pagelist && flag == true) {
                                } else {
                                    that.status = 'nomore';
                                    that.newsList.push(that.dataList[that.pagelist]);
                                    flag = false;
                                    that.flag = false;
                                }
                            }
                        }
                    }
@@ -142,12 +147,9 @@
                for (var i = 0; i < this.pagelist; i++) {
                    this.newsList.push(this.dataList[i])
                }
                if (this.dataList.length - 1 == this.pagelist) {
                    this.newsList.push(this.dataList[this.pagelist])
                    this.status = 'nomore';
                } else if (this.pagelist < this.dataList.length - 1) {
                    this.status = 'loadmore';
                if (this.flag == false) {
                    this.newsList.push(this.dataList[this.pagelist]);
                }
            },
            changeValue(value) {
@@ -156,15 +158,12 @@
                    for (var i = 0; i < this.pagelist; i++) {
                        this.newsList.push(this.dataList[i])
                    }
                    if (this.dataList.length - 1 == this.pagelist) {
                        this.newsList.push(this.dataList[this.pagelist])
                        this.status = 'nomore';
                    } else if (this.pagelist < this.dataList.length - 1) {
                        this.status = 'loadmore';
                    if (this.flag == false) {
                        this.newsList.push(this.dataList[this.pagelist]);
                    }
                }
            }
        }
    };
</script>
@@ -202,3 +201,4 @@
        color: #999;
    }
</style>
pages/report/initiate.vue
@@ -73,7 +73,7 @@
                        label: '周报'
                    },
                    {
                        value: '2',
                        value: '3',
                        label: '月报'
                    }
                ],
pages/report/receive.vue
@@ -1,22 +1,31 @@
<template>
    <view class="container">
        <u-search v-model="keyword" shape="round" class="u-search" input-align="center" height="70" :show-action="false"></u-search>
        <view class="inTmain" v-for="(item,index) in dataList">
            <u-card :title="item.deptName" @click="goDetail(item)">
                    <view class="" slot="body">
                        <view>
                            <view style="margin-bottom: 10px;" class="u-body-item-title u-line-1">汇报人:{{item.realName}}</view>
        <u-search v-model='keyValue' placeholder='请输入公司名称' shape="round" class="u-search" input-align="center"
            height="70" @search='searchValue' @custom='searchValue' @clear='clearValue' @change='changeValue'>
        </u-search>
        <view v-if="newsList.length > 0">
            <view class="inTmain" v-for="(item,index) in newsList">
                <u-card :title="item.deptName" @click="goDetail(item)">
                        <view class="" slot="body">
                            <view>
                                <view style="margin-bottom: 10px;" class="u-body-item-title u-line-1">汇报人:{{item.realName}}</view>
                            </view>
                            <view>
                                <view class="u-body-item-title u-line-1">汇报类型:{{item.type == 1 ? '日报' : item.type == 2 ? '周报' : '月报' }}</view>
                            </view>
                        </view>
                        <view>
                            <view class="u-body-item-title u-line-1">汇报类型:{{item.type == 1 ? '日报' : item.type == 2 ? '周报' : '月报' }}</view>
                        </view>
                    </view>
                    <view class="" slot="foot"></u-icon>汇报时间:{{item.reportTime}}</view>
            </u-card>
                        <view class="" slot="foot"></u-icon>汇报时间:{{item.reportTime}}</view>
                </u-card>
            </view>
            <u-loadmore class='msg' :status="status" />
        </view>
        <view class="msg" v-show="dataList.length == 0">
        <view class="msg" v-else>
            暂无数据
        </view>
    </view>
</template>
@@ -24,31 +33,89 @@
    export default {
        data() {
            return {
                dataList:[],
                keyword: ""
                dataList: [],
                newsList: [],
                status: 'loadmore',
                keyValue: '',
                pagelist: 0,
                flag: true
            };
        },
        onLoad() {
        },
        onReachBottom() {
            var that = this;
            if (that.dataList.length - 1 == that.pagelist && this.status != 'nomore' && that.flag == true) {
                that.newsList.push(that.dataList[that.pagelist]);
                this.status = 'nomore';
                that.flag = false;
                return;
            } else {
                if (that.flag == false) {
                    this.status = 'nomore';
                    return
                }
                // 后续将改为与后端联动
                this.status = 'loading';
                setTimeout(() => {
                    var flag = true;
                    for (var i = 0; i < 5; i++) {
                        if (that.pagelist <= that.dataList.length - 2 && flag == true) {
                            that.newsList.push(that.dataList[that.pagelist++])
                            if (that.dataList.length - 1 == that.pagelist) flag == false
                        }
                    }
                }, 2000);
            }
            
        },
        mounted() {
            this.getCompany();
        },
        methods: {
            getCompany(){
            getCompany() {
                var that = this;
                uni.request({
                    url: this.$store.state.piAPI + "/workReport/pageReply?deptId=" + this.$store.state.UserData.dept_id + '&userId=' + this.$store.state.puserID,
                    method:"get",
                    data:{
                    data: {
                    },
                    success:(res)=> {
                    success: (res) => {
                        var resdata = res.data.data.records;
                        that.dataList = resdata;
                        var flag = true;
                        for (var i = 0; i < 5; i++) {
                            if (that.pagelist <= that.dataList.length - 2) {
                                that.newsList.push(that.dataList[that.pagelist++]);
                            } else {
                                if (that.dataList.length - 1 == that.pagelist && flag == true) {
                                    that.newsList.push(that.dataList[that.pagelist]);
                                    flag = false;
                                    that.flag = false;
                                }
                            }
                        }
                    }
                });
            },
@@ -56,24 +123,61 @@
                uni.navigateTo({
                    url: './receiveDetail?detailData=' + JSON.stringify(item)
                });
            },
            searchValue(value) {
                var that = this;
                var str = value.replace(/\s*/g, "");
                if (str == '') {
                    return
                } else {
                    that.newsList = [];
                    that.dataList.forEach(item => {
                        if (item.deptName.indexOf(str) != -1) {
                            that.newsList.push(item)
                        }
                    })
                    that.status = 'nomore';
                }
            },
            clearValue() {
                this.keyValue = ''
                this.newsList = [];
                for (var i = 0; i < this.pagelist; i++) {
                    this.newsList.push(this.dataList[i])
                }
                if (this.flag == false) {
                    this.newsList.push(this.dataList[this.pagelist]);
                }
            },
            changeValue(value) {
                if (value == '') {
                    this.newsList = [];
                    for (var i = 0; i < this.pagelist; i++) {
                        this.newsList.push(this.dataList[i])
                    }
                    if (this.flag == false) {
                        this.newsList.push(this.dataList[this.pagelist]);
                    }
                }
            }
        }
    };
</script>
<style lang="scss">
    .u-card-wrap {
            background-color: $u-bg-color;
            padding: 1px;
        }
    .u-card-wrap {
        background-color: $u-bg-color;
        padding: 1px;
    }
    .u-body-item {
        font-size: 32rpx;
        color: #333;
        padding: 20rpx 10rpx;
    }
    .u-body-item image {
        width: 120rpx;
        flex: 0 0 120rpx;
@@ -81,15 +185,13 @@
        border-radius: 8rpx;
        margin-left: 12rpx;
    }
    .u-search {
        padding: 20rpx 30rpx 0 30rpx;
    }
    .inTmain{
    }
    .inTmain {}
    .msg {
        height: 72rpx;
        line-height: 72rpx;
pages/report/send.vue
@@ -1,23 +1,34 @@
<template>
    <view class="container">
        <u-search v-model="keyword" shape="round" class="u-search" input-align="center" height="70" :show-action="false"></u-search>
        <view v-for="(item,index) in dataList">
            <u-card :title="item.deptName" @click="goDetail(item)">
        <u-search v-model='keyValue' placeholder='请输入公司名称' shape="round" class="u-search" input-align="center"
            height="70" @search='searchValue' @custom='searchValue' @clear='clearValue' @change='changeValue'>
        </u-search>
        <view v-if="newsList.length > 0">
            <view class="inTmain" v-for="(item,index) in newsList">
                <u-card :title="item.deptName" @click="goDetail(item)">
                    <view class="" slot="body">
                        <view>
                            <view style="margin-bottom: 10px;" class="u-body-item-title u-line-1">汇报人:{{item.realName}}</view>
                            <view style="margin-bottom: 10px;" class="u-body-item-title u-line-1">汇报人:{{item.realName}}
                            </view>
                        </view>
                        <view>
                            <view class="u-body-item-title u-line-1">汇报类型:{{item.type == 1 ? '日报' : item.type == 2 ? '周报' : '月报' }}</view>
                            <view class="u-body-item-title u-line-1">
                                汇报类型:{{item.type == 1 ? '日报' : item.type == 2 ? '周报' : '月报' }}</view>
                        </view>
                    </view>
                    <view class="" slot="foot"></u-icon>汇报时间:{{item.reportTime}}</view>
            </u-card>
                    <view class="" slot="foot">
                        </u-icon>汇报时间:{{item.reportTime}}</view>
                </u-card>
            </view>
            <u-loadmore class='msg' :status="status" />
        </view>
        <view class="msg" v-show="dataList.length == 0">
        <view class="msg" v-else>
            暂无数据
        </view>
    </view>
</template>
@@ -25,56 +36,152 @@
    export default {
        data() {
            return {
                dataList:[],
                keyword: ""
                dataList: [],
                newsList: [],
                status: 'loadmore',
                keyValue: '',
                pagelist: 0,
                flag: true
            };
        },
        onLoad() {
        },
        onReachBottom() {
            var that = this;
            if (that.dataList.length - 1 == that.pagelist && this.status != 'nomore' && that.flag == true) {
                that.newsList.push(that.dataList[that.pagelist]);
                this.status = 'nomore';
                that.flag = false;
                return;
            } else {
                if (that.flag == false) {
                    this.status = 'nomore';
                    return
                }
                // 后续将改为与后端联动
                this.status = 'loading';
                setTimeout(() => {
                    var flag = true;
                    for (var i = 0; i < 5; i++) {
                        if (that.pagelist <= that.dataList.length - 2 && flag == true) {
                            that.newsList.push(that.dataList[that.pagelist++])
                            if (that.dataList.length - 1 == that.pagelist) flag == false
                        }
                    }
                }, 2000);
            }
            
        },
        mounted() {
            this.getCompany();
        },
        methods: {
            getCompany(){
            getCompany() {
                var that = this;
                uni.request({
                    url: this.$store.state.piAPI + "/workReport/page?deptId=" + this.$store.state.UserData.dept_id + '&userId=' + this.$store.state.puserID,
                    method:"get",
                    data:{
                    url: this.$store.state.piAPI + "/workReport/page?deptId=" + this.$store.state.UserData
                        .dept_id + '&userId=' + this.$store.state.puserID,
                    method: "get",
                    data: {
                    },
                    success:(res)=> {
                    success: (res) => {
                        var resdata = res.data.data.records;
                        that.dataList = resdata;
                        var flag = true;
                        for (var i = 0; i < 5; i++) {
                            if (that.pagelist <= that.dataList.length - 2) {
                                that.newsList.push(that.dataList[that.pagelist++]);
                            } else {
                                if (that.dataList.length - 1 == that.pagelist && flag == true) {
                                    that.newsList.push(that.dataList[that.pagelist]);
                                    flag = false;
                                    that.flag = false;
                                }
                            }
                        }
                    }
                });
            },
            goDetail(item){
            goDetail(item) {
                uni.navigateTo({
                    url: './sendDetail?detailData=' + JSON.stringify(item)
                });
            },
            searchValue(value) {
                var that = this;
                var str = value.replace(/\s*/g, "");
                if (str == '') {
                    return
                } else {
                    that.newsList = [];
                    that.dataList.forEach(item => {
                        if (item.deptName.indexOf(str) != -1) {
                            that.newsList.push(item)
                        }
                    })
                    that.status = 'nomore';
                }
            },
            clearValue() {
                this.keyValue = ''
                this.newsList = [];
                for (var i = 0; i < this.pagelist; i++) {
                    this.newsList.push(this.dataList[i])
                }
                if (this.flag == false) {
                    this.newsList.push(this.dataList[this.pagelist]);
                }
            },
            changeValue(value) {
                if (value == '') {
                    this.newsList = [];
                    for (var i = 0; i < this.pagelist; i++) {
                        this.newsList.push(this.dataList[i])
                    }
                    if (this.flag == false) {
                        this.newsList.push(this.dataList[this.pagelist]);
                    }
                }
            }
        }
    };
</script>
<style lang="scss">
    .u-card-wrap {
            background-color: $u-bg-color;
            padding: 1px;
        }
    .u-card-wrap {
        background-color: $u-bg-color;
        padding: 1px;
    }
    .u-body-item {
        font-size: 32rpx;
        color: #333;
        padding: 20rpx 10rpx;
    }
    .u-body-item image {
        width: 120rpx;
        flex: 0 0 120rpx;
@@ -82,11 +189,13 @@
        border-radius: 8rpx;
        margin-left: 12rpx;
    }
    .u-search {
        padding: 20rpx 30rpx 0 30rpx;
    }
    .inTmain {}
    .msg {
        height: 72rpx;
        line-height: 72rpx;
store/actions.js
@@ -53,7 +53,6 @@
                        });
                        return;
                    }
                    console.log(res.data, 897998)
                    store.commit('getUserData', res.data)
                    // console.log(res.data,123542);
                    data.isit = true;
utils/func.js
@@ -6,10 +6,10 @@
        vm.$u.vuex('userInfo', userInfo)
        vm.$u.vuex('accessToken', userInfo.access_token)
        vm.$u.vuex('isLogin', true)
        vm.loging = false
        uni.switchTab({
            url: '/pages/home/home'
        })
        uni.hideNavigationBarLoading();
    }
    // 退出登录