lsw il y a 10 mois
Parent
commit
1cfc500313

+ 11 - 0
admin-ui/src/views/work/enterprise/index.vue

@@ -53,6 +53,12 @@
           <preview v-model="scope.row.p1"></preview>
         </template>
       </el-table-column>
+      <el-table-column label="是否推荐" align="center" prop="recommend" width="80">
+        <template slot-scope="scope">
+          <el-tag type="info" v-if="scope.row.recommend == 0">否</el-tag>
+          <el-tag type="success" v-if="scope.row.recommend == 1">是</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="是否认证" align="center" width="130">
         <template slot-scope="scope">
           <el-tag type="danger" v-if="scope.row.state == 0">待认证</el-tag>
@@ -69,6 +75,7 @@
         <template slot-scope="scope">
           <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)">详情</el-button>
           <el-button size="mini" type="text" icon="el-icon-edit" @click="op('audit', scope.row)" v-hasPermi="['work:enterprise:edit']" v-if="scope.row.state == 0">审核</el-button>
+          <el-button size="mini" type="text" icon="el-icon-sell" @click="op('recommend', scope.row)" v-hasPermi="['work:enterprise:recommend']" v-if="scope.row.state == 1">推荐</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:enterprise:remove']">删除</el-button>
         </template>
       </el-table-column>
@@ -82,6 +89,7 @@
 
 <script>
 import edit from './edit';
+import recommend from './recommend';
 export default {
   name: 'Enterprise',
   data() {
@@ -127,6 +135,9 @@ export default {
       if (tag == 'detail') {
         this.iframe({ obj: edit, param: { id: row.id, detail: true }, title: '企业详情', width: '50%', height: '65%' });
       }
+      if (tag == 'recommend') {
+        this.iframe({ obj: recommend, param: { id: row.id }, title: '设为推荐', width: '25%', height: '35%' });
+      }
       if (tag == 'audit') {
         this.iframe({ obj: edit, param: { id: row.id, detail: true }, title: '审核', width: '50%', height: '65%' });
       }

+ 62 - 0
admin-ui/src/views/work/enterprise/recommend.vue

@@ -0,0 +1,62 @@
+<template>
+  <div class="cmain">
+    <el-form ref="form" :model="form" :disabled="param.detail || param.audit" :rules="rules" label-width="100px">
+      <el-form-item label="设为推荐" prop="recommend">
+        <el-select v-model="form.recommend" placeholder="请选择">
+          <el-option label="设置" :value="1"></el-option>
+          <el-option label="取消" :value="0"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="图片封面" prop="logo" v-if="form.recommend == 1"><cropper v-model="form.logo" :fixed_number="[1, 1]"></cropper></el-form-item>
+    </el-form>
+    <div class="mfooter">
+      <el-button type="primary" @click="submitForm()">确定</el-button>
+      <el-button @click="$layer.close(layerid)">取 消</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      form: { recommend: 1 },
+      rules: {
+        recommend: [{ required: true, message: '不能为空', trigger: 'blur' }],
+        logo: [{ required: true, message: '封面图不能为空', trigger: 'blur' }]
+      }
+    };
+  },
+  props: {
+    param: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    },
+    layerid: {
+      type: String
+    }
+  },
+  mounted() {
+    if (this.param.id) {
+      this.ajax({ url: '/work/enterprise/detail/' + this.param.id }).then((response) => {
+        this.form = response.data;
+      });
+    }
+  },
+  methods: {
+    submitForm(audit) {
+      this.$refs['form'].validate((valid) => {
+        if (valid) {
+          this.ajax({ method: 'post', url: '/work/enterprise/edit', data: this.form }).then((response) => {
+            this.$modal.msgSuccess('修改成功');
+            this.$layer.close(this.layerid);
+            this.$parent.getList();
+          });
+        }
+      });
+    }
+  }
+};
+</script>

+ 1 - 0
admin-ui/src/views/work/notice/edit.vue

