├── .browserslistrc
├── public
├── favicon.ico
└── index.html
├── src
├── assets
│ ├── logo.png
│ ├── banner_1.jpg
│ └── banner_2.jpg
├── main.js
├── utils
│ └── config.js
├── store
│ └── index.js
├── views
│ ├── ComingSoon.vue
│ ├── NowPlaying.vue
│ ├── Films.vue
│ ├── Film.vue
│ └── City.vue
├── router
│ └── index.js
├── App.vue
└── components
│ └── ListItem.vue
├── babel.config.js
├── postcss.config.js
├── .gitignore
├── .eslintrc.js
├── index.html
├── README.md
└── package.json
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyingying/sell-ticket/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyingying/sell-ticket/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/src/assets/banner_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyingying/sell-ticket/HEAD/src/assets/banner_1.jpg
--------------------------------------------------------------------------------
/src/assets/banner_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiangyingying/sell-ticket/HEAD/src/assets/banner_2.jpg
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | 'autoprefixer': {
4 | browsers: ['Android >= 4.0', 'iOS >= 7']
5 | },
6 | 'postcss-pxtorem': {
7 | rootValue: 37.5,
8 | propList: ['*']
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | 'extends': [
7 | 'plugin:vue/essential',
8 | 'eslint:recommended'
9 | ],
10 | rules: {
11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
13 | },
14 | parserOptions: {
15 | parser: 'babel-eslint'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # sell-tickets
2 |
3 | ## Project setup
4 | ```
5 | yarn install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | yarn run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | yarn run build
16 | ```
17 |
18 | ### Run your tests
19 | ```
20 | yarn run test
21 | ```
22 |
23 | ### Lints and fixes files
24 | ```
25 | yarn run lint
26 | ```
27 |
28 | ### Customize configuration
29 | See [Configuration Reference](https://cli.vuejs.org/config/).
30 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import '@/utils/config.js'
6 | import axios from 'axios'
7 | axios.interceptors.request.use(function (config) {
8 | store.state.isLoading = true;
9 | return config;
10 | });
11 | axios.interceptors.response.use(function (response) {
12 | store.state.isLoading = false;
13 | return response;
14 | });
15 | Vue.config.productionTip = false
16 | Vue.prototype.axios=axios
17 | new Vue({
18 | router,
19 | store,
20 | render: h => h(App)
21 | }).$mount('#app')
22 |
--------------------------------------------------------------------------------
/src/utils/config.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import axios from 'axios'
3 | import Vant from 'vant'
4 | import { Swipe, SwipeItem } from 'vant';
5 | import 'vant/lib/index.css';
6 | import { Lazyload } from 'vant';
7 | import {Loading} from 'vant'
8 | import { IndexBar, IndexAnchor } from 'vant';
9 | import ListItem from '@/components/ListItem.vue'
10 | Vue.use(Lazyload);
11 | Vue.use(Swipe).use(SwipeItem);
12 | Vue.use(IndexBar).use(IndexAnchor);
13 | Vue.use(Loading)
14 | Vue.use(Vant)
15 | Vue.component("ListItem",ListItem)
16 | Vue.prototype.axios=axios
17 | axios.defaults.baseURL='https://douban-api.now.sh/v2'
18 | export default Vue
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 | function getCity(){
6 | let defaultCity="北京";
7 | if(localStorage.getItem("cities")){
8 | defaultCity=localStorage.getItem("cities")
9 | }
10 | return defaultCity
11 | }
12 | export default new Vuex.Store({
13 | state: {
14 | isLoading:true,
15 | city:getCity()
16 | },
17 | mutations: {
18 | toggleCity(state,city){
19 | state.city=city
20 | }
21 | },
22 | actions: {
23 | changeCity(ctx,city){
24 | ctx.commit("toggleCity",city)
25 | localStorage.setItem("cities",city)
26 | }
27 | },
28 | modules: {
29 | }
30 | })
31 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | sell-tickets
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/views/ComingSoon.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
26 |
27 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sell-tickets",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "amfe-flexible": "^2.2.1",
12 | "axios": "^0.19.0",
13 | "core-js": "^3.3.2",
14 | "postcss-pxtorem": "^4.0.1",
15 | "vant": "^2.2.13",
16 | "vue": "^2.6.10",
17 | "vue-router": "^3.1.3",
18 | "vuex": "^3.0.1"
19 | },
20 | "devDependencies": {
21 | "@vue/cli-plugin-babel": "^4.0.0",
22 | "@vue/cli-plugin-eslint": "^4.0.0",
23 | "@vue/cli-service": "^4.0.0",
24 | "babel-eslint": "^10.0.3",
25 | "eslint": "^5.16.0",
26 | "eslint-plugin-vue": "^5.0.0",
27 | "node-sass": "^4.12.0",
28 | "sass-loader": "^8.0.0",
29 | "vue-template-compiler": "^2.6.10"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 | import Films from '../views/Films.vue'
4 |
5 | Vue.use(VueRouter)
6 |
7 | const routes = [
8 | {
9 | path: '/films',
10 | name: 'films',
11 | component: Films,
12 | children:[
13 | {
14 | path:'nowPlaying',
15 | component:()=>import('../views/NowPlaying.vue')
16 | },
17 | {
18 | path:'ComingSoon',
19 | component:()=>import('../views/ComingSoon.vue')
20 | },
21 | ],
22 | },
23 | {
24 | path: '/film',
25 | name: 'film',
26 | component: () => import('../views/Film.vue')
27 | },
28 | {
29 | path: '/city',
30 | name: 'city',
31 | component: () => import('../views/City.vue')
32 | },
33 | {
34 | path:'/',
35 | redirect:"/films/nowPlaying"
36 | }
37 | ]
38 |
39 | const router = new VueRouter({
40 | mode: 'hash',
41 | base: process.env.BASE_URL,
42 | routes
43 | })
44 |
45 | export default router
46 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 加载中...
7 |
8 |
9 |
19 |
52 |
--------------------------------------------------------------------------------
/src/views/NowPlaying.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
30 |
31 |
--------------------------------------------------------------------------------
/src/components/ListItem.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
![]()
6 |
7 |
{{data.title}}
8 |
主演:{{item.name}} /
9 |
{{data.durations[0]}}
10 |
11 |
12 |
13 |
14 |
15 |
31 |
32 |
--------------------------------------------------------------------------------
/src/views/Films.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{city}}
7 |
8 |
电影
9 |
10 |
11 |
12 | {{city}}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 正在热映
22 | 即将上映
23 |
24 |
25 |
26 |
27 |
28 |
29 |
67 |
123 |
--------------------------------------------------------------------------------
/src/views/Film.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
{{data.title}}
6 |
7 |
8 |
![]()
9 |
10 |
{{data.title}}
11 |
{{item}} |
12 |
{{data.mainland_pubdate}}上映
13 |
{{data.countries[0]}} | {{data.durations[0]}}
14 |
{{data.summary}}
15 |
16 |
17 |
演职人员
18 |
19 |
20 |
21 |
![]()
22 |
{{item.name}}
23 |
24 |
25 |
26 |
27 |
28 |
29 | 剧照
30 | 全部({{data.clips.length}}) >
31 |
32 |
33 |
34 |
![]()
35 |
36 |
37 |
38 |
选座购票
39 |
40 |
41 |
42 |
81 |
82 |
--------------------------------------------------------------------------------
/src/views/City.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
当前城市 - 武汉
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
GPS定位你所在城市
19 |
武汉
20 |
21 |
22 |
热门城市
23 |
26 | {{item.name}}
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
100 |
101 |
--------------------------------------------------------------------------------