<template>
	<view class="page">
		<view class="mainBody">
			<scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="0">
				<view class="item" :class="{'active':tab===1}" @click="checkTab(1)">
					<text class="left">全部</text>
					<view class="line"></view>
				</view>
				<view class="item" :class="{'active':tab===2}" @click="checkTab(2)">
					<text class="left">数码电子</text>
					<view class="line"></view>
				</view>
				<view class="item" :class="{'active':tab===3}" @click="checkTab(3)">
					<text class="left">美妆</text>
					<view class="line"></view>
				</view>
				<view class="item" :class="{'active':tab===4}" @click="checkTab(4)">
					<text class="left">服饰</text>
					<view class="line"></view>
				</view>
			</scroll-view>

		</view>
		<view class="list_info">
			<block v-for="(item,index) in 2" :key="index">
				<view class="item">
					<view class="avator">
						<image class="icon" src="../../static/me/sex_2.png" mode="widthFix">
						</image>
					</view>
					<view class="tit">
						<view class="name">2023季迪奥限量款背包</view>
						<view class="desc">市场价：¥10,000.00</view>
					</view>
					<view class="list_mem">
						<image class="icon" v-for="(item,index) in 6" src="../../static/me/sex_2.png" mode="widthFix" />
					</view>
					<view class="btn_submit">加入心愿</view>
				</view>
			</block>

			<view class="blankHeight"></view>
		</view>

	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				tab: 1,
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				list: [{
					name: '实名认证',
					'desc': '',
					'path': ''
				}]
			}
		},
		onLoad() {
			setTimeout(function() {
				uni.setNavigationBarColor({
					frontColor: '#ffffff',
					backgroundColor: '#00000000',
					animation: {
						duration: 400,
						timingFunc: 'easeIn'
					}
				})
			}, 200);
		},
		onShow() {
			this.loadData();
		},
		methods: {
			onBack() {},
			checkTab(tab) {
				this.tab = tab;
				// this.loadData();
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			loadData() {
				console.log("this.globalData", getApp().globalData);
				let obj2 = {
					is_first: 0
				}
				const postData = Object.assign({}, getApp().globalData.postHeader, obj2);

				console.log(postData);

				uni.request({
					url: this.$apiHost + '/Gushi/getmyinfo', //仅为示例，并非真实接口地址。
					data: postData,
					method: 'POST',
					header: {
						'content-type': 'application/json', //自定义请求头信息
						'Access-Control-Allow-Origin': '*'
					},
					success: (res) => {
						console.log('data:', res.data);
						this.myinfo = res.data;
					}
				});



			},
			EditNickname() {
				let that = this;
				this.$refs['DialogBox'].confirm({
					title: '更改昵称',
					placeholder: '请输入修改的昵称',
					value: that.myinfo.nickname,
					DialogType: 'input',
					animation: 0
				}).then((res) => {
					if (res.value.length < 1) {
						uni.showToast({
							title: "请输入有效的昵称",
							icon: 'none'
						});
						return;
					}
					that.myinfo.nickname = res.value;
					let obj2 = {
						nickname: res.value
					}
					const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
					uni.request({
						url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
						data: postData,
						method: 'POST',
						header: {
							'content-type': 'application/json', //自定义请求头信息
							'Access-Control-Allow-Origin': '*'
						},
						success: (res) => {
							uni.showToast({
								title: res.data.str,
								icon: 'none'
							});
						}
					});
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'wish.scss';
</style>