实现公告获取和输出

This commit is contained in:
F嘉阳
2018-02-26 11:20:02 +08:00
parent b1db4a4944
commit b652389d4e
7 changed files with 87 additions and 27 deletions

View File

@@ -48,6 +48,9 @@ public class DataController {
@Autowired
private VUserfileService vUserfileService;
@Autowired
private NoticeService noticeService;
@Resource
private HttpServletRequest httpServletRequest;
@@ -172,4 +175,9 @@ public class DataController {
throw new UserException(ResultEnum.ILLEGAL_ACCESS);
}
}
@GetMapping("/home/findAllNotice")
public List<TbNotice> findAllNotice(){
return noticeService.findAll();
}
}

View File

@@ -0,0 +1,25 @@
package com.fjy.spring.domain;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
@Data
public class TbNotice {
@Id
@GeneratedValue
private Integer noticeid;
private Integer adminid;
@Column(name = "noticecontent")
private String noticeContent;
@Column(name = "issuetime")
private String issueTime;
}

View File

@@ -6,7 +6,7 @@ import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
/*@Configuration*/
public class WebAppConfig implements WebMvcConfigurer {
/**

View File

@@ -0,0 +1,8 @@
package com.fjy.spring.repository;
import com.fjy.spring.domain.TbNotice;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TbNoticeRepository extends JpaRepository<TbNotice,Integer> {
}

View File

@@ -0,0 +1,20 @@
package com.fjy.spring.service;
import com.fjy.spring.domain.TbNotice;
import com.fjy.spring.repository.TbNoticeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class NoticeService {
@Autowired
private TbNoticeRepository noticeRepository;
public List<TbNotice> findAll(){
return noticeRepository.findAll();
}
}

View File

@@ -93,6 +93,20 @@ var Main = {
activeName: 'login',
fileList: [],
DownloadList: [],
NoticeList:[
{
noticeid: 1,
adminid: 1,
noticeContent: "系统正式上线Alpha测试版",
issueTime: "2018-2-26 11:00"
},
{
noticeid: 2,
adminid: 1,
noticeContent: "系统,测试",
issueTime: "2018-2-26 11:13"
}
],
VersionList:[
{
date:'2018-02-24',
@@ -371,6 +385,15 @@ var Main = {
.catch(function (error) {
console.log(error);
});
axios.get(getRootPath_web()+'/home/findAllNotice')
.then(function (response) {
console.log(response.data);
that.NoticeList = response.data;
//that.limitTime = response.data;
})
.catch(function (error) {
console.log(error);
});
})
},
methods: {

View File

@@ -257,36 +257,12 @@
<el-row>
<el-col :span="24">
<div class="grid-content">
<el-card class="box-card hidden-xs-only">
<div slot="header" class="clearfix">
<span>作业提交倒计时</span>
<span style="color: red"> 功能未完成</span>
</div>
<div class="text item">
<el-table :data="tableHomeworkData" style="width: 100%"
:default-sort="{prop: 'coursename', order: 'descending'}">
<el-table-column prop="coursename" label="科目" sortable width="180">
</el-table-column>
<el-table-column label="倒计时" sortable>
<template slot-scope="scope">
{{limitTime(scope.row)}}
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<el-card th:include="dist/thymeleaf/layout :: timelimit"></el-card>
</div>
</el-col>
</el-row>
<el-row>
<el-card class="box-card hidden-xs-only">
<div slot="header" class="clearfix">
<span>公告</span>
</div>
<div v-for="o in 4" :key="o" class="text item">
{{'公告内容 ' + o }}
</div>
</el-card>
<el-card th:include="dist/thymeleaf/layout :: notice"></el-card>
<!--<template>
<el-table :data="tableData3" style="width: 100%">
<el-table-column label="公告">