lsw há 10 meses atrás
pai
commit
6ef7f05f04

+ 6 - 9
app/components/filters/filters.vue

@@ -9,7 +9,7 @@
 						<text class="icon">&#xe631;</text>
 					</view>
 					<view class="tags">
-						<view class="out">
+						<view class="out" @click="go('/pages/job/position/classification')">
 							<view class="int" :class="{ active: positionName != '不限' }">{{ positionName }}</view>
 						</view>
 					</view>
@@ -24,7 +24,7 @@
 				</view>
 				<view class="item">
 					<view class="title">经验要求</view>
-					<view class="tags" v-for="(item, index) in experiences" :key="item.name" @click="select('experiences', item, index)">
+					<view class="tags" v-for="(item, index) in experience" :key="item.name" @click="select('experience', item, index)">
 						<view class="out">
 							<view class="int" :class="{ active: item.check }">{{ item.name }}</view>
 						</view>
@@ -50,9 +50,6 @@ export default {
 		value: {
 			type: Boolean,
 			default: true
-		},
-		list: {
-			type: Array
 		}
 	},
 	data() {
@@ -60,7 +57,7 @@ export default {
 			type: 0,
 			positionName: '不限',
 			positionId: '',
-			experiences: [{ name: '不限' }, { name: '1年以内' }, { name: '1-3年' }, { name: '3-5年' }, { name: '5-10年' }, { name: '10年以上' }],
+			experience: [{ name: '不限' }, { name: '1年以内' }, { name: '1-3年' }, { name: '3-5年' }, { name: '5-10年' }, { name: '10年以上' }],
 			salary: [{ name: '不限' }, { name: '1-3k' }, { name: '3-5k' }, { name: '5-10k' }, { name: '10-20k' }, { name: '20-50k' }, { name: '50k以上' }]
 		};
 	},
