diff --git a/src/main/java/io/v/nutz/activity/controller/school/ActivityCalendarController.java b/src/main/java/io/v/nutz/activity/controller/school/ActivityCalendarController.java index f4b6f83..22f34ea 100644 --- a/src/main/java/io/v/nutz/activity/controller/school/ActivityCalendarController.java +++ b/src/main/java/io/v/nutz/activity/controller/school/ActivityCalendarController.java @@ -73,6 +73,7 @@ public class ActivityCalendarController { applyEndTime, startTime, endTime, + cover, type activityType FROM activity_tissue diff --git a/src/main/java/io/v/nutz/web/controllers/platform/sys/SysHomeController.java b/src/main/java/io/v/nutz/web/controllers/platform/sys/SysHomeController.java index 8c38e46..b81ca45 100644 --- a/src/main/java/io/v/nutz/web/controllers/platform/sys/SysHomeController.java +++ b/src/main/java/io/v/nutz/web/controllers/platform/sys/SysHomeController.java @@ -1,6 +1,7 @@ package io.v.nutz.web.controllers.platform.sys; import cn.hutool.core.util.StrUtil; +import cn.wizzer.framework.base.Result; import io.v.nutz.base.service.BaseService; import io.v.nutz.constant.Env; import io.v.nutz.sys.models.Sys_menu; @@ -8,27 +9,28 @@ import io.v.nutz.sys.services.SysMenuService; import io.v.nutz.util.ShiroUtil; import io.v.nutz.web.commons.base.Globals; import org.apache.shiro.authz.annotation.RequiresAuthentication; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.select.Elements; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; -import org.nutz.http.Http; +import org.nutz.integration.jedis.RedisService; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.json.Json; import org.nutz.lang.Lang; import org.nutz.lang.Strings; -import org.nutz.log.Log; -import org.nutz.log.Logs; +import org.nutz.lang.util.NutMap; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; -import org.springframework.util.FileCopyUtils; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * Created by wizzer on 2016/6/23. @@ -42,11 +44,15 @@ public class SysHomeController { @Inject private BaseService baseService; - @At("") - @Ok("beetl:/platform/sys/home.html") - @RequiresAuthentication - public void home(HttpSession session, HttpServletRequest request) { + @Inject + private RedisService redisService; + @At("") + @Ok("re") + @RequiresAuthentication + public Object home(HttpSession session, HttpServletRequest request) { +// return "beetl:/platform/sys/home.html"; + return "beetl:/platform/sys/home/index.html"; } @At @@ -215,4 +221,58 @@ public class SysHomeController { } + @At + @RequiresAuthentication + @Ok("json") + public Result getNews() { + try { + + String url = "https://gonghui.hhu.edu.cn/"; + Document document = null; + document = Jsoup.connect(url).get(); + Elements homeElements = document.select(".main1 .inner .mod .mr>div"); + Elements homeElements2 = document.select(".main2 .inner .mod .ml>div"); + List> news = homeElements.stream().map(homeElement -> { + //获取板块名称 + String name = homeElement.selectFirst("div.tt .tit span").text(); + Elements liElements = homeElements.select(".con ul.news_list li.news"); + List notices = liElements.stream().map(liElement -> { + NutMap row = NutMap.NEW(); + String href = liElement.selectFirst("a").attr("href"); + String time = liElement.selectFirst("div.news_meta").text(); + String title = liElement.selectFirst("a").text(); + row.put("href", href); + row.put("time", time); + row.put("text", title); + return row; + }).collect(Collectors.toList()); + return Map.of("label", name, "value", notices); + + }).collect(Collectors.toList()); + List> news2 = homeElements2.stream().map(homeElement -> { + //获取板块名称 + String name = homeElement.selectFirst("div.tt .tit span").text(); + Elements liElements = homeElements2.select(".con ul.news_list li.news"); + List notices = liElements.stream().map(liElement -> { + NutMap row = NutMap.NEW(); + String href = liElement.selectFirst("a").attr("href"); + String time = liElement.selectFirst("div.news_meta").text(); + String title = liElement.selectFirst("a").text(); + row.put("href", href); + row.put("time", time); + row.put("text", title); + return row; + }).collect(Collectors.toList()); + return Map.of("label", name, "value", notices); + + }).collect(Collectors.toList()); + news.addAll(news2); + redisService.setex("gonghui_news", 60 * 60 * 24, Json.toJson(news)); + return Result.success(news); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + } diff --git a/src/main/resources/static/components/plugins/OpenQRCode.vue b/src/main/resources/static/components/plugins/OpenQRCode.vue index a0e1131..bab1828 100644 --- a/src/main/resources/static/components/plugins/OpenQRCode.vue +++ b/src/main/resources/static/components/plugins/OpenQRCode.vue @@ -3,17 +3,18 @@
+
关 闭 - +
@@ -27,6 +28,7 @@ module.exports = { data() { return { codeDialogVisible: false, + title: "活动二维码", } }, @@ -47,7 +49,10 @@ module.exports = { var filename = name + '_' + (new Date()).getTime() + '.' + type; this.saveFile(dataurl, filename); }, - openCode(url) { + openCode(url,title) { + if (title){ + this.title=this.title+"("+title+")" + } this.codeDialogVisible = true this.$nextTick(() => { $("#qrcode").html("") diff --git a/src/main/resources/views/layouts/platform.html b/src/main/resources/views/layouts/platform.html index 3718cf9..6fd793f 100644 --- a/src/main/resources/views/layouts/platform.html +++ b/src/main/resources/views/layouts/platform.html @@ -430,7 +430,7 @@ + + + diff --git a/src/main/resources/views/platform/sys/home/news.js b/src/main/resources/views/platform/sys/home/news.js new file mode 100644 index 0000000..c242c17 --- /dev/null +++ b/src/main/resources/views/platform/sys/home/news.js @@ -0,0 +1,39 @@ +const news = { + template: ` +
+ + +
+ {{ n.time }} + {{ n.text }} +
+
+
+
+ `, + data() { + return { + newsData: [], + activeName: 0 + } + }, + methods: { + async getNews() { + const resp = await $.post("/platform/home/getNews") + if (resp.data.length > 0) { + this.activeName = resp.data[0].label + } + this.newsData = resp.data + }, + openUrl(href) { + const url = this.isHttpOrHttps(href) ? href : "https://gonghui.hhu.edu.cn/" + href + window.open(url) + }, + isHttpOrHttps(url) { + return /^(http:\/\/|https:\/\/)/i.test(url) + } + }, + async created() { + await this.getNews() + } +} diff --git a/src/main/resources/views/platform/sys/home/quickEntry.js b/src/main/resources/views/platform/sys/home/quickEntry.js new file mode 100644 index 0000000..300d9df --- /dev/null +++ b/src/main/resources/views/platform/sys/home/quickEntry.js @@ -0,0 +1,46 @@ +const quickEntry = { + template: ` +
+ +
快速入口
+
+
+ +
+ +
+
+ {{item.label}} +
+
+
+
+ `, + data() { + return { + quickEntries: [] + } + }, + methods: { + listQuickEntry() { + + $.get("/platfotm/agenda/getQuickentry").then((res) => { + if (res.code === 0) { + this.quickEntries = res.data + } + }) + /*$.get("/platform/quickEntry/getQuickentry").then((res) => { + if (res.code === 0) { + this.quickEntries = res.data + } + })*/ + }, + menuClick(item) { + sublime.jumpPagePjax(item.url) + } + }, + created() { + this.listQuickEntry() + } +} diff --git a/src/main/resources/views/platform/sys/home/todo.js b/src/main/resources/views/platform/sys/home/todo.js new file mode 100644 index 0000000..77a4481 --- /dev/null +++ b/src/main/resources/views/platform/sys/home/todo.js @@ -0,0 +1,100 @@ +const todo = { + template: ` +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ `, + mixins: [initTableMixins], + data() { + return { + todoActive: "1", + todoList:[] + } + }, + methods: { + async handleClick() { + this.todoLoading = true + /* const {data, code} = await $.get("/platform/sys/localProcess/todoList", { mode: this.todoActive }) + this.todoList = data*/ + this.todoLoading = false + } + }, + created() { + this.handleClick() + } +} diff --git a/src/main/resources/views/platform/sys/home/userInfo.js b/src/main/resources/views/platform/sys/home/userInfo.js new file mode 100644 index 0000000..f96642a --- /dev/null +++ b/src/main/resources/views/platform/sys/home/userInfo.js @@ -0,0 +1,67 @@ +const userInfo = { + template: ` + + `, + data() { + return { + showSignature: false, + userSignatureUrl: null, + signatureDialogVisible: false, + signatureAddress: window.location.origin + "/platform/signature/scanPcCode?origin=user", + memberInfoDialogVisible:false + } + }, + mounted() {}, + methods: { + openSignature() { + this.signatureDialogVisible = true + this.getUserSignature() + }, + getUserSignature(isRefresh = false) { + $.post("/platform/signature/get").then((res) => { + if (res.code === 0) { + if (isRefresh) { + this.$message.success("刷新成功") + } else { + if (!res.data.signature) { + this.$message.warning("未获取到签字信息") + } + } + this.userSignatureUrl = res.data.signature + } + }) + }, + } +}