uniapp使用时间插件,进行时间搜索查询

uniapp使用时间插件,点击开始时间和结束时间,进行搜索查询

插件市场下载的时间插件
在这里插入图片描述

<template>
	<view class="checkPage">
		<view class="date">
			<view class="datetime" @tap="onShowDatePicker()">
				<image src="../../static/check/date.png" mode="" style="width: 40upx;height: 40upx;margin: 0 20upx;"/>
				<text style="color: #FFFFFF;">{{ selectDate }}</text>
			</view>
			<view class="resetTime" v-show="resetShow" @tap="reset()">重置</view>
		</view>
		<view class="loading">{{ loadingText }}</view>
		<view class="cu-load load-modal" v-if="loadModal">
			<image src="/static/logo.gif"  style="width: 160upx;height: 160upx;"/>
			<view class="gray-text">加载中...</view>
		</view>
		<mx-date-picker :show="showPickerDate" :type="type" :value="value" :show-tips="true" :begin-text="'开始时间'" :end-text="'结束时间'"
		 :show-seconds="true" @confirm="onSelected" @cancel="onSelected" />
	</view>
</template>

<script>
	import MxDatePicker from '@/components/mx-datepicker/mx-datepicker.vue'
	import { mapState, mapMutations } from 'vuex';
	export default {
		components: {
			MxDatePicker,
		},
		data() {
			return {
				showPickerDate:false,
				value: ['2019/01/08', '2019/01/16'],
				type: 'range',
				startDate: '',
				endDate: '',
				selectDate:'请选择时间',
				loadingText: '加载中...',
				linkageVisible: false,
				resetShow:false,
				loadModal:true,
				page: 1,
				listData: [],
			}
		},
		computed: mapState(['hasLogin', 'userInfo']),
		onLoad() {
			if (this.hasLogin === false) {
				uni.navigateTo({
					url: '/pages/login'
				});
			}
			this.getList();
		},
		onShow() {
			setTimeout(() => {
				this.getList();
			}, 500);
		},
		onPullDownRefresh (){
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			...mapMutations(['logout']),
			onShowDatePicker(type) {
				//显示
				this.showPickerDate = true;
				this.value = this[type];
			},
			onSelected(e) {
				// console.log(e)
				//选择
				this.showPickerDate = false;
				if (e) {
					this[this.type] = e.value;
					this.startDate = e.value[0];
					this.endDate = e.value[1];
					this.selectDate = e.value[0] +' — '+e.value[1];
					this.listData = [];
					this.getList();
					this.resetShow = true;
				}
			},
			reset() {
				this.resetShow = false;
				this.selectDate = '请选择时间';
				this.startDate = '';
				this.endDate = '';
				this.getList();
			},
			getList(IsRefresh){
				console.log('hellow',IsRefresh)			
				 this.loadingText = "加载中..."
				if(IsRefresh){
					this.page=1;
				}
				uni.request({
					url: this.url + 'patrolReport/getList',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						Authorization: this.userInfo.token
					},
					data:{
						reportType: indexTab,
						startDate: this.startDate,
						endDate: this.endDate,
						userName: this.userInfo.userName,
						areaId: this.areaId,//这个可以不传
						page: this.page,
						rows: '10'
					},
					success: (res) => {
						this.page++;
						// this.listData = res.data.pageRows;
						this.listData = this.listData.concat(res.data.pageRows);
						uni.stopPullDownRefresh();
						// console.log(res.data.pageRows,"00000999")
						if(res.data.pageRows.length==0){
							this.loadingText = '暂无数据';
						}
						if (res.data.pageRows.length < 10) {
							this.loadingText = '已加载全部';
						}else{
							this.loadingText = '加载更多';
						}
						this.loadModal = false;
						// setTimeout(()=>{
						// 	this.loadingText = '';
						// },1000)
					}
				})
			},
			
		}
	}
</script>

<style scoped style="scss">
	.loading {
		text-align: center;
		line-height: 50px;
	}
	.active{
		background-color: #FFA10C !important;
		
	}
	.checkPage{
		width: 100%;
		overflow: hidden;
		/* position: relative; */
	}
	.date{
		background: #402EF1;
		padding: 10upx;
		position: fixed;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: wrap;
		width: 100%;
		height: 240upx;
	}
	.card{
		margin-top: 240upx;
		overflow: hidden;
		height: calc(100% - 150px);
		.noData{
			width: 500upx;
			height: 540upx;
			margin: 0 auto;
		}
	}
	.datetime{
		width: 80%;
		border-radius: 40upx;
		height: 80upx;
		/* opacity: 0.5; */
		background: #5B57FC;
		display: flex;
		align-items: center;
		padding-left: 20upx;
		margin-bottom: 30upx;
	}
	.resetTime{
		margin: 20upx 0upx 30upx 20upx;
		color: #fff;
	}
</style>

图片如下:
在这里插入图片描述
在这里插入图片描述

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
UniApp 中,你可以通过以下步骤申请试用插件: 1. 在 UniApp 官方插件市场(https://ext.dcloud.net.cn/)或其他第三方插件市场中搜索你需要试用的插件。确保找到适合你项目需求的插件。 2. 点击插件详情页,在页面上你可以找到插件使用说明、示例代码和其他相关信息。请仔细阅读插件的文档,了解插件的功能和使用方法。 3. 如果插件支持试用,通常会在插件详情页提供试用申请或试用入口。点击相关按钮或链接,进入试用申请页面。 4. 填写试用申请表单。通常你需要提供一些必要的信息,例如项目名称、联系方式等。一些插件可能还需要你提供一些额外的信息或进行一些额外的操作。 5. 提交试用申请。完成申请表单后,点击提交按钮将你的试用申请提交给插件作者或相关平台。 6. 等待审核和回复。插件作者或相关平台会对你的试用申请进行审核,并在一定时间内给予回复。如果申请通过,通常会提供试用授权或相关信息。 7. 获取授权或试用信息后,根据插件文档中的指导进行安装和使用。 需要注意的是,不是所有的插件都提供试用功能,而且试用期限和权限可能因插件而异。有些插件可能需要付费购买或使用其他付费方式。在申请试用之前,确保阅读并理解插件的试用规则和相关费用信息。 希望这些步骤对你有所帮助!如有其他问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值