lsw 11 ay önce
ebeveyn
işleme
f7517b5e7b

+ 2 - 1
app/common/common.scss

@@ -217,11 +217,12 @@
 	overflow: hidden;
 	.usearch {
 		float: left;
-		width: 77%;
+		width: 75%;
 	}
 	.address {
 		float: right;
 		padding-top: 5px;
+		width:65px;
 	}
 }
 .item_job {

+ 0 - 7
app/pages/index/index.scss

@@ -1,7 +0,0 @@
-.banner {
-	margin-top: 15px;
-	box-shadow: $box-shadow;
-}
-.menu {
-	box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0);
-}

+ 31 - 16
app/pages/index/index.vue

@@ -5,9 +5,9 @@
 			<view class="usearch">
 				<u-search placeholder="搜索工作" :disabled="true" bgColor="white" :showAction="false" @click="go('/pages/job/search')"></u-search>
 			</view>
-			<view class="address">
+			<view class="address omit" @click="go('/pages/job/position/city')">
 				<text class="icon">&#xe62e;</text>
-				<text>南宁市</text>
+				<text>{{ param.cityName || '南宁市' }}</text>
 			</view>
 		</view>
 		<!--轮播图-->
@@ -50,14 +50,12 @@
 			</view>
 		</view>
 		<view class="tab">
-			<u-tabs :list="tab" @click="click"></u-tabs>
-			<view class="filters" @click="show = true">
-				<text class="icon">&#xe68c;</text>
-				<text>更多</text>
-			</view>
+			<u-tabs :list="tab" @click="tabClick"></u-tabs>
 		</view>
+		<!--职位列表-->
 		<view class="list">
-			<job :list="list"></job>
+			<job :list="list" v-if="list.length > 0"></job>
+			<u-empty v-else text="该城市暂无工作"></u-empty>
 		</view>
 	</view>
 </template>
@@ -65,17 +63,24 @@
 export default {
 	data() {
 		return {
-			tab: [{ name: '推荐' }, { name: '最新' }, { name: '附近' }],
+			tab: [
+				{ name: '最新', orderBy: 'id' },
+				{ name: '附近', orderBy: 'distance' }
+			],
 			list: [],
-			param: { pageNum: 1, pageSize: 20, orderBy: 'id', type: 0 },
+			param: { pageNum: 1, pageSize: 20, type: 0 },
 			bannerList: [],
 			noticeList: []
 		};
 	},
-	onShow() {},
 	onLoad() {
-		this.initData();
 		this.getData();
+		this.initData();
+		uni.$on('select_city', (res) => {
+			this.param.cityName = res.title;
+			this.param.regionId = res.id;
+			this.getData();
+		});
 	},
 	methods: {
 		initData() {
@@ -106,6 +111,9 @@ export default {
 						type: 'wgs84',
 						success: (res) => {
 							uni.setStorageSync('location', res);
+							this.param.latitude = res.latitude;
+							this.param.longitude = res.longitude;
+							this.getData();
 						}
 					});
 				},
@@ -120,12 +128,13 @@ export default {
 				url: '/app/position/list',
 				data: this.param,
 				success: (res) => {
-					this.list.push(...res.data.rows);
+					this.list = res.data.rows;
 				}
 			});
 		},
-		click(e) {
-			this.current = e.index;
+		tabClick(e) {
+			this.param.orderBy = e.orderBy;
+			this.getData();
 		},
 		go(url) {
 			uni.navigateTo({ url: url });
@@ -135,5 +144,11 @@ export default {
 </script>
 
 <style lang="scss">
-@import './index.scss';
+.banner {
+	margin-top: 15px;
+	box-shadow: $box-shadow;
+}
+.menu {
+	box-shadow: none;
+}
 </style>

+ 1 - 1
app/pages/job/position/city.vue

@@ -59,7 +59,7 @@ export default {
 			show: false,
 			title: '',
 			indexList: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z'],
-			hot_city: [{ title: '不限' }, { id: '1002088', title: '南宁市' }, { id: '1000000', title: '北京市' }, { id: '1000008', title: '上海市' }, { id: '1001969', title: '深圳市' }, { id: '1000939', title: '杭州市' }, { id: '1001946', title: '广州市' }],
+			hot_city: [{ title: '不限' }, { id: '3288', title: '南宁市' }, { id: '1215', title: '北京市' }, { id: '2003', title: '上海市' }, { id: '3169', title: '深圳市' }, { id: '2131', title: '杭州市' }, { id: '3146', title: '广州市' }],
 			list: [],
 			all: []
 		};

+ 1 - 1
app/pages/job/search.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="main pt0">
 		<view class="search">
-			<u-search placeholder="搜索工作" bgColor="white" v-model="param.title" :showAction="false" @search="search()" @clear="clear()"></u-search>
+			<u-search placeholder="搜索工作" :focus="true" bgColor="white" v-model="param.title" :showAction="false" @search="search()" @clear="clear()"></u-search>
 		</view>
 		<view class="list">
 			<view class="history" v-if="!focus">

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/config/InterceptorConfig.java

@@ -28,6 +28,7 @@ public class InterceptorConfig implements WebMvcConfigurer {
         registration.excludePathPatterns("/app/position/map"); //排除
         registration.excludePathPatterns("/app/position/detail/**"); //排除
         registration.excludePathPatterns("/app/enterprise/detail/**"); //排除
+        registration.excludePathPatterns("/app/common/column/city/all"); //排除
     }
 
     @Override

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

@@ -4,9 +4,6 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 import java.util.List;
 
@@ -21,14 +18,15 @@ public class PositionQueryDto {
     @ApiModelProperty(value = "企业id")
     private Long enterpriseId;
 
-    @NotNull(message = "职位类型为空")
-    @Min(value = 0, message = "type 只能是 0 或者 1")
-    @Max(value = 1, message = "type 只能是 0 或者 1")
+    @ApiModelProperty(value = "类型分类")
     private Integer type;
 
     @ApiModelProperty(value = "职位名称")
     private String title;
 
+    @ApiModelProperty(value = "地区id")
+    private Long regionId;
+
     @ApiModelProperty(value = "职位分类id")
     private Long positionId;
 
@@ -48,8 +46,7 @@ public class PositionQueryDto {
 
     private Integer max;
 
-    @NotNull(message = "参数错误")
     @Pattern(regexp = "^(id|distance)$", message = "orderBy 参数值只能是 id 或 distance")
-    private String orderBy;
+    private String orderBy = "id";
 
 }

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

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="type != null "> AND type = #{type}</if>
         <if test="enterpriseId != null "> AND user_id = #{enterpriseId}</if>
         <if test="title != null and title != ''"> AND title LIKE concat('%', #{title}, '%')</if>
+        <if test="regionId != null">AND FIND_IN_SET(#{regionId},ancestors)</if>
         <if test="positionId != null"> AND position_id=#{positionId}</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>