build(projects): 增加代码规范
This commit is contained in:
57
.cz-config.js
Normal file
57
.cz-config.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
module.exports = {
|
||||||
|
types: [
|
||||||
|
{ value: 'feat', name: 'feat: 新增功能' },
|
||||||
|
{ value: 'fix', name: 'fix: 修复bug' },
|
||||||
|
{ value: 'docs', name: 'docs: 文档变更' },
|
||||||
|
{
|
||||||
|
value: 'style',
|
||||||
|
name: 'style: 代码格式(不影响功能,例如空格、分号等格式修正)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'refactor',
|
||||||
|
name: 'refactor: 代码重构(不包括 bug 修复、功能新增)',
|
||||||
|
},
|
||||||
|
{ value: 'perf', name: 'perf: 性能优化' },
|
||||||
|
{ value: 'test', name: 'test: 添加、修改测试用例' },
|
||||||
|
{
|
||||||
|
value: 'build',
|
||||||
|
name: 'build: 构建流程、外部依赖变更(如升级 npm 包、修改 脚手架 配置等)',
|
||||||
|
},
|
||||||
|
{ value: 'ci', name: 'ci: 修改 CI 配置、脚本' },
|
||||||
|
{
|
||||||
|
value: 'chore',
|
||||||
|
name: 'chore: 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)',
|
||||||
|
},
|
||||||
|
{ value: 'revert', name: 'revert: 回滚 commit' },
|
||||||
|
{ value: 'wip', name: 'wip: 开发中' },
|
||||||
|
{ value: 'mod', name: 'mod: 不确定分类的修改' },
|
||||||
|
{ value: 'release', name: 'release: 发布' },
|
||||||
|
],
|
||||||
|
scopes: [
|
||||||
|
['custom', '自定义'],
|
||||||
|
['projects', '项目搭建'],
|
||||||
|
['components', '组件相关'],
|
||||||
|
['utils', 'utils 相关'],
|
||||||
|
['styles', '样式相关'],
|
||||||
|
['deps', '项目依赖'],
|
||||||
|
['other', '其他修改'],
|
||||||
|
].map(([value, description]) => {
|
||||||
|
return {
|
||||||
|
value,
|
||||||
|
name: `${value.padEnd(30)} (${description})`,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
messages: {
|
||||||
|
type: '确保本次提交遵循 Angular 规范!选择你要提交的类型:\n',
|
||||||
|
scope: '选择一个 scope(可选):',
|
||||||
|
customScope: '请输入自定义的 scope:',
|
||||||
|
subject: '填写简短精炼的变更描述:',
|
||||||
|
body: '填写更加详细的变更描述(可选)。使用 "|" 换行:',
|
||||||
|
breaking: '列举非兼容性重大的变更(可选):',
|
||||||
|
footer: '列举出所有变更的 Issues Closed(可选)。 例如: #31, #34:',
|
||||||
|
confirmCommit: '确认提交?',
|
||||||
|
},
|
||||||
|
allowBreakingChanges: ['feat', 'fix'],
|
||||||
|
subjectLimit: 100,
|
||||||
|
breaklineChar: '|',
|
||||||
|
}
|
||||||
4
.husky/commit-msg
Normal file
4
.husky/commit-msg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npx --no -- commitlint --edit "$1"
|
||||||
4
.husky/pre-commit
Normal file
4
.husky/pre-commit
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npm run lint:staged
|
||||||
7
.prettierrc.json
Normal file
7
.prettierrc.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 100,
|
||||||
|
"singleQuote": true,
|
||||||
|
"semi": false,
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"htmlWhitespaceSensitivity": "ignore"
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
import TestUtils from '@tarojs/test-utils-vue3'
|
import TestUtils from '@tarojs/test-utils-vue3'
|
||||||
|
|
||||||
describe('Testing', () => {
|
describe('Testing', () => {
|
||||||
|
|
||||||
test('Test', async () => {
|
test('Test', async () => {
|
||||||
const testUtils = new TestUtils()
|
const testUtils = new TestUtils()
|
||||||
await testUtils.createApp()
|
await testUtils.createApp()
|
||||||
await testUtils.PageLifecycle.onShow()
|
await testUtils.PageLifecycle.onShow()
|
||||||
expect(testUtils.html()).toMatchSnapshot()
|
expect(testUtils.html()).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
|
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
|
||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
['taro', {
|
[
|
||||||
framework: 'vue3',
|
'taro',
|
||||||
ts: true
|
{
|
||||||
}]
|
framework: 'vue3',
|
||||||
]
|
ts: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
26
commitlint.config.js
Normal file
26
commitlint.config.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
module.exports = {
|
||||||
|
ignores: [(commit) => commit.includes('init')],
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
rules: {
|
||||||
|
'type-enum': [
|
||||||
|
2,
|
||||||
|
'always',
|
||||||
|
[
|
||||||
|
'feat',
|
||||||
|
'fix',
|
||||||
|
'docs',
|
||||||
|
'style',
|
||||||
|
'refactor',
|
||||||
|
'perf',
|
||||||
|
'test',
|
||||||
|
'build',
|
||||||
|
'ci',
|
||||||
|
'chore',
|
||||||
|
'revert',
|
||||||
|
'wip',
|
||||||
|
'mod',
|
||||||
|
'release',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import type {UserConfigExport} from '@tarojs/cli'
|
import type { UserConfigExport } from '@tarojs/cli'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
logger: {
|
logger: {
|
||||||
quiet: false,
|
quiet: false,
|
||||||
stats: true
|
stats: true,
|
||||||
|
},
|
||||||
|
mini: {},
|
||||||
|
h5: {
|
||||||
|
devServer: {
|
||||||
|
// proxy: {
|
||||||
|
// '/api': {
|
||||||
|
// target: 'http://localhost:3000',
|
||||||
|
// changeOrigin: true,
|
||||||
|
// pathRewrite: {
|
||||||
|
// '^/api': ''
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
mini: {},
|
},
|
||||||
h5: {
|
|
||||||
devServer: {
|
|
||||||
// proxy: {
|
|
||||||
// '/api': {
|
|
||||||
// target: 'http://localhost:3000',
|
|
||||||
// changeOrigin: true,
|
|
||||||
// pathRewrite: {
|
|
||||||
// '^/api': ''
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} satisfies UserConfigExport
|
} satisfies UserConfigExport
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {defineConfig, type UserConfigExport} from '@tarojs/cli'
|
import { defineConfig, type UserConfigExport } from '@tarojs/cli'
|
||||||
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
|
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
|
||||||
import devConfig from './dev'
|
import devConfig from './dev'
|
||||||
import prodConfig from './prod'
|
import prodConfig from './prod'
|
||||||
@@ -13,7 +13,7 @@ export default defineConfig(async (merge, {}) => {
|
|||||||
640: 2.34 / 2,
|
640: 2.34 / 2,
|
||||||
750: 1,
|
750: 1,
|
||||||
375: 2,
|
375: 2,
|
||||||
828: 1.81 / 2
|
828: 1.81 / 2,
|
||||||
},
|
},
|
||||||
sourceRoot: 'src',
|
sourceRoot: 'src',
|
||||||
outputRoot: 'dist',
|
outputRoot: 'dist',
|
||||||
@@ -21,77 +21,77 @@ export default defineConfig(async (merge, {}) => {
|
|||||||
defineConstants: {},
|
defineConstants: {},
|
||||||
copy: {
|
copy: {
|
||||||
patterns: [],
|
patterns: [],
|
||||||
options: {}
|
options: {},
|
||||||
},
|
},
|
||||||
framework: 'vue3',
|
framework: 'vue3',
|
||||||
compiler: 'webpack5',
|
compiler: 'webpack5',
|
||||||
cache: {
|
cache: {
|
||||||
enable: true // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
enable: true, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
||||||
},
|
},
|
||||||
mini: {
|
mini: {
|
||||||
postcss: {
|
postcss: {
|
||||||
pxtransform: {
|
pxtransform: {
|
||||||
enable: true,
|
enable: true,
|
||||||
config: {}
|
config: {},
|
||||||
},
|
},
|
||||||
url: {
|
url: {
|
||||||
enable: true,
|
enable: true,
|
||||||
config: {
|
config: {
|
||||||
limit: 1024 // 设定转换尺寸上限
|
limit: 1024, // 设定转换尺寸上限
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
cssModules: {
|
cssModules: {
|
||||||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||||
config: {
|
config: {
|
||||||
namingPattern: 'module', // 转换模式,取值为 global/module
|
namingPattern: 'module', // 转换模式,取值为 global/module
|
||||||
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
webpackChain(chain) {
|
webpackChain(chain) {
|
||||||
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
h5: {
|
h5: {
|
||||||
publicPath: '/public/',
|
publicPath: '/public/',
|
||||||
staticDirectory: 'static',
|
staticDirectory: 'static',
|
||||||
router: {
|
router: {
|
||||||
mode: 'hash'
|
mode: 'hash',
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: 'js/[name].[hash:8].js',
|
filename: 'js/[name].[hash:8].js',
|
||||||
chunkFilename: 'js/[name].[chunkhash:8].js'
|
chunkFilename: 'js/[name].[chunkhash:8].js',
|
||||||
},
|
},
|
||||||
miniCssExtractPluginOption: {
|
miniCssExtractPluginOption: {
|
||||||
ignoreOrder: true,
|
ignoreOrder: true,
|
||||||
filename: 'css/[name].[hash].css',
|
filename: 'css/[name].[hash].css',
|
||||||
chunkFilename: 'css/[name].[chunkhash].css'
|
chunkFilename: 'css/[name].[chunkhash].css',
|
||||||
},
|
},
|
||||||
postcss: {
|
postcss: {
|
||||||
autoprefixer: {
|
autoprefixer: {
|
||||||
enable: true,
|
enable: true,
|
||||||
config: {}
|
config: {},
|
||||||
},
|
},
|
||||||
cssModules: {
|
cssModules: {
|
||||||
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
|
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||||
config: {
|
config: {
|
||||||
namingPattern: 'module', // 转换模式,取值为 global/module
|
namingPattern: 'module', // 转换模式,取值为 global/module
|
||||||
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
webpackChain(chain) {
|
webpackChain(chain) {
|
||||||
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
rn: {
|
rn: {
|
||||||
appName: 'taroDemo',
|
appName: 'taroDemo',
|
||||||
postcss: {
|
postcss: {
|
||||||
cssModules: {
|
cssModules: {
|
||||||
enable: false // 默认为 false,如需使用 css modules 功能,则设为 true
|
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// 本地开发构建配置(不混淆压缩)
|
// 本地开发构建配置(不混淆压缩)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { UserConfigExport } from "@tarojs/cli";
|
import type { UserConfigExport } from '@tarojs/cli'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mini: {},
|
mini: {},
|
||||||
@@ -29,5 +29,5 @@ export default {
|
|||||||
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
|
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
|
||||||
// }))
|
// }))
|
||||||
// }
|
// }
|
||||||
}
|
},
|
||||||
} satisfies UserConfigExport
|
} satisfies UserConfigExport
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ const defineJestConfig = require('@tarojs/test-utils-vue3/dist/jest.js').default
|
|||||||
|
|
||||||
module.exports = defineJestConfig({
|
module.exports = defineJestConfig({
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
testMatch: ['<rootDir>/__tests__/?(*.)+(spec|test).[jt]s?(x)']
|
testMatch: ['<rootDir>/__tests__/?(*.)+(spec|test).[jt]s?(x)'],
|
||||||
})
|
})
|
||||||
|
|||||||
26
package.json
26
package.json
@@ -29,13 +29,31 @@
|
|||||||
"dev:qq": "npm run build:qq -- --watch",
|
"dev:qq": "npm run build:qq -- --watch",
|
||||||
"dev:jd": "npm run build:jd -- --watch",
|
"dev:jd": "npm run build:jd -- --watch",
|
||||||
"dev:quickapp": "npm run build:quickapp -- --watch",
|
"dev:quickapp": "npm run build:quickapp -- --watch",
|
||||||
"test": "jest"
|
"test": "jest",
|
||||||
|
"lint": "eslint --ext .ts,.vue .",
|
||||||
|
"lint:fix": "eslint --fix --ext .ts,.vue .",
|
||||||
|
"lint:staged": "lint-staged",
|
||||||
|
"prepare": "husky install",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"cz": "cz",
|
||||||
|
"lf": "npx prettier --write --end-of-line lf ."
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 3 versions",
|
"last 3 versions",
|
||||||
"Android >= 4.1",
|
"Android >= 4.1",
|
||||||
"ios >= 8"
|
"ios >= 8"
|
||||||
],
|
],
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,vue}": [
|
||||||
|
"eslint --ext .ts,.vue .",
|
||||||
|
"npx prettier --write --end-of-line lf ."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"commitizen": {
|
||||||
|
"path": "node_modules/cz-customizable"
|
||||||
|
}
|
||||||
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.22.11",
|
"@babel/runtime": "^7.22.11",
|
||||||
@@ -56,6 +74,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.11",
|
"@babel/core": "^7.22.11",
|
||||||
|
"@commitlint/cli": "^18.2.0",
|
||||||
|
"@commitlint/config-conventional": "^18.1.0",
|
||||||
"@tarojs/cli": "3.6.15",
|
"@tarojs/cli": "3.6.15",
|
||||||
"@tarojs/taro-loader": "3.6.15",
|
"@tarojs/taro-loader": "3.6.15",
|
||||||
"@tarojs/test-utils-vue3": "^0.1.1",
|
"@tarojs/test-utils-vue3": "^0.1.1",
|
||||||
@@ -68,12 +88,16 @@
|
|||||||
"@vue/babel-plugin-jsx": "^1.1.5",
|
"@vue/babel-plugin-jsx": "^1.1.5",
|
||||||
"@vue/compiler-sfc": "^3.3.4",
|
"@vue/compiler-sfc": "^3.3.4",
|
||||||
"babel-preset-taro": "3.6.15",
|
"babel-preset-taro": "3.6.15",
|
||||||
|
"commitizen": "^4.3.0",
|
||||||
"css-loader": "6.8.1",
|
"css-loader": "6.8.1",
|
||||||
|
"cz-customizable": "^7.0.0",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"eslint-config-taro": "3.6.15",
|
"eslint-config-taro": "3.6.15",
|
||||||
"eslint-plugin-vue": "^9.17.0",
|
"eslint-plugin-vue": "^9.17.0",
|
||||||
|
"husky": "^8.0.0",
|
||||||
"jest": "^29.6.4",
|
"jest": "^29.6.4",
|
||||||
"jest-environment-jsdom": "^29.6.4",
|
"jest-environment-jsdom": "^29.6.4",
|
||||||
|
"lint-staged": "^15.0.2",
|
||||||
"postcss": "^8.4.29",
|
"postcss": "^8.4.29",
|
||||||
"style-loader": "3.3.3",
|
"style-loader": "3.3.3",
|
||||||
"stylelint": "^15.10.3",
|
"stylelint": "^15.10.3",
|
||||||
|
|||||||
24793
pnpm-lock.yaml
generated
24793
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,17 @@
|
|||||||
import request from "@/utils/request";
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export const getGameOption = () =>
|
export const getGameOption = () =>
|
||||||
request({
|
request({
|
||||||
url: "/betting",
|
url: '/betting',
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
});
|
})
|
||||||
|
|
||||||
export const getKaiJiangList = () => request({url: "/draw", method: "GET"});
|
export const getKaiJiangList = () => request({ url: '/draw', method: 'GET' })
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
export const getJfDz = (uid: string) =>
|
export const getJfDz = (uid: string) =>
|
||||||
request({url: `/userBettingInfo?uid=${uid}`, method: "GET"});
|
request({ url: `/userBettingInfo?uid=${uid}`, method: 'GET' })
|
||||||
|
|
||||||
// 用户投注记录
|
// 用户投注记录
|
||||||
export const getTzJl = (uid: string) =>
|
export const getTzJl = (uid: string) =>
|
||||||
request({url: `/userBettingRecord?uid=${uid}`, method: "GET"});
|
request({ url: `/userBettingRecord?uid=${uid}`, method: 'GET' })
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ export default defineAppConfig({
|
|||||||
'pages/game_detail/index',
|
'pages/game_detail/index',
|
||||||
'pages/yaotouzi/records/index',
|
'pages/yaotouzi/records/index',
|
||||||
'pages/balloon/index/index',
|
'pages/balloon/index/index',
|
||||||
'/pages/balloon/records/index'
|
'/pages/balloon/records/index',
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: 'light',
|
backgroundTextStyle: 'light',
|
||||||
navigationBarBackgroundColor: '#fff',
|
navigationBarBackgroundColor: '#fff',
|
||||||
navigationBarTitleText: 'Game',
|
navigationBarTitleText: 'Game',
|
||||||
navigationBarTextStyle: 'black'
|
navigationBarTextStyle: 'black',
|
||||||
},
|
},
|
||||||
animation: false
|
animation: false,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import {createApp} from 'vue'
|
import { createApp } from 'vue'
|
||||||
import './app.scss'
|
import './app.scss'
|
||||||
|
|
||||||
const App = createApp({
|
const App = createApp({
|
||||||
onShow() {
|
onShow() {},
|
||||||
},
|
|
||||||
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
|
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// 用于配置项目的一些常量,如接口地址、websocket地址等
|
// 用于配置项目的一些常量,如接口地址、websocket地址等
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
export const app = {
|
export const app = {
|
||||||
API_URL: () => `${process.env.TARO_APP_API}`,
|
API_URL: () => `${process.env.TARO_APP_API}`,
|
||||||
API_WS: () =>
|
API_WS: () =>
|
||||||
`${process.env.TARO_APP_WS}?uid=${Taro.getStorageSync("uid")}&game_id=${
|
`${process.env.TARO_APP_WS}?uid=${Taro.getStorageSync('uid')}&game_id=${
|
||||||
Taro.getStorageSync("gameItem").ID
|
Taro.getStorageSync('gameItem').ID
|
||||||
}`,
|
}`,
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
||||||
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
|
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-touch-fullscreen" content="yes">
|
<meta name="apple-touch-fullscreen" content="yes" />
|
||||||
<meta name="format-detection" content="telephone=no,address=no">
|
<meta name="format-detection" content="telephone=no,address=no" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="white">
|
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
<meta http-equiv="Cache-control" content="no-cache">
|
<meta http-equiv="Cache-control" content="no-cache" />
|
||||||
<title>newGameHome</title>
|
<title>newGameHome</title>
|
||||||
<script><%= htmlWebpackPlugin.options.script %></script>
|
<script>
|
||||||
</head>
|
<%= htmlWebpackPlugin.options.script %>
|
||||||
<body>
|
</script>
|
||||||
<div id="app"></div>
|
</head>
|
||||||
</body>
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '吹气球'
|
navigationBarTitleText: '吹气球',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,49 +1,49 @@
|
|||||||
.container {
|
.container {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
margin: 100px;
|
margin: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balloon-box {
|
.balloon-box {
|
||||||
background-image: url("../../../static/balloon.png");
|
background-image: url('../../../static/balloon.png');
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
margin: 100px;
|
margin: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-box {
|
.bottom-box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 1px solid grey;
|
border: 1px solid grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.btn {
|
.btn {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
width: 45%;
|
width: 45%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,192 +1,181 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
import utils from "@/utils";
|
import utils from '@/utils'
|
||||||
|
|
||||||
const val = ref("");
|
const val = ref('')
|
||||||
|
|
||||||
const timeStr = ref("0");
|
const timeStr = ref('0')
|
||||||
|
|
||||||
const betVal = ref(100);
|
const betVal = ref(100)
|
||||||
|
|
||||||
const count = ref(1);
|
const count = ref(1)
|
||||||
|
|
||||||
const zoom = ref(1);
|
const zoom = ref(1)
|
||||||
|
|
||||||
const isBalloon = ref(true);
|
const isBalloon = ref(true)
|
||||||
|
|
||||||
const ws = new WebSocket(
|
const ws = new WebSocket(
|
||||||
`${process.env.TARO_APP_BALLOON_WS}?uid=${Taro.getStorageSync(
|
`${process.env.TARO_APP_BALLOON_WS}?uid=${Taro.getStorageSync('uid')}&game_id=${
|
||||||
"uid"
|
Taro.getStorageSync('gameItem').ID
|
||||||
)}&game_id=${Taro.getStorageSync("gameItem").ID}`
|
}`
|
||||||
);
|
)
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "连接游戏服务器成功",
|
title: '连接游戏服务器成功',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
ws.onmessage = (message) => {
|
ws.onmessage = (message) => {
|
||||||
const res = JSON.parse(message.data);
|
const res = JSON.parse(message.data)
|
||||||
switch (res.code) {
|
switch (res.code) {
|
||||||
case 200:
|
case 200:
|
||||||
timeStr.value = res.data;
|
timeStr.value = res.data
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 400:
|
case 400:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 100:
|
case 100:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
startFun(res.name);
|
startFun(res.name)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const changeBet = () => {
|
const changeBet = () => {
|
||||||
switch (betVal.value) {
|
switch (betVal.value) {
|
||||||
case 100:
|
case 100:
|
||||||
betVal.value = 1000;
|
betVal.value = 1000
|
||||||
break;
|
break
|
||||||
case 1000:
|
case 1000:
|
||||||
betVal.value = 10000;
|
betVal.value = 10000
|
||||||
break;
|
break
|
||||||
case 10000:
|
case 10000:
|
||||||
betVal.value = 100;
|
betVal.value = 100
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const startBet = () => {
|
const startBet = () => {
|
||||||
if (!val.value)
|
if (!val.value)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "请输入秒数",
|
title: '请输入秒数',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
if (Number(val.value) > 13) {
|
if (Number(val.value) > 13) {
|
||||||
val.value = "13";
|
val.value = '13'
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "秒数不能超过13",
|
title: '秒数不能超过13',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
ws.send(
|
ws.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: 1,
|
type: 1,
|
||||||
data: {
|
data: {
|
||||||
number: betVal.value * count.value,
|
number: betVal.value * count.value,
|
||||||
second: Number(val.value),
|
second: Number(val.value),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getUserInfo();
|
getUserInfo()
|
||||||
}, 1000);
|
}, 1000)
|
||||||
};
|
}
|
||||||
|
|
||||||
const clear = () => {
|
const clear = () => {
|
||||||
count.value = 1;
|
count.value = 1
|
||||||
val.value = "";
|
val.value = ''
|
||||||
};
|
}
|
||||||
|
|
||||||
const startFun = (num: number) => {
|
const startFun = (num: number) => {
|
||||||
let count = 1;
|
let count = 1
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
count++;
|
count++
|
||||||
zoom.value += 0.1;
|
zoom.value += 0.1
|
||||||
if (count === num) {
|
if (count === num) {
|
||||||
isBalloon.value = false;
|
isBalloon.value = false
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isBalloon.value = true;
|
isBalloon.value = true
|
||||||
zoom.value = 1;
|
zoom.value = 1
|
||||||
}, 1000);
|
}, 1000)
|
||||||
}
|
}
|
||||||
}, 1000 * i);
|
}, 1000 * i)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
getUserInfo();
|
getUserInfo()
|
||||||
});
|
})
|
||||||
|
|
||||||
const douzi = ref(0);
|
const douzi = ref(0)
|
||||||
|
|
||||||
const getUserInfo = async () => {
|
const getUserInfo = async () => {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: `${
|
url: `${process.env.TARO_APP_BALLOON_API}/userBalloonInfo?uid=${Taro.getStorageSync('uid')}`,
|
||||||
process.env.TARO_APP_BALLOON_API
|
method: 'GET',
|
||||||
}/userBalloonInfo?uid=${Taro.getStorageSync("uid")}`,
|
success: ({ data: res }) => {
|
||||||
method: "GET",
|
douzi.value = res.data.data.pulse
|
||||||
success: ({ data: res }) => {
|
},
|
||||||
douzi.value = res.data.data.pulse;
|
})
|
||||||
},
|
}
|
||||||
});
|
|
||||||
};
|
const toPage = (type: number) => {
|
||||||
|
Taro.navigateTo({
|
||||||
const toPage = (type: number) => {
|
url: `/pages/balloon/records/index?type=${type}`,
|
||||||
Taro.navigateTo({
|
})
|
||||||
url: `/pages/balloon/records/index?type=${type}`,
|
}
|
||||||
});
|
</script>
|
||||||
};
|
|
||||||
</script>
|
<template>
|
||||||
|
<view class="container">
|
||||||
<template>
|
<view class="header">
|
||||||
<view class="container">
|
<view>豆子:{{ douzi }}</view>
|
||||||
<view class="header">
|
<view @click="utils.vibrateShort(() => toPage(1))">开奖记录</view>
|
||||||
<view>豆子:{{ douzi }}</view>
|
<view @click="utils.vibrateShort(() => toPage(2))">投注记录</view>
|
||||||
<view @click="utils.vibrateShort(() => toPage(1))">开奖记录</view>
|
</view>
|
||||||
<view @click="utils.vibrateShort(() => toPage(2))">投注记录</view>
|
<view class="time">开奖倒计时:{{ timeStr }}</view>
|
||||||
</view>
|
<view
|
||||||
<view class="time">开奖倒计时:{{ timeStr }}</view>
|
v-if="isBalloon"
|
||||||
<view
|
class="balloon-box"
|
||||||
v-if="isBalloon"
|
:style="{
|
||||||
class="balloon-box"
|
transform: `scale(${zoom})`,
|
||||||
:style="{
|
transition: 'transform 0.5s',
|
||||||
transform: `scale(${zoom})`,
|
}"
|
||||||
transition: 'transform 0.5s',
|
></view>
|
||||||
}"
|
<view v-else>气球爆炸了!</view>
|
||||||
></view>
|
<view class="bottom-box">
|
||||||
<view v-else>气球爆炸了!</view>
|
<input class="input" type="number" v-model="val" placeholder="请输入秒数,秒数不能超过13" />
|
||||||
<view class="bottom-box">
|
<view class="box">
|
||||||
<input
|
<button class="btn" type="primary" @click="count++">X{{ count }}</button>
|
||||||
class="input"
|
<button class="btn" type="primary" @click="changeBet">X{{ betVal }}</button>
|
||||||
type="number"
|
</view>
|
||||||
v-model="val"
|
<view class="box">
|
||||||
placeholder="请输入秒数,秒数不能超过13"
|
<button class="btn" type="primary" @click="clear">重置</button>
|
||||||
/>
|
<button class="btn" type="primary" @click="startBet">吹</button>
|
||||||
<view class="box">
|
</view>
|
||||||
<button class="btn" type="primary" @click="count++">
|
</view>
|
||||||
X{{ count }}
|
</view>
|
||||||
</button>
|
</template>
|
||||||
<button class="btn" type="primary" @click="changeBet">
|
|
||||||
X{{ betVal }}
|
<style lang="scss">
|
||||||
</button>
|
@import './index.scss';
|
||||||
</view>
|
</style>
|
||||||
<view class="box">
|
|
||||||
<button class="btn" type="primary" @click="clear">重置</button>
|
|
||||||
<button class="btn" type="primary" @click="startBet">吹</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
@import "./index.scss";
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarBackgroundColor: '#23684B',
|
navigationBarBackgroundColor: '#23684B',
|
||||||
enablePullDownRefresh: true
|
enablePullDownRefresh: true,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<template v-if="typeNum === 1">
|
<template v-if="typeNum === 1">
|
||||||
<view class="card" v-for="(item,index) in list as any[]" :key="index">
|
<view class="card" v-for="(item,index) in list as any[]" :key="index">
|
||||||
<view>
|
<view>
|
||||||
<view
|
<view>
|
||||||
>第{{ item.Periods }}期开奖:
|
第{{ item.Periods }}期开奖:
|
||||||
<text>{{ item.Name }}秒</text>
|
<text>{{ item.Name }}秒</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -12,19 +12,17 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view v-if="list.length > 0">
|
<view v-if="list.length > 0">
|
||||||
<view
|
<view class="card desc" v-for="(item,index) in list as any[]" :key="index">
|
||||||
class="card desc"
|
|
||||||
v-for="(item,index) in list as any[]"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view>
|
<view>
|
||||||
<view>第{{ item.Periods }}期投注:</view>
|
<view>第{{ item.Periods }}期投注:</view>
|
||||||
<view
|
<view>
|
||||||
>时间:<text style="color: red">{{ item.Name }}</text></view
|
时间:
|
||||||
>
|
<text style="color: red">{{ item.Name }}</text>
|
||||||
<view class="sub"
|
</view>
|
||||||
>投注时间:<text>{{ item.DrawTime }}</text></view
|
<view class="sub">
|
||||||
>
|
投注时间:
|
||||||
|
<text>{{ item.DrawTime }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align: right">
|
<view style="text-align: right">
|
||||||
<view style="color: red">+{{ item.DrawNum }}积分</view>
|
<view style="color: red">+{{ item.DrawNum }}积分</view>
|
||||||
@@ -40,45 +38,47 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
const list = ref<any[]>([]);
|
const list = ref<any[]>([])
|
||||||
|
|
||||||
const typeNum = ref(0);
|
const typeNum = ref(0)
|
||||||
|
|
||||||
Taro.useLoad((options) => {
|
Taro.useLoad((options) => {
|
||||||
typeNum.value = Number(options.type);
|
typeNum.value = Number(options.type)
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: options.type === "1" ? "开奖记录" : "投注记录",
|
title: options.type === '1' ? '开奖记录' : '投注记录',
|
||||||
});
|
})
|
||||||
getData();
|
getData()
|
||||||
});
|
})
|
||||||
|
|
||||||
Taro.usePullDownRefresh(() => {
|
Taro.usePullDownRefresh(() => {
|
||||||
getData();
|
getData()
|
||||||
});
|
})
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
if (typeNum.value === 1) {
|
if (typeNum.value === 1) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: `${process.env.TARO_APP_BALLOON_API}/draw`,
|
url: `${process.env.TARO_APP_BALLOON_API}/draw`,
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
success: ({ data: res }) => {
|
success: ({ data: res }) => {
|
||||||
list.value = res.data.data || [];
|
list.value = res.data.data || []
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: `${process.env.TARO_APP_BALLOON_API}/userBalloonRecord?uid=${Taro.getStorageSync('uid')}`,
|
url: `${process.env.TARO_APP_BALLOON_API}/userBalloonRecord?uid=${Taro.getStorageSync(
|
||||||
method: "GET",
|
'uid'
|
||||||
|
)}`,
|
||||||
|
method: 'GET',
|
||||||
success: ({ data: res }) => {
|
success: ({ data: res }) => {
|
||||||
list.value = res.data.data || [];
|
list.value = res.data.data || []
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
Taro.stopPullDownRefresh();
|
Taro.stopPullDownRefresh()
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '游戏详情'
|
navigationBarTitleText: '游戏详情',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ page {
|
|||||||
width: 300px;
|
width: 300px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid #f5f5f5;
|
border: 1px solid #f5f5f5;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,24 +15,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
import "./index.scss";
|
import './index.scss'
|
||||||
|
|
||||||
const info = ref<any>({});
|
const info = ref<any>({})
|
||||||
|
|
||||||
Taro.useLoad(() => {
|
Taro.useLoad(() => {
|
||||||
info.value = Taro.getStorageSync("gameItem");
|
info.value = Taro.getStorageSync('gameItem')
|
||||||
});
|
})
|
||||||
|
|
||||||
const list = ref([
|
const list = ref(['https://files.wanzhuanyongcheng.com/file/img/yaotouzi/banner/qietu.png'])
|
||||||
"https://files.wanzhuanyongcheng.com/file/img/yaotouzi/banner/qietu.png",
|
|
||||||
]);
|
|
||||||
|
|
||||||
const startGame = () => {
|
const startGame = () => {
|
||||||
console.log(info.value);
|
console.log(info.value)
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: info.value.url,
|
url: info.value.url,
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '游戏大厅'
|
navigationBarTitleText: '游戏大厅',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 300px;
|
line-height: 300px;
|
||||||
background-image: url("../../static/qietu.png");
|
background-image: url('../../static/qietu.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background-image: url("../../static/an.png");
|
background-image: url('../../static/an.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
right: 30px;
|
right: 30px;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
|
|||||||
@@ -11,42 +11,42 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
import "./index.scss";
|
import './index.scss'
|
||||||
|
|
||||||
Taro.useLoad((options) => {
|
Taro.useLoad((options) => {
|
||||||
Taro.setStorageSync("uid", options.uid);
|
Taro.setStorageSync('uid', options.uid)
|
||||||
if (Taro.getStorageSync("uid")) {
|
if (Taro.getStorageSync('uid')) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: `登陆成功`,
|
title: `登陆成功`,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
getList();
|
getList()
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "登陆失败,请重新进入游戏大厅",
|
title: '登陆失败,请重新进入游戏大厅',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
const list = ref([]);
|
const list = ref([])
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: `${process.env.TARO_APP_HOME}`,
|
url: `${process.env.TARO_APP_HOME}`,
|
||||||
method: "POST",
|
method: 'POST',
|
||||||
success: ({ data: res }) => {
|
success: ({ data: res }) => {
|
||||||
list.value = res.data.data || [];
|
list.value = res.data.data || []
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
const toPage = (item: any) => {
|
const toPage = (item: any) => {
|
||||||
Taro.setStorageSync("gameItem", item);
|
Taro.setStorageSync('gameItem', item)
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/game_detail/index?id=${item.ID}`,
|
url: `/pages/game_detail/index?id=${item.ID}`,
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '摇骰子'
|
navigationBarTitleText: '摇骰子',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.index {
|
.index {
|
||||||
background-color: #23684B;
|
background-color: #23684b;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
@@ -22,12 +22,11 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 2px solid #FFFFFF;
|
border: 2px solid #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userText {
|
.userText {
|
||||||
@@ -48,9 +47,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
background-color: #429C78;
|
background-color: #429c78;
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -59,7 +57,7 @@
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
background-image: url("../../../static/dz.png");
|
background-image: url('../../../static/dz.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
@@ -106,7 +104,7 @@
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
background-color: #E9422F;
|
background-color: #e9422f;
|
||||||
width: 55px;
|
width: 55px;
|
||||||
height: 55px;
|
height: 55px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -124,13 +122,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
width: 137px;
|
width: 137px;
|
||||||
background: linear-gradient(-180deg, #FBE039, #FDC413);
|
background: linear-gradient(-180deg, #fbe039, #fdc413);
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid #FFEDC5;
|
border: 1px solid #ffedc5;
|
||||||
border-radius: 26px;
|
border-radius: 26px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,7 +181,6 @@
|
|||||||
.item1 {
|
.item1 {
|
||||||
width: 24%;
|
width: 24%;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.opt1 {
|
.opt1 {
|
||||||
@@ -249,7 +245,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.base {
|
.base {
|
||||||
background-image: url("../../../static/cais.png");
|
background-image: url('../../../static/cais.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
//flex: 1;
|
//flex: 1;
|
||||||
width: 43%;
|
width: 43%;
|
||||||
@@ -262,13 +258,13 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.qz {
|
.qz {
|
||||||
background-image: url("../../../static/qz.png");
|
background-image: url('../../../static/qz.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
height: 25%;
|
height: 25%;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
line-height: 100px;
|
line-height: 100px;
|
||||||
color: #FBE039;
|
color: #fbe039;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,7 +284,7 @@
|
|||||||
padding: 0 50px;
|
padding: 0 50px;
|
||||||
|
|
||||||
.btn1 {
|
.btn1 {
|
||||||
background-image: url("../../../static/cz.png");
|
background-image: url('../../../static/cz.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
@@ -297,7 +293,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn2 {
|
.btn2 {
|
||||||
background-image: url("../../../static/ssd.png");
|
background-image: url('../../../static/ssd.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
@@ -306,7 +302,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn3 {
|
.btn3 {
|
||||||
background-image: url("../../../static/tz.png");
|
background-image: url('../../../static/tz.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
@@ -322,7 +318,9 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn1, .btn2, .btn3 {
|
.btn1,
|
||||||
|
.btn2,
|
||||||
|
.btn3 {
|
||||||
&:active {
|
&:active {
|
||||||
animation: btn ease 0.3s;
|
animation: btn ease 0.3s;
|
||||||
}
|
}
|
||||||
@@ -363,7 +361,7 @@
|
|||||||
.expanding-div {
|
.expanding-div {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
height: 90px;
|
height: 90px;
|
||||||
background-image: url("../../../static/qzzz.png");
|
background-image: url('../../../static/qzzz.png');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@@ -419,7 +417,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
width: 92%;
|
width: 92%;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
@@ -432,7 +429,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<view class="left">
|
<view class="left">
|
||||||
<image :src="userInfo.avatarUrl"></image>
|
<image :src="userInfo.avatarUrl"></image>
|
||||||
<view class="userText">
|
<view class="userText">
|
||||||
<view class="userName">{{ userInfo.nickName || "用户" }}</view>
|
<view class="userName">{{ userInfo.nickName || '用户' }}</view>
|
||||||
<view class="userScore">积分: {{ userInfo.integral || 0 }}</view>
|
<view class="userScore">积分: {{ userInfo.integral || 0 }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -34,12 +34,8 @@
|
|||||||
<view>剩余{{ time }}s开奖</view>
|
<view>剩余{{ time }}s开奖</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="btn" @click="utils.vibrateShort(() => toPage(1))"
|
<view class="btn" @click="utils.vibrateShort(() => toPage(1))">开奖记录</view>
|
||||||
>开奖记录</view
|
<view class="btn mt-15" @click="utils.vibrateShort(() => toPage(2))">投注记录</view>
|
||||||
>
|
|
||||||
<view class="btn mt-15" @click="utils.vibrateShort(() => toPage(2))"
|
|
||||||
>投注记录</view
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 选项区 -->
|
<!-- 选项区 -->
|
||||||
@@ -61,8 +57,9 @@
|
|||||||
class="close"
|
class="close"
|
||||||
v-if="item.status"
|
v-if="item.status"
|
||||||
@click.stop="utils.vibrateShort(() => clearOneBet(item))"
|
@click.stop="utils.vibrateShort(() => clearOneBet(item))"
|
||||||
>x</view
|
|
||||||
>
|
>
|
||||||
|
x
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="opt1" v-if="odds1.length > 0">
|
<view class="opt1" v-if="odds1.length > 0">
|
||||||
@@ -82,8 +79,9 @@
|
|||||||
class="close"
|
class="close"
|
||||||
v-if="odds1[0].status"
|
v-if="odds1[0].status"
|
||||||
@click.stop="utils.vibrateShort(() => clearOneBet(odds1[0]))"
|
@click.stop="utils.vibrateShort(() => clearOneBet(odds1[0]))"
|
||||||
>x</view
|
|
||||||
>
|
>
|
||||||
|
x
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="subColor item"
|
class="subColor item"
|
||||||
@@ -100,8 +98,9 @@
|
|||||||
class="close"
|
class="close"
|
||||||
v-if="odds1[1].status"
|
v-if="odds1[1].status"
|
||||||
@click.stop="utils.vibrateShort(() => clearOneBet(odds1[1]))"
|
@click.stop="utils.vibrateShort(() => clearOneBet(odds1[1]))"
|
||||||
>x</view
|
|
||||||
>
|
>
|
||||||
|
x
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="base">
|
<view class="base">
|
||||||
@@ -110,9 +109,9 @@
|
|||||||
{{ qzTitle }}
|
{{ qzTitle }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="expanding-div" v-if="isShow"
|
<view class="expanding-div" v-if="isShow">
|
||||||
>{{ nowKJInfo.Start }} - {{ nowKJInfo.End }}</view
|
{{ nowKJInfo.Start }} - {{ nowKJInfo.End }}
|
||||||
>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="optt">
|
<view class="optt">
|
||||||
<view
|
<view
|
||||||
@@ -131,8 +130,9 @@
|
|||||||
class="close"
|
class="close"
|
||||||
v-if="odds1[2].status"
|
v-if="odds1[2].status"
|
||||||
@click.stop="utils.vibrateShort(() => clearOneBet(odds1[2]))"
|
@click.stop="utils.vibrateShort(() => clearOneBet(odds1[2]))"
|
||||||
>x</view
|
|
||||||
>
|
>
|
||||||
|
x
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view
|
<!-- <view
|
||||||
class="subColor item"
|
class="subColor item"
|
||||||
@@ -165,19 +165,16 @@
|
|||||||
class="close"
|
class="close"
|
||||||
v-if="item.status"
|
v-if="item.status"
|
||||||
@click.stop="utils.vibrateShort(() => clearOneBet(item))"
|
@click.stop="utils.vibrateShort(() => clearOneBet(item))"
|
||||||
>x</view
|
|
||||||
>
|
>
|
||||||
|
x
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view style="height: 25%" scroll-y>
|
<scroll-view style="height: 25%" scroll-y>
|
||||||
<view
|
<view class="card subColor" v-for="(item,index) in kjList as any[]" :key="index">
|
||||||
class="card subColor"
|
|
||||||
v-for="(item,index) in kjList as any[]"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view>
|
<view>
|
||||||
<view
|
<view>
|
||||||
>第{{ item.Periods }}期开奖:
|
第{{ item.Periods }}期开奖:
|
||||||
<text style="color: red">{{ item.Start }} , {{ item.End }}</text>
|
<text style="color: red">{{ item.Start }} , {{ item.End }}</text>
|
||||||
<text
|
<text
|
||||||
v-for="(num, i) in item.Name"
|
v-for="(num, i) in item.Name"
|
||||||
@@ -201,124 +198,115 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="subColor bottomBar">
|
<view class="subColor bottomBar">
|
||||||
<view class="btn1" @click="utils.vibrateShort(() => clearBet(true))"
|
<view class="btn1" @click="utils.vibrateShort(() => clearBet(true))">重置</view>
|
||||||
>重置</view
|
<view class="btn2" @click="utils.vibrateShort(() => changeOdd())">X{{ oddVal }}</view>
|
||||||
>
|
<view class="btn3" @click="utils.vibrateShort(() => verifyBet())">投注</view>
|
||||||
<view class="btn2" @click="utils.vibrateShort(() => changeOdd())"
|
|
||||||
>X{{ oddVal }}</view
|
|
||||||
>
|
|
||||||
<view class="btn3" @click="utils.vibrateShort(() => verifyBet())"
|
|
||||||
>投注</view
|
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
import { app } from "@/config";
|
import { app } from '@/config'
|
||||||
import { getGameOption, getKaiJiangList, getJfDz } from "@/api";
|
import { getGameOption, getKaiJiangList, getJfDz } from '@/api'
|
||||||
import utils from "@/utils";
|
import utils from '@/utils'
|
||||||
|
|
||||||
const ws = ref<null | WebSocket>(null);
|
const ws = ref<null | WebSocket>(null)
|
||||||
|
|
||||||
// 是否显示开奖动画
|
// 是否显示开奖动画
|
||||||
const isShow = ref(false);
|
const isShow = ref(false)
|
||||||
|
|
||||||
// 是否开启文字放大动画
|
// 是否开启文字放大动画
|
||||||
const isExpanding = ref(false);
|
const isExpanding = ref(false)
|
||||||
|
|
||||||
interface Odd {
|
interface Odd {
|
||||||
id?: number;
|
id?: number
|
||||||
name?: string;
|
name?: string
|
||||||
odds?: number;
|
odds?: number
|
||||||
markNum?: number;
|
markNum?: number
|
||||||
status?: boolean;
|
status?: boolean
|
||||||
flicker?: boolean;
|
flicker?: boolean
|
||||||
numStr?: number;
|
numStr?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const odds = ref<Odd[]>([]);
|
const odds = ref<Odd[]>([])
|
||||||
|
|
||||||
const odds1 = ref<Odd[]>([]);
|
const odds1 = ref<Odd[]>([])
|
||||||
|
|
||||||
const odds2 = ref<Odd[]>([]);
|
const odds2 = ref<Odd[]>([])
|
||||||
|
|
||||||
const qzTitle = ref("请投注");
|
const qzTitle = ref('请投注')
|
||||||
|
|
||||||
const time = ref(0);
|
const time = ref(0)
|
||||||
|
|
||||||
const nowKJInfo = ref<{
|
const nowKJInfo = ref<{
|
||||||
Start?: string;
|
Start?: string
|
||||||
End?: string;
|
End?: string
|
||||||
Periods?: number;
|
Periods?: number
|
||||||
}>({});
|
}>({})
|
||||||
|
|
||||||
const userInfo = ref<{
|
const userInfo = ref<{
|
||||||
pulse?: number;
|
pulse?: number
|
||||||
integral?: number;
|
integral?: number
|
||||||
nickName?: string;
|
nickName?: string
|
||||||
avatarUrl?: string;
|
avatarUrl?: string
|
||||||
}>({});
|
}>({})
|
||||||
|
|
||||||
const zjObj = ref<any>([]);
|
const zjObj = ref<any>([])
|
||||||
|
|
||||||
const iMsgNum = ref(0);
|
const iMsgNum = ref(0)
|
||||||
|
|
||||||
const numColor = (num: string) => {
|
const numColor = (num: string) => {
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case "大":
|
case '大':
|
||||||
return "red";
|
return 'red'
|
||||||
case "小":
|
case '小':
|
||||||
return "green";
|
return 'green'
|
||||||
// case '单':
|
// case '单':
|
||||||
// return 'orange'
|
// return 'orange'
|
||||||
// case '双':
|
// case '双':
|
||||||
// return 'blue'
|
// return 'blue'
|
||||||
case "和":
|
case '和':
|
||||||
return "purple";
|
return 'purple'
|
||||||
default:
|
default:
|
||||||
return "black";
|
return 'black'
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
startMusic(
|
startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/bg.MP3', true)
|
||||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/bg.MP3",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
initWs();
|
initWs()
|
||||||
initData();
|
initData()
|
||||||
});
|
})
|
||||||
|
|
||||||
Taro.useDidHide(() => {
|
Taro.useDidHide(() => {
|
||||||
console.log("useDidHide");
|
console.log('useDidHide')
|
||||||
ws.value?.close();
|
ws.value?.close()
|
||||||
});
|
})
|
||||||
|
|
||||||
const initData = () => {
|
const initData = () => {
|
||||||
qzTitle.value = "请投注";
|
qzTitle.value = '请投注'
|
||||||
getOddList();
|
getOddList()
|
||||||
getKJList();
|
getKJList()
|
||||||
getUserInfo();
|
getUserInfo()
|
||||||
};
|
}
|
||||||
|
|
||||||
const arr = ["2+2", "3+3", "4+4", "5+5", "6+6"];
|
const arr = ['2+2', '3+3', '4+4', '5+5', '6+6']
|
||||||
// const arr1 = ["大", "小", "单", "双"];
|
// const arr1 = ["大", "小", "单", "双"];
|
||||||
// const arr2 = ["和", "3", "4", "5", "6", "8", "9", "10", "11"];
|
// const arr2 = ["和", "3", "4", "5", "6", "8", "9", "10", "11"];
|
||||||
const arr1 = ["大", "小", "和"];
|
const arr1 = ['大', '小', '和']
|
||||||
const arr2 = ["3", "4", "5", "6", "8", "9", "10", "11"];
|
const arr2 = ['3', '4', '5', '6', '8', '9', '10', '11']
|
||||||
|
|
||||||
// 投注列表
|
// 投注列表
|
||||||
const getOddList = async () => {
|
const getOddList = async () => {
|
||||||
const res = await getGameOption();
|
const res = await getGameOption()
|
||||||
odds.value = [];
|
odds.value = []
|
||||||
odds1.value = [];
|
odds1.value = []
|
||||||
odds2.value = [];
|
odds2.value = []
|
||||||
res.data.data.forEach((item: any) => {
|
res.data.data.forEach((item: any) => {
|
||||||
const { name, ID, odds: odd, max } = item;
|
const { name, ID, odds: odd, max } = item
|
||||||
const newItem = {
|
const newItem = {
|
||||||
id: ID,
|
id: ID,
|
||||||
name: name,
|
name: name,
|
||||||
@@ -328,260 +316,257 @@ const getOddList = async () => {
|
|||||||
numStr: 0,
|
numStr: 0,
|
||||||
status: false,
|
status: false,
|
||||||
flicker: false,
|
flicker: false,
|
||||||
};
|
}
|
||||||
if (Taro.getStorageSync("odds")) {
|
if (Taro.getStorageSync('odds')) {
|
||||||
odds.value = Taro.getStorageSync("odds");
|
odds.value = Taro.getStorageSync('odds')
|
||||||
odds1.value = Taro.getStorageSync("odds1");
|
odds1.value = Taro.getStorageSync('odds1')
|
||||||
odds2.value = Taro.getStorageSync("odds2");
|
odds2.value = Taro.getStorageSync('odds2')
|
||||||
} else {
|
} else {
|
||||||
if (arr1.includes(name)) {
|
if (arr1.includes(name)) {
|
||||||
odds1.value.push(newItem);
|
odds1.value.push(newItem)
|
||||||
} else if (arr.includes(name)) {
|
} else if (arr.includes(name)) {
|
||||||
odds.value.push(newItem);
|
odds.value.push(newItem)
|
||||||
} else if (arr2.includes(name)) {
|
} else if (arr2.includes(name)) {
|
||||||
odds2.value.push(newItem);
|
odds2.value.push(newItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
// const el = odds2.value.splice(0, 1)[0];
|
// const el = odds2.value.splice(0, 1)[0];
|
||||||
// odds2.value.splice(4, 0, el);
|
// odds2.value.splice(4, 0, el);
|
||||||
// console.log(odds1.value)
|
// console.log(odds1.value)
|
||||||
};
|
}
|
||||||
|
|
||||||
// 获取个人信息
|
// 获取个人信息
|
||||||
const getUserInfo = async () => {
|
const getUserInfo = async () => {
|
||||||
const res = await getJfDz(Taro.getStorageSync("uid"));
|
const res = await getJfDz(Taro.getStorageSync('uid'))
|
||||||
userInfo.value = res.data.data;
|
userInfo.value = res.data.data
|
||||||
};
|
}
|
||||||
|
|
||||||
const kJData = ref<any>([]);
|
const kJData = ref<any>([])
|
||||||
const kjList = ref<any>([]);
|
const kjList = ref<any>([])
|
||||||
|
|
||||||
// 开奖列表
|
// 开奖列表
|
||||||
const getKJList = async () => {
|
const getKJList = async () => {
|
||||||
const res = await getKaiJiangList();
|
const res = await getKaiJiangList()
|
||||||
kJData.value = res.data.data;
|
kJData.value = res.data.data
|
||||||
kjList.value = res.data.data.map((item: any) => {
|
kjList.value = res.data.data.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
Name: item.Name.split("-"),
|
Name: item.Name.split('-'),
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// 初始化游戏
|
// 初始化游戏
|
||||||
const initWs = () => {
|
const initWs = () => {
|
||||||
ws.value = new WebSocket(`${app.API_WS()}`);
|
ws.value = new WebSocket(`${app.API_WS()}`)
|
||||||
ws.value.onopen = async () => {
|
ws.value.onopen = async () => {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "连接游戏服务器成功",
|
title: '连接游戏服务器成功',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
ws.value.onmessage = async (e: any) => {
|
ws.value.onmessage = async (e: any) => {
|
||||||
const res = JSON.parse(e.data);
|
const res = JSON.parse(e.data)
|
||||||
switch (res.code) {
|
switch (res.code) {
|
||||||
case 200:
|
case 200:
|
||||||
let num = Number(res.data);
|
let num = Number(res.data)
|
||||||
time.value = num;
|
time.value = num
|
||||||
if (num === 5) {
|
if (num === 5) {
|
||||||
openDraw();
|
openDraw()
|
||||||
}
|
}
|
||||||
break;
|
break
|
||||||
case 401:
|
case 401:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "未登录",
|
title: '未登录',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 403:
|
case 403:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "未能操作",
|
title: '未能操作',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 400:
|
case 400:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "豆子不足",
|
title: '豆子不足',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 5:
|
case 5:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "投注成功",
|
title: '投注成功',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 100:
|
case 100:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 101:
|
case 101:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 301:
|
case 301:
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.navigateBack({
|
Taro.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
});
|
})
|
||||||
}, 2000);
|
}, 2000)
|
||||||
default:
|
default:
|
||||||
iMsgNum.value++;
|
iMsgNum.value++
|
||||||
zjObj.value = res;
|
zjObj.value = res
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
ws.value.onerror = () => {
|
ws.value.onerror = () => {
|
||||||
console.log("连接游戏服务器失败");
|
console.log('连接游戏服务器失败')
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "连接游戏服务器失败",
|
title: '连接游戏服务器失败',
|
||||||
mask: true,
|
mask: true,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const isKj = ref(false);
|
const isKj = ref(false)
|
||||||
// 开奖倒计时
|
// 开奖倒计时
|
||||||
const openDraw = () => {
|
const openDraw = () => {
|
||||||
isExpanding.value = true;
|
isExpanding.value = true
|
||||||
isKj.value = true;
|
isKj.value = true
|
||||||
startMusic(
|
startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/djs.MP3', false)
|
||||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/djs.MP3",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
for (let i = 5; i > 0; i--) {
|
for (let i = 5; i > 0; i--) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// i <= 3 && (fontColor.value = "red");
|
// i <= 3 && (fontColor.value = "red");
|
||||||
qzTitle.value = i.toString();
|
qzTitle.value = i.toString()
|
||||||
}, 1000 * (5 - i));
|
}, 1000 * (5 - i))
|
||||||
}
|
}
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
isExpanding.value = false;
|
isExpanding.value = false
|
||||||
const res = await getKaiJiangList();
|
const res = await getKaiJiangList()
|
||||||
nowKJInfo.value = res.data.data[0];
|
nowKJInfo.value = res.data.data[0]
|
||||||
qzTitle.value = `${nowKJInfo.value?.Periods || 0}期开奖`;
|
qzTitle.value = `${nowKJInfo.value?.Periods || 0}期开奖`
|
||||||
playAminExpand();
|
playAminExpand()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
startFlicker();
|
startFlicker()
|
||||||
}, 6000);
|
}, 6000)
|
||||||
isKj.value = false;
|
isKj.value = false
|
||||||
}, 5000);
|
}, 5000)
|
||||||
};
|
}
|
||||||
|
|
||||||
const oddVal = ref(100);
|
const oddVal = ref(100)
|
||||||
const changeOdd = () => {
|
const changeOdd = () => {
|
||||||
switch (oddVal.value) {
|
switch (oddVal.value) {
|
||||||
case 100:
|
case 100:
|
||||||
oddVal.value = 1000;
|
oddVal.value = 1000
|
||||||
break;
|
break
|
||||||
// case 10:
|
// case 10:
|
||||||
// oddVal.value = 100
|
// oddVal.value = 100
|
||||||
// break
|
// break
|
||||||
case 1000:
|
case 1000:
|
||||||
oddVal.value = 100;
|
oddVal.value = 100
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const clearBet = (val: boolean) => {
|
const clearBet = (val: boolean) => {
|
||||||
clearItems(odds.value, val);
|
clearItems(odds.value, val)
|
||||||
clearItems(odds1.value, val);
|
clearItems(odds1.value, val)
|
||||||
clearItems(odds2.value, val);
|
clearItems(odds2.value, val)
|
||||||
savsData();
|
savsData()
|
||||||
};
|
}
|
||||||
|
|
||||||
const clearItems = (items: any[], isClear: boolean = false) => {
|
const clearItems = (items: any[], isClear: boolean = false) => {
|
||||||
items.forEach((item: any) => {
|
items.forEach((item: any) => {
|
||||||
item.markNum = 0;
|
item.markNum = 0
|
||||||
if (isClear) {
|
if (isClear) {
|
||||||
item.numStr = 0;
|
item.numStr = 0
|
||||||
item.status = false;
|
item.status = false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
const addNum = (item: any) => {
|
const addNum = (item: any) => {
|
||||||
if (isKj.value)
|
if (isKj.value)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "正在开奖,不能下注",
|
title: '正在开奖,不能下注',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
if (item.name === "单" || item.name === "双")
|
if (item.name === '单' || item.name === '双')
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: `${item.name}不能下注`,
|
title: `${item.name}不能下注`,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
item.status = true;
|
item.status = true
|
||||||
item.markNum += oddVal.value;
|
item.markNum += oddVal.value
|
||||||
item.numStr += oddVal.value;
|
item.numStr += oddVal.value
|
||||||
if (item.markNum >= item.max && item.numStr >= item.max) {
|
if (item.markNum >= item.max && item.numStr >= item.max) {
|
||||||
item.markNum = item.max;
|
item.markNum = item.max
|
||||||
item.numStr = item.max;
|
item.numStr = item.max
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: `单注不能超过${item.max}`,
|
title: `单注不能超过${item.max}`,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
savsData();
|
savsData()
|
||||||
};
|
}
|
||||||
|
|
||||||
// 投注
|
// 投注
|
||||||
const verifyBet = () => {
|
const verifyBet = () => {
|
||||||
if (isKj.value)
|
if (isKj.value)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "正在开奖,不能下注",
|
title: '正在开奖,不能下注',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
|
|
||||||
let numCount = 0;
|
let numCount = 0
|
||||||
|
|
||||||
odds.value.forEach((item: any) => {
|
odds.value.forEach((item: any) => {
|
||||||
if (item.markNum > 0) {
|
if (item.markNum > 0) {
|
||||||
numCount += item.markNum;
|
numCount += item.markNum
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
odds1.value.forEach((item: any) => {
|
odds1.value.forEach((item: any) => {
|
||||||
if (item.markNum > 0) {
|
if (item.markNum > 0) {
|
||||||
numCount += item.markNum;
|
numCount += item.markNum
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
odds2.value.forEach((item: any) => {
|
odds2.value.forEach((item: any) => {
|
||||||
if (item.markNum > 0) {
|
if (item.markNum > 0) {
|
||||||
numCount += item.markNum;
|
numCount += item.markNum
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
if (numCount === 0)
|
if (numCount === 0)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "请选择选项,再投注",
|
title: '请选择选项,再投注',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
|
|
||||||
if (numCount > (userInfo.value?.pulse as number))
|
if (numCount > (userInfo.value?.pulse as number))
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "投注豆子不足",
|
title: '投注豆子不足',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
})
|
||||||
|
|
||||||
const data: any[] = [];
|
const data: any[] = []
|
||||||
|
|
||||||
odds.value.forEach((item: any) => {
|
odds.value.forEach((item: any) => {
|
||||||
if (item.markNum > 0) {
|
if (item.markNum > 0) {
|
||||||
@@ -589,9 +574,9 @@ const verifyBet = () => {
|
|||||||
bid: item.id,
|
bid: item.id,
|
||||||
number: item.markNum,
|
number: item.markNum,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
odds1.value.forEach((item: any) => {
|
odds1.value.forEach((item: any) => {
|
||||||
if (item.markNum > 0) {
|
if (item.markNum > 0) {
|
||||||
@@ -599,9 +584,9 @@ const verifyBet = () => {
|
|||||||
bid: item.id,
|
bid: item.id,
|
||||||
number: item.markNum,
|
number: item.markNum,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
odds2.value.forEach((item: any) => {
|
odds2.value.forEach((item: any) => {
|
||||||
if (item.markNum > 0) {
|
if (item.markNum > 0) {
|
||||||
@@ -609,103 +594,97 @@ const verifyBet = () => {
|
|||||||
bid: item.id,
|
bid: item.id,
|
||||||
number: item.markNum,
|
number: item.markNum,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
ws.value?.send(
|
ws.value?.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: 1,
|
type: 1,
|
||||||
data: data,
|
data: data,
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getUserInfo();
|
getUserInfo()
|
||||||
}, 1000);
|
}, 1000)
|
||||||
|
|
||||||
qzTitle.value = "已投注";
|
qzTitle.value = '已投注'
|
||||||
clearBet(false);
|
clearBet(false)
|
||||||
savsData();
|
savsData()
|
||||||
};
|
}
|
||||||
|
|
||||||
// 前往开奖和投注记录
|
// 前往开奖和投注记录
|
||||||
const toPage = (type: number) => {
|
const toPage = (type: number) => {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/yaotouzi/records/index?type=${type}`,
|
url: `/pages/yaotouzi/records/index?type=${type}`,
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// 播放展开动画
|
// 播放展开动画
|
||||||
const playAminExpand = () => {
|
const playAminExpand = () => {
|
||||||
isShow.value = true;
|
isShow.value = true
|
||||||
startMusic(
|
startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/kj.MP3', false)
|
||||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/kj.MP3",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isShow.value = false;
|
isShow.value = false
|
||||||
initData();
|
initData()
|
||||||
}, 10000);
|
}, 10000)
|
||||||
};
|
}
|
||||||
|
|
||||||
// 开始闪烁
|
// 开始闪烁
|
||||||
const startFlicker = () => {
|
const startFlicker = () => {
|
||||||
flickerItems(odds.value);
|
flickerItems(odds.value)
|
||||||
flickerItems(odds1.value);
|
flickerItems(odds1.value)
|
||||||
flickerItems(odds2.value);
|
flickerItems(odds2.value)
|
||||||
zjObj.value = [];
|
zjObj.value = []
|
||||||
};
|
}
|
||||||
|
|
||||||
const flickerItems = (items: any[]) => {
|
const flickerItems = (items: any[]) => {
|
||||||
delData();
|
delData()
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
zjObj.value.forEach((item2: any) => {
|
zjObj.value.forEach((item2: any) => {
|
||||||
if (item.name === item2.name) {
|
if (item.name === item2.name) {
|
||||||
item.flicker = true;
|
item.flicker = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
item.flicker = false;
|
item.flicker = false
|
||||||
}, 3000);
|
}, 3000)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
startMusic(
|
startMusic('https://files.wanzhuanyongcheng.com/file/music/yaotouzi/bg.MP3', true)
|
||||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/bg.MP3",
|
}
|
||||||
true
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const innerAudioContext = Taro.createInnerAudioContext();
|
const innerAudioContext = Taro.createInnerAudioContext()
|
||||||
|
|
||||||
const startMusic = (path: string, loop: boolean = false) => {
|
const startMusic = (path: string, loop: boolean = false) => {
|
||||||
// const innerAudioContext = Taro.createInnerAudioContext()
|
// const innerAudioContext = Taro.createInnerAudioContext()
|
||||||
innerAudioContext.autoplay = true;
|
innerAudioContext.autoplay = true
|
||||||
innerAudioContext.src = path;
|
innerAudioContext.src = path
|
||||||
innerAudioContext.loop = loop;
|
innerAudioContext.loop = loop
|
||||||
innerAudioContext.onPlay();
|
innerAudioContext.onPlay()
|
||||||
innerAudioContext.onError();
|
innerAudioContext.onError()
|
||||||
};
|
}
|
||||||
|
|
||||||
const clearOneBet = (item: Odd) => {
|
const clearOneBet = (item: Odd) => {
|
||||||
item.markNum = 0;
|
item.markNum = 0
|
||||||
item.numStr = 0;
|
item.numStr = 0
|
||||||
item.status = false;
|
item.status = false
|
||||||
savsData();
|
savsData()
|
||||||
};
|
}
|
||||||
|
|
||||||
const savsData = () => {
|
const savsData = () => {
|
||||||
Taro.setStorageSync("odds", odds.value);
|
Taro.setStorageSync('odds', odds.value)
|
||||||
Taro.setStorageSync("odds1", odds1.value);
|
Taro.setStorageSync('odds1', odds1.value)
|
||||||
Taro.setStorageSync("odds2", odds2.value);
|
Taro.setStorageSync('odds2', odds2.value)
|
||||||
};
|
}
|
||||||
|
|
||||||
const delData = () => {
|
const delData = () => {
|
||||||
Taro.removeStorageSync("odds");
|
Taro.removeStorageSync('odds')
|
||||||
Taro.removeStorageSync("odds1");
|
Taro.removeStorageSync('odds1')
|
||||||
Taro.removeStorageSync("odds2");
|
Taro.removeStorageSync('odds2')
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "./index.scss";
|
@import './index.scss';
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarBackgroundColor: '#23684B',
|
navigationBarBackgroundColor: '#23684B',
|
||||||
enablePullDownRefresh: true
|
enablePullDownRefresh: true,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
<template v-if="typeNum === 1">
|
<template v-if="typeNum === 1">
|
||||||
<view class="card" v-for="(item,index) in list as any[]" :key="index">
|
<view class="card" v-for="(item,index) in list as any[]" :key="index">
|
||||||
<view>
|
<view>
|
||||||
<view
|
<view>
|
||||||
>第{{ item.Periods }}期开奖:
|
第{{ item.Periods }}期开奖:
|
||||||
<text
|
<text
|
||||||
v-for="(num, i) in item.Name"
|
v-for="(num, i) in item.Name"
|
||||||
:key="i"
|
:key="i"
|
||||||
:style="{
|
:style="{
|
||||||
color: numColor(num),
|
color: numColor(num),
|
||||||
}"
|
}"
|
||||||
>{{ num }},
|
>
|
||||||
|
{{ num }},
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -19,24 +20,20 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view v-if="list.length > 0">
|
<view v-if="list.length > 0">
|
||||||
<view
|
<view class="card desc" v-for="(item,index) in list as any[]" :key="index">
|
||||||
class="card desc"
|
|
||||||
v-for="(item,index) in list as any[]"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view>
|
<view>
|
||||||
<view>第{{ item.Periods }}期投注:</view>
|
<view>第{{ item.Periods }}期投注:</view>
|
||||||
<view
|
<view>
|
||||||
>点数:<text style="color: red">{{ item.Name }}</text></view
|
点数:
|
||||||
>
|
<text style="color: red">{{ item.Name }}</text>
|
||||||
<view class="sub"
|
</view>
|
||||||
>投注时间:<text>{{ item.DrawTime }}</text></view
|
<view class="sub">
|
||||||
>
|
投注时间:
|
||||||
|
<text>{{ item.DrawTime }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align: right">
|
<view style="text-align: right">
|
||||||
<view style="color: red"
|
<view style="color: red">+{{ item.DrawNum }}积分</view>
|
||||||
>+{{ item.DrawNum }}积分</view
|
|
||||||
>
|
|
||||||
<view style="color: green">-{{ item.Number }}豆子</view>
|
<view style="color: green">-{{ item.Number }}豆子</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,59 +46,59 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
import { getKaiJiangList, getTzJl } from "@/api";
|
import { getKaiJiangList, getTzJl } from '@/api'
|
||||||
|
|
||||||
const list = ref<any[]>([]);
|
const list = ref<any[]>([])
|
||||||
|
|
||||||
const typeNum = ref(0);
|
const typeNum = ref(0)
|
||||||
|
|
||||||
Taro.useLoad((options) => {
|
Taro.useLoad((options) => {
|
||||||
typeNum.value = Number(options.type);
|
typeNum.value = Number(options.type)
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: options.type === "1" ? "开奖记录" : "投注记录",
|
title: options.type === '1' ? '开奖记录' : '投注记录',
|
||||||
});
|
})
|
||||||
getData();
|
getData()
|
||||||
});
|
})
|
||||||
|
|
||||||
Taro.usePullDownRefresh(() => {
|
Taro.usePullDownRefresh(() => {
|
||||||
getData();
|
getData()
|
||||||
});
|
})
|
||||||
|
|
||||||
const numColor = (num: string) => {
|
const numColor = (num: string) => {
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case "大":
|
case '大':
|
||||||
return "red";
|
return 'red'
|
||||||
case "小":
|
case '小':
|
||||||
return "green";
|
return 'green'
|
||||||
case "单":
|
case '单':
|
||||||
return "orange";
|
return 'orange'
|
||||||
case "双":
|
case '双':
|
||||||
return "blue";
|
return 'blue'
|
||||||
case "和":
|
case '和':
|
||||||
return "purple";
|
return 'purple'
|
||||||
default:
|
default:
|
||||||
return "black";
|
return 'black'
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
let res: any;
|
let res: any
|
||||||
if (typeNum.value === 1) {
|
if (typeNum.value === 1) {
|
||||||
res = await getKaiJiangList();
|
res = await getKaiJiangList()
|
||||||
list.value = res.data.data.map((item: any) => {
|
list.value = res.data.data.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
Name: item.Name.split("-"),
|
Name: item.Name.split('-'),
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
res = await getTzJl(Taro.getStorageSync("uid"));
|
res = await getTzJl(Taro.getStorageSync('uid'))
|
||||||
list.value = res.data.data || [];
|
list.value = res.data.data || []
|
||||||
}
|
}
|
||||||
Taro.stopPullDownRefresh();
|
Taro.stopPullDownRefresh()
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
vibrateShort: (Func: Function) =>
|
vibrateShort: (Func: Function) =>
|
||||||
Taro.vibrateShort({
|
Taro.vibrateShort({
|
||||||
type: "medium",
|
type: 'medium',
|
||||||
complete: () => {
|
complete: () => {
|
||||||
Func();
|
Func()
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import {app} from '@/config';
|
import { app } from '@/config'
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
export interface RequestParams {
|
export interface RequestParams {
|
||||||
url: string;
|
url: string
|
||||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE'
|
||||||
header?: object;
|
header?: object
|
||||||
data?: string | object;
|
data?: string | object
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = (request: RequestParams): Promise<any> => {
|
const request = (request: RequestParams): Promise<any> => {
|
||||||
@@ -21,15 +21,15 @@ const request = (request: RequestParams): Promise<any> => {
|
|||||||
header: request.header || {},
|
header: request.header || {},
|
||||||
data: request.data || {},
|
data: request.data || {},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
resolve(res.data);
|
resolve(res.data)
|
||||||
Taro.hideLoading();
|
Taro.hideLoading()
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
reject(err);
|
reject(err)
|
||||||
Taro.hideLoading();
|
Taro.hideLoading()
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
export default request;
|
export default request
|
||||||
|
|||||||
@@ -18,9 +18,7 @@
|
|||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"typeRoots": [
|
"typeRoots": ["node_modules/@types"],
|
||||||
"node_modules/@types"
|
|
||||||
],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"]
|
"@/*": ["src/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
22
types/global.d.ts
vendored
22
types/global.d.ts
vendored
@@ -1,20 +1,20 @@
|
|||||||
/// <reference types="@tarojs/taro" />
|
/// <reference types="@tarojs/taro" />
|
||||||
|
|
||||||
declare module '*.png';
|
declare module '*.png'
|
||||||
declare module '*.gif';
|
declare module '*.gif'
|
||||||
declare module '*.jpg';
|
declare module '*.jpg'
|
||||||
declare module '*.jpeg';
|
declare module '*.jpeg'
|
||||||
declare module '*.svg';
|
declare module '*.svg'
|
||||||
declare module '*.css';
|
declare module '*.css'
|
||||||
declare module '*.less';
|
declare module '*.less'
|
||||||
declare module '*.scss';
|
declare module '*.scss'
|
||||||
declare module '*.sass';
|
declare module '*.sass'
|
||||||
declare module '*.styl';
|
declare module '*.styl'
|
||||||
|
|
||||||
declare namespace NodeJS {
|
declare namespace NodeJS {
|
||||||
interface ProcessEnv {
|
interface ProcessEnv {
|
||||||
/** NODE 内置环境变量, 会影响到最终构建生成产物 */
|
/** NODE 内置环境变量, 会影响到最终构建生成产物 */
|
||||||
NODE_ENV: 'development' | 'production',
|
NODE_ENV: 'development' | 'production'
|
||||||
/** 当前构建的平台 */
|
/** 当前构建的平台 */
|
||||||
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd'
|
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd'
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user