Browse Source

Merge remote-tracking branch 'origin/master'

master
x_ying 2 years ago
parent
commit
08b9110646
  1. 5
      .env.development
  2. 72
      src/api/inquiryMachine.js
  3. 7
      src/main.js
  4. 46
      src/utils/index.js
  5. 6
      src/utils/request.js
  6. 52
      src/views/activityFeed.vue
  7. 26
      src/views/libraryIntroduction.vue
  8. 4
      vue.config.js

5
.env.development

@ -3,9 +3,8 @@ ENV = 'development'
# 接口地址
#内网服务地址
VUE_APP_BASE_API = 'http://192.168.99.107:7070'
VUE_APP_WS_API = 'ws://192.168.99.107:7071'
VUE_APP_CAMERA_API = '192.168.99.107'
VUE_APP_BASE_API = 'http://192.168.99.84:8080'
VUE_APP_WS_API = 'ws://192.168.99.84:8080'
# 刘力-本地服地址
#VUE_APP_BASE_API = 'http://192.168.99.65:7070'

72
src/api/inquiryMachine.js

@ -0,0 +1,72 @@
import request from '@/utils/request'
// import qs from 'qs'
// 活动资讯/活动预告
export function activityInquiry(params) {
return request({
url: '/dxhtsg/activityInquiry',
method: 'get',
params: params
})
}
// 图书馆简介
export function libraryIntro(params) {
return request({
url: '/dxhtsg/libraryIntro',
method: 'get',
params: params
})
}
// 阅读之星
export function FetchBorrowStar(params) {
return request({
url: '/txhtsg/borrowStar',
method: 'get',
params: params
})
}
// 新书推荐
export function FetchNewBookRecommend(params) {
return request({
url: '/txhtsg/newBookRecommend',
method: 'get',
params: params
})
}
// 通知公告
export function FetchInitNotice(params) {
return request({
url: '/txhtsg/initNotice',
method: 'get',
params: params
})
}
// 进馆人数
export function FetchInitIntoNum(params) {
return request({
url: '/txhtsg/initIntoNum',
method: 'get',
params: params
})
}
// 24小时借还量
export function FetchHalfYearBRNum(params) {
return request({
url: '/txhtsg/getHalfYearBRNum',
method: 'get',
params: params
})
}
export default {
activityInquiry,
libraryIntro,
FetchBorrowStar,
FetchNewBookRecommend
}

7
src/main.js

@ -13,6 +13,13 @@ import './assets/fonts/fonts.css'
import axios from 'axios'
Vue.prototype.$axios = axios
// 馆代码
Vue.prototype.libcode = 'FTZN'
import { parseTime } from '@/utils/index.js'
Vue.filter('parseTime', function(time, cFormat) {
return parseTime(time, cFormat)
})
// 引入echart
import echarts from 'echarts'

46
src/utils/index.js

