diff --git a/App.vue b/App.vue index 8c2b732..d9d2e01 100644 --- a/App.vue +++ b/App.vue @@ -1,17 +1,19 @@ diff --git a/config.js b/config.js index 5806535..f8146b8 100644 --- a/config.js +++ b/config.js @@ -1,11 +1,29 @@ const config = { - baseUrl: 'http://127.0.0.1:8503', + baseUrl: getBaseUrl(), api: { login: '/gw/login', - getQuestion: '/user/get_question', - answerQuestion: '/user/answer_question' + getQuestion: '/qgdzs/get_question', + answerQuestion: '/qgdzs/answer_question', + getAllCategory: '/qgdzs/get_all_category' }, timeout: 30000 } +function getBaseUrl() { + var baseUrl = 'http://127.0.0.1:8503' + //#ifdef MP-WEIXIN + const accountInfo = uni.getAccountInfoSync(); + if (accountInfo.miniProgram.envVersion == 'develop') { + baseUrl = 'http://127.0.0.1:8503' + } + if (accountInfo.miniProgram.envVersion == 'trial') { + baseUrl = 'https://www.hlsq.asia/api' + } + if (accountInfo.miniProgram.envVersion == 'release') { + baseUrl = 'https://www.hlsq.asia/api' + } + //#endif + return baseUrl +} + export default config diff --git a/convert.js b/convert.js new file mode 100644 index 0000000..68e4624 --- /dev/null +++ b/convert.js @@ -0,0 +1,35 @@ +const sharp = require('sharp'); +const fs = require('fs'); +const path = require('path'); + +const icons = [ + { svg: 'static/tab-home.svg', png: 'static/tab-home.png' }, + { svg: 'static/tab-home-active.svg', png: 'static/tab-home-active.png' }, + { svg: 'static/tab-game.svg', png: 'static/tab-game.png' }, + { svg: 'static/tab-game-active.svg', png: 'static/tab-game-active.png' }, + { svg: 'static/tab-mine.svg', png: 'static/tab-mine.png' }, + { svg: 'static/tab-mine-active.svg', png: 'static/tab-mine-active.png' } +]; + +async function convertSvgToPng() { + console.log('开始转换SVG到PNG...'); + + for (const icon of icons) { + try { + const svgBuffer = fs.readFileSync(icon.svg); + + await sharp(svgBuffer) + .resize(81, 81) + .png() + .toFile(icon.png); + + console.log(`✓ ${icon.svg} -> ${icon.png}`); + } catch (error) { + console.error(`✗ 转换失败: ${icon.svg}`, error.message); + } + } + + console.log('转换完成!'); +} + +convertSvgToPng().catch(console.error); diff --git a/manifest.json b/manifest.json index 4aff211..7261f00 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { - "name" : "qgdzs", - "appid" : "", + "name" : "卷王大乱斗", + "appid" : "__UNI__3947B70", "description" : "", - "versionName" : "1.0.0", - "versionCode" : "100", + "versionName" : "1.0.7", + "versionCode" : 107, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -50,7 +50,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "", + "appid" : "wx1b6ea981a8bafd4e", "setting" : { "urlCheck" : false }, diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3e87209 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,509 @@ +{ + "name": "svg-to-png", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "svg-to-png", + "version": "1.0.0", + "dependencies": { + "sharp": "^0.33.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.8.1", + "resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.8.1.tgz", + "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-arrayish": { + "version": "0.3.4", + "resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.4.tgz", + "integrity": "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.5", + "@img/sharp-darwin-x64": "0.33.5", + "@img/sharp-libvips-darwin-arm64": "1.0.4", + "@img/sharp-libvips-darwin-x64": "1.0.4", + "@img/sharp-libvips-linux-arm": "1.0.5", + "@img/sharp-libvips-linux-arm64": "1.0.4", + "@img/sharp-libvips-linux-s390x": "1.0.4", + "@img/sharp-libvips-linux-x64": "1.0.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", + "@img/sharp-libvips-linuxmusl-x64": "1.0.4", + "@img/sharp-linux-arm": "0.33.5", + "@img/sharp-linux-arm64": "0.33.5", + "@img/sharp-linux-s390x": "0.33.5", + "@img/sharp-linux-x64": "0.33.5", + "@img/sharp-linuxmusl-arm64": "0.33.5", + "@img/sharp-linuxmusl-x64": "0.33.5", + "@img/sharp-wasm32": "0.33.5", + "@img/sharp-win32-ia32": "0.33.5", + "@img/sharp-win32-x64": "0.33.5" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.4.tgz", + "integrity": "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD", + "optional": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..cd1e5ad --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "name": "svg-to-png", + "version": "1.0.0", + "dependencies": { + "sharp": "^0.33.0" + } +} diff --git a/pages.json b/pages.json index 10beca0..397d3c5 100644 --- a/pages.json +++ b/pages.json @@ -18,31 +18,67 @@ "navigationBarTitleText": "登录", "navigationStyle": "custom" } + }, + { + "path": "pages/gameplay/gameplay", + "style": { + "navigationBarTitleText": "玩法选择" + } + }, + { + "path": "pages/random/random", + "style": { + "navigationBarTitleText": "随机答题" + } + }, + { + "path": "pages/category/category", + "style": { + "navigationBarTitleText": "类目答题" + } + }, + { + "path": "pages/category-question/category-question", + "style": { + "navigationBarTitleText": "类目题目" + } + }, + { + "path": "pages/quick/quick", + "style": { + "navigationBarTitleText": "快速答题" + } } ], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "qgdzs", "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" + "backgroundColor": "#f0f0f0" }, "tabBar": { "color": "#7A7E83", "selectedColor": "#667eea", "borderStyle": "black", - "backgroundColor": "#ffffff", - "fontSize": "14px", + "backgroundColor": "#f5f5f5", + "fontSize": "15px", "list": [ { "pagePath": "pages/index/index", - "iconPath": "", - "selectedIconPath": "", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-active.png", "text": "首页" }, + { + "pagePath": "pages/gameplay/gameplay", + "iconPath": "static/tab-game.png", + "selectedIconPath": "static/tab-game-active.png", + "text": "玩法选择" + }, { "pagePath": "pages/mine/mine", - "iconPath": "", - "selectedIconPath": "", + "iconPath": "static/tab-mine.png", + "selectedIconPath": "static/tab-mine-active.png", "text": "我的" } ] diff --git a/pages/category-question/category-question.vue b/pages/category-question/category-question.vue new file mode 100644 index 0000000..89afcfb --- /dev/null +++ b/pages/category-question/category-question.vue @@ -0,0 +1,373 @@ + + + + + diff --git a/pages/category/category.vue b/pages/category/category.vue new file mode 100644 index 0000000..f320e87 --- /dev/null +++ b/pages/category/category.vue @@ -0,0 +1,162 @@ + + + + + diff --git a/pages/gameplay/gameplay.vue b/pages/gameplay/gameplay.vue new file mode 100644 index 0000000..a3c1e79 --- /dev/null +++ b/pages/gameplay/gameplay.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index 0f7cd54..f4ebeb3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,147 +1,74 @@ + + diff --git a/pages/random/random.vue b/pages/random/random.vue new file mode 100644 index 0000000..2b9b7dc --- /dev/null +++ b/pages/random/random.vue @@ -0,0 +1,368 @@ + + + + + diff --git a/static/tab-game-active.png b/static/tab-game-active.png new file mode 100644 index 0000000..8c89eb8 Binary files /dev/null and b/static/tab-game-active.png differ diff --git a/static/tab-game-active.svg b/static/tab-game-active.svg new file mode 100644 index 0000000..58e04b4 --- /dev/null +++ b/static/tab-game-active.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/tab-game.png b/static/tab-game.png new file mode 100644 index 0000000..45abbe5 Binary files /dev/null and b/static/tab-game.png differ diff --git a/static/tab-game.svg b/static/tab-game.svg new file mode 100644 index 0000000..170b540 --- /dev/null +++ b/static/tab-game.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/static/tab-home-active.png b/static/tab-home-active.png new file mode 100644 index 0000000..e7f3982 Binary files /dev/null and b/static/tab-home-active.png differ diff --git a/static/tab-home-active.svg b/static/tab-home-active.svg new file mode 100644 index 0000000..a017d6c --- /dev/null +++ b/static/tab-home-active.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/static/tab-home.png b/static/tab-home.png new file mode 100644 index 0000000..debac22 Binary files /dev/null and b/static/tab-home.png differ diff --git a/static/tab-home.svg b/static/tab-home.svg new file mode 100644 index 0000000..0b181a4 --- /dev/null +++ b/static/tab-home.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/static/tab-mine-active.png b/static/tab-mine-active.png new file mode 100644 index 0000000..f8e50d9 Binary files /dev/null and b/static/tab-mine-active.png differ diff --git a/static/tab-mine-active.svg b/static/tab-mine-active.svg new file mode 100644 index 0000000..8ac09a5 --- /dev/null +++ b/static/tab-mine-active.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/static/tab-mine.png b/static/tab-mine.png new file mode 100644 index 0000000..e3d7de5 Binary files /dev/null and b/static/tab-mine.png differ diff --git a/static/tab-mine.svg b/static/tab-mine.svg new file mode 100644 index 0000000..09c270e --- /dev/null +++ b/static/tab-mine.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/utils/api.js b/utils/api.js index b8d79b3..6d84dcb 100644 --- a/utils/api.js +++ b/utils/api.js @@ -1,50 +1,75 @@ import config from '../config.js' -import storage from './storage.js' const request = (options) => { return new Promise((resolve, reject) => { + const fullUrl = config.baseUrl + options.url + console.log('=== 请求开始 ===') + console.log('URL:', fullUrl) + console.log('Method:', options.method || 'GET') + console.log('Data:', options.data) + uni.request({ - url: config.baseUrl + options.url, + url: fullUrl, method: options.method || 'GET', data: options.data || {}, header: { 'Content-Type': 'application/json', - 'Authorization': storage.getToken() ? `Bearer ${storage.getToken()}` : '', ...options.header }, timeout: config.timeout, success: (res) => { + console.log('=== 请求成功 ===') + console.log('StatusCode:', res.statusCode) + console.log('Response:', res.data) + const { statusCode, data } = res if (statusCode === 200) { if (data.code === 0 || data.success === true) { resolve(data) } else { - uni.showToast({ - title: data.message || '请求失败', - icon: 'none' + console.error('=== 业务错误 ===') + console.error('Code:', data.code) + console.error('Message:', data.message) + uni.showModal({ + title: '请求失败', + content: data.message || '服务器返回错误', + showCancel: false }) reject(data) } - } else if (statusCode === 401) { - storage.removeToken() - storage.removeUserInfo() - uni.reLaunch({ - url: '/pages/login/login' - }) - reject(res) } else { - uni.showToast({ + console.error('=== HTTP错误 ===') + console.error('StatusCode:', statusCode) + console.error('Response:', data) + uni.showModal({ title: '网络错误', - icon: 'none' + content: `状态码: ${statusCode}`, + showCancel: false }) reject(res) } }, fail: (err) => { - uni.showToast({ - title: '网络连接失败', - icon: 'none' + console.error('=== 请求失败 ===') + console.error('Error:', err) + console.error('Error Message:', err.errMsg) + + let errorMsg = '网络连接失败' + if (err.errMsg) { + if (err.errMsg.includes('timeout')) { + errorMsg = '请求超时,请检查网络' + } else if (err.errMsg.includes('fail')) { + errorMsg = '网络连接失败,请检查网络设置' + } else if (err.errMsg.includes('request:fail')) { + errorMsg = `连接失败: ${err.errMsg}` + } + } + + uni.showModal({ + title: '错误', + content: errorMsg, + showCancel: false }) reject(err) } @@ -53,21 +78,21 @@ const request = (options) => { } const api = { - login(phone, code) { + wxLogin(code) { return request({ url: config.api.login, method: 'POST', data: { - phone, - code + wxMiniCode: code } }) }, - getQuestion() { + getQuestion(categorySn) { return request({ url: config.api.getQuestion, - method: 'POST' + method: 'POST', + data: categorySn ? { category_sn: categorySn } : {} }) }, @@ -82,6 +107,13 @@ const api = { }) }, + getAllCategory() { + return request({ + url: config.api.getAllCategory, + method: 'POST' + }) + }, + get(url, data = {}) { return request({ url,