四、接口请求数据交互 更新录入信息

<template>
	<view class="content">
		<view class="top_cont">
				<button @click="toRegister" class="input_btn">点击跳转页面</button>
                <!-- 用@click方法触发点击事件 进行页面跳转 -->
		</view>
		<view>
			<view style="margin: 20rpx 0; margin-left: 50rpx; font-size: 28rpx;">
				<view style="display: flex; align-items: center;">
					<view style="width: 15rpx;height: 40rpx;background: #0CC1BC;border-radius: 8rpx;"></view>
					<view style="margin-left: 16rpx; font-size: 30rpx;">录入历史</view>
				</view>
			</view>
			<view class="history">
				<view v-for="item in antList" :key='item.data' class="model">
                <!-- v-for循环后台接口获取的列表   对应下面的 {{ 字段 }} -->
					<view class="title titleMax">编码:{{ item.reagentId }}</view>
					<view class="title title1">
						检测人员:{{ item.name }}
					</view>
					<view class="title title1">
						检测时间:{{ item.testingTime }}
					</view>
					<view class="title title1">
						检测结果:
						<text class="callout" v-if="item.status==1">阴性</text>
						<text class="callout" v-if="item.status==2">阳性</text>
						<text class="callout" v-if="item.status==3">无效结果</text>
					</view>
					<view class="title title1">
						录入时间:{{ item.nucleicTime }}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const { baseurl } = require('../../utils/config');
    // 这里引入了一个接口地址(可忽略不计)
	export default {
		data() {
			return {
				reagentId: '',
				idCode: '',
				name: '',
				testingTime: '',
				status: '',
				userInfo: {},
				antList:[],
				Flag: true,
				iphone: '',
				district: '',
				town: '',
				village: '',
				residenceCommunity: ''
			}
		},
		onLoad:function() {
			uni.request({
				url: baseurl+'/epkg/testhistorytest/list',
				method: 'POST',
				data: {
					addName: uni.getStorageSync('username'),
                    // 这里的 getStorageSync 方法是获取缓存的值 由上一个页面传过来的 用户名username
				},
				header: {
					'content-type': 'application/json'
				},
				success: res => {
					this.antList= res.data
				},
			});
		},
        // 读取缓存的值
		onShow:function() {
			uni.request({
				url: baseurl+'/epkg/testhistorytest/list',
				method: 'POST',
				data: {
					addName: uni.getStorageSync('username'),
                    // 这里的 getStorageSync 方法是获取缓存的值 由上一个页面传过来的 用户名username
				},
				header: {
					'content-type': 'application/json'
				},
				success: res => {
					console.log(res);
					this.antList= res.data
				},
			});
		},
		methods: {
			// 更新个人录入信息
			toRegister(){
				uni.navigateTo({
					url:`../index/index`
                    // 获取点击事件跳转的页面的信息录入
				});
			},
		}
	}
</script>

<style>
	.top_cont{
		flex: auto;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 300rpx;
		width: 100%;
		border-bottom: 15rpx solid #eeeeee;
	}
	.input_btn{
		width: 400rpx;
		height: 100rpx;
		background: #0CC1BC;
		border-radius: 100rpx;
		color: white;
		line-height: 100rpx;
		border: 1rpx #a9a9a9 solid;
	}
	.history{
		overflow: auto;
		height: 1000rpx;
		width: 86%;
		margin-left: 50rpx;
		font-size: 28rpx;
	}
	.model{
		border-bottom: #e0e0e0 .5rpx solid;
	}
	
	.txt_words{
		font-size: 30rpx;
	}
	.title{
		color: gray;
		margin: 20rpx 0;
	}
	.titleMax{
		font-size: 32rpx;
		font-weight: 600;
		color: #000000;
	}
	.callout{
		font-size: 30rpx;
		color: deepskyblue;
	}
</style>

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值