<template>
	<view class="main">
		<!--搜索-->
		<view class="search">
			<view class="usearch">
				<u-search placeholder="请输入职位名称" bgColor="white" :showAction="false"></u-search>
			</view>
			<view class="address">
				<text class="icon">&#xe62e;</text>
				<text>南宁市</text>
			</view>
		</view>
		<!--轮播图-->
		<view class="banner">
			<u-swiper circular :radius="5" :indicator="true" keyName="pic" :list="bannerList" :height="150" class="uni-swiper" @click="click"></u-swiper>
		</view>
		<!--找工作-->
		<view class="tab">
			<u-tabs :list="tab" :current="current"></u-tabs>
		</view>
		<view class="jobs">
			<view class="full_time" v-for="(item, index) in jobs" :key="index">
				<view class="out">
					<view class="int">
						<image :src="item.url" mode="aspectFill"></image>
						<view class="title omit">{{ item.name }}</view>
						<view class="desc">{{ item.job }}</view>
						<view class="price">{{ item.price }}元/日</view>
						<view class="address">
							<text class="icon">&#xe62e;</text>
							<text>南宁青秀山</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				ip: this.http.ip,
				current: 0,
				tab: [{ name: '你的工作' }, { name: '身边工作' }, { name: '现结工作' }],
				user: {},
				jobs: [{
						name: '广西龙坚贸易有限公司',
						job: '装卸搬运工',
						price: '4000',
						url: 'http://47.104.228.216/prod-api/profile/upload/2024/04/29/1714401904451.jpg'
					},
					{
						name: '韵达速递',
						job: '快递装卸工',
						price: '4700',
						url: 'http://47.104.228.216/prod-api/profile/upload/2024/04/29/1714401871968.jpg'
					},
					{
						name: '北京滴滴有限公司',
						job: '滴滴快车专车司机',
						price: '4200',
						url: 'http://47.104.228.216/prod-api/profile/upload/2024/04/29/1714401886712.jpg'
					},
					{
						name: '北京美团外卖有限公司',
						job: '美团骑手送餐员',
						price: '3700',
						url: 'http://47.104.228.216/prod-api/profile/upload/2024/04/29/1714401895824.jpg'
					},
					{
						name: '字节跳动有限公司',
						job: '女主播',
						price: '5500',
						url: 'http://47.104.228.216/prod-api/profile/upload/2024/04/29/1714402008141.jpg'
					},
					{
						name: '广西龙坚贸易有限公司',
						job: '装卸搬运工',
						price: '4000',
						url: 'http://47.104.228.216/prod-api/profile/upload/2024/04/29/1714402008141.jpg'
					}
				],
				bannerList: [],
				noticeList: []
			};
		},
		onShow() {
			if (this.hasLogin()) {
				//this.getUserInfo();
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getUserInfo() {
				this.http.request({
					url: '/app/user/info',
					success: (res) => {
						this.user = res.data.data;
					}
				});
			},
			getData() {
				this.http.request({
					url: '/app/home/index',
					success: (res) => {
						this.contract = res.data.data.contract;
						this.bannerList = res.data.data.bannerList;
						res.data.data.noticeList.forEach((item) => {
							this.noticeList.push(item.title);
						});
					}
				});
			},
			go(url) {
				if (this.hasLogin()) {
					uni.navigateTo({
						url: '/pages/index/index'
					})
				} else {
					uni.navigateTo({ url: '/pages/user/login' });
				}
			}
		}
	};
</script>

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