my.vue 9.35 KB
<template>
	<view class="page">
		<view style="position: absolute; top: 0; width: 100%;z-index: 0;">
			<image src="../../static/bg.png" style="width: 100%; height: 450rpx;"></image>
		</view>
		<view class="main">
			<view class="logo">
				<image src="../../static/logo.png" mode="widthFix"></image>
			</view>
			<view class="mian-box" style="position: relative;z-index: 2;">
				<view class="my-top" @click="toPerson">
					<view class="user-info" >
						<view class="portrait" v-if="isHead">
							<image :src="baseUrl + userIcon"></image>
						</view>
						<view class="portrait" v-else>
							<image src="../../static/img/head.jpg"></image>
						</view>
						<view class="info">
							<view class="nickname">
								<text>{{userName}}</text>
							</view>
							<view class="rank">
								<image src="../../static/copy.png"></image><text>{{userId}}</text>
							</view>
						</view>
						<view class="user-right">
							<image src="../../static/right2.png"></image>
						</view>
					</view>
				</view>
				<view class="my-service">
					<view class="service-list">
						<!-- <view class="list">
						<view class="thumb">
							0
						</view>
						<view class="name">
							<text>收藏</text>
						</view>
					</view>
					<view class="line"></view> -->
						<view class="list" @click="supply">
							<view class="thumb">
								{{proCount}}
							</view>
							<view class="name">
								<text>产品</text>
							</view>
						</view>
						<view class="line"></view>
						<view class="list" @click="demand">
							<view class="thumb">
								{{demandCount}}
							</view>
							<view class="name">
								<text>需求</text>
							</view>
						</view>
						<view class="line"></view>
						<view class="list" @click="zhao">
							<view class="thumb">
								{{zhaoPCount}}
							</view>
							<view class="name">
								<text>招聘</text>
							</view>
						</view>
						<!-- <view class="line"></view>
						<view class="list" @click="toMyCom()">
							<view class="thumb">
								{{com}}
							</view>
							<view class="name">
								<text>企业</text>
							</view>
						</view> -->
					</view>
				</view>

				<!-- <view class="my-middle" v-show="isCompany">
				<view class="my-middle-left">
					<image src="../../static/img/logo.png" ></image>{{organizeName}}
				</view>
				<view class="my-middle-right">
					<image src="../../static/right2.png"></image>
				</view>
				
			</view> -->

				<view class="message-list">
					<view class="titleall-box">
						<view class="titleall-left">
							<view class="titleall-left-line"></view>服务与工具
						</view>
					</view>
					<view class="list" @click="toPerson">
						<view class="icon-data">
							<view class="icon">
								<image src="/static/my-icon1.png" mode=""></image>
							</view>
							<view class="data">
								<view class="title">
									<text>个人信息</text>
								</view>
							</view>
						</view>
						<view class="more">
							<text class="iconfont icon-more"></text>
						</view>
					</view>
					<view class="list" @click="toFileLook">
						<view class="icon-data">
							<view class="icon">
								<image src="/static/my-icon2.png" mode=""></image>
							</view>
							<view class="data">
								<view class="title">
									<text>信息回执</text>
								</view>
							</view>
						</view>
						<view class="more">
							<text class="iconfont icon-more"></text>
						</view>
					</view>
					<view class="list" @click="demand">
						<view class="icon-data">
							<view class="icon">
								<image src="/static/my-icon3.png" mode=""></image>
							</view>
							<view class="data">
								<view class="title">
									<text>我的需求</text>
								</view>
							</view>
						</view>
						<view class="more">
							<text class="iconfont icon-more"></text>
						</view>
					</view>
					<view class="list" @click="zhao()">
						<view class="icon-data">
							<view class="icon">
								<image src="/static/my-icon4.png" mode=""></image>
							</view>
							<view class="data">
								<view class="title">
									<text>我的招聘</text>
								</view>
							</view>
						</view>
						<view class="more">
							<text class="iconfont icon-more"></text>
						</view>
					</view>
					<view class="list" @click="supply">
						<view class="icon-data">
							<view class="icon">
								<image src="/static/my-icon5.png" mode=""></image>
							</view>
							<view class="data">
								<view class="title">
									<text>我的产品</text>
								</view>
							</view>
						</view>
						<view class="more">
							<text class="iconfont icon-more"></text>
						</view>
					</view>
					<view class="list" @click="toMyCom" v-show="isAdmin">
						<view class="icon-data">
							<view class="icon">
								<image src="/static/my-icon5.png" mode=""></image>
							</view>
							<view class="data">
								<view class="title">
									<text>我的企业</text>
								</view>
							</view>
						</view>
						<view class="more">
							<text class="iconfont icon-more"></text>
						</view>
					</view>
					<!-- <view class="list">
					<view class="icon-data">
						<view class="icon">
							<image src="/static/my-icon6.png" mode=""></image>
						</view>
						<view class="data">
							<view class="title">
								<text>意见反馈</text>
							</view>
						</view>
					</view>
					<view class="more">
						<text class="iconfont icon-more"></text>
					</view>
				</view> -->

				</view>
			</view>
		</view>
		<!-- tabbar -->
		<TabBar :tabBarShow="1"></TabBar>
	</view>
