├── .browserslistrc
├── .env.development
├── .env.production
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── public
├── favicon.ico
└── index.html
├── src
├── App.vue
├── api
│ └── user.js
├── assets
│ ├── audio
│ │ ├── alarm.mp3
│ │ ├── bg_room0.mp3
│ │ ├── bg_room1.mp3
│ │ ├── big_joker.mp3
│ │ ├── bomb0.mp3
│ │ ├── bomb1.mp3
│ │ ├── call.mp3
│ │ ├── click.mp3
│ │ ├── deal.mp3
│ │ ├── double_line.mp3
│ │ ├── end_lose.mp3
│ │ ├── end_win.mp3
│ │ ├── follow0.mp3
│ │ ├── follow1.mp3
│ │ ├── follow2.mp3
│ │ ├── follow3.mp3
│ │ ├── follow4.mp3
│ │ ├── four_take_two.mp3
│ │ ├── joker_bomb.mp3
│ │ ├── lose.mp3
│ │ ├── nocall0.mp3
│ │ ├── nocall1.mp3
│ │ ├── norob.mp3
│ │ ├── pass0.mp3
│ │ ├── pass1.mp3
│ │ ├── pass2.mp3
│ │ ├── pass3.mp3
│ │ ├── pass4.mp3
│ │ ├── plane.mp3
│ │ ├── play.mp3
│ │ ├── rob0.mp3
│ │ ├── rob1.mp3
│ │ ├── rob2.mp3
│ │ ├── select.mp3
│ │ ├── single_line.mp3
│ │ ├── small_joker.mp3
│ │ ├── start.mp3
│ │ ├── three_take_one.mp3
│ │ ├── three_take_two.mp3
│ │ └── win.mp3
│ └── images
│ │ ├── alarm-clock.png
│ │ ├── avatar
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 2.png
│ │ ├── 3.png
│ │ ├── 4.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ │ ├── back.png
│ │ ├── back1.png
│ │ ├── back2.png
│ │ ├── bg_hall.png
│ │ ├── bomb.png
│ │ ├── bomb1.png
│ │ ├── burst.png
│ │ ├── button
│ │ ├── create_room.png
│ │ ├── enter_room.png
│ │ ├── match_room.png
│ │ ├── next.png
│ │ ├── pass.png
│ │ ├── play.png
│ │ ├── readied.png
│ │ ├── return_room.png
│ │ ├── start.png
│ │ ├── tip.png
│ │ └── traveler.png
│ │ ├── club.png
│ │ ├── coin.png
│ │ ├── ddz_bg.jpg
│ │ ├── default.jpg
│ │ ├── default1.jpg
│ │ ├── desk.jpg
│ │ ├── desk.png
│ │ ├── diamond.png
│ │ ├── hall_logo_pic.png
│ │ ├── hall_user.png
│ │ ├── hall_user2.png
│ │ ├── heart.png
│ │ ├── match.png
│ │ ├── spade.png
│ │ ├── tip.png
│ │ └── victory.png
├── components
│ └── Modal.vue
├── directive
│ └── clickoutside.js
├── main.js
├── permission.js
├── router
│ └── index.js
├── store
│ ├── getters.js
│ ├── index.js
│ └── modules
│ │ └── user.js
├── utils
│ ├── auth.js
│ ├── common.js
│ ├── get-title.js
│ ├── poker.js
│ ├── request.js
│ ├── socket.js
│ ├── storage.js
│ ├── tips.js
│ └── validate.js
└── views
│ ├── hall
│ └── Hall.vue
│ ├── room
│ ├── Action.vue
│ ├── Card.vue
│ ├── Fade.vue
│ ├── HandCard.vue
│ ├── Header.vue
│ ├── Music.vue
│ ├── OutCard.vue
│ ├── Room.vue
│ ├── Setting.vue
│ ├── Settle.vue
│ └── User.vue
│ └── user
│ ├── Login.vue
│ ├── userRegister.vue
│ └── userlogin.vue
└── vue.config.js
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/.env.development:
--------------------------------------------------------------------------------
1 | # just a flag
2 | ENV = 'development'
3 |
4 | # base api
5 | VUE_APP_BASE_HREF = 'http://127.0.0.1:9501'
6 | VUE_APP_BASE_API = '/api'
7 | VUE_APP_SOCKET_URL = '192.168.10.20'
8 | VUE_APP_SOCKET_PORT = '9501'
9 |
10 | # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
11 | # to control whether the babel-plugin-dynamic-import-node plugin is enabled.
12 | # It only does one thing by converting all import() to require().
13 | # This configuration can significantly increase the speed of hot updates,
14 | # when you have a large number of pages.
15 | # Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
16 |
17 | VUE_CLI_BABEL_TRANSPILE_MODULES = true
18 |
--------------------------------------------------------------------------------
/.env.production:
--------------------------------------------------------------------------------
1 | # just a flag
2 | ENV = 'production'
3 |
4 | # base api
5 | VUE_APP_BASE_HREF = 'http://127.0.0.1:91'
6 | VUE_APP_BASE_API = '/api'
7 | VUE_APP_SOCKET_URL = '192.168.10.20'
8 | VUE_APP_SOCKET_PORT = '9501'
9 |
10 | VUE_CLI_BABEL_TRANSPILE_MODULES = true
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | src/assets
3 | public
4 | dist
5 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parserOptions: {
4 | parser: 'babel-eslint',
5 | sourceType: 'module'
6 | },
7 | env: {
8 | browser: true,
9 | node: true,
10 | es6: true,
11 | },
12 | extends: ['plugin:vue/recommended', 'eslint:recommended'],
13 |
14 | // add your custom rules here
15 | //it is base on https://github.com/vuejs/eslint-config-vue
16 | rules: {
17 | "vue/max-attributes-per-line": [2, {
18 | "singleline": 10,
19 | "multiline": {
20 | "max": 1,
21 | "allowFirstLine": false
22 | }
23 | }],
24 | "vue/singleline-html-element-content-newline": "off",
25 | "vue/multiline-html-element-content-newline": "off",
26 | "vue/name-property-casing": ["error", "PascalCase"],
27 | "vue/no-v-html": "off",
28 | 'accessor-pairs': 2,
29 | 'arrow-spacing': [2, {
30 | 'before': true,
31 | 'after': true
32 | }],
33 | 'block-spacing': [2, 'always'],
34 | 'brace-style': [2, '1tbs', {
35 | 'allowSingleLine': true
36 | }],
37 | 'camelcase': [0, {
38 | 'properties': 'always'
39 | }],
40 | 'comma-dangle': [2, 'never'],
41 | 'comma-spacing': [2, {
42 | 'before': false,
43 | 'after': true
44 | }],
45 | 'comma-style': [2, 'last'],
46 | 'constructor-super': 2,
47 | 'curly': [2, 'multi-line'],
48 | 'dot-location': [2, 'property'],
49 | 'eol-last': 2,
50 | 'eqeqeq': ["error", "always", {
51 | "null": "ignore"
52 | }],
53 | 'generator-star-spacing': [2, {
54 | 'before': true,
55 | 'after': true
56 | }],
57 | 'handle-callback-err': [2, '^(err|error)$'],
58 | 'indent': [2, 2, {
59 | 'SwitchCase': 1
60 | }],
61 | 'jsx-quotes': [2, 'prefer-single'],
62 | 'key-spacing': [2, {
63 | 'beforeColon': false,
64 | 'afterColon': true
65 | }],
66 | 'keyword-spacing': [2, {
67 | 'before': true,
68 | 'after': true
69 | }],
70 | 'new-cap': [2, {
71 | 'newIsCap': true,
72 | 'capIsNew': false
73 | }],
74 | 'new-parens': 2,
75 | 'no-array-constructor': 2,
76 | 'no-caller': 2,
77 | 'no-console': 'off',
78 | 'no-class-assign': 2,
79 | 'no-cond-assign': 2,
80 | 'no-const-assign': 2,
81 | 'no-control-regex': 0,
82 | 'no-delete-var': 2,
83 | 'no-dupe-args': 2,
84 | 'no-dupe-class-members': 2,
85 | 'no-dupe-keys': 2,
86 | 'no-duplicate-case': 2,
87 | 'no-empty-character-class': 2,
88 | 'no-empty-pattern': 2,
89 | 'no-eval': 2,
90 | 'no-ex-assign': 2,
91 | 'no-extend-native': 2,
92 | 'no-extra-bind': 2,
93 | 'no-extra-boolean-cast': 2,
94 | 'no-extra-parens': [2, 'functions'],
95 | 'no-fallthrough': 2,
96 | 'no-floating-decimal': 2,
97 | 'no-func-assign': 2,
98 | 'no-implied-eval': 2,
99 | 'no-inner-declarations': [2, 'functions'],
100 | 'no-invalid-regexp': 2,
101 | 'no-irregular-whitespace': 2,
102 | 'no-iterator': 2,
103 | 'no-label-var': 2,
104 | 'no-labels': [2, {
105 | 'allowLoop': false,
106 | 'allowSwitch': false
107 | }],
108 | 'no-lone-blocks': 2,
109 | 'no-mixed-spaces-and-tabs': 2,
110 | 'no-multi-spaces': 2,
111 | 'no-multi-str': 2,
112 | 'no-multiple-empty-lines': [2, {
113 | 'max': 1
114 | }],
115 | 'no-native-reassign': 2,
116 | 'no-negated-in-lhs': 2,
117 | 'no-new-object': 2,
118 | 'no-new-require': 2,
119 | 'no-new-symbol': 2,
120 | 'no-new-wrappers': 2,
121 | 'no-obj-calls': 2,
122 | 'no-octal': 2,
123 | 'no-octal-escape': 2,
124 | 'no-path-concat': 2,
125 | 'no-proto': 2,
126 | 'no-redeclare': 2,
127 | 'no-regex-spaces': 2,
128 | 'no-return-assign': [2, 'except-parens'],
129 | 'no-self-assign': 2,
130 | 'no-self-compare': 2,
131 | 'no-sequences': 2,
132 | 'no-shadow-restricted-names': 2,
133 | 'no-spaced-func': 2,
134 | 'no-sparse-arrays': 2,
135 | 'no-this-before-super': 2,
136 | 'no-throw-literal': 2,
137 | 'no-trailing-spaces': 2,
138 | 'no-undef': 2,
139 | 'no-undef-init': 2,
140 | 'no-unexpected-multiline': 2,
141 | 'no-unmodified-loop-condition': 2,
142 | 'no-unneeded-ternary': [2, {
143 | 'defaultAssignment': false
144 | }],
145 | 'no-unreachable': 2,
146 | 'no-unsafe-finally': 2,
147 | 'no-unused-vars': [2, {
148 | 'vars': 'all',
149 | 'args': 'none'
150 | }],
151 | 'no-useless-call': 2,
152 | 'no-useless-computed-key': 2,
153 | 'no-useless-constructor': 2,
154 | 'no-useless-escape': 0,
155 | 'no-whitespace-before-property': 2,
156 | 'no-with': 2,
157 | 'one-var': [2, {
158 | 'initialized': 'never'
159 | }],
160 | 'operator-linebreak': [2, 'after', {
161 | 'overrides': {
162 | '?': 'before',
163 | ':': 'before'
164 | }
165 | }],
166 | 'padded-blocks': [2, 'never'],
167 | 'quotes': [2, 'single', {
168 | 'avoidEscape': true,
169 | 'allowTemplateLiterals': true
170 | }],
171 | 'semi': [2, 'never'],
172 | 'semi-spacing': [2, {
173 | 'before': false,
174 | 'after': true
175 | }],
176 | 'space-before-blocks': [2, 'always'],
177 | 'space-before-function-paren': [2, 'never'],
178 | 'space-in-parens': [2, 'never'],
179 | 'space-infix-ops': 2,
180 | 'space-unary-ops': [2, {
181 | 'words': true,
182 | 'nonwords': false
183 | }],
184 | 'spaced-comment': [2, 'always', {
185 | 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
186 | }],
187 | 'template-curly-spacing': [2, 'never'],
188 | 'use-isnan': 2,
189 | 'valid-typeof': 2,
190 | 'wrap-iife': [2, 'any'],
191 | 'yield-star-spacing': [2, 'both'],
192 | 'yoda': [2, 'never'],
193 | 'prefer-const': 2,
194 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
195 | 'object-curly-spacing': [2, 'always', {
196 | objectsInObjects: false
197 | }],
198 | 'array-bracket-spacing': [2, 'never']
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 | *.sw?
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
ddz-vue
4 |
5 | 斗地主vue版,
6 | 在线体验地址
7 |
8 |
9 |
10 | ❤︎ 此为客户端vue版, 需要配合服务端使用。
11 | 斗地主服务端
12 |
13 |
14 |
15 |

16 |
17 |

18 |
19 |

20 |
21 |
22 | ## 前言
23 |
24 | >三人斗地主实时对战,AI斗地主,实现基于权重的智能机器人对打。
25 |
26 | ## 功能
27 |
28 | - [x] 游戏逻辑
29 | - [x] 登录/注销
30 | - [x] 游戏大厅
31 | - [x] 创建/加入房间
32 | - [x] 随机匹配
33 | - [x] 智能AI
34 | - [x] 托管出牌
35 | - [x] 断线重连
36 | - [x] 超时自动出牌
37 | - [x] 换桌
38 | - [x] 结算
39 | - [ ] 提示出牌
40 | - [ ] 解散房间
41 | - [ ] 聊天
42 |
43 | ## 安装步骤
44 |
45 | ```
46 | #克隆存储库
47 | git clone https://github.com/voocel/ddz-vue.git
48 |
49 | #进入应用目录与安装依赖
50 | cd ddz-vue
51 |
52 | #安装项目依赖,等待安装完成之后,安装失败可用 cnpm 或 yarn
53 | npm install
54 |
55 | #开启服务器,浏览器访问 http://localhost:8080
56 | npm run serve
57 |
58 | #执行构建命令,生成的dist文件夹放在服务器下即可访问
59 | npm run build
60 | ```
61 | 演示地址: http://voocel.com:88
62 |
63 | 演示环境账号密码:
64 |
65 | 账号 | 密码| 描述
66 | ---|---|---
67 | test1 | 123456 |普通账户
68 | test2 | 123456 |普通账户
69 | test3 | 123456 |普通账户
70 |
71 | ## 预览 效果图
72 |
73 | 
74 | 
75 | 
76 | 
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ddz-vue",
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 | "axios": "^0.19.2",
12 | "core-js": "^3.6.4",
13 | "element-ui": "^2.13.2",
14 | "nprogress": "^0.2.0",
15 | "vue": "^2.6.11",
16 | "vue-native-websocket": "^2.0.14",
17 | "vue-router": "^3.1.6",
18 | "vuex": "^3.1.3"
19 | },
20 | "devDependencies": {
21 | "@vue/cli-plugin-babel": "^4.3.0",
22 | "@vue/cli-plugin-eslint": "^4.3.0",
23 | "@vue/cli-plugin-router": "^4.3.0",
24 | "@vue/cli-plugin-vuex": "^4.3.0",
25 | "@vue/cli-service": "^4.3.0",
26 | "@vue/eslint-config-prettier": "^6.0.0",
27 | "babel-eslint": "^10.1.0",
28 | "eslint": "^6.7.2",
29 | "eslint-plugin-prettier": "^3.1.1",
30 | "eslint-plugin-vue": "^6.2.2",
31 | "prettier": "^1.19.1",
32 | "sass": "^1.26.3",
33 | "sass-loader": "^8.0.2",
34 | "vue-template-compiler": "^2.6.11",
35 | "vue-component-inspector": "^1.1.14"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
14 |
--------------------------------------------------------------------------------
/src/api/user.js:
--------------------------------------------------------------------------------
1 | import request from '@/utils/request'
2 |
3 | export function login(data) {
4 | return request({
5 | url: '/user/login',
6 | method: 'post',
7 | data
8 | })
9 | }
10 |
11 | export function register(data) {
12 | return request({
13 | url: '/user/register',
14 | method: 'post',
15 | data
16 | })
17 | }
18 |
19 | export function logout(data) {
20 | return request({
21 | url: '/user/logout',
22 | method: 'post',
23 | data
24 | })
25 | }
26 |
27 | export function createRoom(data) {
28 | return request({
29 | url: '/user/createRoom',
30 | method: 'post',
31 | data
32 | })
33 | }
34 |
--------------------------------------------------------------------------------
/src/assets/audio/alarm.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/alarm.mp3
--------------------------------------------------------------------------------
/src/assets/audio/bg_room0.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/bg_room0.mp3
--------------------------------------------------------------------------------
/src/assets/audio/bg_room1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/bg_room1.mp3
--------------------------------------------------------------------------------
/src/assets/audio/big_joker.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/big_joker.mp3
--------------------------------------------------------------------------------
/src/assets/audio/bomb0.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/bomb0.mp3
--------------------------------------------------------------------------------
/src/assets/audio/bomb1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/bomb1.mp3
--------------------------------------------------------------------------------
/src/assets/audio/call.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/call.mp3
--------------------------------------------------------------------------------
/src/assets/audio/click.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/click.mp3
--------------------------------------------------------------------------------
/src/assets/audio/deal.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/deal.mp3
--------------------------------------------------------------------------------
/src/assets/audio/double_line.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/double_line.mp3
--------------------------------------------------------------------------------
/src/assets/audio/end_lose.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/end_lose.mp3
--------------------------------------------------------------------------------
/src/assets/audio/end_win.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/end_win.mp3
--------------------------------------------------------------------------------
/src/assets/audio/follow0.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/follow0.mp3
--------------------------------------------------------------------------------
/src/assets/audio/follow1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/follow1.mp3
--------------------------------------------------------------------------------
/src/assets/audio/follow2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/follow2.mp3
--------------------------------------------------------------------------------
/src/assets/audio/follow3.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/follow3.mp3
--------------------------------------------------------------------------------
/src/assets/audio/follow4.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/follow4.mp3
--------------------------------------------------------------------------------
/src/assets/audio/four_take_two.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/four_take_two.mp3
--------------------------------------------------------------------------------
/src/assets/audio/joker_bomb.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/joker_bomb.mp3
--------------------------------------------------------------------------------
/src/assets/audio/lose.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/lose.mp3
--------------------------------------------------------------------------------
/src/assets/audio/nocall0.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/nocall0.mp3
--------------------------------------------------------------------------------
/src/assets/audio/nocall1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/nocall1.mp3
--------------------------------------------------------------------------------
/src/assets/audio/norob.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/norob.mp3
--------------------------------------------------------------------------------
/src/assets/audio/pass0.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/pass0.mp3
--------------------------------------------------------------------------------
/src/assets/audio/pass1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/pass1.mp3
--------------------------------------------------------------------------------
/src/assets/audio/pass2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/pass2.mp3
--------------------------------------------------------------------------------
/src/assets/audio/pass3.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/pass3.mp3
--------------------------------------------------------------------------------
/src/assets/audio/pass4.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/pass4.mp3
--------------------------------------------------------------------------------
/src/assets/audio/plane.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/plane.mp3
--------------------------------------------------------------------------------
/src/assets/audio/play.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/play.mp3
--------------------------------------------------------------------------------
/src/assets/audio/rob0.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/rob0.mp3
--------------------------------------------------------------------------------
/src/assets/audio/rob1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/rob1.mp3
--------------------------------------------------------------------------------
/src/assets/audio/rob2.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/rob2.mp3
--------------------------------------------------------------------------------
/src/assets/audio/select.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/select.mp3
--------------------------------------------------------------------------------
/src/assets/audio/single_line.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/single_line.mp3
--------------------------------------------------------------------------------
/src/assets/audio/small_joker.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/small_joker.mp3
--------------------------------------------------------------------------------
/src/assets/audio/start.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/start.mp3
--------------------------------------------------------------------------------
/src/assets/audio/three_take_one.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/three_take_one.mp3
--------------------------------------------------------------------------------
/src/assets/audio/three_take_two.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/three_take_two.mp3
--------------------------------------------------------------------------------
/src/assets/audio/win.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/audio/win.mp3
--------------------------------------------------------------------------------
/src/assets/images/alarm-clock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/alarm-clock.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/1.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/10.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/11.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/12.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/13.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/14.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/15.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/16.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/17.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/18.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/2.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/3.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/4.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/5.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/6.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/7.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/8.png
--------------------------------------------------------------------------------
/src/assets/images/avatar/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/avatar/9.png
--------------------------------------------------------------------------------
/src/assets/images/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/back.png
--------------------------------------------------------------------------------
/src/assets/images/back1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/back1.png
--------------------------------------------------------------------------------
/src/assets/images/back2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/back2.png
--------------------------------------------------------------------------------
/src/assets/images/bg_hall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/bg_hall.png
--------------------------------------------------------------------------------
/src/assets/images/bomb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/bomb.png
--------------------------------------------------------------------------------
/src/assets/images/bomb1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/bomb1.png
--------------------------------------------------------------------------------
/src/assets/images/burst.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/burst.png
--------------------------------------------------------------------------------
/src/assets/images/button/create_room.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/create_room.png
--------------------------------------------------------------------------------
/src/assets/images/button/enter_room.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/enter_room.png
--------------------------------------------------------------------------------
/src/assets/images/button/match_room.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/match_room.png
--------------------------------------------------------------------------------
/src/assets/images/button/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/next.png
--------------------------------------------------------------------------------
/src/assets/images/button/pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/pass.png
--------------------------------------------------------------------------------
/src/assets/images/button/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/play.png
--------------------------------------------------------------------------------
/src/assets/images/button/readied.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/readied.png
--------------------------------------------------------------------------------
/src/assets/images/button/return_room.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/return_room.png
--------------------------------------------------------------------------------
/src/assets/images/button/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/start.png
--------------------------------------------------------------------------------
/src/assets/images/button/tip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/tip.png
--------------------------------------------------------------------------------
/src/assets/images/button/traveler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/button/traveler.png
--------------------------------------------------------------------------------
/src/assets/images/club.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/club.png
--------------------------------------------------------------------------------
/src/assets/images/coin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/coin.png
--------------------------------------------------------------------------------
/src/assets/images/ddz_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/ddz_bg.jpg
--------------------------------------------------------------------------------
/src/assets/images/default.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/default.jpg
--------------------------------------------------------------------------------
/src/assets/images/default1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/default1.jpg
--------------------------------------------------------------------------------
/src/assets/images/desk.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/desk.jpg
--------------------------------------------------------------------------------
/src/assets/images/desk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/desk.png
--------------------------------------------------------------------------------
/src/assets/images/diamond.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/diamond.png
--------------------------------------------------------------------------------
/src/assets/images/hall_logo_pic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/hall_logo_pic.png
--------------------------------------------------------------------------------
/src/assets/images/hall_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/hall_user.png
--------------------------------------------------------------------------------
/src/assets/images/hall_user2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/hall_user2.png
--------------------------------------------------------------------------------
/src/assets/images/heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/heart.png
--------------------------------------------------------------------------------
/src/assets/images/match.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/match.png
--------------------------------------------------------------------------------
/src/assets/images/spade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/spade.png
--------------------------------------------------------------------------------
/src/assets/images/tip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/tip.png
--------------------------------------------------------------------------------
/src/assets/images/victory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/assets/images/victory.png
--------------------------------------------------------------------------------
/src/components/Modal.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
60 |
61 |
112 |
--------------------------------------------------------------------------------
/src/directive/clickoutside.js:
--------------------------------------------------------------------------------
1 | const HANDLER = '_vue_touchendouside_handler'
2 | const EVENT_MOBILE = 'touchend'
3 | const EVENT_PC = 'mouseup'
4 | export default {
5 | /*
6 | @param el 指令所绑定的元素
7 | @param binding {Object}
8 | @param vnode vue编译生成的虚拟节点
9 | */
10 | bind(el, binding, vnode) {
11 | const documentHandler = function(e) {
12 | if (!vnode.context || e.target.localName === 'button' || e.target.localName === 'span' || e.target.localName === 'img' || e.target.localName === 'li' || e.target.localName === 'i') {
13 | // if(!vnode.context) {
14 | return false
15 | }
16 | const bMobile = navigator.userAgent.match(/Android/i) ||
17 | navigator.userAgent.match(/webOS/i) ||
18 | navigator.userAgent.match(/iPhone/i) ||
19 | navigator.userAgent.match(/iPad/i) ||
20 | navigator.userAgent.match(/iPod/i) ||
21 | navigator.userAgent.match(/BlackBerry/i) ||
22 | navigator.userAgent.match(/Windows Phone/i)
23 | if (bMobile && e.type === EVENT_PC) {
24 | return false
25 | } else if (!bMobile && e.type === EVENT_MOBILE) {
26 | return false
27 | }
28 | if (binding.expression) {
29 | vnode.context[el[HANDLER].methodName](e)
30 | } else {
31 | el[HANDLER].bindingFn(e)
32 | }
33 | }
34 | el[HANDLER] = {
35 | documentHandler,
36 | methodName: binding.expression,
37 | bindingFn: binding.value
38 | }
39 | setTimeout(() => {
40 | document.addEventListener(EVENT_MOBILE, documentHandler, false)
41 | document.addEventListener(EVENT_PC, documentHandler, false)
42 | }, 0)
43 | },
44 | update(el, binding) {
45 | el[HANDLER].methodName = binding.expression
46 | el[HANDLER].bindingFn = binding.value
47 | },
48 | unbind(el) {
49 | document.removeEventListener(EVENT_MOBILE, el[HANDLER].documentHandler, false)
50 | document.removeEventListener(EVENT_PC, el[HANDLER].documentHandler, false)
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/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 ElementUI from 'element-ui'
6 | import VueNativeSock from 'vue-native-websocket'
7 | import 'element-ui/lib/theme-chalk/index.css'
8 | import '@/permission' // permission control
9 | import Common from '@/utils/common.js'
10 | import VCI from 'vue-component-inspector'
11 |
12 | Vue.prototype.$common = Common
13 | Vue.use(ElementUI)
14 | Vue.config.productionTip = false
15 | Vue.use(VueNativeSock, 'ws://' + process.env.VUE_APP_SOCKET_URL + ':' + process.env.VUE_APP_SOCKET_PORT, {
16 | format: 'json',
17 | connectManually: true
18 | // reconnection: true,
19 | // reconnectionAttempts: 5,
20 | // reconnectionDelay: 3000
21 | })
22 | const options = {
23 | noInspect: ['ElPagination', 'ElDialog', 'ElAutocomplete', 'ElDropdown', 'ElDropdownMenu', 'ElDropdownItem', 'ElMenu', 'ElSubmenu', 'ElMenuItem', 'ElMenuItemGroup', 'ElInput', 'ElInputNumber', 'ElRadio', 'ElRadioGroup', 'ElRadioButton', 'ElCheckbox', 'ElCheckboxButton', 'ElCheckboxGroup', 'ElSwitch', 'ElSelect', 'ElOption', 'ElOptionGroup', 'ElButtonGroup', 'ElTable', 'ElTableColumn', 'ElDatePicker', 'ElTimeSelect', 'ElTimePicker', 'ElPopover', 'ElTooltip', 'ElBreadcrumb', 'ElBreadcrumbItem', 'ElForm', 'ElFormItem', 'ElTabs', 'ElTabPane', 'ElTag', 'ElTree', 'ElAlert', 'ElSlider', 'ElIcon', 'ElRow', 'ElCol', 'ElUpload', 'ElProgress', 'ElSpinner', 'ElBadge', 'ElCard', 'ElRate', 'ElSteps', 'ElStep', 'ElCarousel', 'ElScrollbar', 'ElCarouselItem', 'ElCollapse', 'ElCollapseItem', 'ElCascader', 'ElColorPicker', 'ElTransfer', 'ElContainer', 'ElHeader', 'ElAside', 'ElMain', 'ElFooter', 'ElTimeline', 'ElTimelineItem', 'ElLink', 'ElDivider', 'ElImage', 'ElCalendar', 'ElBacktop', 'ElPageHeader', 'ElCascaderPanel', 'ElAvatar', 'ElDrawer', 'ElPopconfirm', 'ElCollapseTransition', 'ElTreeNode', undefined, 'SvgIcon', 'SidebarItem', 'ElTableBody', 'ElTableHeader', 'ElSelectDropdown']
24 | }
25 | Vue.use(VCI, options)
26 |
27 | new Vue({
28 | router,
29 | store,
30 | render: h => h(App)
31 | }).$mount('#app')
32 |
--------------------------------------------------------------------------------
/src/permission.js:
--------------------------------------------------------------------------------
1 | import router from './router'
2 | import store from './store'
3 | import {
4 | Message
5 | } from 'element-ui'
6 | import NProgress from 'nprogress' // progress bar
7 | import 'nprogress/nprogress.css' // progress bar style
8 | import { getToken } from '@/utils/auth' // get token from cookie
9 | import getTitle from '@/utils/get-title'
10 |
11 | NProgress.configure({
12 | showSpinner: false
13 | }) // NProgress Configuration
14 |
15 | const whiteList = ['/login', '/register'] // no redirect whitelist
16 |
17 | router.beforeEach(async(to, from, next) => {
18 | // start progress bar
19 | NProgress.start()
20 |
21 | // set page title
22 | document.title = getTitle(to.meta.title)
23 |
24 | // determine whether the user has logged in
25 | const hasToken = getToken()
26 | if (hasToken) {
27 | if (to.path === '/' || to.path === '/login') {
28 | // if is logged in, redirect to the home page
29 | next('/hall')
30 | NProgress.done()
31 | } else {
32 | const hasGetUserInfo = store.getters.name
33 | if (hasGetUserInfo) {
34 | next()
35 | } else {
36 | try {
37 | // get user info
38 | // await store.dispatch('user/getInfo')
39 |
40 | next()
41 | } catch (error) {
42 | // remove token and go to login page to re-login
43 | await store.dispatch('user/resetToken')
44 | Message.error(error || 'Has Error')
45 | next('/')
46 | NProgress.done()
47 | }
48 | }
49 | }
50 | } else {
51 | /* has no token */
52 | if (whiteList.indexOf(to.path) !== -1) {
53 | // in the free login whitelist, go directly
54 | next()
55 | } else {
56 | // other pages that do not have permission to access are redirected to the login page.
57 | next('/login')
58 | NProgress.done()
59 | }
60 | }
61 | })
62 |
63 | router.afterEach(() => {
64 | // finish progress bar
65 | NProgress.done()
66 | })
67 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 |
4 | Vue.use(VueRouter)
5 |
6 | const routes = [
7 | {
8 | path: '/hall',
9 | name: 'Hall',
10 | component: () => import('@/views/hall/Hall'),
11 | meta: {
12 | requiresAuth: false
13 | }
14 | },
15 | {
16 | path: '/login',
17 | name: 'Login',
18 | component: () => import('@/views/user/Login'),
19 | meta: {
20 | requiresAuth: false
21 | }
22 | },
23 | {
24 | path: '/room',
25 | name: 'Room',
26 | component: () => import('@/views/room/Room'),
27 | meta: {
28 | requiresAuth: true
29 | }
30 | }
31 | ]
32 |
33 | const router = new VueRouter({
34 | mode: 'history',
35 | base: process.env.BASE_URL,
36 | routes
37 | })
38 |
39 | /* 重写路由的push方法 */
40 | const routerPush = VueRouter.prototype.push
41 | VueRouter.prototype.push = function push(location, onResolve, onReject) {
42 | if (onResolve || onReject) return routerPush.call(this, location, onResolve, onReject)
43 | return routerPush.call(this, location).catch(error => error)
44 | }
45 |
46 | export default router
47 |
--------------------------------------------------------------------------------
/src/store/getters.js:
--------------------------------------------------------------------------------
1 | const getters = {
2 | token: state => state.user.token,
3 | avatar: state => state.user.avatar,
4 | name: state => state.user.name
5 | }
6 | export default getters
7 |
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 | import getters from './getters'
4 | import user from './modules/user'
5 |
6 | Vue.use(Vuex)
7 |
8 | const store = new Vuex.Store({
9 | modules: {
10 | user
11 | },
12 | getters
13 | })
14 |
15 | export default store
16 |
--------------------------------------------------------------------------------
/src/store/modules/user.js:
--------------------------------------------------------------------------------
1 | import { login, register, logout } from '@/api/user'
2 | import { getToken, setToken, setUserInfo, removeToken, removeUserInfo, getDirection } from '@/utils/auth'
3 | const state = {
4 | startState: false,
5 | curUser: 'mine',
6 | nextUser: 'mine',
7 | showCall: false,
8 | showRob: false,
9 | isCanPlay: false,
10 | players: {},
11 | seatMap: {},
12 | alarm: {
13 | left: 0,
14 | right: 0,
15 | mine: 1
16 | },
17 | isready: {
18 | left: 0,
19 | right: 0,
20 | mine: 0
21 | }
22 | }
23 |
24 | const mutations = {
25 | setReady(state, readyInfo) {
26 | state.isready[getDirection(readyInfo[0])] = readyInfo[1]
27 | },
28 | resetReady(state) {
29 | state.isready = {
30 | left: 0,
31 | right: 0,
32 | mine: 0
33 | }
34 | },
35 | setCall(state, call) {
36 | state.showCall = call
37 | },
38 | setRob(state, rob) {
39 | state.showRob = rob
40 | },
41 | setCanPlay(state, isCanPlay) {
42 | state.isCanPlay = isCanPlay
43 | },
44 | setStartState(state, status) {
45 | state.startState = status
46 | },
47 | setCurUser(state, user) {
48 | state.curUser = user
49 | },
50 | setAlarm(state, alarm) {
51 | state.alarm = alarm
52 | },
53 | setPlayers(state, players) {
54 | state.players = Object.assign({}, players)
55 | },
56 | setSeatMap(state, seatMap) {
57 | state.seatMap = Object.assign({}, seatMap)
58 | },
59 | resetPlayerSeat(state) {
60 | state.players = {}
61 | state.seatMap = {}
62 | }
63 | }
64 |
65 | const actions = {
66 | login({ commit }, userInfo) {
67 | const { username, password } = userInfo
68 | return new Promise((resolve, reject) => {
69 | login({ username: username.trim(), password: password }).then(response => {
70 | const { result } = response
71 | setUserInfo(JSON.stringify({
72 | nickname: result.nickname,
73 | uid: result.uid
74 | }))
75 | setToken(result.token)
76 | resolve()
77 | }).catch(error => {
78 | console.log(error)
79 | reject(error)
80 | })
81 | })
82 | },
83 | register({ commit }, userInfo) {
84 | const { username, password } = userInfo
85 | return new Promise((resolve, reject) => {
86 | register({ username: username.trim(), password: password }).then(response => {
87 | resolve(response)
88 | }).catch(error => {
89 | reject(error)
90 | })
91 | })
92 | },
93 | logout({ commit, state }) {
94 | return new Promise((resolve, reject) => {
95 | logout({ token: getToken() }).then(() => {
96 | removeToken()
97 | removeUserInfo()
98 | resolve()
99 | }).catch(error => {
100 | reject(error)
101 | })
102 | })
103 | },
104 | backHall({ commit, state }) {
105 | console.log('返回大厅')
106 | },
107 | resetToken({ commit }) {
108 | return new Promise(resolve => {
109 | removeToken()
110 | resolve()
111 | })
112 | },
113 | resetPlayerSeat(ctx) {
114 | ctx.commit('resetPlayerSeat')
115 | }
116 | }
117 |
118 | export default {
119 | namespaced: true,
120 | state,
121 | mutations,
122 | actions
123 | }
124 |
--------------------------------------------------------------------------------
/src/utils/auth.js:
--------------------------------------------------------------------------------
1 | const TokenKey = 'ddz_token'
2 | import store from '../store'
3 | export function getToken() {
4 | return sessionStorage.getItem(TokenKey)
5 | }
6 |
7 | export function setToken(token) {
8 | return sessionStorage.setItem(TokenKey, token)
9 | }
10 |
11 | export function removeToken() {
12 | return sessionStorage.removeItem(TokenKey)
13 | }
14 |
15 | export function refreshToken(token) {
16 | sessionStorage.removeItem(TokenKey)
17 | return sessionStorage.setItem(TokenKey, token)
18 | }
19 |
20 | export function getDirection(uid) {
21 | const seatMap = store.state.user.seatMap
22 | for (const key in seatMap) {
23 | if (seatMap[key] === uid) {
24 | return key
25 | }
26 | }
27 | }
28 |
29 | export function setUserInfo(userInfo) {
30 | return sessionStorage.setItem('ddz_user_info', userInfo)
31 | }
32 |
33 | export function getUserInfo() {
34 | return JSON.parse(sessionStorage.getItem('ddz_user_info'))
35 | }
36 |
37 | export function removeUserInfo() {
38 | return sessionStorage.removeItem('ddz_user_info')
39 | }
40 |
41 | export function setRoomNo(roomNo) {
42 | return sessionStorage.setItem('room_no', roomNo)
43 | }
44 |
45 | export function getRoomNo() {
46 | return sessionStorage.getItem('room_no')
47 | }
48 |
--------------------------------------------------------------------------------
/src/utils/common.js:
--------------------------------------------------------------------------------
1 | import {
2 | Message
3 | } from 'element-ui'
4 | const obj = {
5 | cardMap: {
6 | '1': 'heart',
7 | '2': 'spade',
8 | '3': 'diamond',
9 | '4': 'club'
10 | },
11 | batchFormatCards(arrCards) {
12 | const resultCard = []
13 | arrCards.forEach(h => {
14 | resultCard.push(this.formatCard(h))
15 | })
16 | return resultCard
17 | },
18 | formatCard(originCard) {
19 | const tmp = originCard.split('x')
20 | return {
21 | label: tmp[0],
22 | type: this.cardMap[tmp[1]],
23 | checked: false
24 | }
25 | },
26 | getCurTime(type = 0) {
27 | const myDate = new Date()
28 | const year = myDate.getFullYear()
29 | let month = myDate.getMonth() + 1
30 | let date = myDate.getDate()
31 | let hour = myDate.getHours()
32 | let minute = myDate.getMinutes()
33 | let s = myDate.getSeconds()
34 | if (date < 10) date = '0' + date
35 | if (month < 10) month = '0' + month
36 | if (hour < 10) hour = '0' + hour
37 | if (minute < 10) minute = '0' + minute
38 | if (s < 10) s = '0' + s
39 | if (type === 1) {
40 | return month + '/' + date
41 | }
42 | return (
43 | year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + s
44 | )
45 | },
46 | tip(msg = 'ok', type = 'success', duration = 3000) {
47 | Message({
48 | showClose: true,
49 | message: msg,
50 | duration: duration,
51 | type: type
52 | })
53 | },
54 | /**
55 | * 获取时间
56 | * @param intervalDays :间隔天数
57 | * @param bolPastTime :Boolean,判断在参数date之前,还是之后,
58 | */
59 | getDateRange(intervalDays, bolPastTime = true) {
60 | const dateNow = new Date()
61 | const oneDayTime = 24 * 60 * 60 * 1000
62 | const list = []
63 | let lastDay
64 |
65 | if (bolPastTime === true) {
66 | lastDay = new Date(dateNow.getTime() - intervalDays * oneDayTime)
67 | list.push(this.formateDate(lastDay))
68 | list.push(this.formateDate(dateNow))
69 | } else {
70 | lastDay = new Date(dateNow.getTime() + intervalDays * oneDayTime)
71 | list.push(this.formateDate(dateNow))
72 | list.push(this.formateDate(lastDay))
73 | }
74 | return list
75 | },
76 | formateDate(time) {
77 | const year = time.getFullYear()
78 | let month = time.getMonth() + 1
79 | let day = time.getDate()
80 |
81 | if (month < 10) {
82 | month = '0' + month
83 | }
84 |
85 | if (day < 10) {
86 | day = '0' + day
87 | }
88 |
89 | return year + '-' + month + '-' + day + ''
90 | }
91 |
92 | }
93 | export default obj
94 |
--------------------------------------------------------------------------------
/src/utils/get-title.js:
--------------------------------------------------------------------------------
1 | const title = '斗地主'
2 |
3 | export default function getTitle(pageTitle) {
4 | if (pageTitle) {
5 | return `${pageTitle} - ${title}`
6 | }
7 | return `${title}`
8 | }
9 |
--------------------------------------------------------------------------------
/src/utils/poker.js:
--------------------------------------------------------------------------------
1 | function analyseSameNum(cards, len) {
2 | const res = {
3 | 'singleCount': 0,
4 | 'doubleCount': 0,
5 | 'threeCount': 0,
6 | 'fourCount': 0,
7 | 'singleData': [],
8 | 'doubleData': [],
9 | 'threeData': [],
10 | 'fourData': []
11 | }
12 | for (let i = 0; i < len; i++) {
13 | let cbSameCount = 1
14 | const base = cards[i]
15 | for (let j = i + 1; j < len; j++) {
16 | if (cards[j] !== base) break
17 | cbSameCount++
18 | }
19 | switch (cbSameCount) {
20 | case 1:
21 | res.singleCount = res.singleCount + 1
22 | res.singleData.push(cards[i])
23 | break
24 | case 2:
25 | res.doubleCount = res.doubleCount + 1
26 | res.doubleData.push(cards[i])
27 | break
28 | case 3:
29 | res.threeCount = res.threeCount + 1
30 | res.threeData.push(cards[i])
31 | break
32 | case 4:
33 | res.fourCount = res.fourCount + 1
34 | res.fourData.push(cards[i])
35 | break
36 | }
37 | i += cbSameCount - 1
38 | }
39 | return res
40 | }
41 |
42 | function checkType(cards) {
43 | const len = cards.length
44 | const analyseRes = analyseSameNum(cards, len)
45 | if (len >= 5) {
46 | if (_checkSingleLine(cards, len)) {
47 | return 'single_line'
48 | } else if (!analyseRes.threeCount && !analyseRes.fourCount && _checkDoubleLine(cards, len)) {
49 | return 'double_line'
50 | }
51 | }
52 | if (analyseRes.threeCount >= 2) {
53 | if (analyseRes.threeCount * 3 === len && _checkThreeLine(cards, len)) {
54 | return 'three_line'
55 | } else if (_checkSingleLine(analyseRes.threeData, analyseRes.threeCount) && (len - analyseRes.threeCount * 3 === analyseRes.threeCount)) {
56 | return 'plane_with_wing'
57 | }
58 | }
59 | switch (len) {
60 | case 1:
61 | return 'single'
62 | case 2:
63 | if (cards[0] === '0' && cards[1] === '0') {
64 | return 'joker_bomb'
65 | } else if (analyseRes.doubleCount === 1) {
66 | return 'double'
67 | }
68 | return false
69 | case 3:
70 | if (analyseRes.threeCount === 1) {
71 | return 'three'
72 | }
73 | return false
74 | case 4:
75 | if (analyseRes.fourCount === 1) {
76 | return 'bomb_card'
77 | } else if (analyseRes.threeCount === 1 && analyseRes.singleCount === 1) {
78 | return 'three_take_one'
79 | }
80 | return false
81 | case 5:
82 | if (analyseRes.threeCount === 1 && analyseRes.doubleCount === 1) {
83 | return 'three_take_two'
84 | }
85 | return false
86 | case 6:
87 | if (analyseRes.fourCount === 1 && analyseRes.singleCount === 2) {
88 | return 'four_take_two'
89 | } else if (analyseRes.threeCount === 2) {
90 | return 'three_line'
91 | }
92 | return false
93 | case 8:
94 | if (analyseRes.threeCount === 2 && analyseRes.singleCount === 2) {
95 | return 'plane_with_wing'
96 | }
97 | return false
98 | case 10:
99 | if (analyseRes.threeCount === 2 && analyseRes.doubleCount === 2) {
100 | return 'plane_with_wing'
101 | }
102 | return false
103 |
104 | default:
105 | return false
106 | }
107 | }
108 |
109 | function sortCrad(cards, sortType = 'asc', type = 'obj') {
110 | return cards.sort((a, b) => {
111 | const arr = ['3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '1', '2', '0']
112 | let x, y
113 | if (type === 'num') {
114 | x = arr.indexOf(a)
115 | y = arr.indexOf(b)
116 | } else {
117 | x = arr.findIndex(n => n === a.label)
118 | y = arr.findIndex(n => n === b.label)
119 | }
120 | return sortType === 'asc' ? x - y : y - x
121 | })
122 | }
123 |
124 | function card2num(cards) {
125 | const res = []
126 | cards.forEach(h => {
127 | res.push(h.label)
128 | })
129 | return res
130 | }
131 |
132 | function str2num(str, types) {
133 | for (const index in types) {
134 | if (types[index] === str) {
135 | return index
136 | }
137 | }
138 | }
139 |
140 | function _checkSingleLine(cards, len) {
141 | let base = cards[0]
142 | const res = [base]
143 | for (let i = 0; i < len; i++) {
144 | if (cards[i] - base === 1) {
145 | base = cards[i]
146 | res.push(cards[i])
147 | }
148 | }
149 | return res.length === len
150 | }
151 |
152 | function _checkDoubleLine(cards, len) {
153 | if (len < 6) return false
154 | const tmp = []
155 | tmp.push(...new Set(cards))
156 | if (len === tmp.length * 2) {
157 | return _checkSingleLine(tmp, tmp.length)
158 | }
159 | return false
160 | }
161 |
162 | function _checkThreeLine(cards, len) {
163 | if (len < 6) return false
164 | const tmp = []
165 | tmp.push(...new Set(cards))
166 | if (len === tmp.length * 3) {
167 | return _checkSingleLine(tmp, tmp.length)
168 | }
169 | return false
170 | }
171 |
172 | export default {
173 | checkType,
174 | card2num,
175 | str2num,
176 | sortCrad
177 | }
178 |
--------------------------------------------------------------------------------
/src/utils/request.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import { MessageBox, Message, Loading } from 'element-ui'
3 | import store from '@/store'
4 | import { getToken } from '@/utils/auth'
5 |
6 | // create an axios instance
7 | const service = axios.create({
8 | // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
9 | baseURL: process.env.VUE_APP_BASE_HREF + process.env.VUE_APP_BASE_API,
10 | // withCredentials: true, // send cookies when cross-domain requests
11 | timeout: 20000 // request timeout
12 | })
13 | let loading = null
14 | // request interceptor
15 | service.interceptors.request.use(
16 | config => {
17 | // do something before request is sent
18 | loading = Loading.service({
19 | text: '正在加载中......',
20 | fullscreen: true
21 | })
22 | if (getToken()) {
23 | // let each request carry token
24 | // ['X-Token'] is a custom headers key
25 | // please modify it according to the actual situation
26 | config.headers['Authorization'] = 'Bearer ' + getToken()
27 | }
28 | return config
29 | },
30 | error => {
31 | // do something with request error
32 | console.log(error) // for debug
33 | return Promise.reject(error)
34 | }
35 | )
36 |
37 | // response interceptor
38 | service.interceptors.response.use(
39 | /**
40 | * If you want to get http information such as headers or status
41 | * Please return response => response
42 | */
43 |
44 | /**
45 | * Determine the request status by custom code
46 | * Here is just an example
47 | * You can also judge the status by HTTP Status Code
48 | */
49 | response => {
50 | const res = response.data
51 | let token = response.headers.authorization
52 | if (loading) loading.close()
53 | if (token) {
54 | // axios.defaults.headers.common['Authorization'] = token
55 | if (token.slice(0, 6) === 'Bearer' || token.slice(0, 6) === 'bearer') {
56 | token = token.slice(7)
57 | }
58 | store.dispatch('user/refreshToken', token)
59 | }
60 | // if the custom code is not 20000, it is judged as an error.
61 | if (res.code !== 200) {
62 | // 401: Illegal token; 402: Token expired; 403: Other clients logged in;
63 | Message({
64 | message: res.msg || 'Error',
65 | type: 'error',
66 | duration: 5 * 1000
67 | })
68 | return Promise.reject(new Error(res.msg || 'Error'))
69 | } else {
70 | return res
71 | }
72 | },
73 | error => {
74 | if (loading) loading.close()
75 | if (error.response) {
76 | if (error.response.data.code === 401 || error.response.data.code === 402) {
77 | MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
78 | confirmButtonText: '重新登陆',
79 | cancelButtonText: '取消',
80 | type: 'warning'
81 | }).then(() => {
82 | store.dispatch('user/resetToken').then(() => {
83 | location.reload()
84 | })
85 | }).catch(() => {})
86 | } else {
87 | Message({
88 | message: error.response.data.msg,
89 | type: 'error',
90 | duration: 5 * 1000
91 | })
92 | }
93 | } else {
94 | Message({
95 | message: '网络开小差了!',
96 | type: 'error',
97 | duration: 3 * 1000
98 | })
99 | }
100 | return Promise.reject(error)
101 | }
102 | )
103 |
104 | export default service
105 |
--------------------------------------------------------------------------------
/src/utils/socket.js:
--------------------------------------------------------------------------------
1 | function getSocket(url, params, callback) {
2 | let socket
3 |
4 | if (typeof (WebSocket) === 'undefined') {
5 | console.log('您的浏览器不支持WebSocket')
6 | } else {
7 | console.log('您的浏览器支持WebSocket')
8 |
9 | // 初始化 WebSocket 对象,指定要连接的服务器地址与端口建立连接
10 | socket = new WebSocket(url)
11 |
12 | // 打开事件
13 | socket.onopen = function() {
14 | console.log('Socket 已打开')
15 | socket.send(params)
16 | }
17 |
18 | // 获得消息事件
19 | socket.onmessage = function(msg) {
20 | // 发现消息进入, 开始处理前端触发逻辑
21 | callback(msg, socket)
22 | }
23 |
24 | // 关闭事件
25 | socket.onclose = function() {
26 | console.log('Socket 已关闭')
27 | }
28 |
29 | // 发生了错误事件
30 | socket.onerror = function() {
31 | console.log('Socket 发生了错误,请刷新页面')
32 | // 此时可以尝试刷新页面
33 | }
34 | }
35 | }
36 |
37 | export {
38 | getSocket
39 | }
40 |
--------------------------------------------------------------------------------
/src/utils/storage.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/voocel/ddz-vue/3698b1cc337c83cb0d18e1272c62511764a070b2/src/utils/storage.js
--------------------------------------------------------------------------------
/src/utils/tips.js:
--------------------------------------------------------------------------------
1 | import { MessageBox } from 'element-ui'
2 | import { Message } from 'element-ui'
3 | import store from '@/store'
4 |
5 | const tips = {
6 | reLoginTip() {
7 | MessageBox.confirm(
8 | '登录状态已过期,您可以继续留在该页面,或者重新登录111',
9 | '系统提示', {
10 | confirmButtonText: '重新登陆',
11 | cancelButtonText: '取消',
12 | type: 'warning'
13 | }
14 | ).then(() => {
15 | store.dispatch('user/resetToken').then(() => {
16 | location.reload()
17 | })
18 | }).catch(() => {})
19 | },
20 |
21 | msgTip(msg = 'ok', type = 'success', duration = 3000) {
22 | Message({
23 | showClose: true,
24 | message: msg,
25 | duration: duration,
26 | type: type
27 | })
28 | }
29 |
30 | }
31 | export default tips
32 |
--------------------------------------------------------------------------------
/src/utils/validate.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by PanJiaChen on 16/11/18.
3 | */
4 |
5 | /**
6 | * @param {string} path
7 | * @returns {Boolean}
8 | */
9 | export function isExternal(path) {
10 | return /^(https?:|mailto:|tel:)/.test(path)
11 | }
12 |
13 | /**
14 | * @param {string} str
15 | * @returns {Boolean}
16 | */
17 | export function validUsername(str) {
18 | const nameregex = /^[a-zA-Z0-9]{3,16}$/
19 | return nameregex.test(str)
20 | }
21 |
22 | export function validatemobile(phone) {
23 | const list = []
24 | let result = true
25 | let msg = ''
26 | var isPhone = /^0\d{2,3}-?\d{7,8}$/
27 | // 增加134 减少|1349[0-9]{7},增加181,增加145,增加17[678]
28 | // const isMob = /^((\+?86)|(\(\+86\)))?(13[0123456789][0-9]{8}|15[012356789][0-9]{8}|18[012356789][0-9]{8}|14[57][0-9]{8}|17[3678][0-9]{8})$/
29 | if (!validatenull(phone)) {
30 | if (phone.length === 11) {
31 | if (isPhone.test(phone)) {
32 | msg = '手机号码格式不正确'
33 | } else {
34 | result = false
35 | }
36 | } else {
37 | msg = '手机号码长度不为11位'
38 | }
39 | } else {
40 | msg = '手机号码不能为空'
41 | }
42 | list.push(result)
43 | list.push(msg)
44 | return list
45 | }
46 |
47 | export function validatenull(val) {
48 | if (typeof val === 'boolean') {
49 | return false
50 | }
51 | if (val instanceof Array) {
52 | if (val.length === 0) return true
53 | } else if (val instanceof Object) {
54 | if (JSON.stringify(val) === '{}') return true
55 | } else {
56 | if (val === 'null' || val == null || val === 'undefined' || val === undefined || val === '') return true
57 | return false
58 | }
59 | return false
60 | }
61 |
62 | export function validateURL(textval) {
63 | const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
64 | return urlregex.test(textval)
65 | }
66 |
67 | /* 小写字母*/
68 | export function validateLowerCase(str) {
69 | const reg = /^[a-z]+$/
70 | return reg.test(str)
71 | }
72 |
73 | /* 大写字母*/
74 | export function validateUpperCase(str) {
75 | const reg = /^[A-Z]+$/
76 | return reg.test(str)
77 | }
78 |
79 | /* 大小写字母*/
80 | export function validatAlphabets(str) {
81 | const reg = /^[A-Za-z]+$/
82 | return reg.test(str)
83 | }
84 |
--------------------------------------------------------------------------------
/src/views/hall/Hall.vue:
--------------------------------------------------------------------------------
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 |
38 |
39 |
40 |
41 |
42 |
43 | 1局
44 | 2局
45 | 4局
46 | 8局
47 |
48 |
49 |
53 |
54 |
55 |
56 |
57 |
58 |
142 |
143 |
186 |
--------------------------------------------------------------------------------
/src/views/room/Action.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 换桌
6 | 准备
7 |
8 |
13 |
14 | 不叫
15 | 叫地主
16 |
17 |
18 | 抢地主
19 | 不抢
20 |
21 |
22 |
23 |
24 |
25 |
143 |
144 |
152 |
--------------------------------------------------------------------------------
/src/views/room/Card.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |

6 |
7 |
12 | {{ cards }}
13 |
14 |
15 |
20 | {{ cards }}
21 |
22 |
23 |
24 |
25 |
92 |
93 |
156 |
--------------------------------------------------------------------------------
/src/views/room/Fade.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |

9 |

14 |
15 | 恭喜你,赢了!
16 |
17 |
18 |
19 |
20 |
21 |
30 |
31 |
73 |
--------------------------------------------------------------------------------
/src/views/room/HandCard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
24 |
25 |
26 |
27 |
28 |
159 |
160 |
191 |
192 |
--------------------------------------------------------------------------------
/src/views/room/Header.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
36 |
37 |
51 |
--------------------------------------------------------------------------------
/src/views/room/Music.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
32 |
33 |
36 |
--------------------------------------------------------------------------------
/src/views/room/OutCard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
32 |
33 |
41 |
--------------------------------------------------------------------------------
/src/views/room/Room.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{ tip.left }}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | {{ tip.right }}
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {{ tip.mine }}
47 |
48 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
{{ coin.mine }}
60 |
61 |
62 | 房间号: {{ roomNo }}
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
523 |
524 |
657 |
--------------------------------------------------------------------------------
/src/views/room/Setting.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 设置
5 |
6 | 测试1
7 | 测试2
8 | {{ direction === 'hall' ? '退出登录' : '返回大厅' }}
9 |
10 |
11 |
12 |
13 |
14 |
54 |
55 |
63 |
--------------------------------------------------------------------------------
/src/views/room/Settle.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
15 |
21 |
27 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
71 |
72 |
104 |
--------------------------------------------------------------------------------
/src/views/room/User.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
{{ alarmNum }}
6 |

7 |
8 |
9 |

10 |
11 |
14 |
{{ nickname }}
15 |
16 |
17 |
{{ coin }}
18 |
19 |
20 |
21 |
22 |
23 |
94 |
95 |
140 |
--------------------------------------------------------------------------------
/src/views/user/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |

5 |
6 |
7 |
8 |

9 |
10 |
11 |
12 |
13 |
14 |
15 |
{{ activeName }}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
60 |
61 |
136 |
--------------------------------------------------------------------------------
/src/views/user/userRegister.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 记住账号
15 |
16 | 注册
17 |
18 |
21 |
22 |
23 |
24 |
88 |
124 |
--------------------------------------------------------------------------------
/src/views/user/userlogin.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 记住账号
16 |
17 | 登录
18 |
19 |
22 |
23 |
24 |
25 |
26 |
96 |
132 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devServer: {
3 | host: 'localhost',
4 | port: 8080,
5 | progress: true,
6 | open: false
7 | // proxy: {
8 | // '/socket.io': {
9 | // target: 'http://192.168.10.20:3001',
10 | // ws: true,
11 | // changeOrigin: true
12 | // },
13 | // 'sockjs-node': {
14 | // target: 'http://192.168.10.20:3001',
15 | // ws: false,
16 | // changeOrigin: true
17 | // }
18 | // }
19 | }
20 | // css: {
21 | // loaderOptions: {
22 | // sass: {
23 | // prependData: `@import "@/assets/styles/variables.scss";`
24 | // }
25 | // }
26 | // }
27 | }
28 |
--------------------------------------------------------------------------------