<template>
	<view class="back">
		<view class="operatorList" v-for="item in operators" :key="item.number" @tap="showDetail"
			:data-code="item.code">
			<image class="image1" src="../../static/运营商管理/1@3x.png"></image>
			<text style="margin-top: 38rpx;margin-left: 30rpx; width: 500rpx;">{{item.name}}</text>
			<image class="image2" src="../../static/运营商管理/ico2@3x.png"></image>
		</view>

	</view>

</template>

<script>
	export default {
		data() {
			return {
				realname: '',
				operators: [],
			}
		},
		onLoad(e) {
			this.list(e)

			uni.getStorage({
				key: 'realname',
				success: function(res) {
					console.log(res.data);
					this.realname = res.data
					
					if (this.realname == '') {
						uni.navigateTo({
							url: '/pages/login/login',
						});
						
						console.log("未找到用户，请登录");
					}
				}
			})


		

			uni.$on('flush', () => {
				this.list(e)
			})
		},

		methods: {
			async list(e) {
				let vm = this;
				let url = uni.$api.operator.list;

				let res = await uni.$http.get(url);
				console.log('form发生了submit事件')

				console.log(res);

				this.operators = res.data.data.operators;
				console.log(res.data.data.operators);

			},

			showDetail(e) {
				console.log(e);
				var code = e.currentTarget.dataset.code;

				uni.navigateTo({
					url: '/pages/operator/operatorInfo/operatorInfo?code=' + code,
				});

			}
		}
	}
</script>

<style lang="scss" scoped>
	.operatorList {
		display: flex;
		flex-direction: row;
		height: 125rpx;
		background-color: white;
		margin-top: 30rpx;
		width: 704rpx;
		margin-left: 23rpx;
		border-radius: 10rpx;
	}

	.image1 {
		width: 90rpx;
		height: 90rpx;
		margin-top: 20rpx;
		margin-left: 20rpx;
	}

	.image2 {
		width: 10px;
		height: 10px;
		margin-top: 50rpx;
		// margin-left: 400rpx;

	}

	.back {
		background-color: aliceblue;
		width: 100%;
		height: 100%;
	}
</style>