@ -44,3 +44,49 @@ export function getCurrentTime() {
const time = yy + '年' + mm + '月' + dd + '日 ' + hh + ':' + mf + ':' + ss
return time
}
/**
* Parse the time to string
* @param {(Object|string|number)} time
* @param {string} cFormat
* @returns {string}
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'undefined' || time === null || time === 'null') {
return ''
} else if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}

6
src/utils/request.js

@ -29,14 +29,16 @@ service.interceptors.request.use(
// response 拦截器
service.interceptors.response.use(
response => {
const errorMsg = response.data.message
if (response.data.code === 200) {
const errorMsg = response.data.errMsg
if (response.status === 200) {
console.log(response.data.data)
return response.data.data
} else {
Message.error({
message: errorMsg,
duration: 5000
})
Promise.reject()
}
},
error => {

52
src/views/activityFeed.vue

@ -9,35 +9,43 @@
</div>
<div class="introduction-info">
<ul class="activity-list">
<li>建国70周年读者活动安排<span>2022-06-31</span></li>
<li>建国70周年读者活动安排<span>2022-06-31</span></li>
<li>建国70周年读者活动安排<span>2022-06-31</span></li>
<li>建国70周年读者活动安排<span>2022-06-31</span></li>
<li v-for="(item,index) in infoList" :key="index">
<div class="activity-title">{{ item.overTitle?item.overTitle:'' }}</div><span class="date">{{ item.createTime | parseTime }}</span>
</li>
</ul>
</div>
</div>
</template>
<script>
import data from './libraryIntroductionData'
import { activityInquiry } from '@/api/inquiryMachine'
export default {
name: 'LibraryIntroduction',
name: 'ActivityFeed',
data() {
return {
rankingList: [],
selectMenuIndex: 0,
rawHtml: ''
infoList: [],
selectMenuIndex: 0
}
},
created() {
this.rawHtml = data.html
},
mounted() {
this.getActivityInfo()
},
methods: {
selectMenuChange(index) {
this.selectMenuIndex = index
this.getActivityInfo()
},
getActivityInfo() {
let introType
if (this.selectMenuIndex === 0) {
introType = 20
} else {
introType = 23
}
activityInquiry({ introType: introType, libcode: this.libcode, pageSize: 99 }).then(data => {
this.infoList = data[0]
})
}
}
}
@ -45,7 +53,7 @@ export default {
<style lang="scss" scoped>
@import "~@/assets/styles/index.scss";
.introduction-main{
.introduction-main {
padding: 30px 40px;
.nav-menu {
background: #ffffff;
@ -61,7 +69,7 @@ export default {
text-align: center;
margin-bottom: 20px;
&:hover {
background: #E4E4E4;
background: #e4e4e4;
}
&.is-active {
background: linear-gradient(
@ -79,6 +87,7 @@ export default {
margin-left: 30px;
background: #ffffff;
width: 1510px;
overflow-y: auto;
.info-title {
height: 100px;
text-align: center;
@ -89,19 +98,26 @@ export default {
line-height: 100px;
}
.info-img {
background: url('~@/assets/images/top.png') no-repeat center -5px;
background: url("~@/assets/images/top.png") no-repeat center -5px;
}
}
}
.activity-list li{
.activity-list li {
height: 90px;
margin: 0 40px;
border-bottom: 1px solid #D9D9D9;
border-bottom: 1px solid #d9d9d9;
font-size: 30px;
line-height: 90px;
padding: 0 20px;
span{
span.date {
float: right;
}
.activity-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: calc(100% - 282px);
display: inline-block;
}
}
</style>

26
src/views/libraryIntroduction.vue

@ -18,25 +18,35 @@
</template>
<script>
import data from './libraryIntroductionData'
import { libraryIntro } from '@/api/inquiryMachine'
export default {
name: 'LibraryIntroduction',
data() {
return {
rankingList: [],
selectMenuIndex: 0,
rawHtml: ''
}
},
created() {
this.rawHtml = data.html
},
mounted() {
this.getIntroductionInfo()
},
methods: {
selectMenuChange(index) {
this.selectMenuIndex = index
this.getIntroductionInfo()
},
getIntroductionInfo() {
let introType
if (this.selectMenuIndex === 0) {
introType = 1
} else {
introType = 2
}
libraryIntro({ introType: introType, libcode: this.libcode }).then(res => {
console.log(res)
this.rawHtml = res
})
}
}
}
@ -44,7 +54,7 @@ export default {
<style lang="scss" scoped>
@import "~@/assets/styles/index.scss";
.introduction-main{
.introduction-main {
padding: 30px 40px;
.nav-menu {
background: #ffffff;
@ -60,7 +70,7 @@ export default {
text-align: center;
margin-bottom: 20px;
&:hover {
background: #E4E4E4;
background: #e4e4e4;
}
&.is-active {
background: linear-gradient(
@ -88,7 +98,7 @@ export default {
line-height: 100px;
}
.info-img {
background: url('~@/assets/images/top.png') no-repeat center -5px;
background: url("~@/assets/images/top.png") no-repeat center -5px;
}
}
}

4
vue.config.js

@ -17,11 +17,11 @@ module.exports = {
errors: true
},
proxy: {
'/api': {
'/dxhtsg': {
target: process.env.VUE_APP_BASE_API,
changeOrigin: true,
pathRewrite: {
'^/api': 'api'
'^/dxhtsg': 'dxhtsg'
}
},
'/auth': {

Loading…
Cancel
Save