@@ -52,6 +52,7 @@ export default {
       form: { state: 0, top: 0 },
       rules: {
         title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
+        type: [{ required: true, message: '类型不能为空', trigger: 'blur' }],
         contents: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
         top: [{ required: true, message: '是否置顶不能为空', trigger: 'blur' }],
         state: [{ required: true, message: '状态不能为空', trigger: 'blur' }]

+ 14 - 0
app/pages.json

@@ -239,6 +239,20 @@
 			{
 				"navigationBarTitleText" : "协议"
 			}
+		},
+		{
+			"path" : "pages/notice/index",
+			"style" : 
+			{
+				"navigationBarTitleText" : "通知公告"
+			}
+		},
+		{
+			"path" : "pages/notice/detail",
+			"style" : 
+			{
+				"navigationBarTitleText" : "通知详情"
+			}
 		}
 	],
 	"tabBar": {

+ 41 - 3
app/pages/job/enterprise/card.vue

@@ -13,7 +13,10 @@
 		<view class="list">
 			<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/job/enterprise/detail?id=' + item.id)">
 				<view class="title omit">{{ item.name }}</view>
-				<view class="desc">{{ item.regionName }}</view>
+				<view class="desc">
+					<text class="icon">&#xe64f;</text>
+					<text>{{ item.regionName }} · 招聘岗位:{{ item.positions }}</text>
+				</view>
 				<view class="distance" v-if="item.distance">距离你{{ item.distance }}km</view>
 			</view>
 			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
@@ -25,9 +28,11 @@
 export default {
 	data() {
 		return {
+			ip: this.http.ip,
 			tab: [
-				{ name: '最新', orderBy: 'id' },
-				{ name: '附近', orderBy: 'distance' }
+				{ name: '最新', orderBy: 'id', recommend: '' },
+				{ name: '推荐', orderBy: 'id', recommend: 1 },
+				{ name: '附近', orderBy: 'distance', recommend: '' }
 			],
 			list: [],
 			param: { pageNum: 1, pageSize: 10, orderBy: 'id' },
@@ -61,6 +66,7 @@ export default {
 		},
 		tabClick(e) {
 			this.param.orderBy = e.orderBy;
+			this.param.recommend = e.recommend;
 			this.refresh();
 		},
 		go(url) {
@@ -92,6 +98,30 @@ export default {
 </script>
 
 <style lang="scss">
+.scroll {
+	background-color: white;
+	margin-bottom: 10px;
+	overflow: hidden;
+	border-radius: 5px;
+	padding-top: 10px;
+	.gg {
+		.title {
+			font-size: 15px;
+		}
+	}
+	.sitem {
+		float: left;
+		width: 90px;
+		text-align: center;
+		font-size: 14px;
+		padding: 8px;
+		image {
+			width: 60px;
+			height: 60px;
+			border-radius: 8px;
+		}
+	}
+}
 .item {
 	background-color: white;
 	border-radius: 5px;
@@ -99,11 +129,19 @@ export default {
 	margin-bottom: 10px;
 	.title {
 		font-weight: bold;
+		.icon {
+			color: $main-color;
+			padding-right: 5px;
+		}
 	}
 	.desc {
 		font-size: 14px;
 		color: $font-c;
 		padding-top: 7px;
+		.icon {
+			color: $main-color;
+			padding-right: 3px;
+		}
 	}
 	.distance {
 		float: right;

+ 59 - 0
app/pages/notice/detail.vue

@@ -0,0 +1,59 @@
+<template>
+	<view class="main">
+		<view class="content">
+			<view class="title">{{ item.title }}</view>
+			<view class="desc">
+				<text>发布于:{{ item.createTime }}</text>
+			</view>
+			<view class="con">
+				<u-divider :dot="true"></u-divider>
+				<u-parse :content="item.contents"></u-parse>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			item: {}
+		};
+	},
+	onLoad(e) {
+		this.http.request({
+			url: '/app/notice/detail/' + e.id,
+			success: (res) => {
+				this.item = res.data.data;
+				this.item.contents = res.data.data.contents.replace(new RegExp('/profile/upload/', 'g'), this.http.ip + '/profile/upload/');
+			}
+		});
+	},
+	methods: {}
+};
+</script>
+
+<style lang="scss">
+.main {
+	padding: 0px 10px 10px 10px;
+}
+.content {
+	padding: 15px;
+	background-color: white;
+	border-radius: 8px;
+	.title {
+		font-size: 18px;
+	}
+	.desc {
+		padding-top: 15px;
+		font-size: 13px;
+		color: #7c8388;
+		text {
+			padding-right: 25px;
+		}
+	}
+	.con {
+		font-size: 14px;
+	}
+}
+</style>

+ 91 - 0
app/pages/notice/index.vue

@@ -0,0 +1,91 @@
+<template>
+	<view class="list">
+		<view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/notice/detail?id=' + item.id)">
+			<view class="title omit">{{ item.title }}</view>
+			<view class="desc">
+				<text>发布于 {{ item.createTime }}</text>
+			</view>
+		</view>
+		<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+		<u-empty v-if="!loadMore && list.length == 0"></u-empty>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			list: [],
+			param: { pageNum: 1, pageSize: 10, type: '小程序通知' },
+			loadMore: true
+		};
+	},
+	onLoad(e) {
+		this.getData();
+	},
+	methods: {
+		getData() {
+			this.http.request({
+				url: '/app/notice/list',
+				data: this.param,
+				loading: 'false',
+				success: (res) => {
+					this.loadMore = res.data.pages > this.param.pageNum ? true : false;
+					res.data.rows.forEach((item) => {
+						item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
+						this.list.push(item);
+					});
+				}
+			});
+		},
+		go(url) {
+			uni.navigateTo({ url: url });
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNum = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.refresh();
+			uni.stopPullDownRefresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNum++;
+			this.getData();
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+.list {
+	padding: 5px 12px 12px 12px;
+	.item {
+		background-color: white;
+		border-radius: 5px;
+		padding: 12px;
+		margin-bottom: 10px;
+		.title {
+			font-size: 15px;
+			font-weight: bold;
+		}
+		.desc {
+			font-size: 14px;
+			color: $font-c;
+			padding-top: 7px;
+			text {
+				padding-right: 20px;
+			}
+		}
+	}
+}
+</style>

+ 30 - 0
app/pages/serve/index.vue

@@ -87,6 +87,24 @@
 				</view>
 			</view>
 		</view>
+		<!--通知公告-->
+		<!--新闻-->
+		<view class="news">
+			<view class="gg">
+				<view class="title">通知公告</view>
+				<view class="bor"></view>
+				<view class="more" @click="go('/pages/notice/index')">
+					<text>更多</text>
+					<text class="icon">&#xe62b;</text>
+				</view>
+			</view>
+			<view class="bhe">
+				<view class="item" v-for="(item, index) in noticeList" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
+					<view class="title omit">{{ item.title }}</view>
+					<view class="date">{{ item.createTime.substring(5, 10) }}</view>
+				</view>
+			</view>
+		</view>
 		<!--新闻-->
 		<view class="news">
 			<view class="gg">
@@ -146,6 +164,7 @@ export default {
 				a4: 'https://chenglantimes.com/prod-api/profile/upload/2024/05/20/1716198212203.jpg'
 			},
 			bannerList: [],
+			noticeList: [],
 			newsList: [],
 			expand: false
 		};
@@ -162,6 +181,13 @@ export default {
 					this.bannerList = res.data.data;
 				}
 			});
+			//通知公告
+			this.http.request({
+				url: '/app/home/notice/小程序通知',
+				success: (res) => {
+					this.noticeList = res.data.data;
+				}
+			});
 			//资讯
 			this.http.request({
 				url: '/app/home/news',
@@ -181,6 +207,10 @@ export default {
 .banner {
 	margin-top: -10px;
 }
+.notice {
+	border-radius: 5px;
+	margin-top: 10px;
+}
 .news {
 	margin-top: 10px;
 	background-color: white;

BIN
app/static/bg.png


+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_HomeController.java

@@ -33,6 +33,7 @@ public class Api_HomeController extends BaseController {
     @Autowired
     private INewsService newsService;
 
+
     @GetMapping("/banner/{type}")
     public AjaxResult banner(@PathVariable("type") Integer type) {
         return AjaxResult.success(bannerService.homeList(type));
@@ -43,6 +44,11 @@ public class Api_HomeController extends BaseController {
         return AjaxResult.success(newsService.homeList());
     }
 
+    @GetMapping("/notice/{type}")
+    public AjaxResult notice(@PathVariable("type") String type) {
+        return AjaxResult.success(noticeService.homeList(type));
+    }
+
     @GetMapping("/contract")
     public AjaxResult contract() {
         return AjaxResult.success(contractService.selectContract());

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_NoticeController.java

@@ -1,13 +1,21 @@
 package com.ruoyi.web.work.api;
 
 import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.web.work.domain.Notice;
 import com.ruoyi.web.work.service.INoticeService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * 通知公告
+ *
  * @author 高伟森
  * @date 2024-04-18
  */
@@ -17,5 +25,16 @@ public class Api_NoticeController extends BaseController {
     @Autowired
     private INoticeService noticeService;
 
+    @GetMapping("/list")
+    public TableDataInfo list(Notice notice) {
+        notice.setState(0);
+        startPage();
+        List<Notice> list = noticeService.selectList(notice);
+        return getDataTable(list);
+    }
 
+    @GetMapping("/detail/{id}")
+    public AjaxResult detail(@PathVariable("id") Long id) {
+        return noticeService.detail(id);
+    }
 }

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/NoticeController.java

@@ -38,7 +38,7 @@ public class NoticeController extends BaseController {
 
     @GetMapping("/queryList")
     public AjaxResult queryList(){
-        return AjaxResult.success(noticeService.queryList("企业通知"));
+        return AjaxResult.success(noticeService.homeList("企业通知"));
     }
 
     @GetMapping(value = "/detail/{id}")

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/Enterprise.java

@@ -63,6 +63,9 @@ public class Enterprise{
     @ApiModelProperty(value = "认证不通过原因")
     private String msg;
 
+    @ApiModelProperty(value = "是否推荐:0=否,1=是")
+    private Integer recommend;
+
     @ApiModelProperty(value = "认证  0未认证 1已认证  2认证不通过")
     private Integer state;
 

+ 8 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/vo/EnterpriseListVo.java

@@ -20,8 +20,8 @@ public class EnterpriseListVo {
     @ApiModelProperty(value = "地区名称")
     private String regionName;
 
-    @ApiModelProperty(value = "注册资本")
-    private String capital;
+    @ApiModelProperty(value = "是否推荐:0=否,1=是")
+    private Integer recommend;
 
     @ApiModelProperty(value = "经度")
     private String longitude;
@@ -32,4 +32,10 @@ public class EnterpriseListVo {
     @ApiModelProperty(value = "距离km")
     private String distance;
 
+    @ApiModelProperty(value = "企业logo")
+    private String logo;
+
+    @ApiModelProperty(value = "招聘职位数量")
+    private  Integer positions;
+
 }

+ 1 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/work/mapper/NoticeMapper.java

@@ -3,7 +3,6 @@ package com.ruoyi.web.work.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.web.work.domain.Notice;
 import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -14,8 +13,7 @@ import java.util.List;
 public interface NoticeMapper extends BaseMapper<Notice> {
     List<Notice> selectList(Notice notice);
 
-    List<Notice> queryList(@Param("type") String type);
+    List<Notice> homeList(@Param("type") String type);
 
-    @Select("SELECT * FROM tb_notice WHERE title = #{title}")
     Notice selectByTitle(@Param("title") String title);
 }

+ 3 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/INoticeService.java

@@ -13,7 +13,9 @@ import java.util.List;
 public interface INoticeService extends IService<Notice> {
     List<Notice> selectList(Notice notice);
 
-    List<Notice> queryList(String type);
+    List<Notice> homeList(String type);
 
     AjaxResult add(Notice notice);
+
+    AjaxResult detail(Long id);
 }

+ 11 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/NoticeServiceImpl.java

@@ -25,8 +25,8 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
     }
 
     @Override
-    public List<Notice> queryList(String type) {
-        return noticeMapper.queryList(type);
+    public List<Notice> homeList(String type) {
+        return noticeMapper.homeList(type);
     }
 
     @Override
@@ -41,4 +41,13 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
         }
         return AjaxResult.success();
     }
+
+    @Override
+    public AjaxResult detail(Long id) {
+        Notice notice = getById(id);
+        if (notice == null || notice.getState() != 0) {
+            return AjaxResult.error("通知不存在或停用");
+        }
+        return AjaxResult.success(notice);
+    }
 }

+ 16 - 13
ruoyi-admin/src/main/resources/mapper/work/EnterpriseMapper.xml

@@ -13,20 +13,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     <select id="indexList" resultType="com.ruoyi.web.work.domain.vo.EnterpriseListVo">
         SELECT
-        id,
-        name,
-        region_name,
-        latitude,
-        longitude,
-        capital
-        <if test="longitude !=null and longitude !=null ">,ROUND( ST_Distance_Sphere ( POINT ( #{longitude}, #{latitude} ), POINT ( longitude, latitude ))/ 1000, 2 ) AS distance</if>
+        e.id,
+        e.name,
+        e.logo,
+        e.recommend,
+        e.region_name,
+        e.latitude,
+        e.longitude,
+        (SELECT COUNT( p.id ) FROM tb_position p WHERE	p.user_id = e.id AND p.state=0 AND p.audit=1 ) AS positions
+        <if test="longitude !=null and longitude !=null ">,ROUND( ST_Distance_Sphere ( POINT ( #{longitude}, #{latitude} ), POINT ( e.longitude, e.latitude ))/ 1000, 2 ) AS distance</if>
         FROM
-        tb_enterprise
-        WHERE state =1
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="state != null "> and state = #{state}</if>
-            <if test="regionId != null">and FIND_IN_SET(#{regionId},ancestors)</if>
+        tb_enterprise e
+        WHERE e.state =1
+            <if test="name != null  and name != ''"> and e.name like concat('%', #{name}, '%')</if>
+            <if test="state != null "> and e.state = #{state}</if>
+            <if test="regionId != null">and FIND_IN_SET(#{regionId},e.ancestors)</if>
+            <if test="recommend != null "> AND e.recommend = #{recommend}</if>
             <if test="orderBy=='distance' and longitude !=null">ORDER BY distance ASC</if>
-            <if test="orderBy=='id'">ORDER BY id DESC</if>
+            <if test="orderBy=='id'">ORDER BY e.id DESC</if>
     </select>
 </mapper>

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

@@ -13,7 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         ORDER BY top DESC,id DESC
     </select>
-    <select id="queryList" resultType="com.ruoyi.web.work.domain.Notice">
-        SELECT id,title,create_time FROM tb_notice WHERE state=0 AND type = #{type} ORDER BY top DESC,id DESC LIMIT 10
+    <select id="homeList" resultType="com.ruoyi.web.work.domain.Notice">
+        SELECT id,title,create_time FROM tb_notice WHERE state=0 AND type = #{type} ORDER BY top DESC,id DESC LIMIT 5
     </select>
+
+    <select id="selectByTitle" resultType="com.ruoyi.web.work.domain.Notice">
+        SELECT * FROM tb_notice WHERE title = #{title}
+    </select>
+
 </mapper>