Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -0,0 +1,32 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
coverage
|
||||||
|
*.local
|
||||||
|
|
||||||
|
/cypress/videos/
|
||||||
|
/cypress/screenshots/
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
/unpackage/*
|
||||||
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 9afd67d4320ab967a75ad9a38e65907cb3074bfe
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
@ -0,0 +1,12 @@
|
|||||||
|
const apiOther = {
|
||||||
|
/**
|
||||||
|
* 发送手机验证码
|
||||||
|
*/
|
||||||
|
sendMobileCode: (params) => {
|
||||||
|
return uni.$u.http.post("/mobile/get_verify_code", {
|
||||||
|
mobileNo: params.mobileNo, // 手机号码
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default apiOther;
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 站点接口
|
||||||
|
*/
|
||||||
|
|
||||||
|
const apiStations = {
|
||||||
|
/**
|
||||||
|
* 站点列表
|
||||||
|
*/
|
||||||
|
get: (params) => {
|
||||||
|
return uni.$u.http.get("/stations");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default apiStations;
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* 车票接口
|
||||||
|
*/
|
||||||
|
|
||||||
|
const apiTickets = {
|
||||||
|
/**
|
||||||
|
* 车票列表
|
||||||
|
*/
|
||||||
|
get: (params) => {
|
||||||
|
return uni.$u.http.get("/tickets", {
|
||||||
|
params: {
|
||||||
|
state: 1, // 已出票(订单已支付)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default apiTickets;
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 车次接口
|
||||||
|
*/
|
||||||
|
|
||||||
|
const apiTrains = {
|
||||||
|
/**
|
||||||
|
* 车次列表
|
||||||
|
*/
|
||||||
|
get: (params) => {
|
||||||
|
return uni.$u.http.get("/trains/query_train", {
|
||||||
|
params: {
|
||||||
|
from: params.from,
|
||||||
|
to: params.to,
|
||||||
|
date: params.date,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default apiTrains;
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<script>
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||||
|
CSS.supports('top: constant(a)'))
|
||||||
|
document.write(
|
||||||
|
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||||
|
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<title></title>
|
||||||
|
<!--preload-links-->
|
||||||
|
<!--app-context-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"><!--app-html--></div>
|
||||||
|
<script type="module" src="/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 762 B |
|
After Width: | Height: | Size: 502 B |
|
After Width: | Height: | Size: 978 B |
|
After Width: | Height: | Size: 734 B |
|
After Width: | Height: | Size: 883 B |
|
After Width: | Height: | Size: 841 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 525 B |
|
After Width: | Height: | Size: 800 B |
|
After Width: | Height: | Size: 652 B |
|
After Width: | Height: | Size: 579 B |
|
After Width: | Height: | Size: 944 B |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 578 B |
|
After Width: | Height: | Size: 594 B |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 366 B |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 727 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 335 KiB |
|
After Width: | Height: | Size: 652 KiB |
|
After Width: | Height: | Size: 1023 KiB |
@ -0,0 +1,35 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import Vuex from "vuex";
|
||||||
|
|
||||||
|
import storeAuth from "./modules/auth";
|
||||||
|
|
||||||
|
Vue.use(Vuex);
|
||||||
|
|
||||||
|
const store = new Vuex.Store({
|
||||||
|
state: {
|
||||||
|
stations: [],
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
SET_STATIONS(state, stations) {
|
||||||
|
state.stations = stations || [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
/**
|
||||||
|
* [{ id: 1, name: "长沙南站" }]
|
||||||
|
*/
|
||||||
|
updateStations({ commit }, stations) {
|
||||||
|
commit(
|
||||||
|
"SET_STATIONS",
|
||||||
|
stations.sort((a, b) =>
|
||||||
|
a.pinyin < b.pinyin ? -1 : a.pinyin > b.pinyin ? 1 : 0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
modules: {
|
||||||
|
auth: storeAuth,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default store;
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
import getDefaultAuth from "./state";
|
||||||
|
|
||||||
|
export function updateAuth({ commit }, auth) {
|
||||||
|
auth = auth ?? getDefaultAuth();
|
||||||
|
if ("token" in auth) uni.setStorageSync("auth-token", auth.token);
|
||||||
|
if ("id" in auth) commit("SET_AUTH_ID", auth.id);
|
||||||
|
if ("account" in auth) commit("SET_AUTH_ACCOUNT", auth.account);
|
||||||
|
if ("name" in auth) commit("SET_AUTH_NAME", auth.name);
|
||||||
|
if ("idCardNo" in auth) commit("SET_AUTH_ID_CARD_NO", auth.idCardNo);
|
||||||
|
if ("mobileNo" in auth) commit("SET_AUTH_MOBILE_NO", auth.mobileNo);
|
||||||
|
if ("bankCardNo" in auth) commit("SET_AUTH_BANK_CARD_NO", auth.bankCardNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function revertAuth({ dispatch }) {
|
||||||
|
dispatch("updateAuth", getDefaultAuth());
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Auth 代表登录用户信息
|
||||||
|
*/
|
||||||
|
|
||||||
|
import getDefaultAuth from "./state";
|
||||||
|
import * as mutations from "./mutations";
|
||||||
|
import * as actions from "./actions";
|
||||||
|
|
||||||
|
const storeAuth = {
|
||||||
|
state: getDefaultAuth(),
|
||||||
|
mutations,
|
||||||
|
actions,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default storeAuth;
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import getDefaultAuth from "./state";
|
||||||
|
|
||||||
|
export function SET_AUTH_ID(state, id) {
|
||||||
|
state.id = id || getDefaultAuth().id;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SET_AUTH_ACCOUNT(state, account) {
|
||||||
|
state.account = account || getDefaultAuth().account;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SET_AUTH_NAME(state, name) {
|
||||||
|
state.name = name || getDefaultAuth().name;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SET_AUTH_ID_CARD_NO(state, idCardNo) {
|
||||||
|
state.idCardNo = idCardNo || getDefaultAuth().idCardNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SET_AUTH_MOBILE_NO(state, mobileNo) {
|
||||||
|
state.mobileNo = mobileNo || getDefaultAuth().mobileNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SET_AUTH_BANK_CARD_NO(state, bankCardNo) {
|
||||||
|
state.bankCardNo = bankCardNo || getDefaultAuth().bankCardNo;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
function getDefaultAuth() {
|
||||||
|
return {
|
||||||
|
id: undefined,
|
||||||
|
account: "", // 用户名
|
||||||
|
name: "", // 姓名
|
||||||
|
idCardNo: "", // 身份证号
|
||||||
|
mobileNo: undefined, // 手机号
|
||||||
|
bankCardNo: undefined, // 银行卡号
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getDefaultAuth;
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
uni.addInterceptor({
|
||||||
|
returnValue (res) {
|
||||||
|
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
export function timeAscCompareFn(aTime, bTime) {
|
||||||
|
const at = uni.$u.dayjs(aTime);
|
||||||
|
const bt = uni.$u.dayjs(bTime);
|
||||||
|
|
||||||
|
if (at.isBefore(bt)) return -1;
|
||||||
|
else if (at.isAfter(bt)) return 1;
|
||||||
|
else return 0;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
uNavbarBgColor: "transparent",
|
||||||
|
uNavbarTitleColor: "transparent",
|
||||||
|
uNavbarIconColor: "var(--color-white)",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onPageScroll(e) {
|
||||||
|
let per = e.scrollTop / 200;
|
||||||
|
if (per < 0) per = 0;
|
||||||
|
else if (per > 1) per = 1;
|
||||||
|
|
||||||
|
this.uNavbarBgColor = `rgba(245,245,245,${per})`;
|
||||||
|
this.uNavbarTitleColor = `rgba(48,49,51,${per})`;
|
||||||
|
this.uNavbarIconColor = `rgba(${255 - (255 - 96) * per},${
|
||||||
|
255 - (255 - 98) * per
|
||||||
|
},${255 - (255 - 102) * per})`;
|
||||||
|
},
|
||||||
|
};
|
||||||