Skip to content

Commit

Permalink
feat:首页版本信息
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed Oct 12, 2023
1 parent 13b7af2 commit 6f41b07
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.oddfar.campus.admin.controller.system;

import com.oddfar.campus.common.domain.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;


/**
* 首页
*/
@RestController
public class SysIndexController {

@Value("${campus.version}")
private String version;

@Value("${campus.frameworkVersion}")
private String frameworkVersion;

/**
* 版本情况
*/
@RequestMapping("/version")
public R version() {
HashMap<String, String> map = new HashMap<>();
map.put("version", version);
map.put("frameworkVersion", frameworkVersion);
return R.ok(map);
}


}
1 change: 1 addition & 0 deletions campus-modular/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ campus:
name: campus-imaotai
# 版本
version: ${revision}
frameworkVersion: ${campus.revision}

server:
port: 8160
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<name>campus</name>
<url>http://campus.oddfar.com</url>
<description>校园信息墙</description>
<description>i茅台自动预约</description>

<modules>
<module>campus-common</module>
Expand All @@ -21,7 +21,8 @@
</modules>

<properties>
<revision>1.0.8</revision>
<revision>1.0.9</revision>
<campus.revision>1.1.6</campus.revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<bitwalker.version>1.21</bitwalker.version>
Expand Down
9 changes: 9 additions & 0 deletions vue_campus_admin/src/api/system/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import request from '@/utils/request'

// 版本情况
export function getVersion() {
return request({
url: '/version',
method: 'get',
})
}
28 changes: 22 additions & 6 deletions vue_campus_admin/src/views/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<div class="app-container home">
<p>当前版本{{ version }}</p>
<p></p>
<p>
本项目中所有内容只供学习和研究使用,不得将本项目中任何内容用于违反国家/地区/组织等的法律法规或相关规定的其他用途。
</p>
Expand All @@ -11,22 +9,38 @@
<p></p>
<p>本项目免费,无任何盈利</p>
<p>项目完全开源,更新地址:https://github.com/oddfar/campus-imaotai</p>

<el-card class="box-card">
<p>版本情况:</p>
<p>campus-imaotai:{{ version }}</p>
<p>campus框架:{{ frameworkVersion }}</p>
</el-card>
</div>
</template>

<script>
import {getVersion} from "@/api/system/index";
export default {
name: "Index",
data() {
return {
// 版本号
version: "1.0.8",
version: "",
frameworkVersion: "",
};
},
created() {
this.getVersion();
},
methods: {
goTarget(href) {
window.open(href, "_blank");
},
getVersion() {
getVersion().then((response) => {
this.version = response.data.version;
this.frameworkVersion = response.data.frameworkVersion;
}
);
}
},
};
</script>
Expand All @@ -39,12 +53,14 @@ export default {
font-size: 17.5px;
border-left: 5px solid #eee;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eee;
}
.col-item {
margin-bottom: 20px;
}
Expand Down

0 comments on commit 6f41b07

Please sign in to comment.