From b76f80ece375375dd40cc693c9c2c0f20516cc98 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Tue, 9 Dec 2025 10:25:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E5=95=86=E5=9F=8E=E5=88=86=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config.js | 2 +- package.json | 3 + pages.json | 31 +++- pages/user/shop/index.vue | 8 +- pnpm-lock.yaml | 364 ++++++++++++++++++++++++++++++++++++++ scoreShop/index.vue | 32 ++++ src/auto-imports.d.ts | 77 ++++++++ vite.config.js | 54 ++++-- 8 files changed, 540 insertions(+), 31 deletions(-) create mode 100644 scoreShop/index.vue create mode 100644 src/auto-imports.d.ts diff --git a/common/config.js b/common/config.js index f070d96..a12d3f1 100644 --- a/common/config.js +++ b/common/config.js @@ -1,5 +1,5 @@ // const debug = process.env.NODE_ENV == 'development' ? true : false; -const debug = false; +const debug = true; // #ifdef H5 const proxyApi = "/api"; // #endif diff --git a/package.json b/package.json index add3875..4dae7db 100644 --- a/package.json +++ b/package.json @@ -8,5 +8,8 @@ "pinia": "^2.3.1", "pinia-plugin-unistorage": "^0.1.2", "ysk-utils": "^1.0.78" + }, + "devDependencies": { + "unplugin-auto-import": "^0.16.7" } } diff --git a/pages.json b/pages.json index 0a96556..77c8f69 100644 --- a/pages.json +++ b/pages.json @@ -46,7 +46,6 @@ "navigationBarTitleText": "红包中心" } }, - { "path": "pages/product/index", "style": { @@ -133,7 +132,8 @@ "style": { "navigationBarTitleText": "会员支付码" } - }, { + }, + { "path": "pages/user/member/setPassword", "style": { "navigationBarTitleText": "密码设置" @@ -215,9 +215,11 @@ } } ], - "subPackages": [{ + "subPackages": [ + { "root": "user", - "pages": [{ + "pages": [ + { "path": "vip/vip", "style": { "navigationBarTitleText": "", @@ -244,12 +246,12 @@ "navigationStyle": "custom" } } - ] }, { "root": "distribution", - "pages": [{ + "pages": [ + { "path": "index", "style": { "navigationBarTitleText": "分销中心", @@ -295,6 +297,17 @@ } } ] + }, + { + "root": "scoreShop", + "pages": [ + { + "path": "index", + "style": { + "navigationBarTitleText": "积分商城" + } + } + ] } // , // { @@ -326,12 +339,14 @@ "color": "#999", "selectedColor": "#000", "borderStyle": "white", - "list": [{ + "list": [ + { "iconPath": "static/tabbar/1.png", "selectedIconPath": "static/tabbar/1-1.png", "pagePath": "pages/index/index", "text": "首页" - }, { + }, + { "iconPath": "static/tabbar/2.png", "selectedIconPath": "static/tabbar/2-1.png", "pagePath": "pages/order/index", diff --git a/pages/user/shop/index.vue b/pages/user/shop/index.vue index 22e5f99..0cbd5c2 100644 --- a/pages/user/shop/index.vue +++ b/pages/user/shop/index.vue @@ -21,7 +21,7 @@ - + 当前积分 @@ -55,12 +55,12 @@ - + 澳洲高级洗发水 - + 30积分 @@ -81,7 +81,6 @@ + \ No newline at end of file diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts new file mode 100644 index 0000000..16298ba --- /dev/null +++ b/src/auto-imports.d.ts @@ -0,0 +1,77 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: typeof import('vue')['EffectScope'] + const computed: typeof import('vue')['computed'] + const createApp: typeof import('vue')['createApp'] + const customRef: typeof import('vue')['customRef'] + const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] + const defineComponent: typeof import('vue')['defineComponent'] + const effectScope: typeof import('vue')['effectScope'] + const getCurrentInstance: typeof import('vue')['getCurrentInstance'] + const getCurrentScope: typeof import('vue')['getCurrentScope'] + const h: typeof import('vue')['h'] + const inject: typeof import('vue')['inject'] + const isProxy: typeof import('vue')['isProxy'] + const isReactive: typeof import('vue')['isReactive'] + const isReadonly: typeof import('vue')['isReadonly'] + const isRef: typeof import('vue')['isRef'] + const markRaw: typeof import('vue')['markRaw'] + const nextTick: typeof import('vue')['nextTick'] + const onActivated: typeof import('vue')['onActivated'] + const onBeforeMount: typeof import('vue')['onBeforeMount'] + const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] + const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] + const onDeactivated: typeof import('vue')['onDeactivated'] + const onErrorCaptured: typeof import('vue')['onErrorCaptured'] + const onHide: typeof import('@dcloudio/uni-app')['onHide'] + const onLoad: typeof import('@dcloudio/uni-app')['onLoad'] + const onMounted: typeof import('vue')['onMounted'] + const onRenderTracked: typeof import('vue')['onRenderTracked'] + const onRenderTriggered: typeof import('vue')['onRenderTriggered'] + const onScopeDispose: typeof import('vue')['onScopeDispose'] + const onServerPrefetch: typeof import('vue')['onServerPrefetch'] + const onShow: typeof import('@dcloudio/uni-app')['onShow'] + const onUnload: typeof import('@dcloudio/uni-app')['onUnload'] + const onUnmounted: typeof import('vue')['onUnmounted'] + const onUpdated: typeof import('vue')['onUpdated'] + const onWatcherCleanup: typeof import('vue')['onWatcherCleanup'] + const provide: typeof import('vue')['provide'] + const reactive: typeof import('vue')['reactive'] + const readonly: typeof import('vue')['readonly'] + const ref: typeof import('vue')['ref'] + const resolveComponent: typeof import('vue')['resolveComponent'] + const shallowReactive: typeof import('vue')['shallowReactive'] + const shallowReadonly: typeof import('vue')['shallowReadonly'] + const shallowRef: typeof import('vue')['shallowRef'] + const toRaw: typeof import('vue')['toRaw'] + const toRef: typeof import('vue')['toRef'] + const toRefs: typeof import('vue')['toRefs'] + const toValue: typeof import('vue')['toValue'] + const triggerRef: typeof import('vue')['triggerRef'] + const uni.navigateTo: typeof import('@dcloudio/uni-app')['uni.navigateTo'] + const uni.request: typeof import('@dcloudio/uni-app')['uni.request'] + const uni.showToast: typeof import('@dcloudio/uni-app')['uni.showToast'] + const unref: typeof import('vue')['unref'] + const useAttrs: typeof import('vue')['useAttrs'] + const useCssModule: typeof import('vue')['useCssModule'] + const useCssVars: typeof import('vue')['useCssVars'] + const useId: typeof import('vue')['useId'] + const useModel: typeof import('vue')['useModel'] + const useSlots: typeof import('vue')['useSlots'] + const useTemplateRef: typeof import('vue')['useTemplateRef'] + const watch: typeof import('vue')['watch'] + const watchEffect: typeof import('vue')['watchEffect'] + const watchPostEffect: typeof import('vue')['watchPostEffect'] + const watchSyncEffect: typeof import('vue')['watchSyncEffect'] +} +// for type re-export +declare global { + // @ts-ignore + export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' + import('vue') +} diff --git a/vite.config.js b/vite.config.js index f9cb735..1b71633 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,19 +1,37 @@ -import { - defineConfig -} from 'vite'; -import uni from '@dcloudio/vite-plugin-uni'; +// vite.config.js(正确的 CommonJS 配置) +const { defineConfig } = require("vite"); +const uni = require("@dcloudio/vite-plugin-uni").default; // uni 插件需要 .default +const AutoImport = require("unplugin-auto-import/vite"); // 旧版本 AutoImport 直接导出函数,无需 .default -export default defineConfig({ - plugins: [uni()], - server: { - hmr: true, - proxy: { - '/api': { - target: 'http://192.168.1.42', - changeOrigin: true, - rewrite: path => path.replace(/^\/api/, ''), - secure: false - } - } - } -}) \ No newline at end of file +module.exports = defineConfig({ + plugins: [ + uni(), + AutoImport({ + include: [ + /\.js$/, + /\.vue$/, /\.vue\?vue/ + ], + imports: [ + "vue", + { + "@dcloudio/uni-app": [ + "onLoad", "onShow", "onHide", "onUnload", + "uni.request", "uni.navigateTo", "uni.showToast" + ] + } + ], + dts: "src/auto-imports.d.ts" + }), + ], + server: { + hmr: true, + proxy: { + "/api": { + target: "http://192.168.1.42", + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ""), + secure: false, + }, + }, + }, +}); \ No newline at end of file