@@ -90,7 +87,7 @@ export default {
 		confirm(item) {
 			this.$emit('input', false);
 			this.$emit('confirm', {
-				experiences: this.experiences.filter((item) => item.check && item.name != '不限'),
+				experience: this.experience.filter((item) => item.check && item.name != '不限'),
 				salary: this.salary.filter((item) => item.check),
 				positionId: this.positionId
 			});
@@ -100,11 +97,11 @@ export default {
 		},
 		clear() {
 			this.salary.forEach((i) => (i.check = false));
-			this.experiences.forEach((i) => (i.check = false));
+			this.experience.forEach((i) => (i.check = false));
 			this.positionName = '不限';
 			this.positionId = '';
 			this.$forceUpdate();
-			this.$emit('confirm', { experiences: [], salary: '', positionId: '' });
+			this.$emit('confirm', { experience: [], salary: [], positionId: '' });
 			this.$emit('input', false);
 		},
 		close() {

+ 39 - 0
app/components/job/job.vue

@@ -0,0 +1,39 @@
+<template>
+	<view>
+		<view class="item_job" v-for="(item, index) in list" :key="index" @click="go('/pages/job/detail?id=' + item.id)">
+			<view class="top">
+				<view class="title omit">{{ item.title }}</view>
+				<view class="salary">{{ item.salary }}</view>
+			</view>
+			<view class="bot">
+				<view class="address omit">
+					<text>{{ item.regionName }}</text>
+					<text class="icon">&#xe757;</text>
+					<text>{{ item.location }}</text>
+				</view>
+				<view class="distance" v-if="item.distance">距离你{{ item.distance }}km</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	name: 'job',
+	props: {
+		list: {
+			type: Array
+		}
+	},
+	data() {
+		return {};
+	},
+	methods: {
+		go(url) {
+			uni.navigateTo({ url: url });
+		}
+	}
+};
+</script>
+
+<style lang="scss"></style>

+ 13 - 14
app/pages.json

@@ -4,6 +4,19 @@
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
+			"path": "pages/job/search",
+			"style": {
+				"navigationBarTitleText": "职位搜索"
+			}
+		},
+		{
+			"path": "pages/job/list",
+			"style": {
+				"navigationBarTitleText": "找工作",
+				"enablePullDownRefresh": true
+			}
+		},
+		{
 			"path": "pages/index/index",
 			"style": {
 				"navigationBarTitleText": "爱就业咨询服务平台",
@@ -156,20 +169,6 @@
 			"style": {
 				"navigationBarTitleText": "新闻详情"
 			}
-		},
-		{
-			"path": "pages/job/list",
-			"style": {
-				"navigationBarTitleText": "全职",
-				"enablePullDownRefresh": true
-			}
-		},
-		{
-			"path" : "pages/job/search",
-			"style" : 
-			{
-				"navigationBarTitleText" : "职位搜索"
-			}
 		}
 	],
 	"tabBar": {

+ 4 - 30
app/pages/job/list.vue

@@ -11,20 +11,7 @@
 			</view>
 		</view>
 		<view class="list">
-			<view class="item_job" v-for="(item, index) in list" :key="index" @click="go('/pages/job/detail?id=' + item.id)">
-				<view class="top">
-					<view class="title omit">{{ item.title }}</view>
-					<view class="salary">{{ item.salary }}</view>
-				</view>
-				<view class="bot">
-					<view class="address omit">
-						<text>{{ item.regionName }}</text>
-						<text class="icon">&#xe757;</text>
-						<text>{{ item.location }}</text>
-					</view>
-					<view class="distance" v-if="item.distance">距离你{{ item.distance }}km</view>
-				</view>
-			</view>
+			<job :list="list"></job>
 			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
 		</view>
@@ -69,22 +56,9 @@ export default {
 			this.refresh();
 		},
 		confirm(e) {
-			console.log('asd:' + JSON.stringify(e));
-			if (e.experiences.length > 0) {
-				this.param.experiences = e.experiences.map((item) => item.name);
-			} else {
-				delete this.param.experiences;
-			}
-			if (e.salary) {
-				this.param.salary = e.salary.map((item) => item.name).toString();
-			} else {
-				delete this.param.salary;
-			}
-			if (e.positionId) {
-				this.param.positionId = e.positionId;
-			} else {
-				delete this.param.positionId;
-			}
+			this.param.experience = e.experience.map((item) => item.name).toString() || '';
+			this.param.salary = e.salary.map((item) => item.name).toString() || '';
+			this.param.positionId = e.positionId || '';
 			this.refresh();
 		},
 		go(url) {

+ 110 - 9
app/pages/job/search.vue

@@ -1,19 +1,120 @@
 <template>
-	<view>
-		
+	<view class="main">
+		<view class="search">
+			<u-search placeholder="搜索工作" bgColor="white" v-model="param.title" :showAction="false" @search="search()" @clear="clear()"></u-search>
+		</view>
+		<view class="list">
+			<view class="history" v-if="!focus">
+				<view class="title">搜索历史</view>
+				<view class="del" v-if="history.length > 0" @click="del()">
+					<text class="icon">&#xe8b6;</text>
+					<text>清除</text>
+				</view>
+				<view class="tag" v-for="(item, index) in history" :key="item" @click="(param.title = item), search()">{{ item }}</view>
+			</view>
+			<job :list="list"></job>
+			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
+		</view>
 	</view>
 </template>
-
 <script>
-	export default {
-		data() {
-			return {
-				
-			};
+export default {
+	data() {
+		return {
+			list: [],
+			focus: false,
+			history: uni.getStorageSync('history') || [],
+			param: { pageNum: 1, pageSize: 10, type: 0, orderBy: 'id' },
+			loadMore: false
+		};
+	},
+	onLoad(e) {
+		if (this.getLocation()) {
+			this.param.latitude = this.getLocation().latitude;
+			this.param.longitude = this.getLocation().longitude;
+		}
+	},
+	methods: {
+		getData() {
+			this.http.request({
+				url: '/app/position/list',
+				data: this.param,
+				loading: 'false',
+				success: (res) => {
+					this.loadMore = res.data.pages > this.param.pageNum ? true : false;
+					this.list.push(...res.data.rows);
+				}
+			});
+		},
+		go(url) {
+			uni.navigateTo({ url: url });
+		},
+		search() {
+			if (this.param.title.trim()) {
+				this.focus = true;
+				if (this.history.filter((item) => item == this.param.title.trim()) == 0) {
+					this.history.unshift(this.param.title);
+					uni.setStorageSync('history', this.history);
+				}
+				this.refresh();
+			}
+		},
+		del() {
+			uni.removeStorageSync('history');
+			this.history = [];
+		},
+		clear() {
+			this.focus = false;
+			this.param.title = '';
+			this.list = [];
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNum = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNum++;
+			this.getData();
 		}
 	}
+};
 </script>
 
 <style lang="scss">
-
+.search {
+	margin-bottom: 15px;
+}
+.history {
+	overflow: hidden;
+	.title {
+		margin-bottom: 12px;
+		font-weight: bold;
+	}
+	.del {
+		float: right;
+		font-size: 14px;
+		margin-top: -30px;
+		color: #f44336;
+		.icon {
+			padding-right: 3px;
+		}
+	}
+	.tag {
+		float: left;
+		padding: 4px 10px;
+		border-radius: 30px;
+		background-color: white;
+		margin-right: 10px;
+		margin-bottom: 5px;
+		font-size: 14px;
+		color: $font-c;
+	}
+}
 </style>

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/dto/PositionQueryDto.java

@@ -36,7 +36,7 @@ public class PositionQueryDto {
     private String latitude;
 
     @ApiModelProperty(value = "工作经验 [1年以内,5-10年]")
-    private List<String> experiences;
+    private List<String> experience;
 
     @ApiModelProperty(value = "薪资待遇")
     private String salary;

+ 2 - 2
ruoyi-admin/src/main/resources/mapper/work/PositionMapper.xml

@@ -36,9 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         state = 0
         AND audit = 1
         AND type = #{type}
-        <if test="title != null and title != ''"> AND title LIKE concat('%', #{name}, '%')</if>
+        <if test="title != null and title != ''"> AND title LIKE concat('%', #{title}, '%')</if>
         <if test="positionId != null"> AND position_id=#{positionId}</if>
-        <if test="experiences != null  and experiences.size() > 0">AND experience IN (<foreach collection="experiences" item="name" separator=",">#{name}</foreach>)</if>
+        <if test="experience != null  and experience.size() > 0">AND experience IN (<foreach collection="experience" item="name" separator=",">#{name}</foreach>)</if>
         <if test="min != null and max !=null">AND min <![CDATA[ >= ]]> #{min} AND max <![CDATA[ <= ]]> #{max}</if>
         <if test="orderBy=='distance' and longitude !=null">ORDER BY distance ASC</if>
         <if test="orderBy=='id'">ORDER BY id DESC</if>