</template>

<script>
	import request from '@/utils/request.js'
	import TabBar from '../../components/TabBar/TabBar.vue';
	export default {
		components: {
			TabBar,
		},
		data() {
			return {
				scrollTop: 0,
				isHotline: false,
				userId: '',
				userName: '',
				userIcon: '',
				organizeName: '',
				// 判断用户是否是公司成员
				// isCompany:false,
				// 判断用户是否有公司logo
				isLogo: false,
				// 是否有头像
				isHead: false,
				baseUrl: 'http://deyanggaoxin.fengshiyun.com',
				// 产品数量
				proCount: '',
				// 需求数量
				demandCount: '',
				// 招聘数量
				zhaoPCount: '',
				// 企业数量
				com:'',
				isAdmin:false
			};
		},
		onLoad() {
			this.getUser()
			this.getSelfProCount()
			this.getSelfDemandCount()
			this.getSelfZhaoCount()
			this.getSelfCom()
		},
		onReady() {
			uni.hideTabBar();
		},
		methods: {
			// 获取用户信息
			getUser() {
				if (uni.getStorageSync('user')) {
					let userCode = uni.getStorageSync('user')
					// console.log("用户的code", this.userCode)
					this.userId = userCode.userInfo.userId
					if(this.userId === 'admin'){
						this.isAdmin = true
					}
					this.userName = userCode.userInfo.userAccount
					this.userIcon = userCode.userInfo.headIcon
					this.organizeName = userCode.userInfo.organizeName
					this.isCompany = userCode.userInfo.isCompany
					console.log(userCode)
				} else {
					uni.showToast({
						title: '请登录',
						icon: 'none'
					})
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/login/index'
						})
					})
				}
			},
			// 跳转到个人信息页面
			toPerson(){
				uni.navigateTo({
					url:"/pages/my/personalData/index"
				})
			},
			// 跳转到个人产品页面
			supply() {
				uni.navigateTo({
					url: "/pages/my/myPro/myPro"
				})
			},
			// 跳转到个人需求页面
			demand() {
				uni.navigateTo({
					url: '/pages/my/myDemand/myDemand'
				})
			},
			// 跳转到个人招聘页面
			zhao() {
				uni.navigateTo({
					url: '/pages/my/myZhao/myZhao'
				})
			},
			toFileLook() {
				uni.navigateTo({
					url: '/pages/fileLook/fileLook'
				})
			},
			// 发布企业列表页面
			toMyCom(){
				uni.navigateTo({
					url:'/pages/my/myCom/myCom'
				})
			},
			// 获取自己发布的产品
			getSelfProCount() {
				request({
					url: this.baseUrl + '/api/Extend/baseproduct',
					method: 'get',
					data: {}
				}).then(res => {
					if (res.code === 200) {
						console.log(res)
						this.proCount = res.data.list.length
					} else {
						uni.showToast({
							icon: "error",
							title: res.msg
						})
					}
				})
			},

			// 获取自己发布的需求
			getSelfDemandCount() {
				request({
					url: this.baseUrl + '/api/Extend/demandrelease',
					method: 'get',
					data: {}
				}).then(res => {
					if (res.code === 200) {
						// console.log(res.data.list.length ,"需求数量")
						this.demandCount = res.data.list.length
					} else {
						uni.showToast({
							icon: "error",
							title: res.msg
						})
					}
				})
			},
			// 获取自己发布的招聘
			getSelfZhaoCount() {
				request({
					url: this.baseUrl + '/api/Extend/basetalentrecruitment',
					method: 'get',
					data: {}
				}).then(res => {
					if (res.code === 200) {
						console.log(res)
						this.zhaoPCount = res.data.list.length
					} else {
						uni.showToast({
							icon: "error",
							title: res.msg
						})
					}
				})
			},
			// 获取自己发布的企业
			getSelfCom() {
				request({
					url: this.baseUrl + '/api/SubDev/baseenterprisemanager',
					method: 'get',
					data: {}
				}).then(res => {
					if (res.code === 200) {
						console.log(res)
						this.com = res.data.list.length
					} else {
						uni.showToast({
							icon: "error",
							title: res.msg
						})
					}
				})
			},
		}
	}
</script>

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