diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..d23208f
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jsLinters/eslint.xml b/.idea/jsLinters/eslint.xml
new file mode 100644
index 0000000..2ece342
--- /dev/null
+++ b/.idea/jsLinters/eslint.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components.d.ts b/components.d.ts
index 59fdbea..6df8adc 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -14,17 +14,20 @@ declare module '@vue/runtime-core' {
NutCellGroup: typeof import('@nutui/nutui-taro')['CellGroup']
NutCheckbox: typeof import('@nutui/nutui-taro')['Checkbox']
NutDialog: typeof import('@nutui/nutui-taro')['Dialog']
+ NutEllipsis: typeof import('@nutui/nutui-taro')['Ellipsis']
NutEmpty: typeof import('@nutui/nutui-taro')['Empty']
NutForm: typeof import('@nutui/nutui-taro')['Form']
NutFormItem: typeof import('@nutui/nutui-taro')['FormItem']
NutGrid: typeof import('@nutui/nutui-taro')['Grid']
NutGridItem: typeof import('@nutui/nutui-taro')['GridItem']
NutInput: typeof import('@nutui/nutui-taro')['Input']
+ NutInputNumber: typeof import('@nutui/nutui-taro')['InputNumber']
NutOverlay: typeof import('@nutui/nutui-taro')['Overlay']
NutPicker: typeof import('@nutui/nutui-taro')['Picker']
NutPopup: typeof import('@nutui/nutui-taro')['Popup']
NutPrice: typeof import('@nutui/nutui-taro')['Price']
NutSearchbar: typeof import('@nutui/nutui-taro')['Searchbar']
+ NutSwipe: typeof import('@nutui/nutui-taro')['Swipe']
NutSwiper: typeof import('@nutui/nutui-taro')['Swiper']
NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem']
NutTabPane: typeof import('@nutui/nutui-taro')['TabPane']
diff --git a/config/dev.ts b/config/dev.ts
index 6821bf8..bb82ddc 100644
--- a/config/dev.ts
+++ b/config/dev.ts
@@ -1,9 +1,10 @@
+// @ts-nocheck
+
module.exports = {
- env: {
- NODE_ENV: '"development"'
- },
- defineConstants: {
- },
- mini: {},
- h5: {}
+ env: {
+ NODE_ENV: '"development"'
+ },
+ defineConstants: {},
+ mini: {},
+ h5: {}
}
diff --git a/config/index.ts b/config/index.ts
index 14897e2..f2dc3d4 100644
--- a/config/index.ts
+++ b/config/index.ts
@@ -1,101 +1,105 @@
-import Components from 'unplugin-vue-components/webpack';
-import NutUIResolver from '@nutui/nutui-taro/dist/resolver';
+// @ts-nocheck
+import Components from 'unplugin-vue-components/webpack'
+import NutUIResolver from '@nutui/nutui-taro/dist/resolver'
+import { join } from 'node:path'
const config = {
- projectName: 'taroApp',
- date: '2023-8-13',
- designWidth (input: { file: string; }) {
- if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
- return 375
- }
- return 750
- },
- deviceRatio: {
- 640: 2.34 / 2,
- 750: 1,
- 828: 1.81 / 2,
- 375: 2
- },
- sourceRoot: 'src',
- outputRoot: 'dist',
- plugins: ['@tarojs/plugin-html'],
- defineConstants: {
- },
- copy: {
- patterns: [
- ],
- options: {
- }
- },
- framework: 'vue3',
- compiler: {
- type: 'webpack5',
- prebundle: { enable: false }
- },
- cache: {
- enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
- },
- sass:{
- data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`
- },
- mini: {
- webpackChain(chain) {
- chain.plugin('unplugin-vue-components').use(Components({
- resolvers: [NutUIResolver({taro: true})]
- }))
+ projectName: 'taroApp',
+ date: '2023-8-13',
+ designWidth(input: { file: string; }) {
+ if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
+ return 375
+ }
+ return 750
},
- postcss: {
- pxtransform: {
- enable: true,
- config: {
- // selectorBlackList: ['nut-']
- }
- },
- url: {
- enable: true,
- config: {
- limit: 1024 // 设定转换尺寸上限
- }
- },
- cssModules: {
- enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
- config: {
- namingPattern: 'module', // 转换模式,取值为 global/module
- generateScopedName: '[name]__[local]___[hash:base64:5]'
- }
- }
- }
- },
- h5: {
- webpackChain(chain) {
- chain.plugin('unplugin-vue-components').use(Components({
- resolvers: [NutUIResolver({taro: true})]
- }))
+ deviceRatio: {
+ 640: 2.34 / 2,
+ 750: 1,
+ 828: 1.81 / 2,
+ 375: 2
},
- publicPath: '/',
- staticDirectory: 'static',
- esnextModules: ['nutui-taro', 'icons-vue-taro'],
- postcss: {
- autoprefixer: {
- enable: true,
- config: {
-
+ sourceRoot: 'src',
+ outputRoot: 'dist',
+ plugins: ['@tarojs/plugin-html'],
+ defineConstants: {},
+ copy: {
+ patterns: [],
+ options: {}
+ },
+ framework: 'vue3',
+ compiler: {
+ type: 'webpack5',
+ prebundle: {enable: false}
+ },
+ cache: {
+ enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
+ },
+ sass: {
+ data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`
+ },
+ alias: {
+ '@': join(__dirname, '..', 'src')
+ },
+ mini: {
+ webpackChain(chain) {
+ chain.plugin('unplugin-vue-components').use(Components({
+ resolvers: [NutUIResolver({taro: true})]
+ }))
+ },
+ miniCssExtractPluginOption: {
+ //忽略css文件引入顺序
+ ignoreOrder: true
+ },
+ postcss: {
+ pxtransform: {
+ enable: true,
+ config: {
+ // selectorBlackList: ['nut-']
+ }
+ },
+ url: {
+ enable: true,
+ config: {
+ limit: 1024 // 设定转换尺寸上限
+ }
+ },
+ cssModules: {
+ enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
+ config: {
+ namingPattern: 'module', // 转换模式,取值为 global/module
+ generateScopedName: '[name]__[local]___[hash:base64:5]'
+ }
+ }
}
- },
- cssModules: {
- enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
- config: {
- namingPattern: 'module', // 转换模式,取值为 global/module
- generateScopedName: '[name]__[local]___[hash:base64:5]'
+ },
+ h5: {
+ webpackChain(chain) {
+ chain.plugin('unplugin-vue-components').use(Components({
+ resolvers: [NutUIResolver({taro: true})]
+ }))
+ },
+ publicPath: '/',
+ staticDirectory: 'static',
+ esnextModules: ['nutui-taro', 'icons-vue-taro'],
+ postcss: {
+ autoprefixer: {
+ enable: true,
+ config: {}
+ },
+ cssModules: {
+ enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
+ config: {
+ namingPattern: 'module', // 转换模式,取值为 global/module
+ generateScopedName: '[name]__[local]___[hash:base64:5]'
+ }
+ }
}
- }
}
- }
}
module.exports = function (merge) {
- if (process.env.NODE_ENV === 'development') {
- return merge({}, config, require('./dev'))
- }
- return merge({}, config, require('./prod'))
+ if (process.env.NODE_ENV === 'development') {
+ return merge({}, config, require('./dev'))
+ }
+ return merge({}, config, require('./prod'))
}
diff --git a/config/prod.ts b/config/prod.ts
index e148666..1dd81ba 100644
--- a/config/prod.ts
+++ b/config/prod.ts
@@ -1,37 +1,38 @@
-module.exports = {
- env: {
- NODE_ENV: '"production"'
- },
- defineConstants: {
- },
- mini: {},
- h5: {
- /**
- * WebpackChain 插件配置
- * @docs https://github.com/neutrinojs/webpack-chain
- */
- // webpackChain (chain) {
- // /**
- // * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
- // * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
- // */
- // chain.plugin('analyzer')
- // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
+// @ts-nocheck
- // /**
- // * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
- // * @docs https://github.com/chrisvfritz/prerender-spa-plugin
- // */
- // const path = require('path')
- // const Prerender = require('prerender-spa-plugin')
- // const staticDir = path.join(__dirname, '..', 'dist')
- // chain
- // .plugin('prerender')
- // .use(new Prerender({
- // staticDir,
- // routes: [ '/pages/index/index' ],
- // postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
- // }))
- // }
- }
+module.exports = {
+ env: {
+ NODE_ENV: '"production"'
+ },
+ defineConstants: {},
+ mini: {},
+ h5: {
+ /**
+ * WebpackChain 插件配置
+ * @docs https://github.com/neutrinojs/webpack-chain
+ */
+ // webpackChain (chain) {
+ // /**
+ // * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
+ // * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
+ // */
+ // chain.plugin('analyzer')
+ // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
+
+ // /**
+ // * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
+ // * @docs https://github.com/chrisvfritz/prerender-spa-plugin
+ // */
+ // const path = require('path')
+ // const Prerender = require('prerender-spa-plugin')
+ // const staticDir = path.join(__dirname, '..', 'dist')
+ // chain
+ // .plugin('prerender')
+ // .use(new Prerender({
+ // staticDir,
+ // routes: [ '/pages/index/index' ],
+ // postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
+ // }))
+ // }
+ }
}
diff --git a/package.json b/package.json
index 4240467..39ba72b 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"build:qq": "taro build --type qq",
"build:jd": "taro build --type jd",
"build:quickapp": "taro build --type quickapp",
- "dev:weapp": "taro build --type weapp --watch",
+ "dev:weapp": "set NODE_ENV=production && taro build --type weapp --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch",
@@ -53,6 +53,7 @@
"@tarojs/shared": "3.6.11",
"@tarojs/taro": "3.6.11",
"pinia": "^2.1.6",
+ "uqrcodejs": "^4.0.7",
"vue": "^3.2.40"
},
"devDependencies": {
@@ -62,15 +63,15 @@
"@tarojs/webpack5-runner": "3.6.11",
"@types/node": "^18.15.11",
"@types/webpack-env": "^1.13.6",
- "@typescript-eslint/eslint-plugin": "^5.20.0",
- "@typescript-eslint/parser": "^5.20.0",
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
+ "@typescript-eslint/parser": "^6.4.0",
"@vue/babel-plugin-jsx": "^1.0.6",
"@vue/compiler-sfc": "^3.2.40",
"babel-preset-taro": "3.6.11",
"css-loader": "3.4.2",
"eslint": "^8.12.0",
"eslint-config-taro": "3.6.11",
- "eslint-plugin-vue": "^8.0.0",
+ "eslint-plugin-vue": "^9.17.0",
"style-loader": "1.3.0",
"stylelint": "9.3.0",
"ts-node": "^10.9.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index cd820ac..f022802 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -59,6 +59,9 @@ dependencies:
pinia:
specifier: ^2.1.6
version: 2.1.6(typescript@4.1.2)(vue@3.2.40)
+ uqrcodejs:
+ specifier: ^4.0.7
+ version: 4.0.7
vue:
specifier: ^3.2.40
version: 3.2.40
@@ -83,11 +86,11 @@ devDependencies:
specifier: ^1.13.6
version: 1.13.6
'@typescript-eslint/eslint-plugin':
- specifier: ^5.20.0
- version: 5.20.0(@typescript-eslint/parser@5.20.0)(eslint@8.12.0)(typescript@4.1.2)
+ specifier: ^6.4.0
+ version: 6.4.0(@typescript-eslint/parser@6.4.0)(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/parser':
- specifier: ^5.20.0
- version: 5.20.0(eslint@8.12.0)(typescript@4.1.2)
+ specifier: ^6.4.0
+ version: 6.4.0(eslint@8.12.0)(typescript@4.1.2)
'@vue/babel-plugin-jsx':
specifier: ^1.0.6
version: 1.0.6(@babel/core@7.8.0)
@@ -107,17 +110,14 @@ devDependencies:
specifier: 3.6.11
version: 3.6.11(@babel/core@7.8.0)(eslint@8.12.0)(typescript@4.1.2)
eslint-plugin-vue:
- specifier: ^8.0.0
- version: 8.0.0(eslint@8.12.0)
+ specifier: ^9.17.0
+ version: 9.17.0(eslint@8.12.0)
style-loader:
specifier: 1.3.0
version: 1.3.0(webpack@5.78.0)
stylelint:
specifier: 9.3.0
version: 9.3.0
- taro-plugin-pinia:
- specifier: ^1.0.0
- version: 1.0.0
ts-node:
specifier: ^10.9.1
version: 10.9.1(@swc/core@1.3.23)(@types/node@18.15.11)(typescript@4.1.2)
@@ -2588,6 +2588,16 @@ packages:
requiresBuild: true
optional: true
+ /@eslint-community/eslint-utils@4.4.0(eslint@8.12.0):
+ resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ peerDependencies:
+ eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
+ dependencies:
+ eslint: 8.12.0
+ eslint-visitor-keys: 3.4.3
+ dev: true
+
/@eslint-community/eslint-utils@4.4.0(eslint@8.41.0):
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -4023,6 +4033,10 @@ packages:
dependencies:
sass: 1.50.0
+ /@types/semver@7.5.0:
+ resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==}
+ dev: true
+
/@types/send@0.17.1:
resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==}
dependencies:
@@ -4071,28 +4085,30 @@ packages:
'@types/node': 18.15.11
dev: true
- /@typescript-eslint/eslint-plugin@5.20.0(@typescript-eslint/parser@5.20.0)(eslint@8.12.0)(typescript@4.1.2):
- resolution: {integrity: sha512-fapGzoxilCn3sBtC6NtXZX6+P/Hef7VDbyfGqTTpzYydwhlkevB+0vE0EnmHPVTVSy68GUncyJ/2PcrFBeCo5Q==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ /@typescript-eslint/eslint-plugin@6.4.0(@typescript-eslint/parser@6.4.0)(eslint@8.12.0)(typescript@4.1.2):
+ resolution: {integrity: sha512-62o2Hmc7Gs3p8SLfbXcipjWAa6qk2wZGChXG2JbBtYpwSRmti/9KHLqfbLs9uDigOexG+3PaQ9G2g3201FWLKg==}
+ engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
- '@typescript-eslint/parser': ^5.0.0
- eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
+ '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha
+ eslint: ^7.0.0 || ^8.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
- '@typescript-eslint/parser': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
- '@typescript-eslint/scope-manager': 5.20.0
- '@typescript-eslint/type-utils': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
- '@typescript-eslint/utils': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
+ '@eslint-community/regexpp': 4.6.2
+ '@typescript-eslint/parser': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
+ '@typescript-eslint/scope-manager': 6.4.0
+ '@typescript-eslint/type-utils': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
+ '@typescript-eslint/utils': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
+ '@typescript-eslint/visitor-keys': 6.4.0
debug: 4.3.4
eslint: 8.12.0
- functional-red-black-tree: 1.0.1
+ graphemer: 1.4.0
ignore: 5.2.4
- regexpp: 3.2.0
+ natural-compare: 1.4.0
semver: 7.5.4
- tsutils: 3.21.0(typescript@4.1.2)
+ ts-api-utils: 1.0.1(typescript@4.1.2)
typescript: 4.1.2
transitivePeerDependencies:
- supports-color
@@ -4118,6 +4134,27 @@ packages:
- supports-color
dev: true
+ /@typescript-eslint/parser@6.4.0(eslint@8.12.0)(typescript@4.1.2):
+ resolution: {integrity: sha512-I1Ah1irl033uxjxO9Xql7+biL3YD7w9IU8zF+xlzD/YxY6a4b7DYA08PXUUCbm2sEljwJF6ERFy2kTGAGcNilg==}
+ engines: {node: ^16.0.0 || >=18.0.0}
+ peerDependencies:
+ eslint: ^7.0.0 || ^8.0.0
+ typescript: '*'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+ dependencies:
+ '@typescript-eslint/scope-manager': 6.4.0
+ '@typescript-eslint/types': 6.4.0
+ '@typescript-eslint/typescript-estree': 6.4.0(typescript@4.1.2)
+ '@typescript-eslint/visitor-keys': 6.4.0
+ debug: 4.3.4
+ eslint: 8.12.0
+ typescript: 4.1.2
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
/@typescript-eslint/scope-manager@5.20.0:
resolution: {integrity: sha512-h9KtuPZ4D/JuX7rpp1iKg3zOH0WNEa+ZIXwpW/KWmEFDxlA/HSfCMhiyF1HS/drTICjIbpA6OqkAhrP/zkCStg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -4126,20 +4163,29 @@ packages:
'@typescript-eslint/visitor-keys': 5.20.0
dev: true
- /@typescript-eslint/type-utils@5.20.0(eslint@8.12.0)(typescript@4.1.2):
- resolution: {integrity: sha512-WxNrCwYB3N/m8ceyoGCgbLmuZwupvzN0rE8NBuwnl7APgjv24ZJIjkNzoFBXPRCGzLNkoU/WfanW0exvp/+3Iw==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ /@typescript-eslint/scope-manager@6.4.0:
+ resolution: {integrity: sha512-TUS7vaKkPWDVvl7GDNHFQMsMruD+zhkd3SdVW0d7b+7Zo+bd/hXJQ8nsiUZMi1jloWo6c9qt3B7Sqo+flC1nig==}
+ engines: {node: ^16.0.0 || >=18.0.0}
+ dependencies:
+ '@typescript-eslint/types': 6.4.0
+ '@typescript-eslint/visitor-keys': 6.4.0
+ dev: true
+
+ /@typescript-eslint/type-utils@6.4.0(eslint@8.12.0)(typescript@4.1.2):
+ resolution: {integrity: sha512-TvqrUFFyGY0cX3WgDHcdl2/mMCWCDv/0thTtx/ODMY1QhEiyFtv/OlLaNIiYLwRpAxAtOLOY9SUf1H3Q3dlwAg==}
+ engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
- eslint: '*'
+ eslint: ^7.0.0 || ^8.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
- '@typescript-eslint/utils': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
+ '@typescript-eslint/typescript-estree': 6.4.0(typescript@4.1.2)
+ '@typescript-eslint/utils': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
debug: 4.3.4
eslint: 8.12.0
- tsutils: 3.21.0(typescript@4.1.2)
+ ts-api-utils: 1.0.1(typescript@4.1.2)
typescript: 4.1.2
transitivePeerDependencies:
- supports-color
@@ -4150,6 +4196,11 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
+ /@typescript-eslint/types@6.4.0:
+ resolution: {integrity: sha512-+FV9kVFrS7w78YtzkIsNSoYsnOtrYVnKWSTVXoL1761CsCRv5wpDOINgsXpxD67YCLZtVQekDDyaxfjVWUJmmg==}
+ engines: {node: ^16.0.0 || >=18.0.0}
+ dev: true
+
/@typescript-eslint/typescript-estree@5.20.0(typescript@4.1.2):
resolution: {integrity: sha512-36xLjP/+bXusLMrT9fMMYy1KJAGgHhlER2TqpUVDYUQg4w0q/NW/sg4UGAgVwAqb8V4zYg43KMUpM8vV2lve6w==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -4171,19 +4222,41 @@ packages:
- supports-color
dev: true
- /@typescript-eslint/utils@5.20.0(eslint@8.12.0)(typescript@4.1.2):
- resolution: {integrity: sha512-lHONGJL1LIO12Ujyx8L8xKbwWSkoUKFSO+0wDAqGXiudWB2EO7WEUT+YZLtVbmOmSllAjLb9tpoIPwpRe5Tn6w==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ /@typescript-eslint/typescript-estree@6.4.0(typescript@4.1.2):
+ resolution: {integrity: sha512-iDPJArf/K2sxvjOR6skeUCNgHR/tCQXBsa+ee1/clRKr3olZjZ/dSkXPZjG6YkPtnW6p5D1egeEPMCW6Gn4yLA==}
+ engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
- eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
+ typescript: '*'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
dependencies:
+ '@typescript-eslint/types': 6.4.0
+ '@typescript-eslint/visitor-keys': 6.4.0
+ debug: 4.3.4
+ globby: 11.1.0
+ is-glob: 4.0.3
+ semver: 7.5.4
+ ts-api-utils: 1.0.1(typescript@4.1.2)
+ typescript: 4.1.2
+ transitivePeerDependencies:
+ - supports-color
+ dev: true
+
+ /@typescript-eslint/utils@6.4.0(eslint@8.12.0)(typescript@4.1.2):
+ resolution: {integrity: sha512-BvvwryBQpECPGo8PwF/y/q+yacg8Hn/2XS+DqL/oRsOPK+RPt29h5Ui5dqOKHDlbXrAeHUTnyG3wZA0KTDxRZw==}
+ engines: {node: ^16.0.0 || >=18.0.0}
+ peerDependencies:
+ eslint: ^7.0.0 || ^8.0.0
+ dependencies:
+ '@eslint-community/eslint-utils': 4.4.0(eslint@8.12.0)
'@types/json-schema': 7.0.12
- '@typescript-eslint/scope-manager': 5.20.0
- '@typescript-eslint/types': 5.20.0
- '@typescript-eslint/typescript-estree': 5.20.0(typescript@4.1.2)
+ '@types/semver': 7.5.0
+ '@typescript-eslint/scope-manager': 6.4.0
+ '@typescript-eslint/types': 6.4.0
+ '@typescript-eslint/typescript-estree': 6.4.0(typescript@4.1.2)
eslint: 8.12.0
- eslint-scope: 5.1.1
- eslint-utils: 3.0.0(eslint@8.12.0)
+ semver: 7.5.4
transitivePeerDependencies:
- supports-color
- typescript
@@ -4197,6 +4270,14 @@ packages:
eslint-visitor-keys: 3.4.3
dev: true
+ /@typescript-eslint/visitor-keys@6.4.0:
+ resolution: {integrity: sha512-yJSfyT+uJm+JRDWYRYdCm2i+pmvXJSMtPR9Cq5/XQs4QIgNoLcoRtDdzsLbLsFM/c6um6ohQkg/MLxWvoIndJA==}
+ engines: {node: ^16.0.0 || >=18.0.0}
+ dependencies:
+ '@typescript-eslint/types': 6.4.0
+ eslint-visitor-keys: 3.4.3
+ dev: true
+
/@vue/babel-helper-vue-transform-on@1.1.5:
resolution: {integrity: sha512-SgUymFpMoAyWeYWLAY+MkCK3QEROsiUnfaw5zxOVD/M64KQs8D/4oK6Q5omVA2hnvEOE0SCkH2TZxs/jnnUj7w==}
dev: true
@@ -7136,17 +7217,20 @@ packages:
- typescript
dev: true
- /eslint-plugin-vue@8.0.0(eslint@8.12.0):
- resolution: {integrity: sha512-BhS+B4bHFXS4b3bwpfPIJXgvydgvw+2lsM7Ue2AA8BscBjCFT+PbsTAGqpOnc+k28AsM6S8oplqgu/R/5ISeag==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ /eslint-plugin-vue@9.17.0(eslint@8.12.0):
+ resolution: {integrity: sha512-r7Bp79pxQk9I5XDP0k2dpUC7Ots3OSWgvGZNu3BxmKK6Zg7NgVtcOB6OCna5Kb9oQwJPl5hq183WD0SY5tZtIQ==}
+ engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.2.0 || ^7.0.0 || ^8.0.0
dependencies:
+ '@eslint-community/eslint-utils': 4.4.0(eslint@8.12.0)
eslint: 8.12.0
- eslint-utils: 3.0.0(eslint@8.12.0)
natural-compare: 1.4.0
+ nth-check: 2.1.1
+ postcss-selector-parser: 6.0.13
semver: 7.5.4
- vue-eslint-parser: 8.3.0(eslint@8.12.0)
+ vue-eslint-parser: 9.3.1(eslint@8.12.0)
+ xml-name-validator: 4.0.0
transitivePeerDependencies:
- supports-color
dev: true
@@ -13149,10 +13233,6 @@ packages:
postcss-value-parser: 3.3.1
dev: true
- /taro-plugin-pinia@1.0.0:
- resolution: {integrity: sha512-Ip2LTRh7NGsFyEzkZWvU115xDqV3D8cRRbqqw0JKTvzHFBzpwycmrUVQQxV61AMg0r2RJm3mcEbQ997j7xNjtg==}
- dev: true
-
/terser-webpack-plugin@5.3.9(@swc/core@1.3.23)(esbuild@0.14.54)(webpack@5.78.0):
resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==}
engines: {node: '>= 10.13.0'}
@@ -13348,6 +13428,15 @@ packages:
resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==}
dev: true
+ /ts-api-utils@1.0.1(typescript@4.1.2):
+ resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==}
+ engines: {node: '>=16.13.0'}
+ peerDependencies:
+ typescript: '>=4.2.0'
+ dependencies:
+ typescript: 4.1.2
+ dev: true
+
/ts-node@10.9.1(@swc/core@1.3.23)(@types/node@18.15.11)(typescript@4.1.2):
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true
@@ -13720,6 +13809,10 @@ packages:
tslib: 2.6.1
dev: false
+ /uqrcodejs@4.0.7:
+ resolution: {integrity: sha512-84+aZmD2godCVI+93lxE3YUAPNY8zAJvNA7xRS7R7U+q57KzMDepBSfNCwoRUhWOfR6eHFoAOcHRPwsP6ka1cA==}
+ dev: false
+
/uri-js@4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
dependencies:
@@ -13898,9 +13991,9 @@ packages:
vue: 3.2.40
dev: false
- /vue-eslint-parser@8.3.0(eslint@8.12.0):
- resolution: {integrity: sha512-dzHGG3+sYwSf6zFBa0Gi9ZDshD7+ad14DGOdTLjruRVgZXe2J+DcZ9iUhyR48z5g1PqRa20yt3Njna/veLJL/g==}
- engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ /vue-eslint-parser@9.3.1(eslint@8.12.0):
+ resolution: {integrity: sha512-Clr85iD2XFZ3lJ52/ppmUDG/spxQu6+MAeHXjjyI4I1NUYZ9xmenQp4N0oaHJhrA8OOxltCVxMRfANGa70vU0g==}
+ engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '>=6.0.0'
dependencies:
diff --git a/src/api/admin.ts b/src/api/admin.ts
new file mode 100644
index 0000000..7bac9d8
--- /dev/null
+++ b/src/api/admin.ts
@@ -0,0 +1,4 @@
+import request from '../utils/request';
+
+// 订单核销
+export const orderVerify = (data: object) => request('/user/cancelPointOrder', data, 'POST');
diff --git a/src/api/goods.ts b/src/api/goods.ts
index e69de29..7e478ec 100644
--- a/src/api/goods.ts
+++ b/src/api/goods.ts
@@ -0,0 +1,19 @@
+import request from '@/utils/request'
+
+// 获取商品列表
+export const getGoodsList = () => request('/point/goods', {}, 'POST')
+
+// 添加购物车
+export const addCart = (data: object) => request('/user/addCart', data, 'POST')
+
+// 获取购物车列表
+export const getCartList = () => request('/user/cart', {}, 'POST')
+
+// 获取积分商品详情
+export const getGoodsDetail = (data: object) => request('/point/details', data, 'POST')
+
+// 积分商品下单
+export const createOrder = (data: object) => request('/point/place', data, 'POST')
+
+// 确认付款
+export const payJfOrder = (data: object) => request('/point/confirmOrder', data, 'POST')
\ No newline at end of file
diff --git a/src/api/order.ts b/src/api/order.ts
index e69de29..a3d529e 100644
--- a/src/api/order.ts
+++ b/src/api/order.ts
@@ -0,0 +1,4 @@
+import request from '@/utils/request'
+
+// 订单支付
+export const payOrder = (data: object) => request('/order/place', data, 'POST')
\ No newline at end of file
diff --git a/src/api/user.ts b/src/api/user.ts
index 91e5e7f..985f7be 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -1,4 +1,4 @@
-import { request } from "../utils/request";
+import request from "@/utils/request";
// 登录
export const login = (data: object) => request("/login", data, "POST");
@@ -6,5 +6,20 @@ export const login = (data: object) => request("/login", data, "POST");
// 获取用户信息
export const getUserInfo = () => request("/user/detail", {}, "GET");
-// 支付订单
-export const payOrder = (data: object) => request("/order/place", data, "POST");
+// 获取短信验证码
+export const getVerifyCode = (data: object) => request("/getSmsCode", data, "POST");
+
+// 商家入驻申请
+export const applyMer = (data: object) => request("/store/settle", data, "POST");
+
+// 获取商家类型列表
+export const getMerTypeList = () => request("/store/getOther", {},"POST");
+
+// 获取个人信息
+export const getPersonalInfo = () => request("/user/info", {}, "POST");
+
+// 获取轮播图
+export const getBanner = () => request("/rotation", {}, "POST");
+
+// 获取积分订单列表
+export const getIntegralOrderList = (data: object) => request("/user/pointOrder", data, "POST");
diff --git a/src/app.config.ts b/src/app.config.ts
index d523795..2147b0d 100644
--- a/src/app.config.ts
+++ b/src/app.config.ts
@@ -1,78 +1,86 @@
export default defineAppConfig({
pages: [
- "pages/index/index",
- "pages/category/index",
- "pages/cart/index",
- "pages/user/index",
+ 'pages/index/index',
+ 'pages/category/index',
+ 'pages/cart/index',
+ 'pages/user/index',
],
subPackages: [
{
- root: "pages/users",
+ root: 'pages/users',
pages: [
- "order_list/index",
- "setting/index",
- "user_setting/index",
- "settled_mer/index",
- "order_list_detail/index",
- ],
+ 'order_list/index',
+ 'setting/index',
+ 'user_setting/index',
+ 'settled_mer/index',
+ 'order_list_detail/index',
+ 'account/index'
+ ]
},
{
- root: "pages/goods",
+ root: 'pages/goods',
pages: [
- "goods_detail/index",
- "order_create/index",
- "order_status/index",
- ],
+ 'goods_detail/index',
+ 'order_create/index',
+ 'order_status/index'
+ ]
},
{
- root: "pages/admin",
- pages: ["verify/index"],
+ root: 'pages/admin',
+ pages: ['verify/index']
},
+ {
+ root: 'pages/game',
+ pages: [
+ 'gamehome/index',
+ 'gamedetail/index',
+ ]
+ }
],
window: {
- backgroundTextStyle: "light",
- navigationBarBackgroundColor: "#fff",
- navigationBarTitleText: "WeChat",
- navigationBarTextStyle: "black",
+ backgroundTextStyle: 'light',
+ navigationBarBackgroundColor: '#fff',
+ navigationBarTitleText: 'WeChat',
+ navigationBarTextStyle: 'black'
},
tabBar: {
- color: "#666666",
- selectedColor: "#ff0000",
- backgroundColor: "#ffffff",
- borderStyle: "white",
+ color: '#666666',
+ selectedColor: '#ff0000',
+ backgroundColor: '#ffffff',
+ borderStyle: 'white',
list: [
{
- pagePath: "pages/index/index",
- iconPath: "static/tabbar/1-001.png",
- selectedIconPath: "static/tabbar/1-002.png",
- text: "首页",
+ pagePath: 'pages/index/index',
+ iconPath: 'static/tabbar/1-001.png',
+ selectedIconPath: 'static/tabbar/1-002.png',
+ text: '首页'
},
{
- pagePath: "pages/category/index",
- iconPath: "static/tabbar/2-001.png",
- selectedIconPath: "static/tabbar/2-002.png",
- text: "分类",
+ pagePath: 'pages/category/index',
+ iconPath: 'static/tabbar/2-001.png',
+ selectedIconPath: 'static/tabbar/2-002.png',
+ text: '分类'
},
{
- pagePath: "pages/cart/index",
- iconPath: "static/tabbar/3-001.png",
- selectedIconPath: "static/tabbar/3-002.png",
- text: "购物车",
+ pagePath: 'pages/cart/index',
+ iconPath: 'static/tabbar/3-001.png',
+ selectedIconPath: 'static/tabbar/3-002.png',
+ text: '购物车'
},
{
- pagePath: "pages/user/index",
- iconPath: "static/tabbar/4-001.png",
- selectedIconPath: "static/tabbar/4-002.png",
- text: "我的",
- },
- ],
+ pagePath: 'pages/user/index',
+ iconPath: 'static/tabbar/4-001.png',
+ selectedIconPath: 'static/tabbar/4-002.png',
+ text: '我的'
+ }
+ ]
},
permission: {
- "scope.userLocation": {
- desc: "你的位置信息将用于小程序位置接口的效果展示",
- },
+ 'scope.userLocation': {
+ desc: '你的位置信息将用于小程序位置接口的效果展示'
+ }
},
- requiredBackgroundModes: ["audio", "location"],
+ requiredBackgroundModes: ['audio', 'location'],
// @ts-ignore
- requiredPrivateInfos: ["getLocation"],
-});
+ requiredPrivateInfos: ['getLocation']
+})
diff --git a/src/app.scss b/src/app.scss
index e19438c..4eb7044 100644
--- a/src/app.scss
+++ b/src/app.scss
@@ -14,6 +14,7 @@
page {
font-family: AlibabaPuHuiTi-3-55-Regular, serif;
+ background-color: #f5f5f5;
}
.app {
diff --git a/src/components/Auth.vue b/src/components/Auth.vue
index 7fd7604..a2a7d8e 100644
--- a/src/components/Auth.vue
+++ b/src/components/Auth.vue
@@ -3,7 +3,8 @@
授权提醒
请授权头像信息,以便为您提供更好的服务!请授权头像信息,以便为您提供更好的服务!
+
随便逛逛
@@ -15,45 +16,53 @@
diff --git a/src/pages/admin/verify/index.vue b/src/pages/admin/verify/index.vue
index c9e1fc7..5341270 100644
--- a/src/pages/admin/verify/index.vue
+++ b/src/pages/admin/verify/index.vue
@@ -10,29 +10,43 @@
diff --git a/src/pages/game/gamedetail/index.config.ts b/src/pages/game/gamedetail/index.config.ts
new file mode 100644
index 0000000..7cff30c
--- /dev/null
+++ b/src/pages/game/gamedetail/index.config.ts
@@ -0,0 +1,4 @@
+export default definePageConfig({
+ navigationBarTitleText: "游戏详情",
+ navigationStyle: "custom",
+});
diff --git a/src/pages/game/gamedetail/index.vue b/src/pages/game/gamedetail/index.vue
new file mode 100644
index 0000000..b2e6457
--- /dev/null
+++ b/src/pages/game/gamedetail/index.vue
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+ 开始游戏
+
+
+
+
+
+
+
diff --git a/src/pages/game/gamehome/index.config.ts b/src/pages/game/gamehome/index.config.ts
new file mode 100644
index 0000000..58fc10b
--- /dev/null
+++ b/src/pages/game/gamehome/index.config.ts
@@ -0,0 +1,3 @@
+export default definePageConfig({
+ navigationBarTitleText: "活动游戏",
+});
diff --git a/src/pages/game/gamehome/index.vue b/src/pages/game/gamehome/index.vue
new file mode 100644
index 0000000..e0ba927
--- /dev/null
+++ b/src/pages/game/gamehome/index.vue
@@ -0,0 +1,67 @@
+
+
+
+ 摇骰子
+
+
+
+
+
+
+
diff --git a/src/pages/goods/goods_detail/index.vue b/src/pages/goods/goods_detail/index.vue
index 666bc29..1ab048d 100644
--- a/src/pages/goods/goods_detail/index.vue
+++ b/src/pages/goods/goods_detail/index.vue
@@ -1,293 +1,405 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MIUCHO可爱卡通学生通勤手提电脑包13.3寸14村女适用苹果联想小米
-
-
-
-
- 产品介绍
-
-
-
-
-
-
-
-
- 首页
-
-
-
- 购物车
-
-
-
- 客服
-
-
-
-
-
- 加入购物车
- 立即兑换
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ goodInfo.name }}
+
+
+
+
+
+ 产品介绍
+
+
+
+
+
+
+
+
+ 首页
+
+
+
+ 购物车
+
+
+
+ 客服
+
+
+
+
+
+ 加入购物车
+
+ 立即兑换
+
+
+
+
+
+
+ 商品规格
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/goods/order_create/index.vue b/src/pages/goods/order_create/index.vue
index d2eac41..3a1086f 100644
--- a/src/pages/goods/order_create/index.vue
+++ b/src/pages/goods/order_create/index.vue
@@ -56,7 +56,7 @@
diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue
index 0bd81a1..46bec3c 100644
--- a/src/pages/user/index.vue
+++ b/src/pages/user/index.vue
@@ -8,18 +8,19 @@
-
+
@@ -45,24 +47,24 @@
我的订单
全部订单
-
+
-
+
待付款
-
+
待使用
-
+
已使用
-
+
已失效
@@ -74,8 +76,10 @@
@@ -85,7 +89,7 @@
-
+
+
+
+
-
+
diff --git a/src/pages/users/account/index.config.ts b/src/pages/users/account/index.config.ts
index e69de29..f2056d7 100644
--- a/src/pages/users/account/index.config.ts
+++ b/src/pages/users/account/index.config.ts
@@ -0,0 +1,3 @@
+export default definePageConfig({
+ navigationBarTitleText: '我的账户'
+})
\ No newline at end of file
diff --git a/src/pages/users/account/index.vue b/src/pages/users/account/index.vue
index 60e543d..91abf84 100644
--- a/src/pages/users/account/index.vue
+++ b/src/pages/users/account/index.vue
@@ -1,15 +1,73 @@
-
- $END$
+
+
+ Hello! YuanHuakk
+
+
+
+ 豆子:188888
+
+
+ 积分:188888
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/src/pages/users/order_list/index.vue b/src/pages/users/order_list/index.vue
index ddabd61..399285e 100644
--- a/src/pages/users/order_list/index.vue
+++ b/src/pages/users/order_list/index.vue
@@ -1,7 +1,14 @@
@@ -76,11 +124,10 @@ const closePay = () => {
订单信息
消费订单:{{ 10 || 0 }} 总消费积分:{{ 12312 || 0 }}
-
+ >消费订单:{{ 10 || 0 }} 总消费积分:{{ 12312 || 0 }}
+
-
+
{
-
+
- 2023-08-14 14:24:23
- 待付款
+ {{ item.add_time.slice(0, 19) }}
+ {{
+ item.status === 1
+ ? "待付款"
+ : item.status === 2
+ ? "待使用"
+ : item.status === 3
+ ? "已使用"
+ : "已失效"
+ }}
-
- 商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
-
+
+ {{ item.BindGoods.name }}
- 123.00
- x1
+ {{ item.BindGoods.number }}
+ x{{ item.count }}
- 共10件商品,实付积分:
- 123.00
-
+ 共{{ item.count }}件商品,实付积分:
+ {{ item.number }}
- 取消订单
-
+ 取消订单
+
查看详情
-
+ @click="toDetail(item)"
+ >查看详情
+
立即付款
-
+ v-if="item.status === 0"
+ @click="openPay(item)"
+ >立即付款
+
+const goodInfo = ref({});
+
+const statusList = ref([
+ {
+ id: 0,
+ text: "待付款",
+ },
+ {
+ id: 1,
+ text: "待使用",
+ },
+ {
+ id: 2,
+ text: "已使用",
+ },
+ {
+ id: 3,
+ text: "已失效",
+ },
+]);
+
+const isShowCode = ref(false);
+
+const url = ref("");
+
+useLoad((options) => {
+ console.log("options", options);
+ goodInfo.value = getStorageSync("item");
+});
+
+const toPhone = () => {
+ makePhoneCall({
+ phoneNumber: goodInfo.value.BindStore.phone,
+ });
+};
+
+const toAdder = () => {
+ openLocation({
+ latitude: Number(goodInfo.value.BindStore.lat),
+ longitude: Number(goodInfo.value.BindStore.lon),
+ scale: 18,
+ });
+};
+
+const openPay = () => {};
+
+const openCode = () => {
+ url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
+ isShowCode.value = true;
+};
+
+const closed = () => {
+ isShowCode.value = false;
+ url.value = "";
+};
+
+
+
diff --git a/src/pages/users/settled_mer/index.config.ts b/src/pages/users/settled_mer/index.config.ts
index 4977ea9..43d922a 100644
--- a/src/pages/users/settled_mer/index.config.ts
+++ b/src/pages/users/settled_mer/index.config.ts
@@ -1,3 +1,3 @@
export default definePageConfig({
- navigationBarTitleText: '申请商户',
+ navigationBarTitleText: '商户入驻',
})
\ No newline at end of file
diff --git a/src/pages/users/settled_mer/index.vue b/src/pages/users/settled_mer/index.vue
index 2bc6fe5..478016d 100644
--- a/src/pages/users/settled_mer/index.vue
+++ b/src/pages/users/settled_mer/index.vue
@@ -1,160 +1,250 @@
-
-
-
+
-
-
-
+
+
-
-
-
+
+
-
-
-
+
+
+
+
+
+ {{ smsStr }}
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
- 提交
-
+
+
+
+
+
+
+
+
-
-
-
- 入驻协议
-
-
+
+ 提交
+
+
+
+
+
+ 入驻协议
+
+
\ No newline at end of file
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 20386fe..667d29e 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -1,46 +1,48 @@
-import Taro from "@tarojs/taro";
+import Taro from '@tarojs/taro'
-const BASE_URL = () => {
- if (process.env.NODE_ENV === "development") {
- return "http://192.168.2.3:9000";
- } else {
- return "https://api.imooc.hybrid.lgdsunday.club";
- }
-};
+const BASE_URL = process.env.NODE_ENV === 'development' ? 'http://192.168.2.3:9000' : 'https://www.wanzhuanyongcheng.cn'
-// interface Res {
-//
-// }
+interface Res {
+ code: number;
+ data: T;
+ msg: string;
+}
-type Method = "GET" | "POST" | "PUT" | "DELETE";
+type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
-export const request = (
+const request = (
url: string,
data: object = {},
- method: Method = "GET"
-): Promise => {
+ method: Method = 'GET'
+): Promise> => {
return new Promise((resolve, reject) => {
+ Taro.showLoading({
+ title: '加载中...',
+ mask: true
+ })
Taro.request({
- url: BASE_URL() + "/app" + url,
+ url: BASE_URL + '/app' + url,
data: data,
method: method,
header: {
- "content-type": "application/json",
- token: Taro.getStorageSync("token"),
+ 'content-type': 'application/json',
+ token: Taro.getStorageSync('token')
},
success: ({data}) => {
- console.log(data);
+ Taro.hideLoading()
if (data.code !== 200)
- return reject({code: 1, msg: data.msg});
- resolve(data);
+ return reject({code: 1, msg: data.msg})
+ resolve(data)
},
fail: () => {
Taro.showToast({
- title: "服务器异常",
- icon: "none",
- });
- reject({code: 1, msg: "服务器异常"});
- },
- });
- });
-};
+ title: '服务器异常',
+ icon: 'none'
+ })
+ reject({code: 1, msg: '服务器异常'})
+ }
+ })
+ })
+}
+
+export default request
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 4d4dbe2..c3f4480 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,34 +1,39 @@
{
- "compilerOptions": {
- "target": "es2017",
- "module": "commonjs",
- "removeComments": false,
- "preserveConstEnums": true,
- "moduleResolution": "node",
- "experimentalDecorators": true,
- "noImplicitAny": false,
- "allowSyntheticDefaultImports": true,
- "outDir": "lib",
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "strictNullChecks": true,
- "sourceMap": true,
- "baseUrl": ".",
- "rootDir": ".",
- "jsx": "preserve",
- "allowJs": true,
- "resolveJsonModule": true,
- "typeRoots": [
- "node_modules/@types"
+ "compilerOptions": {
+ "target": "es2017",
+ "module": "commonjs",
+ "removeComments": false,
+ "preserveConstEnums": true,
+ "moduleResolution": "node",
+ "experimentalDecorators": true,
+ "noImplicitAny": false,
+ "allowSyntheticDefaultImports": true,
+ "outDir": "lib",
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "strictNullChecks": true,
+ "sourceMap": true,
+ "baseUrl": ".",
+ "rootDir": ".",
+ "jsx": "preserve",
+ "allowJs": true,
+ "resolveJsonModule": true,
+ "typeRoots": [
+ "node_modules/@types"
+ ],
+ "types": [
+ "@tarojs/components/vue3"
+ ],
+ "paths": {
+ "@/*": [
+ "src/*"
+ ]
+ }
+ },
+ "include": [
+ "./src",
+ "./types",
+ "components.d.ts"
],
- "types": [
- "@tarojs/components/vue3"
- ]
- },
- "include": [
- "./src",
- "./types",
- "components.d.ts"
- ],
- "compileOnSave": false
+ "compileOnSave": false
}