├── style
└── global.wxss
├── pages
├── login
│ ├── login.json
│ ├── userprotocol.json
│ ├── userprotocol.wxss
│ ├── login.wxss
│ ├── userprotocol.wxml
│ ├── userprotocol.js
│ ├── login.wxml
│ └── login.js
├── seats
│ ├── seats.json
│ ├── seats.wxss
│ ├── seats.wxml
│ └── seats.js
├── detail
│ ├── an_paying.json
│ ├── an_success.json
│ ├── cancelled.json
│ ├── cashing.json
│ ├── failed.json
│ ├── paying.json
│ ├── success.json
│ ├── failed.wxss
│ ├── cancelled.wxss
│ ├── rushing.json
│ ├── an_paying.wxss
│ ├── paying.wxss
│ ├── success.wxss
│ ├── an_success.wxss
│ ├── cashing.wxss
│ ├── failed.wxml
│ ├── cancelled.wxml
│ ├── rushing.wxml
│ ├── failed.js
│ ├── cancelled.js
│ ├── paying.js
│ ├── an_paying.js
│ ├── success.js
│ ├── cashing.js
│ ├── an_success.js
│ ├── paying.wxml
│ ├── rushing.js
│ ├── success.wxml
│ ├── an_paying.wxml
│ ├── cashing.wxml
│ ├── an_success.wxml
│ └── rushing.wxss
├── index
│ ├── index.json
│ ├── index.wxss
│ ├── index.wxml
│ └── index.js
├── station
│ ├── station.json
│ ├── station.wxml
│ └── station.wxss
├── order
│ ├── dualorder.json
│ ├── order.json
│ ├── order.wxss
│ ├── order.wxml
│ ├── dualorder.wxss
│ ├── dualorder.wxml
│ ├── order.js
│ └── dualorder.js
├── people
│ ├── people.json
│ ├── people.wxss
│ ├── people.wxml
│ └── people.js
├── rushType
│ ├── rushType.json
│ ├── rushType.wxss
│ ├── rushType.wxml
│ └── rushType.js
├── dates
│ ├── dates.json
│ ├── dates.wxss
│ ├── dates.wxml
│ └── dates.js
├── submit
│ ├── submit.wxss
│ ├── submit.json
│ ├── submit.wxml
│ └── submit.js
└── trains
│ ├── trains.json
│ ├── trains.wxss
│ ├── trains.wxml
│ └── trains.js
├── image
├── home_1.png
├── home_2.png
├── icon_1.png
├── icon_10.png
├── icon_11.png
├── icon_12.png
├── icon_13.png
├── icon_14.png
├── icon_15.png
├── icon_16.png
├── icon_17.png
├── icon_18.png
├── icon_19.jpg
├── icon_2.jpeg
├── icon_20.png
├── icon_21.png
├── icon_22.jpg
├── icon_23.png
├── icon_24.png
├── icon_25.png
├── icon_3.jpeg
├── icon_4.png
├── icon_5.png
├── icon_6.png
├── icon_7.png
├── icon_8.png
├── icon_9.png
├── dingdan_1.png
└── dingdan_2.png
├── sitemap.json
├── .gitignore
├── project.config.json
├── app.js
├── LICENSE
├── app.json
├── config.js
├── README.md
├── app.wxss
├── 环境搭建教程.md
└── utils
└── util.js
/style/global.wxss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/pages/login/login.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/seats/seats.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/an_paying.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/an_success.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/cancelled.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/cashing.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/failed.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/paying.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/detail/success.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/pages/station/station.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/image/home_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/home_1.png
--------------------------------------------------------------------------------
/image/home_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/home_2.png
--------------------------------------------------------------------------------
/image/icon_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_1.png
--------------------------------------------------------------------------------
/image/icon_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_10.png
--------------------------------------------------------------------------------
/image/icon_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_11.png
--------------------------------------------------------------------------------
/image/icon_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_12.png
--------------------------------------------------------------------------------
/image/icon_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_13.png
--------------------------------------------------------------------------------
/image/icon_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_14.png
--------------------------------------------------------------------------------
/image/icon_15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_15.png
--------------------------------------------------------------------------------
/image/icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_16.png
--------------------------------------------------------------------------------
/image/icon_17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_17.png
--------------------------------------------------------------------------------
/image/icon_18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_18.png
--------------------------------------------------------------------------------
/image/icon_19.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_19.jpg
--------------------------------------------------------------------------------
/image/icon_2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_2.jpeg
--------------------------------------------------------------------------------
/image/icon_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_20.png
--------------------------------------------------------------------------------
/image/icon_21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_21.png
--------------------------------------------------------------------------------
/image/icon_22.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_22.jpg
--------------------------------------------------------------------------------
/image/icon_23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_23.png
--------------------------------------------------------------------------------
/image/icon_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_24.png
--------------------------------------------------------------------------------
/image/icon_25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_25.png
--------------------------------------------------------------------------------
/image/icon_3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_3.jpeg
--------------------------------------------------------------------------------
/image/icon_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_4.png
--------------------------------------------------------------------------------
/image/icon_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_5.png
--------------------------------------------------------------------------------
/image/icon_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_6.png
--------------------------------------------------------------------------------
/image/icon_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_7.png
--------------------------------------------------------------------------------
/image/icon_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_8.png
--------------------------------------------------------------------------------
/image/icon_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/icon_9.png
--------------------------------------------------------------------------------
/pages/order/dualorder.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "enablePullDownRefresh": true
4 | }
--------------------------------------------------------------------------------
/pages/order/order.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "enablePullDownRefresh": true
4 | }
--------------------------------------------------------------------------------
/image/dingdan_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/dingdan_1.png
--------------------------------------------------------------------------------
/image/dingdan_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/15207135348/qiangpiaojiang/HEAD/image/dingdan_2.png
--------------------------------------------------------------------------------
/pages/people/people.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarTitleText": "选择乘客"
4 | }
--------------------------------------------------------------------------------
/pages/rushType/rushType.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarTitleText": "选择抢票方式"
4 | }
--------------------------------------------------------------------------------
/pages/dates/dates.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "calendar": "plugin://calendar/calendar"
4 | }
5 | }
--------------------------------------------------------------------------------
/pages/login/userprotocol.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarTitleText": "账户授权协议",
4 | "backgroundTextStyle": "light"
5 | }
--------------------------------------------------------------------------------
/pages/detail/failed.wxss:
--------------------------------------------------------------------------------
1 | .center{
2 | text-align: center;
3 | }
4 | .height150{
5 | height: 170px;
6 | }
7 | .large-margin-top{
8 | margin-top: 20px;
9 | }
--------------------------------------------------------------------------------
/pages/seats/seats.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-color: white;
3 | }
4 | .position-bottom{
5 | width: 90%;
6 | left: 5%;
7 | position: fixed;
8 | bottom: 0px;
9 | }
--------------------------------------------------------------------------------
/pages/submit/submit.wxss:
--------------------------------------------------------------------------------
1 | .head{
2 | width: 100%;
3 | height: 150px;
4 | background-color: #4169E1;
5 | }
6 | .light-background{
7 | background-color:rgba(58, 120, 202, 0.623);
8 | }
--------------------------------------------------------------------------------
/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/pages/detail/cancelled.wxss:
--------------------------------------------------------------------------------
1 | /* pages/detail/cancelled.wxss */
2 | .center{
3 | text-align: center;
4 | }
5 | .height150{
6 | height: 170px;
7 | }
8 | .large-margin-top{
9 | margin-top: 20px;
10 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows
2 | [Dd]esktop.ini
3 | Thumbs.db
4 | $RECYCLE.BIN/
5 |
6 | # macOS
7 | .DS_Store
8 | .fseventsd
9 | .Spotlight-V100
10 | .TemporaryItems
11 | .Trashes
12 |
13 | # Node.js
14 | node_modules/
15 |
--------------------------------------------------------------------------------
/pages/detail/rushing.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarBackgroundColor": "#4169E1",
4 | "navigationBarTextStyle": "white",
5 | "navigationBarTitleText": "订单详情",
6 | "backgroundTextStyle": "light"
7 | }
--------------------------------------------------------------------------------
/pages/submit/submit.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarBackgroundColor": "#4169E1",
4 | "navigationBarTextStyle": "white",
5 | "navigationBarTitleText": "订单填写",
6 | "backgroundTextStyle": "light"
7 | }
--------------------------------------------------------------------------------
/pages/trains/trains.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {},
3 | "navigationBarBackgroundColor": "#4169E1",
4 | "navigationBarTextStyle": "white",
5 | "navigationBarTitleText": "选择车次",
6 | "backgroundTextStyle": "light"
7 | }
--------------------------------------------------------------------------------
/pages/login/userprotocol.wxss:
--------------------------------------------------------------------------------
1 | /* pages/login/userprotocol.wxss */
2 | page {
3 | background-color: white;
4 | }
5 | .margin15{
6 | margin-left: 18px;
7 | margin-right: 18px;
8 | margin-top: 18px;
9 | margin-bottom: 18px;
10 | }
--------------------------------------------------------------------------------
/pages/login/login.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: white;
3 | }
4 |
5 | .line-left {
6 | display: flex;
7 | justify-content: left;
8 | align-items: center;
9 | }
10 |
11 | .margin-left-right{
12 | margin-left: 10px;
13 | margin-right: 10px;
14 | }
--------------------------------------------------------------------------------
/pages/people/people.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-color: white;
3 | }
4 | .position-bottom{
5 | width: 90%;
6 | left: 5%;
7 | position: fixed;
8 | bottom: 0px;
9 | }
10 | .line {
11 | display: flex;
12 | align-items: center;
13 | text-align: left;
14 | justify-content: left;
15 | }
--------------------------------------------------------------------------------
/pages/rushType/rushType.wxss:
--------------------------------------------------------------------------------
1 | /* pages/rushType/rushType.wxss */
2 | page{
3 | background-color: white;
4 | }
5 | .position-bottom{
6 | width: 90%;
7 | left: 5%;
8 | position: fixed;
9 | bottom: 0px;
10 | }
11 | .line {
12 | display: flex;
13 | align-items: center;
14 | text-align: left;
15 | justify-content: left;
16 | }
--------------------------------------------------------------------------------
/pages/dates/dates.wxss:
--------------------------------------------------------------------------------
1 | .title {
2 | text-align: left;
3 | display: block;
4 | color: grey;
5 | font-size: x-small;
6 | padding-top: 10px;
7 | padding-bottom: 10px;
8 | padding-left: 15px;
9 | padding-right: 15px;
10 | }
11 |
12 | .demo5 {
13 | padding: 15px;
14 | }
15 |
16 | .demo5-calendar {
17 | background-color: white;
18 | padding-top: 10px;
19 | }
20 |
21 | .demo5-header {
22 | font-size: large;
23 | color: #59518d;
24 | }
25 |
26 | .demo5-board {
27 | color: #c7cbe2;
28 | font-weight: bold;
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/pages/detail/an_paying.wxss:
--------------------------------------------------------------------------------
1 | .height70{
2 | height: 70px;
3 | }
4 | .line-left {
5 | display: flex;
6 | justify-content: left;
7 | align-items: center;
8 | }
9 |
10 | .line {
11 | display: flex;
12 | justify-content: space-between;
13 | align-items: center;
14 | }
15 |
16 | .line-right {
17 | display: flex;
18 | justify-content: right;
19 | align-items: center;
20 | }
21 | .small-padding{
22 | padding-top: 7px;
23 | padding-bottom: 7px;
24 | padding-left: 10px;
25 | padding-right: 10px;
26 | }
27 | .background-lightblue{
28 | background-color: lightblue;
29 | }
30 | .center{
31 | align-items: center;
32 | }
--------------------------------------------------------------------------------
/pages/detail/paying.wxss:
--------------------------------------------------------------------------------
1 | .height70{
2 | height: 70px;
3 | }
4 | .line-left {
5 | display: flex;
6 | justify-content: left;
7 | align-items: center;
8 | }
9 |
10 | .line {
11 | display: flex;
12 | justify-content: space-between;
13 | align-items: center;
14 | }
15 |
16 | .line-right {
17 | display: flex;
18 | justify-content: right;
19 | align-items: center;
20 | }
21 | .small-padding{
22 | padding-top: 7px;
23 | padding-bottom: 7px;
24 | padding-left: 10px;
25 | padding-right: 10px;
26 | }
27 | .background-lightblue{
28 | background-color: lightblue;
29 | }
30 | .center{
31 | align-items: center;
32 | }
--------------------------------------------------------------------------------
/pages/detail/success.wxss:
--------------------------------------------------------------------------------
1 | /* pages/detail/success.wxss */
2 | .height70{
3 | height: 70px;
4 | }
5 | .line-left {
6 | display: flex;
7 | justify-content: left;
8 | align-items: center;
9 | }
10 |
11 | .line {
12 | display: flex;
13 | justify-content: space-between;
14 | align-items: center;
15 | }
16 |
17 | .line-right {
18 | display: flex;
19 | justify-content: right;
20 | align-items: center;
21 | }
22 | .small-padding{
23 | padding-top: 7px;
24 | padding-bottom: 7px;
25 | padding-left: 10px;
26 | padding-right: 10px;
27 | }
28 | .background-lightblue{
29 | background-color: lightblue;
30 | }
31 | .center{
32 | align-items: center;
33 | }
--------------------------------------------------------------------------------
/pages/order/order.wxss:
--------------------------------------------------------------------------------
1 | .xxxsmall-icon{
2 | height: 14px;
3 | width: 14px;
4 | }
5 | .success-color{
6 | color: rgb(17, 165, 17);
7 | }
8 | .rushing-color{
9 | color: #1296db;
10 | }
11 | .failed-color{
12 | color: gray;
13 | }
14 | .cancelled-color{
15 | color: gray;
16 | }
17 | .column {
18 | display: flex;
19 | flex-direction: column;
20 | justify-content: space-between;
21 | }
22 | .large-icon{
23 | height: 80px;
24 | width: 80px;
25 | }
26 | .background-no-order{
27 | position: absolute;
28 | top: 150px;
29 | width: 100%;
30 | text-align: center;
31 | color: gray;
32 |
33 | }
34 | .background-has-order{
35 | display: none;
36 | }
--------------------------------------------------------------------------------
/pages/detail/an_success.wxss:
--------------------------------------------------------------------------------
1 | /* pages/detail/an_success.wxss */
2 | .height70{
3 | height: 70px;
4 | }
5 | .line-left {
6 | display: flex;
7 | justify-content: left;
8 | align-items: center;
9 | }
10 |
11 | .line {
12 | display: flex;
13 | justify-content: space-between;
14 | align-items: center;
15 | }
16 |
17 | .line-right {
18 | display: flex;
19 | justify-content: right;
20 | align-items: center;
21 | }
22 | .small-padding{
23 | padding-top: 7px;
24 | padding-bottom: 7px;
25 | padding-left: 10px;
26 | padding-right: 10px;
27 | }
28 | .background-lightblue{
29 | background-color: lightblue;
30 | }
31 | .center{
32 | align-items: center;
33 | }
--------------------------------------------------------------------------------
/pages/detail/cashing.wxss:
--------------------------------------------------------------------------------
1 | /* pages/detail/an_success.wxss */
2 | .height70{
3 | height: 70px;
4 | }
5 | .line-left {
6 | display: flex;
7 | justify-content: left;
8 | align-items: center;
9 | }
10 |
11 | .line {
12 | display: flex;
13 | justify-content: space-between;
14 | align-items: center;
15 | }
16 |
17 | .line-right {
18 | display: flex;
19 | justify-content: right;
20 | align-items: center;
21 | }
22 | .small-padding{
23 | padding-top: 7px;
24 | padding-bottom: 7px;
25 | padding-left: 10px;
26 | padding-right: 10px;
27 | }
28 | .background-lightblue{
29 | background-color: lightblue;
30 | }
31 | .center{
32 | align-items: center;
33 | }
--------------------------------------------------------------------------------
/pages/dates/dates.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 30天之后的票可以预约抢票,开售自动抢支持选多个日期,可大幅度提升成功率
4 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/pages/seats/seats.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 您可以多选几个坐席,这样抢票成功率更高。选择后暂收最高票价,出票后视实际情况退还差额。
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{item}}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | .head {
2 | width: 100%;
3 | }
4 | .body {
5 | position: absolute;
6 | top: 110px;
7 | width: 94%;
8 | left: 3%;
9 | border-radius: 5px;
10 | background-color: white;
11 | padding-top: 10px;
12 | }
13 |
14 | input {
15 | height: 30px;
16 | background-color:white;
17 | font-size: 14px;
18 | }
19 |
20 | .sites {
21 | width: 100rpx;
22 | background-color: #ddd;
23 | }
24 | .special-icon{
25 | height: 24px;
26 | width: 24px;
27 | padding: 6px;
28 | }
29 | .float-right{
30 | float: right;
31 | }
32 |
33 | .middle-margin-left-right-bottom{
34 | margin-left: 10px;
35 | margin-right: 10px;
36 | margin-bottom: 10px;
37 | }
38 | .middle-padding-left-right-bottom{
39 | padding-left: 4px;
40 | padding-right: 4px;
41 | padding-bottom: 8px;
42 | }
--------------------------------------------------------------------------------
/pages/trains/trains.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-color: white;
3 | }
4 | image{
5 | width: 45px;
6 | height: 5px;
7 | }
8 | .column {
9 | display: flex;
10 | flex-direction: column;
11 | justify-content: space-between;
12 | }
13 | .center {
14 | text-align: center;
15 | }
16 | .right {
17 | text-align: right;
18 | }
19 | .large-margin-left{
20 | margin-left: 15%;
21 | }
22 | .large-margin-right{
23 | margin-right: 15%;
24 | }
25 | .position-bottom{
26 | width: 90%;
27 | left: 5%;
28 | position: fixed;
29 | bottom: 0px;
30 | }
31 | .margin-left20{
32 | margin-left: 20px;
33 | }
34 | .margin-right20{
35 | margin-right: 20px;
36 | }
37 | .margin-top7{
38 | margin-top: 7.5px;
39 | }
40 | .margin-bottom7{
41 | margin-bottom: 7.5px;
42 | }
43 | .margin-right6{
44 | margin-right: 6px;
45 | }
--------------------------------------------------------------------------------
/pages/station/station.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{item.cityName}}
8 |
9 |
10 |
11 |
12 | {{item.cityName}}
13 | {{item.cityName}}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": true,
9 | "postcss": true,
10 | "minified": true,
11 | "newFeature": true,
12 | "autoAudits": false,
13 | "coverView": true
14 | },
15 | "compileType": "miniprogram",
16 | "libVersion": "2.9.1",
17 | "appid": "wxb81ef370325715b1",
18 | "projectname": "qiangpiaojiang",
19 | "debugOptions": {
20 | "hidedInDevtools": []
21 | },
22 | "isGameTourist": false,
23 | "simulatorType": "wechat",
24 | "simulatorPluginLibVersion": {},
25 | "condition": {
26 | "search": {
27 | "current": -1,
28 | "list": []
29 | },
30 | "conversation": {
31 | "current": -1,
32 | "list": []
33 | },
34 | "game": {
35 | "currentL": -1,
36 | "list": []
37 | },
38 | "miniprogram": {
39 | "current": -1,
40 | "list": []
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/pages/login/userprotocol.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 1.本平台不是火车票委托预定合同的权利义务主体,不介入用户同服务方或12306之间的购票纠纷,但本平台将提供一切协助,保护用户的合法权益。
7 |
8 |
9 |
10 | 2.本平台暂不提供改签、退票和先付款安心抢服务。只会在抢到票的同时,通知您前往12306进行支付,如果因您超时未支付导致出票失败,本平台概不负责。
11 |
12 |
13 |
14 | 3.用户账户、密码安全性:用户本人具有对用户名和密码保密对义务,并对该用户名和密码下发生所有的活动负责。请您根据服务要求,提供准确的个人信息,并确保您个人信息同本平台信息保持一致,因您提供信息不真实或个人随意更改而导致的问题,由您个人自行承担相应的后果。如因您个人修改了用户名和密码而导致退票而无法正常进行的损失将由用户自行承担。
15 |
16 |
17 |
18 | 4.用户隐私制度:本平台尊重并保护用户个人隐私,您使用或注册的用户名、邮箱、地址等涉及个人资料的部分。非经您个人许可或依据相关法律、法规的强制性规定,本平台不会主动泄漏给第三方。
19 |
20 |
21 |
22 | 5.用户了解并同意:为了更好的为您提供火车票代购服务,一旦您选择了12306购票服务,您同意将您的12306账号和密码授权给本平台,允许本平台使用您的12306账户和密码登陆,并完成火车票预定等操作。对于您的隐私信息及相关交易信息,本平台会严格按照平台隐私政策进行保护。
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pages/rushType/rushType.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 同时选择两种即为双通道抢票
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | {{item}}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/pages/login/userprotocol.js:
--------------------------------------------------------------------------------
1 | // pages/login/userprotocol.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 |
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 |
16 | },
17 |
18 | /**
19 | * 生命周期函数--监听页面初次渲染完成
20 | */
21 | onReady: function () {
22 |
23 | },
24 |
25 | /**
26 | * 生命周期函数--监听页面显示
27 | */
28 | onShow: function () {
29 |
30 | },
31 |
32 | /**
33 | * 生命周期函数--监听页面隐藏
34 | */
35 | onHide: function () {
36 |
37 | },
38 |
39 | /**
40 | * 生命周期函数--监听页面卸载
41 | */
42 | onUnload: function () {
43 |
44 | },
45 |
46 | /**
47 | * 页面相关事件处理函数--监听用户下拉动作
48 | */
49 | onPullDownRefresh: function () {
50 |
51 | },
52 |
53 | /**
54 | * 页面上拉触底事件的处理函数
55 | */
56 | onReachBottom: function () {
57 |
58 | },
59 |
60 | /**
61 | * 用户点击右上角分享
62 | */
63 | onShareAppMessage: function () {
64 |
65 | }
66 | })
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | var config = require('config.js');
2 | //app.js
3 | App({
4 | globalData: {
5 | userInfo: null
6 | },
7 | onLaunch: function () {
8 | // 获取用户信息
9 | wx.getSetting({
10 | success: res => {
11 | if (res.authSetting['scope.userInfo']) {
12 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
13 | wx.getUserInfo({
14 | success: res => {
15 | // 可以将 res 发送给后台解码出 unionId
16 | console.log(res.userInfo)
17 | this.globalData.userInfo = res.userInfo
18 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
19 | // 所以此处加入 callback 以防止这种情况
20 | if (this.userInfoReadyCallback) {
21 | this.userInfoReadyCallback(res)
22 | }
23 | }
24 | })
25 | }
26 | }
27 | })
28 | }
29 | })
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 yangyun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/pages/order/order.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 您当前没有相关订单~
4 |
5 |
6 |
7 |
8 |
9 | {{item.fromStation}}
10 |
11 | {{item.toStation}}
12 |
13 | 出发日期:{{item.dates}}
14 |
15 |
16 | {{item.status}}
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/pages/login/login.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 同意
21 | 《账户授权协议》
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/pages/rushType/rushType.js:
--------------------------------------------------------------------------------
1 | // pages/rushType/rushType.js
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | rushTypes:["实时抢票", "候补抢票"],
9 | checks: []
10 | },
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 | //初始化页面数据
16 | console.log("rushType onLoad")
17 | },
18 |
19 | checkboxChange: function (e) {
20 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
21 | this.setData({
22 | checks: e.detail.value
23 | })
24 | },
25 |
26 | bindtapOK: function (e) {
27 | console.log('bindtapOK')
28 | console.log('选择但抢票方式' + this.data.checks)
29 | let checks = this.data.checks
30 | let rushTypes = this.data.rushTypes
31 | let selectedRushTypes = []
32 | for (var i = 0; i < checks.length; ++i) {
33 | let index = Number(checks[i])
34 | selectedRushTypes.push(rushTypes[index])
35 | }
36 | console.log("选择的抢票方式:")
37 | console.log(selectedRushTypes)
38 | console.log("rushType页面跳回submit页面")
39 | let eventChannel = this.getOpenerEventChannel();
40 | wx.navigateBack({
41 | delta: 1,
42 | success: function (res) {
43 | console.log("携带参数")
44 | console.log(selectedRushTypes)
45 | eventChannel.emit('okEvent', {
46 | data: selectedRushTypes
47 | });
48 | }
49 | });
50 | }
51 | })
--------------------------------------------------------------------------------
/pages/detail/failed.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 抢票失败
6 | 抢票时间已到期,任务自动停止
7 |
8 |
9 |
10 | 行程
11 | {{order.fromStation}}-{{order.toStation}}
12 |
13 |
14 | 日期
15 | {{order.dates}}
16 |
17 |
18 | 乘客
19 | {{order.people}}
20 |
21 |
22 | 车次
23 | {{order.trains}}
24 |
25 |
26 | 坐席
27 | {{order.seats}}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/pages/detail/cancelled.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 已取消
6 | 您的订单已取消,欢迎再次使用
7 |
8 |
9 |
10 | 行程
11 | {{order.fromStation}}-{{order.toStation}}
12 |
13 |
14 | 日期
15 | {{order.dates}}
16 |
17 |
18 | 乘客
19 | {{order.people}}
20 |
21 |
22 | 车次
23 | {{order.trains}}
24 |
25 |
26 | 坐席
27 | {{order.seats}}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/pages/detail/rushing.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{order.queryCount}}
4 | 我们已为您抢票{{order.queryCount}}次啦
5 | 抢票截止时间{{order.expireTime}},抢到票后将提醒您在25分钟内支付,超时将自动取消订单,请确保及时支付!
6 |
7 |
8 |
9 | 行程
10 | {{order.fromStation}}-{{order.toStation}}
11 |
12 |
13 | 日期
14 | {{order.dates}}
15 |
16 |
17 | 乘客
18 | {{order.people}}
19 |
20 |
21 | 车次
22 | {{order.trains}}
23 |
24 |
25 | 坐席
26 | {{order.seats}}
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/pages/order/dualorder.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | display: flex;
3 | flex-direction: column;
4 | height: 100%;
5 | }
6 |
7 | .navbar {
8 | flex: none;
9 | display: flex;
10 | background: #fff;
11 | font-size: 14px;
12 | color: #bbbbbb;
13 | }
14 |
15 | .navbar .item {
16 | position: relative;
17 | flex: auto;
18 | text-align: center;
19 | line-height: 90rpx;
20 | }
21 |
22 | .navbar .item.active {
23 | color: orange;
24 | }
25 |
26 | .navbar .item.active:after {
27 | content: "";
28 | display: block;
29 | position: absolute;
30 | bottom: 0;
31 | left: 0;
32 | right: 0;
33 | height: 5rpx;
34 | background: orange;
35 | }
36 |
37 | .swiper {
38 | height: 100%
39 | }
40 |
41 | .info {
42 | display: flex;
43 | justify-content: center;
44 | align-items: center;
45 | flex-direction: column;
46 | }
47 |
48 | .xxxsmall-icon {
49 | height: 14px;
50 | width: 14px;
51 | }
52 |
53 | .green {
54 | color: rgb(17, 165, 17);
55 | }
56 |
57 | .blue {
58 | color: #1296db;
59 | }
60 |
61 | .gray {
62 | color: gray;
63 | }
64 | .red {
65 | color: #d81e06;
66 | }
67 | .darkblue{
68 | color: #13227a;
69 | }
70 |
71 | .column {
72 | display: flex;
73 | flex-direction: column;
74 | justify-content: space-between;
75 | }
76 |
77 | .large-icon {
78 | height: 80px;
79 | width: 80px;
80 | }
81 |
82 | .background-no-order {
83 | position: absolute;
84 | top: 150px;
85 | width: 100%;
86 | text-align: center;
87 | color: gray;
88 | }
89 |
90 | .background-has-order {
91 | display: none;
92 | }
--------------------------------------------------------------------------------
/pages/people/people.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 如果需要添加新的乘车人,请前往12306添加!
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | {{item.name}}
16 | {{item.type}}
17 | {{item.tip}}
18 |
19 |
20 | {{item.idType}}
21 | {{item.idNo}}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/pages/station/station.wxss:
--------------------------------------------------------------------------------
1 | /* pages/station.wxss */
2 | .a-z{
3 | width: 35rpx;
4 | position: fixed;
5 | top: 112rpx;
6 | text-align: center;
7 | right: 5rpx;
8 | color: #3399CC;
9 | font-size: 30rpx;
10 | /* border: 1rpx solid #3399CC; */
11 | }
12 |
13 |
14 | .city-item-content {
15 | display: flex;
16 | flex-direction: column;
17 | justify-content: center;
18 | margin-top: 110rpx;
19 | background-color: #FFFFFF;
20 | }
21 |
22 | .city-item {
23 | background: #fff;
24 | /* margin-top: 5rpx; */
25 | width: 80%;
26 | padding-left: 5%;
27 | margin-left: 5%;
28 | height: 90rpx;
29 | font-size: 45rpx;
30 | line-height: 100rpx;
31 | border-bottom: 1rpx solid #CCCCCC;
32 | /* border:1rpx solid red; */
33 | }
34 |
35 | .city-item-A-Z{
36 | width: 100%;
37 | height: 40rpx;
38 | font-size: 30rpx;
39 | padding-left: 10%;
40 | background-color: #EEEEEE;
41 | border-top: 1rpx solid #CCCCCC;
42 | margin-top: -1rpx;
43 | }
44 |
45 |
46 | .search-box {
47 | top: 0;
48 | position: fixed;
49 | width: 100%;
50 | /* left:5%; */
51 | background: #eee;
52 | height: 110rpx;
53 | font-size: 30rpx;
54 | border-bottom:1rpx solid #DDDDDD;
55 | /* border: 1rpx solid red; */
56 | }
57 |
58 | .search-input {
59 | height: 70rpx;
60 | line-height: 60rpx;
61 | width: 80%;
62 | margin-left: 7.5%;
63 | border-radius: 20rpx;
64 | /* border: 1rpx solid red; */
65 | background: #fff;
66 | margin-top: 20rpx;
67 | padding-left: 5%;
68 | }
69 |
70 | .search-input-placeholder {
71 | text-align: center;
72 | }
--------------------------------------------------------------------------------
/pages/detail/failed.js:
--------------------------------------------------------------------------------
1 | // pages/detail/runing.js
2 | var config = require('../../config.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | order: {},
10 | },
11 |
12 | /**
13 | * 生命周期函数--监听页面加载
14 | */
15 | onLoad: function (options) {
16 | //初始化页面数据
17 | const that = this;
18 | const eventChannel = this.getOpenerEventChannel();
19 | eventChannel.on('data', function (data) {
20 | that.setData({
21 | order: data
22 | });
23 | console.log("failed页面收到order页面的数据:" + data)
24 | });
25 | },
26 |
27 | deleteOrder: function (e) {
28 | console.log("deleteOrder")
29 | let order = this.data.order;
30 | wx.showModal({
31 | title: '该操作不可逆,确定要删除订单吗?',
32 | showCancel: true,
33 | success(res) {
34 | if (res.confirm) {
35 | console.log('用户点击确定')
36 | config.get(config.urls.DELETE_ORDER_URL, {
37 | orderId: order.orderId
38 | }, function (res) {
39 | console.log(res)
40 | if (res.data.success) {
41 | wx.navigateBack({
42 | delta: 1,
43 | success: function (res) {
44 | console.log("返回order页面")
45 | }
46 | });
47 | }
48 | });
49 | } else if (res.cancel) {
50 | console.log('用户点击取消')
51 | }
52 | }
53 | })
54 | }
55 | })
--------------------------------------------------------------------------------
/pages/detail/cancelled.js:
--------------------------------------------------------------------------------
1 | // pages/detail/cancelled.js
2 | var config = require('../../config.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | order: {},
10 | },
11 |
12 | /**
13 | * 生命周期函数--监听页面加载
14 | */
15 | onLoad: function (options) {
16 | //初始化页面数据
17 | const that = this;
18 | const eventChannel = this.getOpenerEventChannel();
19 | eventChannel.on('data', function (data) {
20 | that.setData({
21 | order: data
22 | });
23 | console.log("cancelled页面收到order页面的数据:" + data)
24 | });
25 | },
26 |
27 | deleteOrder: function (e) {
28 | console.log("deleteOrder")
29 | let order = this.data.order;
30 | wx.showModal({
31 | title: '该操作不可逆,确定要删除订单吗?',
32 | showCancel: true,
33 | success(res) {
34 | if (res.confirm) {
35 | console.log('用户点击确定')
36 | config.get(config.urls.DELETE_ORDER_URL, {
37 | orderId: order.orderId
38 | }, function (res) {
39 | console.log(res)
40 | if (res.data.success) {
41 | wx.navigateBack({
42 | delta: 1,
43 | success: function (res) {
44 | console.log("返回order页面")
45 | }
46 | });
47 | }
48 | });
49 | } else if (res.cancel) {
50 | console.log('用户点击取消')
51 | }
52 | }
53 | })
54 | }
55 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/login/login",
5 | "pages/dates/dates",
6 | "pages/trains/trains",
7 | "pages/seats/seats",
8 | "pages/submit/submit",
9 | "pages/order/order",
10 | "pages/order/dualorder",
11 | "pages/detail/rushing",
12 | "pages/station/station",
13 | "pages/people/people",
14 | "pages/detail/success",
15 | "pages/detail/failed",
16 | "pages/detail/cancelled",
17 | "pages/login/userprotocol",
18 | "pages/rushType/rushType",
19 | "pages/detail/an_success",
20 | "pages/detail/paying",
21 | "pages/detail/an_paying",
22 | "pages/detail/cashing"
23 | ],
24 | "window": {
25 | "backgroundTextStyle": "dark",
26 | "navigationBarBackgroundColor": "#fff",
27 | "navigationBarTitleText": "抢票酱",
28 | "navigationBarTextStyle": "black"
29 | },
30 | "plugins": {
31 | "calendar": {
32 | "version": "1.1.3",
33 | "provider": "wx92c68dae5a8bb046"
34 | }
35 | },
36 | "tabBar": {
37 | "backgroundColor": "#efefef",
38 | "color": "#808080",
39 | "selectedColor": "#FFA500",
40 | "borderStyle": "white",
41 | "list": [
42 | {
43 | "selectedIconPath": "image/home_2.png",
44 | "iconPath": "image/home_1.png",
45 | "pagePath": "pages/index/index",
46 | "text": "首页"
47 | },
48 | {
49 | "selectedIconPath": "image/dingdan_2.png",
50 | "iconPath": "image/dingdan_1.png",
51 | "pagePath": "pages/order/dualorder",
52 | "text": "订单"
53 | }
54 | ]
55 | },
56 | "style": "v2",
57 | "sitemapLocation": "sitemap.json"
58 | }
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | // let basePath = 'https://yangyun.picp.vip';
2 | let basePath = 'https://yangyun.xiaomy.net';
3 | // let basePath = 'https://yangyun.xyz';
4 | let urls = {
5 | LOGIN_WX_URL: basePath + '/auth/login_wx',
6 | GET12306ACCOUNT_URL: basePath + '/auth/get_12306_account',
7 | SET12306ACCOUNT_URL: basePath + "/auth/set_12306_account",
8 | FUCK12306_URL: basePath + "/12306/fuck12306",
9 | GET_TRAINS_URL: basePath + "/12306/get_trains",
10 | GET_EXPIRE_TIME_URL: basePath + "/12306/get_expire_time",
11 | GET_ORDERS_URL: basePath + "/12306/get_orders",
12 | GET_PEOPLE_URL: basePath + "/12306/get_people",
13 | GET_QUERT_COUNT_URL: basePath + "/12306/get_query_count",
14 | CANCEL_ORDER_URL: basePath + "/12306/cancel_order",
15 | DELETE_ORDER_URL: basePath + "/12306/delete_order",
16 | GET_SUCCESS_ORDER_URL: basePath + "/12306/get_success_info",
17 | GET_SUCCESS_AN_ORDER_URL: basePath + "/12306/get_an_success_info",
18 | }
19 | var post = function (url, data, success) {
20 | var header = {
21 | 'content-type': 'application/json; charset=utf-8',
22 | 'cookie': wx.getStorageSync("sessionid")
23 | };
24 | wx.request({
25 | url: url,
26 | method: "POST",
27 | header: header,
28 | data: data,
29 | success(res) {
30 | var cookie = res.header["Set-Cookie"];
31 | if (cookie != null) {
32 | wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
33 | }
34 | success(res);
35 | }
36 | })
37 | }
38 | var get = function (url, data, success) {
39 | var header = {
40 | 'content-type': 'application/json; charset=utf-8',
41 | 'cookie': wx.getStorageSync("sessionid")
42 | };
43 | wx.request({
44 | url: url,
45 | method: "GET",
46 | header: header,
47 | data: data,
48 | success(res) {
49 | var cookie = res.header["Set-Cookie"];
50 | if (cookie != null) {
51 | wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
52 | }
53 | success(res);
54 | }
55 | })
56 | }
57 | module.exports = {
58 | urls: urls,
59 | get: get,
60 | post: post
61 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # qiangpiaojiang
2 |
3 | 这是一款基于Java开发的12306抢票小程序的前端小程序代码
4 |
5 | 后端代码传送门
6 |
7 | `https://github.com/15207135348/Java12306`
8 |
9 | 12306接口文档传送门
10 |
11 | `https://github.com/15207135348/12306InterfaceDoc`
12 |
13 | #### 功能列表
14 |
15 | * [x] 车次查询
16 | * [x] 车次筛选
17 | * [x] 自动打码
18 | * [x] 自动登录
19 | * [x] 普通刷票
20 | * [x] 候补抢票
21 | * [x] 微信通知
22 | * [x] 邮件通知
23 | * [x] 用户订单管理
24 | * [x] 先抢票后付款
25 | * [ ] 预约抢票
26 | * [ ] 车次推荐
27 | * [ ] 坐席推荐
28 | * [ ] 时段推荐
29 | * [ ] 在线选座
30 | * [ ] 成功率预估
31 | * [ ] 先付款安心抢
32 | * [ ] 免12306账户密码抢票
33 |
34 | #### 项目环境
35 |
36 | * [x] 微信开发者工具
37 |
38 | #### 使用到的小程序插件
39 |
40 | * [x] 极点日历(在微信开发平台添加插件)
41 |
42 | #### 项目使用说明
43 |
44 | * 在微信开发平台上创建一个小程序,拿到小程序的AppID和AppSecret
45 |
46 | * 申请订阅消息1(用于候补抢票结果的通知)
47 | 
48 |
49 |
50 | * 申请订阅消息2(用于普通抢票结果的通知)
51 | 
52 |
53 |
54 | * 在微信开发平台中设置请求接口(如果没有域名、SSL证书以及公网IP,可用[mousenat](https://www.mousenat.cn/index.html)的内网穿透来一站解决所有问题)
55 | 
56 |
57 |
58 | * 启动后端服务器
59 |
60 | * 详见`https://github.com/15207135348/Java12306`
61 |
62 | * 使用微信开发者工具打开小程序
63 |
64 | #### 思路图
65 |
66 | 
67 |
68 | #### 项目申明
69 |
70 | * 本软件只供学习交流使用,请不要用作商业用途,交流群号
71 |
72 | * 群号:832236668
73 |
74 | * 进群看公告
75 |
76 | * 在群文件中获取12306接口文档
77 |
78 | * 关注公众号【大数据学堂】,点击原创合集->抢票小程序,观看视频教程
79 | 
80 |
81 | * 使用【抢票酱小程序】体验最终效果。
82 | 
83 |
84 |
--------------------------------------------------------------------------------
/pages/detail/paying.js:
--------------------------------------------------------------------------------
1 | var config = require('../../config.js');
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | order: null,
9 | res: null
10 | },
11 |
12 | /**
13 | * 生命周期函数--监听页面加载
14 | */
15 | onLoad: function (options) {
16 | wx.showLoading({
17 | title: '加载中'
18 | })
19 | //初始化页面数据
20 | const that = this;
21 | const eventChannel = this.getOpenerEventChannel();
22 | eventChannel.on('data', function (data) {
23 | that.setData({
24 | order: data
25 | });
26 | console.log("paying页面收到order页面的数据:" + data)
27 |
28 | let order = data;
29 | console.log("请求成功订单细节");
30 | config.get(config.urls.GET_SUCCESS_ORDER_URL, {
31 | orderId: order.orderId
32 | }, function (res) {
33 | console.log(res)
34 | wx.hideLoading()
35 | if (res.data.success) {
36 | let message = res.data.message
37 | message = JSON.parse(message);
38 | that.setData({
39 | res: message
40 | })
41 | }
42 | });
43 | });
44 |
45 | },
46 |
47 | cancelOrder: function (e) {
48 | console.log("deleteOrder")
49 | let order = this.data.order;
50 | wx.showModal({
51 | title: '该操作不可逆,确定要取消订单吗?',
52 | showCancel: true,
53 | success(res) {
54 | if (res.confirm) {
55 | console.log('用户点击确定')
56 | config.get(config.urls.CANCEL_ORDER_URL, {
57 | orderId: order.orderId
58 | }, function (res) {
59 | console.log(res)
60 | if (res.data.success) {
61 | wx.navigateBack({
62 | delta: 1,
63 | success: function (res) {
64 | console.log("返回order页面")
65 | }
66 | });
67 | }
68 | });
69 | } else if (res.cancel) {
70 | console.log('用户点击取消')
71 | }
72 | }
73 | })
74 | }
75 | })
--------------------------------------------------------------------------------
/pages/detail/an_paying.js:
--------------------------------------------------------------------------------
1 | var config = require('../../config.js');
2 | Page({
3 |
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | order: null,
9 | res: null
10 | },
11 |
12 | /**
13 | * 生命周期函数--监听页面加载
14 | */
15 | onLoad: function (options) {
16 | wx.showLoading({
17 | title: '加载中'
18 | })
19 | //初始化页面数据
20 | const that = this;
21 | const eventChannel = this.getOpenerEventChannel();
22 | eventChannel.on('data', function (data) {
23 | that.setData({
24 | order: data
25 | });
26 | console.log("an_paying页面收到order页面的数据:" + data)
27 |
28 | let order = data;
29 | console.log("请求成功订单细节");
30 | config.get(config.urls.GET_SUCCESS_AN_ORDER_URL, {
31 | orderId: order.orderId
32 | }, function (res) {
33 | console.log(res)
34 | wx.hideLoading()
35 | if (res.data.success) {
36 | let message = res.data.message
37 | message = JSON.parse(message);
38 | that.setData({
39 | res: message
40 | })
41 | }
42 | });
43 | });
44 |
45 | },
46 |
47 | cancelOrder: function (e) {
48 | console.log("deleteOrder")
49 | let order = this.data.order;
50 | wx.showModal({
51 | title: '该操作不可逆,确定要取消订单吗?',
52 | showCancel: true,
53 | success(res) {
54 | if (res.confirm) {
55 | console.log('用户点击确定')
56 | config.get(config.urls.CANCEL_ORDER_URL, {
57 | orderId: order.orderId
58 | }, function (res) {
59 | console.log(res)
60 | if (res.data.success) {
61 | wx.navigateBack({
62 | delta: 1,
63 | success: function (res) {
64 | console.log("返回order页面")
65 | }
66 | });
67 | }
68 | });
69 | } else if (res.cancel) {
70 | console.log('用户点击取消')
71 | }
72 | }
73 | })
74 | }
75 | })
--------------------------------------------------------------------------------
/pages/detail/success.js:
--------------------------------------------------------------------------------
1 | // pages/detail/success.js
2 | var config = require('../../config.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | order: null,
10 | res: null
11 | },
12 |
13 | /**
14 | * 生命周期函数--监听页面加载
15 | */
16 | onLoad: function (options) {
17 | wx.showLoading({
18 | title: '加载中'
19 | })
20 | //初始化页面数据
21 | const that = this;
22 | const eventChannel = this.getOpenerEventChannel();
23 | eventChannel.on('data', function (data) {
24 | that.setData({
25 | order: data
26 | });
27 | console.log("rushing页面收到order页面的数据:" + data)
28 |
29 | let order = data;
30 | console.log("请求成功订单细节");
31 | config.get(config.urls.GET_SUCCESS_ORDER_URL, {
32 | orderId: order.orderId
33 | }, function (res) {
34 | console.log(res)
35 | wx.hideLoading()
36 | if (res.data.success) {
37 | let message = res.data.message
38 | message = JSON.parse(message);
39 | that.setData({
40 | res: message
41 | })
42 | }
43 | });
44 | });
45 |
46 | },
47 |
48 | deleteOrder: function (e) {
49 | console.log("deleteOrder")
50 | let order = this.data.order;
51 | wx.showModal({
52 | title: '该操作不可逆,确定要删除订单吗?',
53 | showCancel: true,
54 | success(res) {
55 | if (res.confirm) {
56 | console.log('用户点击确定')
57 | config.get(config.urls.DELETE_ORDER_URL, {
58 | orderId: order.orderId
59 | }, function (res) {
60 | console.log(res)
61 | if (res.data.success) {
62 | wx.navigateBack({
63 | delta: 1,
64 | success: function (res) {
65 | console.log("返回order页面")
66 | }
67 | });
68 | }
69 | });
70 | } else if (res.cancel) {
71 | console.log('用户点击取消')
72 | }
73 | }
74 | })
75 | }
76 | })
--------------------------------------------------------------------------------
/pages/detail/cashing.js:
--------------------------------------------------------------------------------
1 | // pages/detail/an_success.js
2 | var config = require('../../config.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | order: null,
10 | res: null
11 | },
12 |
13 | /**
14 | * 生命周期函数--监听页面加载
15 | */
16 | onLoad: function (options) {
17 | wx.showLoading({
18 | title: '加载中'
19 | })
20 | //初始化页面数据
21 | const that = this;
22 | const eventChannel = this.getOpenerEventChannel();
23 | eventChannel.on('data', function (data) {
24 | that.setData({
25 | order: data
26 | });
27 | console.log("cashing页面收到order页面的数据:" + data)
28 |
29 | let order = data;
30 | console.log("请求成功订单细节");
31 | config.get(config.urls.GET_SUCCESS_AN_ORDER_URL, {
32 | orderId: order.orderId
33 | }, function (res) {
34 | console.log(res)
35 | wx.hideLoading()
36 | if (res.data.success) {
37 | let message = res.data.message
38 | message = JSON.parse(message);
39 | that.setData({
40 | res: message
41 | })
42 | }
43 | });
44 | });
45 |
46 | },
47 |
48 | cancelOrder: function (e) {
49 | console.log("cancelOrder")
50 | let order = this.data.order;
51 | wx.showModal({
52 | title: '该操作不可逆,确定要取消订单吗?',
53 | showCancel: true,
54 | success(res) {
55 | if (res.confirm) {
56 | console.log('用户点击确定')
57 | config.get(config.urls.CANCEL_ORDER_URL, {
58 | orderId: order.orderId
59 | }, function (res) {
60 | console.log(res)
61 | if (res.data.success) {
62 | wx.navigateBack({
63 | delta: 1,
64 | success: function (res) {
65 | console.log("返回order页面")
66 | }
67 | });
68 | }
69 | });
70 | } else if (res.cancel) {
71 | console.log('用户点击取消')
72 | }
73 | }
74 | })
75 | }
76 | })
--------------------------------------------------------------------------------
/pages/detail/an_success.js:
--------------------------------------------------------------------------------
1 | // pages/detail/an_success.js
2 | var config = require('../../config.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | order: null,
10 | res: null
11 | },
12 |
13 | /**
14 | * 生命周期函数--监听页面加载
15 | */
16 | onLoad: function (options) {
17 | wx.showLoading({
18 | title: '加载中'
19 | })
20 | //初始化页面数据
21 | const that = this;
22 | const eventChannel = this.getOpenerEventChannel();
23 | eventChannel.on('data', function (data) {
24 | that.setData({
25 | order: data
26 | });
27 | console.log("an_success页面收到order页面的数据:" + data)
28 |
29 | let order = data;
30 | console.log("请求成功订单细节");
31 | config.get(config.urls.GET_SUCCESS_AN_ORDER_URL, {
32 | orderId: order.orderId
33 | }, function (res) {
34 | console.log(res)
35 | wx.hideLoading()
36 | if (res.data.success) {
37 | let message = res.data.message
38 | message = JSON.parse(message);
39 | that.setData({
40 | res: message
41 | })
42 | }
43 | });
44 | });
45 |
46 | },
47 |
48 | deleteOrder: function (e) {
49 | console.log("deleteOrder")
50 | let order = this.data.order;
51 | wx.showModal({
52 | title: '该操作不可逆,确定要删除订单吗?',
53 | showCancel: true,
54 | success(res) {
55 | if (res.confirm) {
56 | console.log('用户点击确定')
57 | config.get(config.urls.DELETE_ORDER_URL, {
58 | orderId: order.orderId
59 | }, function (res) {
60 | console.log(res)
61 | if (res.data.success) {
62 | wx.navigateBack({
63 | delta: 1,
64 | success: function (res) {
65 | console.log("返回order页面")
66 | }
67 | });
68 | }
69 | });
70 | } else if (res.cancel) {
71 | console.log('用户点击取消')
72 | }
73 | }
74 | })
75 | }
76 | })
--------------------------------------------------------------------------------
/pages/trains/trains.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 从早到晚
7 |
8 |
9 |
10 | 高铁动车
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | {{item.fromTime}}
20 | {{item.fromStation}}
21 |
22 |
23 | {{item.trainCode}}
24 |
25 | {{item.duration}}
26 |
27 |
28 | {{item.toTime}}
29 | {{item.toStation}}
30 |
31 |
32 |
33 |
34 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/pages/detail/paying.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 待支付
5 |
6 |
7 |
8 | 取票号:
9 | {{res.sequenceNo}}
10 |
11 |
12 |
13 |
14 | {{res.fromDate}}
15 | {{res.fromTime}}
16 | {{res.fromStation}}站
17 |
18 |
19 | {{res.trainCode}}时刻表>
20 | {{res.duration}}
21 |
22 |
23 | {{res.toDate}}
24 | {{res.toTime}}
25 | {{res.toStation}}站
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{item.passengerName}}
34 | {{item.ticketType}}
35 |
36 | {{item.passengerId}}
37 |
38 |
39 |
40 | {{item.seatType}}
41 | ¥{{item.price}}
42 |
43 |
44 | {{item.coach}}车厢{{item.seat}}
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/pages/detail/rushing.js:
--------------------------------------------------------------------------------
1 | // pages/detail/runing.js
2 | var config = require('../../config.js');
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | order: {},
10 | timer: null,
11 | },
12 |
13 | /**
14 | * 生命周期函数--监听页面加载
15 | */
16 | onLoad: function (options) {
17 | //初始化页面数据
18 | const that = this;
19 | const eventChannel = this.getOpenerEventChannel();
20 | eventChannel.on('data', function (data) {
21 | that.setData({
22 | order: data
23 | });
24 | console.log("rushing页面收到order页面的数据:" + data)
25 | });
26 | },
27 |
28 | bindtapCancelOrder: function (e) {
29 | console.log("bindtapCancelOrder")
30 | let that = this;
31 | let order = this.data.order;
32 | wx.showModal({
33 | title: '确定要取消订单吗',
34 | showCancel: true,
35 | success(res) {
36 | if (res.confirm) {
37 | console.log('用户点击确定')
38 | config.get(config.urls.CANCEL_ORDER_URL, {
39 | orderId: order.orderId
40 | }, function (res) {
41 | console.log(res)
42 | if (res.data.success) {
43 | wx.navigateBack({
44 | delta: 1,
45 | success: function (res) {
46 | console.log("navigateBack时取消定时器")
47 | if (that.data.timer != null) {
48 | clearInterval(that.data.timer);
49 | console.log("取消定时器:" + that.data.timer);
50 | }
51 | }
52 | });
53 | }
54 | });
55 | } else if (res.cancel) {
56 | console.log('用户点击取消')
57 | }
58 | }
59 |
60 | })
61 | },
62 |
63 | /**
64 | * 生命周期函数--监听页面显示
65 | */
66 | onShow: function () {
67 | let that = this;
68 | let order = this.data.order;
69 | let id = setInterval(function () {
70 | config.get(config.urls.GET_QUERT_COUNT_URL, {
71 | orderId: order.orderId
72 | }, function (res) {
73 | console.log(res)
74 | if (res.data.success) {
75 | order.queryCount = res.data.message;
76 | that.setData({
77 | order: order
78 | })
79 | console.log("查询次数更新:" + order.queryCount);
80 | }
81 | });
82 | }, 5000);
83 | this.setData({
84 | timer: id
85 | });
86 | wx.setStorageSync('rushing_timer', id)
87 | console.log("定时器ID:" + id);
88 | }
89 | })
--------------------------------------------------------------------------------
/pages/detail/success.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 已完成
6 |
7 |
8 |
9 |
10 | 取票号:
11 | {{res.sequenceNo}}
12 |
13 |
14 |
15 |
16 | {{res.fromDate}}
17 | {{res.fromTime}}
18 | {{res.fromStation}}站
19 |
20 |
21 | {{res.trainCode}}时刻表>
22 | {{res.duration}}
23 |
24 |
25 | {{res.toDate}}
26 | {{res.toTime}}
27 | {{res.toStation}}站
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | {{item.passengerName}}
36 | {{item.ticketType}}
37 |
38 | {{item.passengerId}}
39 |
40 |
41 |
42 | {{item.seatType}}
43 | ¥{{item.price}}
44 |
45 |
46 | {{item.coach}}车厢{{item.seat}}
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 出发站
8 | 到达站
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 出发日期
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | 抢票车次
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 抢票坐席
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {{expireTime}}
47 |
48 |
49 |
--------------------------------------------------------------------------------
/pages/detail/an_paying.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 待支付
5 |
6 |
7 |
8 | 候补订单号:
9 | {{res.reserveNo}}
10 |
11 |
12 |
13 |
14 | {{res.fromDate}}
15 | {{res.fromTime}}
16 | {{res.fromStation}}站
17 |
18 |
19 | {{res.trainCode}}时刻表>
20 | {{res.duration}}
21 |
22 |
23 | {{res.toDate}}
24 | {{res.toTime}}
25 | {{res.toStation}}站
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{item.name}}
34 | {{item.type}}
35 |
36 | {{item.idNo}}
37 |
38 |
39 |
40 | {{res.seatType}}
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | 待支付金额:
50 | ¥{{res.prepayAmount}}
51 |
52 | {{res.queueInfo}}
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/pages/detail/cashing.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 待兑现
5 |
6 |
7 |
8 | 候补订单号:
9 | {{res.reserveNo}}
10 |
11 |
12 |
13 |
14 | {{res.fromDate}}
15 | {{res.fromTime}}
16 | {{res.fromStation}}站
17 |
18 |
19 | {{res.trainCode}}时刻表>
20 | {{res.duration}}
21 |
22 |
23 | {{res.toDate}}
24 | {{res.toTime}}
25 | {{res.toStation}}站
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{item.name}}
34 | {{item.type}}
35 |
36 | {{item.idNo}}
37 |
38 |
39 |
40 | {{res.seatType}}
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | 已支付金额:
50 | ¥{{res.prepayAmount}}
51 |
52 | {{res.queueInfo}}
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/pages/detail/an_success.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 已完成
6 |
7 |
8 |
9 | 候补订单号:
10 | {{res.reserveNo}}
11 |
12 |
13 |
14 |
15 | {{res.fromDate}}
16 | {{res.fromTime}}
17 | {{res.fromStation}}站
18 |
19 |
20 | {{res.trainCode}}时刻表>
21 | {{res.duration}}
22 |
23 |
24 | {{res.toDate}}
25 | {{res.toTime}}
26 | {{res.toStation}}站
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | {{item.name}}
35 | {{item.type}}
36 |
37 | {{item.idNo}}
38 |
39 |
40 |
41 | {{res.seatType}}
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 已支付金额:
51 | ¥{{res.prepayAmount}}
52 |
53 | {{res.queueInfo}}
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/pages/people/people.js:
--------------------------------------------------------------------------------
1 | var config = require("../../config.js");
2 | Page({
3 | /**
4 | * 页面的初始数据
5 | */
6 | data: {
7 | people: [],
8 | checks: []
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 | //初始化页面数据
16 | const that = this;
17 | wx.showLoading({
18 | title: '加载中'
19 | })
20 | config.get(config.urls.GET_PEOPLE_URL, {}, function (res) {
21 | console.log("后台返回数据")
22 | console.log(res.data);
23 | wx.hideLoading()
24 | if (res.data.success) {
25 | let arr = JSON.parse(res.data.message);
26 | for(var i = 0; i < arr.length; ++i)
27 | {
28 | //如果手机未核验
29 | if (!arr[i].ifReceive)
30 | {
31 | arr[i].tip = "需核验乘车人手机号"
32 | }
33 | else
34 | {
35 | arr[i].tip = ""
36 | }
37 | }
38 | that.setData({
39 | people: arr
40 | })
41 | }
42 | });
43 | },
44 |
45 | checkboxChange: function (e) {
46 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
47 | this.setData({
48 | checks: e.detail.value
49 | })
50 | },
51 |
52 | bindtapOK: function (e) {
53 | console.log('bindtapOK')
54 | console.log('选择乘客的序号' + this.data.checks)
55 | let checks = this.data.checks
56 | let people = this.data.people
57 | let selectedPeople = []
58 | for (var i = 0; i < checks.length; ++i) {
59 | let index = Number(checks[i])
60 | let selectedOne = people[index]
61 | selectedPeople.push(selectedOne.name)
62 | }
63 | console.log("选择的乘客:")
64 | console.log(selectedPeople)
65 |
66 | var flag = true;
67 | for(var i = 0; i < checks.length; ++i)
68 | {
69 | let index = Number(checks[i])
70 | if (!people[index].ifReceive)
71 | {
72 | flag = false;
73 | break;
74 | }
75 | }
76 | if(!flag)
77 | {
78 | wx.showModal({
79 | title: '手机号未核验',
80 | content: '请前往12306核验乘客的手机号',
81 | showCancel: false,
82 | success(res) {
83 | console.log('用户点击确定')
84 | }
85 | })
86 | return
87 | }
88 |
89 | console.log("people页面跳回submit页面")
90 | let eventChannel = this.getOpenerEventChannel();
91 | wx.navigateBack({
92 | delta: 1,
93 | success: function (res) {
94 | console.log("携带参数")
95 | console.log(selectedPeople)
96 | eventChannel.emit('okEvent', {
97 | data: selectedPeople
98 | });
99 | }
100 | });
101 | }
102 | })
--------------------------------------------------------------------------------
/pages/order/dualorder.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item}}
5 |
6 |
7 |
8 |
9 |
10 |
11 | 您当前没有相关实时订单~
12 |
13 |
14 |
15 |
16 |
17 | {{item.fromStation}}
18 |
19 | {{item.toStation}}
20 |
21 | 出发日期:{{item.dates}}
22 |
23 |
24 | {{item.status}}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | 您当前没有相关候补订单~
37 |
38 |
39 |
40 |
41 |
42 | {{item.fromStation}}
43 |
44 | {{item.toStation}}
45 |
46 | 出发日期:{{item.dates}}
47 |
48 |
49 | {{item.status}}
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/pages/seats/seats.js:
--------------------------------------------------------------------------------
1 | Page({
2 |
3 | /**
4 | * 页面的初始数据
5 | */
6 | data: {
7 | seats: [],
8 | checks: []
9 | },
10 |
11 | /**
12 | * 生命周期函数--监听页面加载
13 | */
14 | onLoad: function (options) {
15 | //初始化页面数据
16 | const that = this;
17 | const eventChannel = this.getOpenerEventChannel();
18 | eventChannel.on('data', function (data) {
19 | console.log("seats页面收到了index页面的参数")
20 | let totalSeats = data.totalSeats
21 | console.log(data)
22 | console.log(totalSeats)
23 | let list = []
24 | for (var key in totalSeats) {
25 | list.push(key)
26 | }
27 | console.log(list)
28 | that.setData({
29 | seats: list
30 | })
31 | })
32 | },
33 |
34 | /**
35 | * 生命周期函数--监听页面初次渲染完成
36 | */
37 | onReady: function () {
38 |
39 | },
40 |
41 | /**
42 | * 生命周期函数--监听页面显示
43 | */
44 | onShow: function () {
45 |
46 | // console.log("seats页面的onShow函数")
47 | // let trains = this.data.trains.split("/");
48 | // console.log(trains)
49 | // let map = {};
50 | // for (var i = 0; i < trains.length; ++i) {
51 | // let seats = this.data.totalSeats[trains[i].substring(0, 1)];
52 | // for (var j = 0; j < seats.length; ++j) {
53 | // map[seats[j]] = true;
54 | // }
55 | // }
56 | // let list = []
57 | // for (var key in map) {
58 | // list.push(key)
59 | // }
60 | // console.log(list)
61 | // this.setData({
62 | // seats: list
63 | // })
64 | },
65 |
66 | checkboxChange: function (e) {
67 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
68 | this.setData({
69 | checks: e.detail.value
70 | })
71 | },
72 |
73 | bindtapOK: function(e) {
74 | console.log('bindtapOK')
75 | console.log('选择的座位的序号' + this.data.checks)
76 | let checks = this.data.checks
77 | let seats = this.data.seats
78 | let selectedSeats = []
79 | for(var i = 0; i < checks.length; ++i)
80 | {
81 | let index = Number(checks[i])
82 | let selectedSeat = seats[index]
83 | selectedSeats.push(selectedSeat)
84 | }
85 | console.log("选择的座位:")
86 | console.log(selectedSeats)
87 |
88 | console.log("seats页面跳回index页面")
89 | let eventChannel = this.getOpenerEventChannel();
90 | wx.navigateBack({
91 | delta: 1,
92 | success: function (res) {
93 | eventChannel.emit('okEvent', {data: selectedSeats});
94 | }
95 | });
96 | },
97 |
98 |
99 |
100 |
101 | /**
102 | * 生命周期函数--监听页面隐藏
103 | */
104 | onHide: function () {
105 |
106 | },
107 |
108 | /**
109 | * 生命周期函数--监听页面卸载
110 | */
111 | onUnload: function () {
112 |
113 | },
114 |
115 | /**
116 | * 页面相关事件处理函数--监听用户下拉动作
117 | */
118 | onPullDownRefresh: function () {
119 |
120 | },
121 |
122 | /**
123 | * 页面上拉触底事件的处理函数
124 | */
125 | onReachBottom: function () {
126 |
127 | },
128 |
129 | /**
130 | * 用户点击右上角分享
131 | */
132 | onShareAppMessage: function () {
133 |
134 | }
135 | })
--------------------------------------------------------------------------------
/pages/login/login.js:
--------------------------------------------------------------------------------
1 | var config = require("../../config.js");
2 |
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | username: "",
10 | password: "",
11 | isPassword: true,
12 | eye_image_url: "../../image/icon_21.png",
13 | agree:true,
14 | },
15 |
16 | /**
17 | * 生命周期函数--监听页面加载
18 | */
19 | onLoad: function (options) {
20 |
21 | },
22 |
23 | bindinputUsername: function(e){
24 | this.setData({
25 | username: e.detail.value
26 | });
27 | console.log(e.detail.value);
28 | },
29 |
30 | bindinputPassword: function(e){
31 | this.setData({
32 | password: e.detail.value
33 | });
34 | console.log(e.detail.value);
35 | },
36 | bindtapEye: function(e) {
37 |
38 | if(this.data.isPassword){
39 | this.setData({
40 | isPassword:false,
41 | eye_image_url:"../../image/icon_20.png"
42 | })
43 | }else{
44 | this.setData({
45 | isPassword:true,
46 | eye_image_url:"../../image/icon_21.png"
47 | })
48 | }
49 | },
50 | bindtapShowProtocol: function(e){
51 | wx.navigateTo({
52 | url: 'userprotocol',
53 | })
54 | },
55 | checkboxChange: function(e) {
56 | var agree = (e.detail.value.length == 1)
57 | console.log(agree)
58 | this.setData({
59 | agree: agree
60 | })
61 | },
62 |
63 | bindtapLogin: function(e){
64 | console.log(this.data.username);
65 | console.log(this.data.password);
66 | console.log(this.data.agree);
67 |
68 | if(this.data.username == ""){
69 | wx.showModal({
70 | content: '请输入12306账号',
71 | showCancel: false,
72 | success (res) {
73 | console.log('用户点击确定')
74 | }
75 | })
76 | return;
77 | }
78 |
79 | if(this.data.password == ""){
80 | wx.showModal({
81 | content: '请输入12306密码',
82 | showCancel: false,
83 | success (res) {
84 | console.log('用户点击确定')
85 | }
86 | })
87 | return;
88 | }
89 |
90 | if(!this.data.agree){
91 | wx.showModal({
92 | content: '请同意条款',
93 | showCancel: false,
94 | success (res) {
95 | console.log('用户点击确定')
96 | }
97 | })
98 | return;
99 | }
100 |
101 | wx.showLoading({
102 | title: '登陆中'
103 | })
104 |
105 | config.get(config.urls.SET12306ACCOUNT_URL, {
106 | username: this.data.username,
107 | password: this.data.password
108 | },function (res) {
109 | wx.hideLoading()
110 |
111 | let data = res.data;
112 | if(data.success)
113 | {
114 | console.log(data.message);
115 | wx.showToast({
116 | title: '绑定成功',
117 | icon: 'success',
118 | duration: 500
119 | })
120 | wx.navigateBack({
121 | delta: 1
122 | })
123 | }
124 | else
125 | {
126 | console.log(data.message);
127 | wx.showModal({
128 | title: '登陆失败',
129 | content: '请核对信息是否有误',
130 | showCancel: false,
131 | success (res) {
132 | console.log('用户点击确定')
133 | }
134 | })
135 | }
136 | })
137 | }
138 |
139 | })
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | page {
3 | background-color: #efefef;
4 | font-family:'宋体', 'Times New Roman';
5 | }
6 | /*分割线样式*/
7 | .spilt-line{
8 | background: rgb(226, 228, 223);
9 | width: 100%;
10 | height: 1px;
11 | }
12 | button {
13 | color: white;
14 | width: 100%;
15 | margin: 10px;
16 | background-color: orange;
17 | }
18 | .xsmall-icon{
19 | height: 18px;
20 | width: 18px;
21 | }
22 | .xxsmall-icon{
23 | height: 16px;
24 | width: 16px;
25 | }
26 | .small-icon{
27 | height: 24px;
28 | width: 24px;
29 | }
30 | .middle-icon{
31 | height: 36px;
32 | width: 36px;
33 | }
34 | .large-icon{
35 | height: 50px;
36 | width: 50px;
37 | }
38 | .text-align-right{
39 | text-align: right;
40 | }
41 | .placeholderStyle{
42 | color: darkgray;
43 | }
44 | .line {
45 | display: flex;
46 | justify-content: space-between;
47 | align-items: center;
48 | }
49 | .left-line {
50 | display: flex;
51 | align-items: center;
52 | }
53 | .column {
54 | display: flex;
55 | flex-direction: column;
56 | }
57 |
58 | .small-width{
59 | width: 30px;
60 | }
61 | .middle-width{
62 | width: 70px;
63 | }
64 | .large-width{
65 | width: 120px;
66 | }
67 | .xlarge-width{
68 | width: 150px;
69 | }
70 | .height40{
71 | height: 40px;
72 | }
73 | .height50{
74 | height: 50px;
75 | }
76 | .height45{
77 | height: 45px;
78 | }
79 | .height65{
80 | height: 65px;
81 | }
82 | .height80{
83 | height: 80px;
84 | }
85 | .height60{
86 | height: 60px;
87 | }
88 | .height100{
89 | height: 100px;
90 | }
91 | .height170{
92 | height: 170px;
93 | }
94 | .small-margin{
95 | margin-left: 5px;
96 | margin-right: 5px;
97 | margin-top: 2.5px;
98 | margin-bottom: 2.5px;
99 | }
100 | .middle-margin{
101 | margin-left: 10px;
102 | margin-right: 10px;
103 | margin-top: 5px;
104 | margin-bottom: 5px;
105 | }
106 | .large-margin{
107 | margin-left: 15px;
108 | margin-right: 15px;
109 | margin-top: 7.5px;
110 | margin-bottom: 7.5px;
111 | }
112 | .xlarge-margin{
113 | margin-left: 20px;
114 | margin-right: 20px;
115 | margin-top: 7.5px;
116 | margin-bottom: 7.5px;
117 | }
118 | .small-margin2{
119 | margin-top: 5px;
120 | }
121 | .middle-margin2{
122 | margin-top: 7.5px;
123 | }
124 | .large-margin2{
125 | margin-top: 10px;
126 | }
127 |
128 | .small-padding{
129 | padding: 2px;
130 | }
131 | .middle-padding{
132 | padding: 4px;
133 | }
134 | .large-padding{
135 | padding: 6px;
136 | }
137 | .xlarge-padding{
138 | padding: 8px;
139 | }
140 | .xxsmall-text{
141 | font-size: 11px;
142 | }
143 | .xsmall-text{
144 | font-size: 12px;
145 | }
146 | .small-text{
147 | font-size: 13px;
148 | }
149 | .middle-text{
150 | font-size: 14px;
151 | }
152 | .large-text{
153 | font-size: 16px;
154 | }
155 | .xlarge-text{
156 | font-size: 17px;
157 | }
158 | .xxlarge-text{
159 | font-size: 20px;
160 | }
161 |
162 | .color-orange{
163 | color: orange;
164 | }
165 | .color-white{
166 | color: white;
167 | }
168 | .color-gray{
169 | color: gray;
170 | }
171 | .color-lightgray{
172 | color: lightgray;
173 | }
174 | .color-darkgray{
175 | color: darkgray;
176 | }
177 | .background-white {
178 | background-color:white;
179 | }
180 | .background-blue {
181 | background-color: #4169E1;
182 | }
183 | .autofill{
184 | width: 100%;
185 | flex:1;
186 | }
187 | .large-margin-top{
188 | margin-top: 15px;
189 | }
190 | .large-margin-bottom{
191 | margin-bottom: 15px;
192 | }
193 | .small-margin-top{
194 | margin-top: 5px;
195 | }
196 | .middle-margin-top{
197 | margin-top: 10px;
198 | }
199 | .middle-margin-bottom{
200 | margin-bottom: 10px;
201 | }
202 | .small-margin-right{
203 | margin-right: 5px;
204 | }
205 | .middle-margin-right{
206 | margin-right: 10px;
207 | }
208 | .small-checkbox{
209 | transform: scale(0.8,0.8);
210 | }
211 | .middle-checkbox{
212 | transform: scale(1,1);
213 | }
--------------------------------------------------------------------------------
/pages/submit/submit.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | 抢票车次
17 |
18 |
19 |
20 | 抢票坐席
21 |
22 |
23 |
24 | 出发日期
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | 添加乘客
40 |
41 |
42 |
43 |
44 | 邮箱地址
45 |
46 |
47 |
52 |
53 | 抢票方式
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/pages/dates/dates.js:
--------------------------------------------------------------------------------
1 | // pages/index.js
2 | var util = require('../../utils/util.js');
3 | Page({
4 | /**
5 | * 页面的初始数据
6 | */
7 | data: {
8 | year: new Date().getFullYear(), // 年份
9 | month: new Date().getMonth() + 1, // 月份
10 | day: new Date().getDate(),
11 | startDate: "2000-01",
12 | endDate: "2099-12",
13 | selects: {}, //已选择的日期
14 | styles: {
15 | i: 0,
16 | arr: [[], [], [], [], []],
17 | }
18 | },
19 |
20 | /**
21 | * 生命周期函数--监听页面加载
22 | */
23 | onLoad: function(options) {
24 |
25 | var date1 = new Date();
26 | var date2 = new Date();
27 | date2.setMonth(date2.getMonth() + this.data.styles.arr.length-1);
28 | let styles = this.data.styles;
29 | let i = styles.i;
30 | for(var day = 1; day < date1.getDate(); ++day)
31 | {
32 | let obj = {
33 | month: "current",
34 | day: day,
35 | color: 'white'
36 | };
37 | styles.arr[i].push(obj);
38 | }
39 | this.setData({
40 | styles: styles,
41 | startDate: date1.getFullYear().toString() + "-" + util.formatNumber(date1.getMonth()+1),
42 | endDate: date2.getFullYear().toString() + "-" + util.formatNumber(date2.getMonth() + 1)
43 | });
44 | },
45 | next: function (event) {
46 | let styles = this.data.styles;
47 | styles.i = styles.i + 1;
48 | this.setData({
49 | styles: styles
50 | });
51 | },
52 | prev: function (event) {
53 | let styles = this.data.styles;
54 | styles.i = styles.i - 1;
55 | this.setData({
56 | styles: styles
57 | });
58 | },
59 | dateChange: function (event) {
60 | console.log(event.detail);
61 | },
62 |
63 | isSelectable: function(y, m, d){
64 | var date = new Date()
65 | var year = date.getFullYear()
66 | var month = date.getMonth() + 1
67 | var day = date.getDate()
68 | console.log(y,m,d, year, month, day)
69 | if(y < year){
70 | return false
71 | }
72 | if(y > year){
73 | return true
74 | }
75 | if(m < month){
76 | return false
77 | }
78 | if(m > month){
79 | return true
80 | }
81 | return d >= day
82 | },
83 |
84 | dayClick: function (event) {
85 | var detail = event.detail
86 |
87 | if(!this.isSelectable(detail.year, detail.month, detail.day)){
88 | console.log("当前日期不可选")
89 | return
90 | }
91 |
92 | var key = detail.year + "年" + detail.month + "月"+detail.day+"日"
93 | if (this.data.selects[key] === undefined)
94 | {
95 | let styles = this.data.styles;
96 | let i = styles.i;
97 | let obj = {
98 | month: "current",
99 | day: detail.day,
100 | color: 'white',
101 | background: '#f5a8f0'
102 | };
103 | styles.arr[i].push(obj);
104 | this.setData({
105 | styles: styles
106 | });
107 | this.data.selects[key] = obj;
108 | }
109 | else
110 | {
111 | let val = this.data.selects[key];
112 | let styles = this.data.styles;
113 | let i = styles.i;
114 | util.arrayRemove(styles.arr[i], val);
115 | this.setData({
116 | styles: styles
117 | });
118 | this.data.selects[key] = undefined;
119 | }
120 | },
121 | bindtapOK: function(event) {
122 | let data = util.obj2Arr(this.data.selects);
123 | let eventChannel = this.getOpenerEventChannel();
124 | wx.navigateBack({
125 | delta: 1,
126 | success: function (res) {
127 | eventChannel.emit('okEvent', {data: data});
128 | }
129 | });
130 | }
131 | })
--------------------------------------------------------------------------------
/pages/order/order.js:
--------------------------------------------------------------------------------
1 | // pages/order/order.js
2 | var config = require("../../config.js");
3 | Page({
4 |
5 | /**
6 | * 页面的初始数据
7 | */
8 | data: {
9 | orders: [],
10 | table: {
11 |
12 | 抢票失败: {url : "../detail/failed", colorclass: "failed-color", imageurl: "../../image/icon_14.png"},
13 | 已取消: {url : "../detail/cancelled", colorclass: "cancelled-color", imageurl: "../../image/icon_18.png"},
14 | 休息中:{url : "../detail/rushing", colorclass: "rushing-color", imageurl: "../../image/icon_15.png"},
15 | 已完成:{url : "../detail/success", colorclass: "success-color", imageurl: "../../image/icon_7.png"},
16 |
17 | 实时抢票中: {url : "../detail/rushing", colorclass: "rushing-color", imageurl: "../../image/icon_15.png"},
18 | 实时待支付: {url : "../detail/success", colorclass: "success-color", imageurl: "../../image/icon_7.png"},
19 |
20 | 候补抢票中:{url : "../detail/rushing", colorclass: "rushing-color", imageurl: "../../image/icon_15.png"},
21 | 候补待支付:{url : "../detail/an_success", colorclass: "success-color", imageurl: "../../image/icon_7.png"},
22 | 待兑现:{url : "../detail/an_success", colorclass: "success-color", imageurl: "../../image/icon_7.png"},
23 | },
24 | background: "background-has-order"
25 | },
26 |
27 | /**
28 | * 生命周期函数--监听页面加载
29 | */
30 | onLoad: function (options) {
31 |
32 | },
33 |
34 | /**
35 | * 生命周期函数--监听页面初次渲染完成
36 | */
37 | onReady: function () {
38 |
39 | },
40 |
41 | /**
42 | * 生命周期函数--监听页面显示
43 | */
44 | onShow: function () {
45 |
46 | console.log("orders页面的onShow函数")
47 | // 清理rushing页面的定时器
48 | console.log("清理rushing页面的定时器")
49 | wx.getStorage({
50 | key: 'rushing_timer',
51 | success: function (res) {
52 | clearInterval(res.data);
53 | console.log("取消定时器:" + res.data);
54 | }
55 | })
56 | this.loadOrder()
57 | },
58 |
59 | loadOrder: function(){
60 | wx.showLoading({
61 | title: '加载中'
62 | })
63 | let that = this;
64 | console.log("向后台发送请求,url="+config.urls.GET_ORDERS_URL)
65 | config.get(config.urls.GET_ORDERS_URL, {}, function(res){
66 | console.log("后台返回数据")
67 | console.log(res.data);
68 | wx.hideLoading()
69 | let arr = []
70 | if(res.data.success){
71 | arr = JSON.parse(res.data.message);
72 | for(var i = 0; i < arr.length; ++i){
73 | var obj = that.data.table[arr[i].status]
74 | arr[i]["colorclass"] = obj.colorclass;
75 | arr[i]["imageurl"] = obj.imageurl;
76 | }
77 | }
78 | that.setData({
79 | orders: arr
80 | })
81 | if(arr.length == 0)
82 | {
83 | console.log("当前没有订单")
84 | that.setData({
85 | background: "background-no-order"
86 | })
87 | }
88 | else
89 | {
90 | that.setData({
91 | background: "background-has-order"
92 | })
93 | }
94 | });
95 | },
96 |
97 | // 下拉刷新
98 | onPullDownRefresh: function (e) {
99 | // 显示顶部刷新图标
100 | wx.showNavigationBarLoading()
101 | this.loadOrder()
102 | // 隐藏导航栏加载框
103 | wx.hideNavigationBarLoading();
104 | // 停止下拉动作
105 | wx.stopPullDownRefresh();
106 | },
107 |
108 | bindtabLookDetail: function(e) {
109 | console.log("bindtabLookDetail")
110 | let index = Number(e.currentTarget.id)
111 | let order = this.data.orders[index];
112 | let tourl = this.data.table[order.status].url
113 | console.log("从order页面跳转到"+ tourl + "页面")
114 | wx.navigateTo({
115 | url: tourl,
116 | events: {
117 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
118 | okEvent: function (res) {
119 | console.log(res);
120 | }
121 | },
122 | success: function (res) {
123 | // 通过eventChannel向被打开页面传送数据
124 | res.eventChannel.emit('data', order);
125 | console.log("order页面向" + tourl + "页面传递数据:"+ order)
126 | }
127 | })
128 | }
129 | })
--------------------------------------------------------------------------------
/环境搭建教程.md:
--------------------------------------------------------------------------------
1 | # 1. 需要用到的软件
2 |
3 |
4 |
5 |
6 |
7 | 前面五个软件大家应该都很熟悉了,这里主要介绍一下mousenat和Charles是干嘛用的,以及安装方法。
8 |
9 | ## mousenat
10 |
11 | mousenat是一款内网穿透软件,我们的服务器要让别人能够访问,得要有公网IP,而且微信小程序要求所有的网络请求都必须是https的,且不可以直接访问ip和端口,要通过ICP备案过的域名才能访问,使用mousenat可以让我们本地的服务也能被别人访问到,且拥有免费的https的二级域名。
12 |
13 | mousenat的安装可以参考官网教程:https://www.mousenat.cn/explain.html
14 |
15 | ## Charles
16 |
17 | 玩过网络爬虫的同学应该听说过Charles,它是一款http/https调试代理工具,能够记录你的电脑与互联网之间的所有http通讯数据,通过Charles,您可以查看你使用12306网站进行购票时,发生了哪些http请求,这些请求的http请求头、请求参数、返回体是怎么样的。
18 |
19 | 安装charles需要破解和配置ssl证书,没有配置ssl证书的话,捕获的https数据包是乱码。
20 |
21 | 可以参考博客:https://www.cnblogs.com/nicece/p/10019872.html
22 |
23 | # 2. 下载依赖
24 |
25 | 因为下载依赖需要很长时间,所以,需要提前把依赖下载好。
26 |
27 | **Java依赖:**
28 |
29 |
30 |
31 |
32 |
33 | **python依赖:**
34 |
35 |
36 |
37 | ```shell
38 | # 切换到requestments.txt文件所在的目录
39 | cd src/main/python
40 | # 使用pip安装依赖,请确保python版本为3.6,否则tensorflow可能安装失败
41 | pip3 install –r requestments.txt
42 | ```
43 |
44 | # 3. 数据库配置
45 |
46 | **创建数据库表:**
47 |
48 |
49 |
50 | ```shell
51 | # 切换到ticketserver.sql文件所在的目录
52 | cd res/doc
53 | # 连接数据库
54 | mysql –uroot -p
55 | # 使用source命令创建数据库表
56 | source ticketserver.sql
57 | ```
58 |
59 | **在src/main/resources/application-prod.properties文件中和application-test.properties中修改数据库用户名和密码:**
60 |
61 |
62 |
63 | # 4. 小程序配置
64 |
65 | ## 4.1 创建一个小程序
66 |
67 | https://mp.weixin.qq.com/
68 |
69 |
70 |
71 | ## 4.2 配置appid和appsecret
72 |
73 | - 在开发->开发设置下的开发者ID找到AppID和AppSecret
74 |
75 |
76 |
77 | - 前端project.config.json文件中修改appid,这样这个小程序就归你啦。
78 |
79 |
80 |
81 | - 后端application-test.properties和application-prod.properties文件中设置appid和appsecret
82 |
83 |
84 |
85 | ## 4.3 添加极点日历插件
86 |
87 | 小程序的时间选择页面用到了日历的功能,我们这里使用了极点日历这个插件。因此,你需要在自己的小程序开放平台中添加第三方的插件。
88 |
89 | 
90 |
91 | 如图,在设置->第三方设置->插件管理中,添加极点日历插件。
92 |
93 | ## 4.4 服务器域名配置
94 |
95 | 为了安全考虑,小程序前端如果要访问某个域名,必须现在微信开发平台中设置。在**微信开发平台->开发->开发设置->服务器域名**,添加**mousenat配置时**的获得的域名。
96 |
97 | 
98 |
99 | 在小程序的config.js文件中,将域名修改为你的mousenat域名,这样小程序就能访问到你的服务器了。
100 |
101 | 修改**basePath="你的域名"**
102 |
103 | 
104 |
105 |
106 |
107 | ## 4.5 开通订阅消息
108 |
109 | 由于我们的抢票小程序在为用户抢到票之后,需要通过微信通知用户,所以,我们需要用到订阅消息功能,该功能需要在微信开放平台中进行开通。
110 |
111 |
112 |
113 | 开通的格式必须满足如下,否则后台代码需要重新修改,就会很麻烦。首先,类目选择信息查询,然后,详细内容,要选择**phrase2.DATA和thing4.DATA**,注意不要搞错了!!!
114 |
115 | 
116 |
117 | 实时抢票结果通知的模版,**详细内容的设置**同样要注意不要搞错啦!!!
118 |
119 | 
120 |
121 | 申请了模版之后,我们还需要在小程序前端和后台分别修改模版的ID,小程序前端通过模版ID向用户请求是否要订阅这条消息。后端通过模版ID告诉微信服务器,请帮我向用户发送订阅消息。
122 |
123 | 前端在**pages/submit/submit.js**文件中修改模版ID,注意在微信开发者工具中模版消息无效,可以通过预览在手机进行调试。
124 |
125 | 
126 |
127 |
128 |
129 | 后端在src/main/resources/application-prod.properties和application-test.properties文件中修改模版ID
130 |
131 | 
132 |
133 |
134 |
135 | # 5. 启动抢票酱
136 |
137 | 到这里,我们应该就可以在自己的电脑上将抢票酱完全运行起来啦,启动抢票酱有三步:
138 |
139 | 第一,启动python下的app.py,开启自动打码服务
140 |
141 | 第二,启动java下的StartApplication.java,启动后端服务
142 |
143 | 第三,启动小程序前端,编译->预览,即可在手机上使用抢票酱。
--------------------------------------------------------------------------------
/pages/trains/trains.js:
--------------------------------------------------------------------------------
1 | var config = require("../../config.js");
2 | Page({
3 | /**
4 | * 页面的初始数据
5 | */
6 | data: {
7 | fromStation: "",
8 | toStation: "",
9 | dates: "",
10 | trains_temp: [],
11 | trains: [],
12 | checks: []
13 | },
14 |
15 | /**
16 | * 生命周期函数--监听页面加载
17 | */
18 | onLoad: function (options) {
19 | //初始化页面数据
20 | const that = this;
21 | const eventChannel = this.getOpenerEventChannel();
22 | eventChannel.on('data', function (data) {
23 | console.log("trains页面收到了index页面的参数")
24 | console.log(data)
25 | that.setData({
26 | fromStation: data.fromStation,
27 | toStation: data.toStation,
28 | dates: data.dates
29 | });
30 | console.log("trains设置参数成功,参数如下")
31 | console.log(that.data.fromStation)
32 | console.log(that.data.toStation)
33 | console.log(that.data.dates)
34 |
35 | wx.showLoading({
36 | title: '加载中'
37 | })
38 | console.log("向后台发送请求,url=" + config.urls.GET_TRAINS_URL)
39 | console.log("携带参数")
40 | console.log(data)
41 | config.get(config.urls.GET_TRAINS_URL, data, function (res) {
42 | console.log("后台返回数据")
43 | console.log(res.data);
44 | wx.hideLoading()
45 | if (res.data.success) {
46 | let arr = JSON.parse(res.data.message);
47 | for(var i = 0; i < arr.length; ++i)
48 | {
49 | var ticketList = [];
50 | var m = arr[i].tickets
51 | for(var k in m)
52 | {
53 | if(m[k] == "")
54 | {
55 | continue;
56 | }
57 | if(m[k] == "无" && arr[i].canBackup)
58 | {
59 | m[k] = "可候补"
60 | }
61 | if(m[k] == "无" && !arr[i].canBackup)
62 | {
63 | m[k] = "可抢票"
64 | }
65 | ticketList.push(k+":"+m[k])
66 | }
67 | arr[i].ticketList = ticketList;
68 | }
69 | that.setData({
70 | trains: arr,
71 | trains_temp: arr
72 | })
73 | console.log(arr);
74 | }
75 | });
76 | });
77 | },
78 |
79 | checkboxChange1: function (e) {
80 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
81 | //从早到晚高铁动车
82 | if (e.detail.value.length == 2) {
83 | var trains = this.data.trains_temp;
84 | var arr = [];
85 | for (var i = 0; i < trains.length; ++i) {
86 | if (trains[i].trainCode.indexOf("D") >= 0 ||
87 | trains[i].trainCode.indexOf("G") >= 0 ||
88 | trains[i].trainCode.indexOf("C") >= 0) {
89 | arr.push(trains[i]);
90 | }
91 | }
92 | this.setData({
93 | trains: arr
94 | });
95 | } else if (e.detail.value.length == 1 && e.detail.value[0] == "time") {
96 | var arr = this.data.trains_temp;
97 | this.setData({
98 | trains: arr
99 | });
100 | } else if (e.detail.value.length == 1 && e.detail.value[0] == "type") {
101 | var trains = this.data.trains_temp;
102 | var arr = [];
103 | for (var i = trains.length - 1; i >= 0; --i) {
104 | if (trains[i].trainCode.indexOf("D") >= 0 ||
105 | trains[i].trainCode.indexOf("G") >= 0 ||
106 | trains[i].trainCode.indexOf("C") >= 0) {
107 | arr.push(trains[i]);
108 | }
109 | }
110 | this.setData({
111 | trains: arr
112 | });
113 | } else if (e.detail.value.length == 0) {
114 | var trains = this.data.trains_temp;
115 | var arr = [];
116 | for (var i = trains.length - 1; i >= 0; --i) {
117 | arr.push(trains[i]);
118 | }
119 | this.setData({
120 | trains: arr
121 | });
122 | }
123 | },
124 |
125 | checkboxChange2: function (e) {
126 | console.log('checkbox发生change事件,携带value值为:', e.detail.value)
127 | this.setData({
128 | checks: e.detail.value
129 | })
130 | },
131 |
132 | bindtapOK: function (e) {
133 | console.log('bindtapOK')
134 | console.log('选择的车次的序号' + this.data.checks)
135 | let checks = this.data.checks
136 | let trains = this.data.trains
137 | let selectedTrains = []
138 | let totalSeats = {}
139 | for (var i = 0; i < checks.length; ++i) {
140 | let index = Number(checks[i])
141 | let selectedTrain = trains[index]
142 | selectedTrains.push(selectedTrain.trainCode)
143 | for (var k in selectedTrain.tickets) {
144 | if (selectedTrain.tickets[k] != "") {
145 | totalSeats[k] = selectedTrain.tickets[k];
146 | }
147 | }
148 | }
149 | console.log("选择的车次:")
150 | console.log(selectedTrains)
151 | console.log("车次的坐席:")
152 | console.log(totalSeats)
153 |
154 | console.log("trains页面跳回index页面")
155 | let eventChannel = this.getOpenerEventChannel();
156 | wx.navigateBack({
157 | delta: 1,
158 | success: function (res) {
159 | console.log("携带参数")
160 | console.log(selectedTrains)
161 | eventChannel.emit('okEvent', {
162 | data: {
163 | selectedTrains: selectedTrains,
164 | totalSeats: totalSeats
165 | }
166 | });
167 | }
168 | });
169 | }
170 | })
--------------------------------------------------------------------------------
/pages/order/dualorder.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | var config = require("../../config.js");
3 |
4 | Page({
5 | data: {
6 | navbar: ['实时抢票订单', '候补抢票订单'],
7 | currentTab: 0,
8 | table1: {
9 | 抢票失败: {url : "../detail/failed", colorclass: "gray", imageurl: "../../image/icon_14.png"},
10 | 已取消: {url : "../detail/cancelled", colorclass: "gray", imageurl: "../../image/icon_18.png"},
11 | 休息中:{url : "../detail/rushing", colorclass: "blue", imageurl: "../../image/icon_15.png"},
12 | 已完成:{url : "../detail/success", colorclass: "green", imageurl: "../../image/icon_7.png"},
13 | 与未完成订单冲突:{url : "../detail/cancelled", colorclass: "gray", imageurl: "../../image/icon_18.png"},
14 | 实时抢票中: {url : "../detail/rushing", colorclass: "blue", imageurl: "../../image/icon_15.png"},
15 | 实时待支付: {url : "../detail/paying", colorclass: "red", imageurl: "../../image/icon_23.png"},
16 | },
17 | table2: {
18 | 抢票失败: {url : "../detail/failed", colorclass: "gray", imageurl: "../../image/icon_14.png"},
19 | 已取消: {url : "../detail/cancelled", colorclass: "gray", imageurl: "../../image/icon_18.png"},
20 | 休息中:{url : "../detail/rushing", colorclass: "blue", imageurl: "../../image/icon_15.png"},
21 | 已完成:{url : "../detail/success", colorclass: "green", imageurl: "../../image/icon_7.png"},
22 | 与未完成订单冲突:{url : "../detail/cancelled", colorclass: "gray", imageurl: "../../image/icon_18.png"},
23 | 候补抢票中: {url : "../detail/rushing", colorclass: "blue", imageurl: "../../image/icon_15.png"},
24 | 候补待支付: {url : "../detail/an_paying", colorclass: "red", imageurl: "../../image/icon_23.png"},
25 | 待兑现:{url : "../detail/cashing", colorclass: "darkblue", imageurl: "../../image/icon_25.png"},
26 | },
27 | background1: "background-has-order",
28 | background2: "background-has-order",
29 | orders: [[], []],
30 | },
31 |
32 | onShow() {
33 | var currentTab = wx.getStorageSync('currentTab')
34 | this.setData({
35 | currentTab: currentTab
36 | })
37 |
38 | console.log("orders页面的onShow函数")
39 | // 清理rushing页面的定时器
40 | console.log("清理rushing页面的定时器")
41 | wx.getStorage({
42 | key: 'rushing_timer',
43 | success: function (res) {
44 | clearInterval(res.data);
45 | console.log("取消定时器:" + res.data);
46 | }
47 | })
48 | this.loadOrder()
49 |
50 | },
51 |
52 | //切换bar
53 | navbarTap: function (e) {
54 | this.setData({
55 | currentTab: e.currentTarget.dataset.idx
56 | })
57 | //全局变量
58 | wx.setStorageSync('currentTab', this.data.currentTab)
59 | },
60 | swiperChange: function (e) {
61 | this.setData({
62 | currentTab: e.detail.current,
63 | })
64 | //全局变量
65 | wx.setStorageSync('currentTab', this.data.currentTab)
66 | },
67 |
68 | loadOrder: function(){
69 | wx.showLoading({
70 | title: '加载中'
71 | })
72 | let that = this;
73 | console.log("向后台发送请求,url="+config.urls.GET_ORDERS_URL)
74 | config.get(config.urls.GET_ORDERS_URL, {}, function(res){
75 | console.log("后台返回数据")
76 | console.log(res.data);
77 | wx.hideLoading()
78 | let arr = []
79 | var arr1 = []
80 | var arr2 = []
81 | if(res.data.success){
82 | arr = JSON.parse(res.data.message);
83 | for(var i = 0; i < arr.length; ++i){
84 | if(arr[i].rushType == "实时抢票"){
85 | var obj = that.data.table1[arr[i].status]
86 | arr[i]["colorclass"] = obj.colorclass;
87 | arr[i]["imageurl"] = obj.imageurl;
88 | arr1.push(arr[i])
89 | }
90 | if(arr[i].rushType == "候补抢票"){
91 | var obj = that.data.table2[arr[i].status]
92 | arr[i]["colorclass"] = obj.colorclass;
93 | arr[i]["imageurl"] = obj.imageurl;
94 | arr2.push(arr[i])
95 | }
96 | }
97 | }
98 | that.setData({
99 | orders: [arr1, arr2]
100 | })
101 | if(arr1.length == 0)
102 | {
103 | that.setData({
104 | background1: "background-no-order"
105 | })
106 | }
107 | else
108 | {
109 | that.setData({
110 | background1: "background-has-order"
111 | })
112 | }
113 | if(arr2.length == 0)
114 | {
115 | that.setData({
116 | background2: "background-no-order"
117 | })
118 | }
119 | else
120 | {
121 | that.setData({
122 | background2: "background-has-order"
123 | })
124 | }
125 | });
126 | },
127 |
128 | // 下拉刷新
129 | onPullDownRefresh: function (e) {
130 | // 显示顶部刷新图标
131 | wx.showNavigationBarLoading()
132 | this.loadOrder()
133 | // 隐藏导航栏加载框
134 | wx.hideNavigationBarLoading();
135 | // 停止下拉动作
136 | wx.stopPullDownRefresh();
137 | },
138 |
139 | bindtabLookDetail: function(e) {
140 | console.log("bindtabLookDetail")
141 | let currentTab = this.data.currentTab
142 | let index = Number(e.currentTarget.id)
143 | let order = this.data.orders[currentTab][index]
144 | let tourl
145 | if(currentTab == 0){
146 | tourl = this.data.table1[order.status].url
147 | }else{
148 | tourl = this.data.table2[order.status].url
149 | }
150 |
151 | console.log("从order页面跳转到"+ tourl + "页面")
152 | wx.navigateTo({
153 | url: tourl,
154 | events: {
155 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
156 | okEvent: function (res) {
157 | console.log(res);
158 | }
159 | },
160 | success: function (res) {
161 | // 通过eventChannel向被打开页面传送数据
162 | res.eventChannel.emit('data', order);
163 | console.log("order页面向" + tourl + "页面传递数据:"+ order)
164 | }
165 | })
166 | }
167 |
168 | })
--------------------------------------------------------------------------------
/pages/submit/submit.js:
--------------------------------------------------------------------------------
1 | var config = require("../../config.js");
2 | var util = require('../../utils/util.js');
3 |
4 | Page({
5 |
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | fromStation: "武汉",
11 | toStation: "西安",
12 | trains: "G571",
13 | seats: "二等座",
14 | dates: "2020年1月28/2020年1月29/2020年1月30",
15 | expireTime: "",
16 |
17 | people: "",
18 | contactInfo: "",
19 | payType: {
20 | i: 1,
21 | arr: ["先付款安心抢", "抢到票再通知我付款"]
22 | },
23 | rushTypes: "",
24 | hasLogin12306: false,
25 | accountOf12306: "登陆12306账号",
26 | text: "出票更快,成功率更高"
27 | },
28 |
29 | /**
30 | * 生命周期函数--监听页面加载
31 | */
32 | onLoad: function (options) {
33 | //初始化页面数据
34 | const that = this;
35 | const eventChannel = this.getOpenerEventChannel();
36 | eventChannel.on('data', function (data) {
37 | that.setData({
38 | fromStation: data.fromStation,
39 | toStation: data.toStation,
40 | trains: data.trains,
41 | dates: data.dates,
42 | dates: data.dates,
43 | seats: data.seats
44 | });
45 | });
46 | let people = wx.getStorageSync('people')
47 | let contactInfo = wx.getStorageSync('contactInfo')
48 | let rushTypes = wx.getStorageSync('rushTypes')
49 | console.log(people)
50 | console.log(contactInfo)
51 | console.log(rushTypes)
52 | that.setData({
53 | people: people,
54 | contactInfo: contactInfo,
55 | rushTypes: rushTypes
56 | });
57 | },
58 |
59 |
60 | /**
61 | * 生命周期函数--监听页面初次渲染完成
62 | */
63 | onReady: function () {
64 |
65 | },
66 |
67 | /**
68 | * 生命周期函数--监听页面显示
69 | */
70 | onShow: function () {
71 | let that = this;
72 | //请求12306账号
73 | config.get(
74 | config.urls.GET12306ACCOUNT_URL, {},
75 | function (res) {
76 | let data = res.data;
77 | if (data.success) {
78 | that.setData({
79 | accountOf12306: data.message,
80 | hasLogin12306: true
81 | });
82 | console.log(data.message);
83 | } else {
84 | that.setData({
85 | accountOf12306: "登陆12306账号",
86 | hasLogin12306: false
87 | });
88 | console.log(data.message);
89 | }
90 | });
91 | },
92 |
93 | bindtabLogin12306: function (e) {
94 |
95 | // let that = this;
96 | // if (that.data.hasLogin12306)
97 |
98 | wx.navigateTo({
99 | url: '../login/login',
100 | events: {
101 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
102 | okEvent: function (res) {
103 | console.log(res);
104 | }
105 | }
106 | })
107 | },
108 |
109 | bindtapPeople: function (e) {
110 | console.log("点击添加乘客")
111 |
112 | if(!this.data.hasLogin12306){
113 | wx.showModal({
114 | title: '请先登陆12306',
115 | showCancel: false,
116 | success(res) {
117 | console.log('用户点击确定')
118 | }
119 | })
120 | return
121 | }
122 |
123 | let that = this;
124 | wx.navigateTo({
125 | url: '../people/people',
126 | events: {
127 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
128 | okEvent: function (res) {
129 | console.log("people页面跳回submit页面,返回结果")
130 | console.log(res);
131 | let str = util.arrJoin(res.data, "/");
132 | that.setData({
133 | people: str,
134 | });
135 | wx.setStorageSync('people', str)
136 | }
137 | }
138 | })
139 |
140 | },
141 |
142 | bindinputContactInfo: function (e) {
143 | this.setData({
144 | contactInfo: e.detail.value
145 | });
146 | console.log(e.detail.value);
147 | wx.setStorageSync('contactInfo', this.data.contactInfo)
148 | },
149 |
150 | bindtapPayType: function (e) {
151 | console.log("选择付款方式");
152 |
153 | },
154 |
155 | bindtaprushType: function(e) {
156 | console.log("选择抢票方式")
157 | let that = this;
158 | wx.navigateTo({
159 | url: '../rushType/rushType',
160 | events: {
161 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
162 | okEvent: function (res) {
163 | console.log("rushType页面跳回submit页面,返回结果")
164 | console.log(res);
165 | let str = util.arrJoin(res.data, "/");
166 | that.setData({
167 | rushTypes: str,
168 | });
169 | wx.setStorageSync('rushTypes', str)
170 | }
171 | }
172 | })
173 |
174 | },
175 |
176 | bindtapSubmit: function (e) {
177 | console.log("提交订单");
178 | if (!this.data.hasLogin12306) {
179 | wx.showModal({
180 | title: '先请登陆12306账号',
181 | showCancel: false,
182 | success(res) {
183 | console.log('用户点击确定')
184 | }
185 | })
186 | return
187 | }
188 | if (this.data.people == "") {
189 | wx.showModal({
190 | title: '添加乘客姓名',
191 | content: '多个人买票请用/分隔',
192 | showCancel: false,
193 | success(res) {
194 | console.log('用户点击确定')
195 | }
196 | })
197 | return
198 | }
199 | if (this.data.contactInfo == "") {
200 | wx.showModal({
201 | title: '添加联系方式',
202 | content: '支持邮箱和手机号',
203 | showCancel: false,
204 | success(res) {
205 | console.log('用户点击确定')
206 | }
207 | })
208 | return
209 | }
210 | if (this.data.rushTypes == "") {
211 | wx.showModal({
212 | title: '选择付款方式',
213 | content: '支持实时抢票和候补抢票',
214 | showCancel: false,
215 | success(res) {
216 | console.log('用户点击确定')
217 | }
218 | })
219 | return
220 | }
221 | let data = {
222 | people: this.data.people,
223 | contactInfo: this.data.contactInfo,
224 | fromStation: this.data.fromStation,
225 | toStation: this.data.toStation,
226 | dates: this.data.dates,
227 | trains: this.data.trains,
228 | seats: this.data.seats,
229 | rushTypes:this.data.rushTypes
230 | }
231 | wx.showLoading({
232 | title: '请稍等...',
233 | })
234 | config.get(config.urls.FUCK12306_URL, data, function (res) {
235 | console.log("下单成功,返回数据:" + res.data);
236 | wx.hideLoading({
237 | complete: (res) => {
238 | console.log("hideLoading complete res" + res)
239 | wx.showModal({
240 | title: '正在为您抢票',
241 | content: '成功后会微信/邮箱/电话通知您',
242 | showCancel: false,
243 | success(res) {
244 | console.log('用户点击确定')
245 | //请求订阅消息【下单成功后后台推送给用户】
246 | wx.requestSubscribeMessage({
247 | tmplIds: ['K_hAQJeBiVnBwblrF6lB0qZthvlaNFtC_20RgYM3HHc', 'K_hAQJeBiVnBwblrF6lB0pYtVX5ag5-D2sRikUtoouA'],
248 | success(res) {
249 | console.log("requestSubscribeMessage res" + res)
250 | wx.navigateTo({
251 | url: '../order/dualorder',
252 | events: {
253 | okEvent: function (res) {
254 | console.log(res);
255 | }
256 | }
257 | })
258 | console.log("navigateTo order页面")
259 | }
260 | })
261 | }
262 | })
263 | }
264 | })
265 | });
266 | }
267 | })
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | var config = require('../config.js');
2 | var dateFormat = function (fmt, date) {
3 | let ret;
4 | let opt = {
5 | "Y+": date.getFullYear().toString(), // 年
6 | "M+": (date.getMonth() + 1).toString(), // 月
7 | "D+": date.getDate().toString(), // 日
8 | "h+": date.getHours().toString(), // 时
9 | "m+": date.getMinutes().toString(), // 分
10 | "s+": date.getSeconds().toString() // 秒
11 | // 有其他格式化字符需求可以继续添加,必须转化成字符串
12 | };
13 | for (let k in opt) {
14 | ret = new RegExp("(" + k + ")").exec(fmt);
15 | if (ret) {
16 | fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
17 | };
18 | };
19 | return fmt;
20 | }
21 | const formatNumber = n => {
22 | n = n.toString()
23 | return n[1] ? n : '0' + n
24 | }
25 |
26 | var getBiggerzIndex = (function () {
27 | //定义弹出层ui的最小zIndex
28 | let index = 2000;
29 | return function (level = 0) {
30 | return level + (++index);
31 | };
32 | })();
33 |
34 | var deepCopy = function (obj) {
35 | // 只拷贝对象
36 | if (typeof obj !== 'object') return;
37 | // 根据obj的类型判断是新建一个数组还是一个对象
38 | var newObj = obj instanceof Array ? [] : {};
39 | for (var key in obj) {
40 | // 遍历obj,并且判断是obj的属性才拷贝
41 | if (obj.hasOwnProperty(key)) {
42 | // 判断属性值的类型,如果是对象递归调用深拷贝
43 | newObj[key] = typeof obj[key] === 'object' ? deepCopy(obj[key]) : obj[key];
44 | }
45 | }
46 | return newObj;
47 | };
48 |
49 | var arrayRemove = function (arr, val) {
50 | for (var i = 0; i < arr.length; i++) {
51 | if (arr[i] == val) {
52 | arr.splice(i, 1);
53 | }
54 | }
55 | };
56 |
57 | var obj2Arr = function (obj) {
58 | let arr = new Array;
59 | for (var key in obj) {
60 | if (obj[key] !== undefined) {
61 | arr.push(key);
62 | }
63 | }
64 | return arr;
65 | }
66 |
67 | var arrJoin = function (arr, spilt) {
68 | var str = "";
69 | if (arr.length > 0) {
70 | for (var i = 0; i < arr.length - 1; ++i) {
71 | str = str + arr[i] + spilt;
72 | }
73 | str = str + arr[arr.length - 1];
74 | }
75 | return str;
76 | }
77 | var post = function (url, data, success) {
78 | var header = {
79 | 'content-type': 'application/json; charset=utf-8',
80 | 'cookie': wx.getStorageSync("sessionid")
81 | };
82 | reqObj = wx.request({
83 | url: url,
84 | method: "POST",
85 | header: header,
86 | data: data,
87 | success(res) {
88 | var cookie = res.header["Set-Cookie"];
89 | if (cookie != null) {
90 | wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
91 | }
92 | success(res);
93 | }
94 | })
95 | return reqObj;
96 | }
97 | var get = function (url, data, success) {
98 | var header = {
99 | 'content-type': 'application/json; charset=utf-8',
100 | 'cookie': wx.getStorageSync("sessionid")
101 | };
102 | reqObj = wx.request({
103 | url: url,
104 | method: "GET",
105 | header: header,
106 | data: data,
107 | success(res) {
108 | var cookie = res.header["Set-Cookie"];
109 | if (cookie != null) {
110 | wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
111 | }
112 | success(res);
113 | }
114 | })
115 | return reqObj;
116 | }
117 |
118 | /**
119 | * @description 静态日期操作类,封装系列日期操作方法
120 | * @description 输入时候月份自动减一,输出时候自动加一
121 | * @return {object} 返回操作方法
122 | */
123 | let dateUtil = {
124 |
125 | //根据一个日期获取所有信息
126 | getDetail: function (date) {
127 | if (!date) date = new Date();
128 | var d, now = new Date(),
129 | dateInfo = {},
130 | _diff;
131 | var weekDayArr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
132 |
133 | if (typeof date === 'number') {
134 | d = new Date();
135 | d.setTime(date);
136 | date = d;
137 | }
138 |
139 | //充值date对象,让其成为一天的起点时间
140 | date = new Date(date.getFullYear(), date.getMonth(), date.getDate());
141 | now = new Date(now.getFullYear(), now.getMonth(), now.getDate());
142 |
143 | _diff = date.getTime() - now.getTime();
144 |
145 | if (_diff == 0) {
146 | dateInfo.day1 = '今天';
147 | } else if (_diff == 86400000) {
148 | dateInfo.day1 = '明天';
149 | } else if (_diff == 172800000) {
150 | dateInfo.day1 = '后天';
151 | }
152 |
153 | dateInfo.weekday = weekDayArr[date.getDay()];
154 |
155 | dateInfo.year = date.getFullYear();
156 | dateInfo.month = date.getMonth() + 1;
157 | dateInfo.day = date.getDate();
158 |
159 | return dateInfo;
160 |
161 | },
162 |
163 | //获取前一个月
164 | preMonth: function (d) {
165 | if (typeof d === 'string') d = new Date(d);
166 | else d = new Date();
167 | let date = new Date(d.getFullYear(), d.getMonth() - 1)
168 | return date;
169 | },
170 |
171 | nextMonth: function (d) {
172 | if (typeof d === 'string') d = new Date(d);
173 | else d = new Date();
174 | let date = new Date(d.getFullYear(), d.getMonth() + 1)
175 | return date;
176 | },
177 |
178 | //获取前一个天
179 | preDay: function (d) {
180 | if (typeof d === 'string') d = new Date(d);
181 | else d = new Date();
182 | let date = new Date(d.getFullYear(), d.getMonth(), d.getDate() - 1)
183 | return date;
184 | },
185 |
186 | nextDay: function (d) {
187 | if (typeof d === 'string') d = new Date(d);
188 | else d = new Date();
189 | let date = new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1)
190 | return date;
191 | },
192 |
193 | /**
194 | * @description 数字操作,
195 | * @return {string} 返回处理后的数字
196 | */
197 | formatNum: function (n) {
198 | if (n < 10) return '0' + n;
199 | return n;
200 | },
201 | /**
202 | * @description 将字符串转换为日期,支持格式y-m-d ymd (y m r)以及标准的
203 | * @return {Date} 返回日期对象
204 | */
205 | parse: function (dateStr, formatStr) {
206 | if (typeof dateStr === 'undefined') return null;
207 | if (typeof formatStr === 'string') {
208 | var _d = new Date(formatStr);
209 | //首先取得顺序相关字符串
210 | var arrStr = formatStr.replace(/[^ymd]/g, '').split('');
211 | if (!arrStr && arrStr.length != 3) return null;
212 |
213 | var formatStr = formatStr.replace(/y|m|d/g, function (k) {
214 | switch (k) {
215 | case 'y':
216 | return '(\\d{4})';
217 | case 'm':
218 | ;
219 | case 'd':
220 | return '(\\d{1,2})';
221 | }
222 | });
223 |
224 | var reg = new RegExp(formatStr, 'g');
225 | var arr = reg.exec(dateStr)
226 |
227 | var dateObj = {};
228 | for (var i = 0, len = arrStr.length; i < len; i++) {
229 | dateObj[arrStr[i]] = arr[i + 1];
230 | }
231 | return new Date(dateObj['y'], dateObj['m'] - 1, dateObj['d']);
232 | }
233 | return null;
234 | },
235 | /**
236 | * @description将日期格式化为字符串
237 | * @return {string} 常用格式化字符串
238 | */
239 | format: function (date, f) {
240 | if (arguments.length < 2 && !date.getTime) {
241 | format = date;
242 | date = new Date();
243 | } else if (arguments.length == 2 && typeof date === 'number' && typeof f === 'string') {
244 | var d = new Date();
245 | d.setTime(date);
246 | date = d;
247 | }
248 |
249 | typeof f != 'string' && (f = 'Y年M月D日 H时F分S秒');
250 | return f.replace(/Y|y|M|m|D|d|H|h|F|f|S|s/g, function (a) {
251 | switch (a) {
252 | case "y":
253 | return (date.getFullYear() + "").slice(2);
254 | case "Y":
255 | return date.getFullYear();
256 | case "m":
257 | return date.getMonth() + 1;
258 | case "M":
259 | return dateUtil.formatNum(date.getMonth() + 1);
260 | case "d":
261 | return date.getDate();
262 | case "D":
263 | return dateUtil.formatNum(date.getDate());
264 | case "h":
265 | return date.getHours();
266 | case "H":
267 | return dateUtil.formatNum(date.getHours());
268 | case "f":
269 | return date.getMinutes();
270 | case "F":
271 | return dateUtil.formatNum(date.getMinutes());
272 | case "s":
273 | return date.getSeconds();
274 | case "S":
275 | return dateUtil.formatNum(date.getSeconds());
276 | }
277 | });
278 | },
279 | // @description 是否为为日期对象,该方法可能有坑,使用需要慎重
280 | // @param year {num} 日期对象
281 | // @return {boolean} 返回值
282 | isDate: function (d) {
283 | if ((typeof d == 'object') && (d instanceof Date)) return true;
284 | return false;
285 | },
286 | // @description 是否为闰年
287 | // @param year {num} 可能是年份或者为一个date时间
288 | // @return {boolean} 返回值
289 | isLeapYear: function (year) {
290 | //传入为时间格式需要处理
291 | if (_.dateUtil.isDate(year)) year = year.getFullYear()
292 | if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) return true;
293 | return false;
294 | },
295 |
296 | // @description 获取一个月份的天数
297 | // @param year {num} 可能是年份或者为一个date时间
298 | // @param year {num} 月份
299 | // @return {num} 返回天数
300 | getDaysOfMonth: function (year, month) {
301 | //自动减一以便操作
302 | month--;
303 | if (_.dateUtil.isDate(year)) {
304 | month = year.getMonth(); //注意此处月份要加1,所以我们要减一
305 | year = year.getFullYear();
306 | }
307 | return [31, _.dateUtil.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
308 | },
309 |
310 | // @description 获取一个月份1号是星期几,注意此时的月份传入时需要自主减一
311 | // @param year {num} 可能是年份或者为一个date时间
312 | // @param year {num} 月份
313 | // @return {num} 当月一号为星期几0-6
314 | getBeginDayOfMouth: function (year, month) {
315 | //自动减一以便操作
316 | month--;
317 | if ((typeof year == 'object') && (year instanceof Date)) {
318 | month = year.getMonth();
319 | year = year.getFullYear();
320 | }
321 | var d = new Date(year, month, 1);
322 | return d.getDay();
323 | }
324 |
325 | };
326 |
327 | module.exports = {
328 | dateFormat: dateFormat,
329 | formatNumber: formatNumber,
330 | getBiggerzIndex: getBiggerzIndex,
331 | dateUtil: dateUtil,
332 | get: get,
333 | post: post,
334 | deepCopy: deepCopy,
335 | arrayRemove: arrayRemove,
336 | arrJoin: arrJoin,
337 | obj2Arr: obj2Arr
338 | }
--------------------------------------------------------------------------------
/pages/detail/rushing.wxss:
--------------------------------------------------------------------------------
1 | .height150{
2 | height: 170px;
3 | }
4 | .cycle-backgroud{
5 | background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAgAElEQVR4Xu19fZhU5Xn37z6zu9hkKYiNVVPmDB9ZKQo7Z9aPKIZoE4hNtAm2xCbvi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NSOQI5PZs6T5o5kMzSfQVUT4VC1MsoQcnwN4M2XpseAjtijbVDNHzQnk2JnNlednEjWeripBif6qOqlEawmXaLOb4c2TH7E7qyp4ifl4Y/YAAAE/SURBVMHWtECO5dFpDc8C0VXQcoI5XyLH1QPF/CoRPeWCN4es5NbqCdy/SJVAhuE2HWuZy272T6HRZeBK3mgk4cQQG7+IXxANWIPxTtG3XB3HMKAEMsLp0NMamZoNuJcT0ycAiH+TqvoMItoL5p8x8QuBrPb8xLYOUR9MHSdhQAkkz1PDMZvPYwpcoYGvYIbYuSf2bVTy8S4xfupq9FMi/g99nb2zkoOttNiUQIqckVwxhIZMEzGamOlcBjfRQEnVKUVC5zt8DwO7iWgXgXdzFrv73f7dU9e/WlXFJfJN2m97JRCfGOb58wPpxq5z3Xpu0qA1gd0zCFojg8cSuJFBY0l84SdqdJnHEqERLsaKqt6k4SAzejWig2DuZaCXwAcZ1Euggwy3F6S948LdTa62Sz8wZTc99ljWp1RqGvZ/AGp7icvI4o7wAAAAAElFTkSuQmCC");
6 | display: inline-block;
7 | width: 80px;
8 | height: 80px;
9 | line-height: 80px;
10 | text-align: center;
11 | background-size: contain;
12 | }
13 | .center{
14 | text-align: center;
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | var util = require('../../utils/util.js');
4 | var config = require('../../config.js');
5 | const app = getApp()
6 | Page({
7 | data: {
8 | fromStation: "",
9 | toStation: "",
10 | dates: "",
11 | trains: "",
12 | seats: "",
13 | totalSeats: {},
14 | expireTime: ""
15 | },
16 |
17 | GetDateStr: function (AddDayCount) {
18 | var dd = new Date();
19 | dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
20 | var y = dd.getFullYear();
21 | var m = dd.getMonth() + 1; //获取当前月份的日期
22 | var d = dd.getDate();
23 | return y + "年" + m + "月" + d + "日";
24 | },
25 |
26 |
27 | onLoad: function (options) {
28 | let fromStation = wx.getStorageSync('fromStation')
29 | let toStation = wx.getStorageSync('toStation')
30 | let dates = this.GetDateStr(1)
31 | this.setData({
32 | fromStation: fromStation,
33 | toStation: toStation,
34 | dates: dates
35 | })
36 |
37 | //登陆一下
38 | wx.login({
39 | success: res => {
40 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
41 | config.get(config.urls.LOGIN_WX_URL, {
42 | code: res.code
43 | },
44 | function (res) {
45 | console.log(res.data.message);
46 | }
47 | )
48 | }
49 | })
50 | },
51 |
52 | bindtapFromStation: function (e) {
53 | console.log("bindtapFromStation");
54 | let that = this;
55 | wx.navigateTo({
56 | url: '../station/station',
57 | events: {
58 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
59 | okEvent: function (res) {
60 | console.log(res);
61 | that.setData({
62 | fromStation: res.data,
63 | });
64 | wx.setStorageSync('fromStation', res.data)
65 | console.log("station页面返回参数:" + res.data)
66 | }
67 | }
68 | })
69 | },
70 |
71 | bindtapToStation: function (e) {
72 |
73 | console.log("bindtapToStation");
74 |
75 | let that = this;
76 | wx.navigateTo({
77 | url: '../station/station',
78 | events: {
79 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
80 | okEvent: function (res) {
81 | console.log(res);
82 | that.setData({
83 | toStation: res.data,
84 | });
85 | wx.setStorageSync('toStation', res.data)
86 | console.log("station页面返回参数:" + res.data)
87 | }
88 | }
89 | })
90 | },
91 | bindtapSwitch: function (e) {
92 | console.log("bindtapSwitch")
93 | let temp = this.data.fromStation
94 | this.setData({
95 | fromStation: this.data.toStation,
96 | toStation: temp
97 | });
98 | this.setData({
99 | trains: "",
100 | seats: ""
101 | });
102 | wx.setStorageSync('fromStation', this.data.fromStation)
103 | wx.setStorageSync('toStation', this.data.toStation)
104 | },
105 | bindtapDates: function (e) {
106 | let that = this;
107 | wx.navigateTo({
108 | url: '../dates/dates',
109 | events: {
110 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
111 | okEvent: function (res) {
112 | let str = util.arrJoin(res.data, "/");
113 | console.log(str);
114 | that.setData({
115 | dates: str,
116 | });
117 | wx.setStorageSync('dates', str)
118 | }
119 | }
120 | })
121 | },
122 | bindtapTrains: function (e) {
123 | console.log("在index的bindtapTrains函数中")
124 | if (this.data.fromStation == "") {
125 | wx.showModal({
126 | title: '请先选择起始站',
127 | showCancel: false,
128 | success(res) {
129 | console.log('用户点击确定')
130 | }
131 | })
132 | return
133 | }
134 | if (this.data.toStation == "") {
135 | wx.showModal({
136 | title: '请先选择终点站',
137 | showCancel: false,
138 | success(res) {
139 | console.log('用户点击确定')
140 | }
141 | })
142 | return
143 | }
144 | if (this.data.dates == "") {
145 | wx.showModal({
146 | title: '请先选择时间',
147 | showCancel: false,
148 | success(res) {
149 | console.log('用户点击确定')
150 | }
151 | })
152 | return
153 | }
154 | let that = this;
155 | wx.navigateTo({
156 | url: '../trains/trains',
157 | events: {
158 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
159 | okEvent: function (res) {
160 | console.log("trains页面跳回index页面,返回结果")
161 | console.log(res);
162 | let str = util.arrJoin(res.data.selectedTrains, "/");
163 | let totalSeats = res.data.totalSeats;
164 | that.setData({
165 | trains: str,
166 | totalSeats: totalSeats
167 | });
168 | //获取过期时间
169 | var params = {
170 | fromStation: that.data.fromStation,
171 | toStation: that.data.toStation,
172 | dates: that.data.dates,
173 | trains: that.data.trains
174 | }
175 | config.get(config.urls.GET_EXPIRE_TIME_URL, params, function (res) {
176 | console.log("过期时间")
177 | console.log(res.data);
178 | if (res.data.success) {
179 | let expireTime = res.data.message;
180 | that.setData({
181 | expireTime: "抢票至:" + expireTime
182 | });
183 | }
184 | });
185 | }
186 | },
187 | success: function (res) {
188 | // 通过eventChannel向被打开页面传送数据
189 | let data = {
190 | fromStation: that.data.fromStation,
191 | toStation: that.data.toStation,
192 | dates: that.data.dates
193 | }
194 | res.eventChannel.emit('data', data);
195 | console.log("index页面跳转trains页面,传递参数")
196 | console.log(data)
197 | }
198 | })
199 | },
200 | bindtapSeats: function (e) {
201 | console.log("bindtapSeats");
202 | if (this.data.fromStation == "") {
203 | wx.showModal({
204 | title: '请先选择起始站',
205 | showCancel: false,
206 | success(res) {
207 | console.log('用户点击确定')
208 | }
209 | })
210 | return
211 | }
212 | if (this.data.toStation == "") {
213 | wx.showModal({
214 | title: '请先选择终点站',
215 | showCancel: false,
216 | success(res) {
217 | console.log('用户点击确定')
218 | }
219 | })
220 | return
221 | }
222 | if (this.data.dates == "") {
223 | wx.showModal({
224 | title: '请先选择时间',
225 | showCancel: false,
226 | success(res) {
227 | console.log('用户点击确定')
228 | }
229 | })
230 | return
231 | }
232 | if (this.data.trains == "") {
233 | wx.showModal({
234 | title: '请先选择车次',
235 | showCancel: false,
236 | success(res) {
237 | console.log('用户点击确定')
238 | }
239 | })
240 | return
241 | }
242 | let that = this;
243 | wx.navigateTo({
244 | url: '../seats/seats',
245 | events: {
246 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
247 | okEvent: function (res) {
248 | console.log(res);
249 | let str = util.arrJoin(res.data, "/");
250 | that.setData({
251 | seats: str,
252 | });
253 | }
254 | },
255 | success: function (res) {
256 | // 通过eventChannel向被打开页面传送数据
257 | let data = {
258 | totalSeats: that.data.totalSeats
259 | }
260 | res.eventChannel.emit('data', data);
261 | console.log("index页面跳转seats页面,传递参数")
262 | console.log(data)
263 | }
264 | })
265 | },
266 |
267 | bindtapNext: function (e) {
268 |
269 | var data = this.data;
270 |
271 | if (data.fromStation == "") {
272 | wx.showModal({
273 | title: '请先选择起始站',
274 | showCancel: false,
275 | success(res) {
276 | console.log('用户点击确定')
277 | }
278 | })
279 | return
280 | }
281 | if (data.toStation == "") {
282 | wx.showModal({
283 | title: '请先选择终点站',
284 | showCancel: false,
285 | success(res) {
286 | console.log('用户点击确定')
287 | }
288 | })
289 | return
290 | }
291 | if (data.dates == "") {
292 | wx.showModal({
293 | title: '请先选择时间',
294 | showCancel: false,
295 | success(res) {
296 | console.log('用户点击确定')
297 | }
298 | })
299 | return
300 | }
301 | if (data.trains == "") {
302 | wx.showModal({
303 | title: '请先选择车次',
304 | showCancel: false,
305 | success(res) {
306 | console.log('用户点击确定')
307 | }
308 | })
309 | return
310 | }
311 | if (data.seats == "") {
312 | wx.showModal({
313 | title: '请先选择坐席',
314 | showCancel: false,
315 | success(res) {
316 | console.log('用户点击确定')
317 | }
318 | })
319 | return
320 | }
321 |
322 | wx.setStorageSync('fromStation', this.data.fromStation)
323 | wx.setStorageSync('toStation', this.data.toStation)
324 | wx.setStorageSync('dates', this.data.dates)
325 |
326 | wx.navigateTo({
327 | url: '../submit/submit',
328 | events: {
329 | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
330 | okEvent: function (res) {
331 | console.log(res);
332 | }
333 | },
334 | success: function (res) {
335 | // 通过eventChannel向被打开页面传送数据
336 | res.eventChannel.emit('data', data);
337 | }
338 | })
339 | }
340 | })
--------------------------------------------------------------------------------