uploadInfo.vue 3.0 KB
<template>
	<view>
		<l-file ref="lFile" :logo="logo" @up-success="onSuccess"></l-file>
		<view class="infoList">
			<view class="infoItem">
				<text>1.现场检测表</text>
				<image @click="uploadFile" src="../../../static/image/icon_add.png" mode=""></image>
			</view>
			<view class="infoItem">
				<text>2.影像检查</text>
				<image @click="uploadFile" src="../../../static/image/icon_add.png" mode=""></image>
			</view>
			<view class="infoItem">
				<text>3.监测数据</text>
				<image @click="uploadFile" src="../../../static/image/icon_add.png" mode=""></image>
			</view>
			<view class="imgList">
				<view class="imgItem">
					<image class="img" src="../../../static/image/del/Ellipse-1@2x.png" mode=""></image>
					<image class="clearBtn" src="../../../static/image/icon_clear2.png" mode=""></image>
				</view>
			</view>
		</view>
		<view style="height: 130rpx;"></view>
		<view class="bottomBtnWrap">
			<view class="bottomBtn">
				保存
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				logo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbpic.588ku.com%2Felement_origin_min_pic%2F00%2F00%2F07%2F155788a6d8a5c42.jpg&refer=http%3A%2F%2Fbpic.588ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1619847627&t=2da40b583002205c204d980b54b35040',
			}
		},
		methods:{
			uploadFile(){
				this.$refs.lFile.upload({
					// #ifdef APP-PLUS
					// nvue页面使用时请查阅nvue获取当前webview的api,当前示例为vue窗口
					currentWebview: this.$mp.page.$getAppWebview(),
					// #endif
					url: '/dropbox/document/upload', //替换为你的
					name: 'file',
					header: {  //根据你接口需求自定义
						'Authorization': '',
						'uid': '3871',
						'client': 'app',
						'accountid': 'IMED5274'
					}
					// body参数直接写key,value,如:
					// key1: 'value1',
					// key2: 'value2',
				});
			},
			onSuccess(res) {
				console.log('上传成功回调',JSON.stringify(res));
				uni.showToast({
					title: JSON.stringify(res),
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.infoList{
		padding: 0 32rpx;
		.infoItem{
			height: 124rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			border-bottom: 2rpx solid #f2f3f5;
			image{width: 44rpx;height: 44rpx;}
		}
	}
	.bottomBtnWrap{
		height: 132rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #fff;
		position: fixed;
		bottom: 0;
		width: 100%;
		.bottomBtn{
			width: 624rpx;
			height: 100rpx;
			background: #4bb377;
			border-radius: 28rpx;
			color: #fff;
			text-align: center;
			line-height: 100rpx;
			font-size: 34rpx;
		}
	}
	.imgList{display: flex;flex-wrap: wrap;margin-top: 10rpx;}
	.imgList .imgItem{position: relative;width: 160rpx;height: 160rpx;margin: 10rpx 10rpx 0 0;}
	.imgItem .img{width: 160rpx;height: 160rpx;}
	.imgItem .clearBtn{width: 28rpx;height: 28rpx;position: absolute;right: -10rpx;top: -10rpx;}
</style>