| pages/company/company.vue | ●●●●● patch | view | raw | blame | history | |
| pages/report/initiate.vue | ●●●●● patch | view | raw | blame | history | |
| pages/report/receive.vue | ●●●●● patch | view | raw | blame | history | |
| pages/report/send.vue | ●●●●● patch | view | raw | blame | history | |
| store/actions.js | ●●●●● patch | view | raw | blame | history | |
| utils/func.js | ●●●●● 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; } 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 - 1) { if (that.pagelist <= that.dataList.length - 2 && flag == true) { that.newsList.push(that.dataList[that.pagelist]) 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]) } } 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) { 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]) } that.newsList.push(that.dataList[that.pagelist++]); } else { that.status = 'nomore'; if (that.dataList.length - 1 == that.pagelist && flag == true) { that.newsList.push(that.dataList[that.pagelist]); flag = false; that.flag = false; } } } } @@ -143,11 +148,8 @@ 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,7 +1,12 @@ <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-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> @@ -14,9 +19,13 @@ <view class="" slot="foot"></u-icon>汇报时间:{{item.reportTime}}</view> </u-card> </view> <view class="msg" v-show="dataList.length == 0"> <u-loadmore class='msg' :status="status" /> </view> <view class="msg" v-else> 暂无数据 </view> </view> </template> @@ -25,13 +34,49 @@ data() { return { dataList:[], keyword: "" 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() { @@ -49,6 +94,28 @@ 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,8 +123,45 @@ 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> @@ -86,9 +190,7 @@ padding: 20rpx 30rpx 0 30rpx; } .inTmain{ } .inTmain {} .msg { 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-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> <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> @@ -26,13 +37,49 @@ data() { return { dataList:[], keyword: "" 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() { @@ -42,7 +89,8 @@ 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, url: this.$store.state.piAPI + "/workReport/page?deptId=" + this.$store.state.UserData .dept_id + '&userId=' + this.$store.state.puserID, method:"get", data:{ @@ -50,6 +98,28 @@ 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; } } } } }); }, @@ -57,8 +127,45 @@ 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> @@ -87,6 +194,8 @@ 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(); } // 退出登录