Skip to content

Commit e885681

Browse files
committed
Merge branch 'develop'
2 parents bd1e63b + fc4a2a2 commit e885681

File tree

10 files changed

+158
-11
lines changed

10 files changed

+158
-11
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Laravel Vue admin 管理系统
1010
### 主要技术栈
1111

1212
- 后端框架: Laravel 5.5.x
13-
- 前端 MVVM 框架: Vue 2.5.x
14-
- 开发工作流: Webpack 4.x
13+
- 前端 MVVM 框架: Vue 2.6.10
14+
- 前端构建: Vue-cli
1515
- 路由: Vue-Router 3.x
1616
- 数据交互: Axios
1717
- 代码风格检测: Eslint
18-
- UI框架: Element-UI 2.4.11
18+
- UI框架: Element-UI 2.7.2
1919
- Laravel 的运行环境要求 PHP5.6 以上。
2020

2121
## 案例演示

admin/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"git": "git add ../laravel/public/static/* && git add ../laravel/public/index.html && git commit -m \"chore(view): 构建前端\"",
1616
"test:unit": "jest --clearCache && vue-cli-service test:unit",
1717
"test:ci": "npm run lint && npm run test:unit",
18-
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
18+
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
19+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w -r 0"
1920
},
2021
"dependencies": {
2122
"axios": ">=0.18.1",
@@ -36,7 +37,7 @@
3637
"@babel/core": "7.0.0",
3738
"@babel/register": "7.0.0",
3839
"@vue/cli-plugin-babel": "3.6.0",
39-
"@vue/cli-plugin-eslint": "3.6.0",
40+
"@vue/cli-plugin-eslint": "^3.9.1",
4041
"@vue/cli-plugin-unit-jest": "3.6.3",
4142
"@vue/cli-service": "3.6.0",
4243
"@vue/test-utils": "1.0.0-beta.29",
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<template>
2+
<div
3+
ref="div"
4+
class="ys-float-btn"
5+
:style="{'width':itemWidth+'px','height':itemHeight+'px','left':left+'px','top':top+'px'}"
6+
@click="onBtnClicked"
7+
>
8+
<slot name="icon" />
9+
<p :style="{'font-size': fontSize+'px'}">{{ text }}</p>
10+
</div>
11+
</template>
12+
13+
<script>
14+
export default {
15+
name: 'FloatButton',
16+
props: {
17+
text: {
18+
type: String,
19+
default: '默认文字'
20+
},
21+
itemWidth: {
22+
type: Number,
23+
default: 60
24+
},
25+
itemHeight: {
26+
type: Number,
27+
default: 60
28+
},
29+
gapWidth: {
30+
type: Number,
31+
default: 10
32+
},
33+
coefficientHeight: {
34+
type: Number,
35+
default: 0.8
36+
},
37+
fontSize: {
38+
type: Number,
39+
default: 12
40+
}
41+
},
42+
data() {
43+
return {
44+
timer: null,
45+
currentTop: 0,
46+
clientWidth: 0,
47+
clientHeight: 0,
48+
left: 0,
49+
top: 0
50+
}
51+
},
52+
created() {
53+
this.clientWidth = document.documentElement.clientWidth
54+
this.clientHeight = document.documentElement.clientHeight
55+
this.left = this.clientWidth - this.itemWidth - this.gapWidth
56+
this.top = this.clientHeight * this.coefficientHeight
57+
},
58+
mounted() {
59+
window.addEventListener('scroll', this.handleScrollStart)
60+
this.$nextTick(() => {
61+
const div = this.$refs.div
62+
div.addEventListener('touchstart', () => {
63+
div.style.transition = 'none'
64+
})
65+
div.addEventListener('touchmove', (e) => {
66+
if (e.targetTouches.length === 1) {
67+
const touch = event.targetTouches[0]
68+
this.left = touch.clientX - this.itemWidth / 2
69+
this.top = touch.clientY - this.itemHeight / 2
70+
}
71+
})
72+
div.addEventListener('touchend', () => {
73+
div.style.transition = 'all 0.3s'
74+
if (this.left > this.clientWidth / 2) {
75+
this.left = this.clientWidth - this.itemWidth - this.gapWidth
76+
} else {
77+
this.left = this.gapWidth
78+
}
79+
})
80+
})
81+
},
82+
beforeDestroy() {
83+
window.removeEventListener('scroll', this.handleScrollStart)
84+
},
85+
methods: {
86+
onBtnClicked() {
87+
this.$emit('onFloatBtnClicked')
88+
},
89+
handleScrollStart() {
90+
this.timer && clearTimeout(this.timer)
91+
this.timer = setTimeout(() => {
92+
this.handleScrollEnd()
93+
}, 300)
94+
this.currentTop = document.documentElement.scrollTop || document.body.scrollTop
95+
if (this.left > this.clientWidth / 2) {
96+
this.left = this.clientWidth - this.itemWidth / 2
97+
} else {
98+
this.left = -this.itemWidth / 2
99+
}
100+
},
101+
handleScrollEnd() {
102+
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
103+
if (scrollTop === this.currentTop) {
104+
if (this.left > this.clientWidth / 2) {
105+
this.left = this.clientWidth - this.itemWidth - this.gapWidth
106+
} else {
107+
this.left = this.gapWidth
108+
}
109+
clearTimeout(this.timer)
110+
}
111+
}
112+
}
113+
}
114+
</script>
115+
116+
<style scoped>
117+
.ys-float-btn {
118+
background: rgb(255, 255, 255);
119+
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
120+
border-radius: 50%;
121+
color: #666666;
122+
z-index: 20;
123+
transition: all 0.3s;
124+
125+
display: flex;
126+
flex-direction: column;
127+
justify-content: center;
128+
align-items: center;
129+
130+
position: fixed;
131+
bottom: 20vw;
132+
}
133+
134+
.ys-float-btn img {
135+
width: 50%;
136+
height: 50%;
137+
object-fit: contain;
138+
margin-bottom: 3px;
139+
}
140+
141+
</style>

admin/src/views/home/line.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,21 @@
2222
<el-table-column prop="carCode" label="车牌" width="" />
2323
<el-table-column prop="ArrivalTime" label="进站时间" width="" />
2424
</el-table>
25+
26+
<float-button :text="Flush" :font-size="16" @onFloatBtnClicked="handleReload()" />
2527
</div>
2628
</template>
2729

2830
<script>
2931
import request from '@/utils/request'
3032
import fieldSet from '../../components/common/fieldSet'
33+
import FloatButton from '../../components/FloatButton'
3134
3235
export default {
3336
name: 'Lines',
3437
components: {
35-
fieldSet
38+
fieldSet,
39+
FloatButton
3640
},
3741
data() {
3842
return {
@@ -42,7 +46,8 @@ export default {
4246
to: '',
4347
href: '',
4448
tableData: [],
45-
tableLine: []
49+
tableLine: [],
50+
Flush: '刷新'
4651
}
4752
},
4853
created() {

0 commit comments

Comments
 (0)