<template>
	<view class="main">
		<!--轮播图-->
		<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="menu">
			<view class="cd">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #f44336;">&#xe6be;</view>
						<view class="title">失业登记</view>
					</view>
				</view>
			</view>
			<view class="cd">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #4CAF50">&#xe64a;</view>
						<view class="title">就业补贴</view>
					</view>
				</view>
			</view>
			<view class="cd">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #ff9800">&#xe73c;</view>
						<view class="title">培训指导</view>
					</view>
				</view>
			</view>
			<view class="cd">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #607d8b">&#xe998;</view>
						<view class="title">法务服务</view>
					</view>
				</view>
			</view>
			<view class="cd" @click="go('/pages/index/index')">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #03A9F4">&#xe725;</view>
						<view class="title">结算广场</view>
					</view>
				</view>
			</view>
			<view class="cd" @click="go('/pages/clsd/job/full_time')">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #4581fb">&#xe9d9;</view>
						<view class="title">全职岗位</view>
					</view>
				</view>
			</view>
			<view class="cd" @click="go('/pages/clsd/job/part_time')">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #FF5722">&#xe62a;</view>
						<view class="title">兼职岗位</view>
					</view>
				</view>
			</view>
			<view class="cd">
				<view class="out">
					<view class="int">
						<view class="icon" style="background-color: #795548">&#xe6a6;</view>
						<view class="title">社保窗口</view>
					</view>
				</view>
			</view>
		</view>
		<!--新闻-->
		<view class="news" @click="webview('https://chenglantimes.com/tzgg')">
			<view class="gg">
				<view class="title">最新资讯</view>
				<view class="bor"></view>
				<view class="more">
					<text>更多</text>
					<text class="icon">&#xe62b;</text>
				</view>
			</view>
			<view class="item">
				<view class="title omit">春招进行时......</view>
				<view class="date">04-29</view>
			</view>
			<view class="item">
				<view class="title omit">2022年全区十八大与南宁召开广西大力推广招聘兼职的在线</view>
				<view class="date">04-29</view>
			</view>
		</view>
		<!--横幅-->
		<image src="../../static/banner.jpg" mode="widthFix" class="hengfu" @click="webview('https://chenglantimes.com/a1')"></image>
		<!--图片内容-->
		<view class="ad" style="margin-left: -10px; margin-right: -10px">
			<view class="item" style="height: 190px">
				<view class="out" @click="webview('https://chenglantimes.com/a1')">
					<view class="int" style="height: 175px; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2)">
						<image src="https://chenglantimes.com/prod-api/profile/upload/2024/05/20/1716197779982.jpg" mode="heightFix" style="height: 180px; width: 100%"></image>
					</view>
				</view>
			</view>
			<view class="item" style="height: 190px">
				<view class="out">
					<view class="int">
						<view class="it" style="height: 80px" @click="webview('https://chenglantimes.com/a1')">
							<image src="https://chenglantimes.com/prod-api/profile/upload/2024/05/20/1716195826603.jpg" mode="aspectFill" style="height: 85px; width: 100%"></image>
						</view>
						<view class="it" style="height: 80px; margin-top: 15px" @click="webview('https://chenglantimes.com/a1')">
							<image src="https://chenglantimes.com/prod-api/profile/upload/2024/05/20/1716198212203.jpg" mode="aspectFill" style="height: 77px; width: 100%"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				ip: this.http.ip,
				user: {},
				jobs: [1, 2, 3, 4, 5, 6],
				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) {
				uni.navigateTo({ url: url });
			},
			webview(src) {
				uni.navigateTo({
					url: '/pages/other/webview?src=' + src
				})
			}
		}
	};
</script>

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