diff --git a/collect_information/.gitignore b/collect_information/.gitignore index f54f355..4abd8e3 100644 --- a/collect_information/.gitignore +++ b/collect_information/.gitignore @@ -8,5 +8,4 @@ node_modules/ yarn.lock components.d.ts package-lock.json -.vscode -.idea + diff --git a/collect_information/config/dev.ts b/collect_information/config/dev.ts index 352cac8..83b5450 100644 --- a/collect_information/config/dev.ts +++ b/collect_information/config/dev.ts @@ -1,10 +1,124 @@ -import type { UserConfigExport } from "@tarojs/cli"; -export default { - logger: { - quiet: false, - stats: true - }, - mini: {}, - h5: {} -} satisfies UserConfigExport +// import type { UserConfigExport } from "@tarojs/cli"; +// export default { +// logger: { +// quiet: false, +// stats: true +// }, +// mini: {}, +// h5: {} +// } satisfies UserConfigExport +import {defineConfig, type UserConfigExport} from '@tarojs/cli' +import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' +import devConfig from './dev' +import prodConfig from './prod' +import ComponentsPlugin from 'unplugin-vue-components/webpack' +import NutUIResolver from '@nutui/auto-import-resolver' + +// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 +export default defineConfig(async (merge, {command, mode}) => { + const baseConfig: UserConfigExport = { + projectName: 'collect_information', + date: '2024-4-12', + designWidth(input: any) { + // 配置 NutUI 375 尺寸 + if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) { + return 375 + } + // 全局使用 Taro 默认的 750 尺寸 + 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: 'webpack5', + cache: { + enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache + }, + mini: { + miniCssExtractPluginOption: { + ignoreOrder: true + }, + postcss: { + pxtransform: { + enable: true, + config: {} + }, + url: { + enable: true, + config: { + limit: 1024 // 设定转换尺寸上限 + } + }, + cssModules: { + enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true + config: { + namingPattern: 'module', // 转换模式,取值为 global/module + generateScopedName: '[name]__[local]___[hash:base64:5]' + } + } + }, + webpackChain(chain) { + chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin) + chain.plugin('unplugin-vue-components').use(ComponentsPlugin({ + resolvers: [NutUIResolver({taro: true})] + })) + } + }, + h5: { + publicPath: '/', + staticDirectory: 'static', + output: { + filename: 'js/[name].[hash:8].js', + chunkFilename: 'js/[name].[chunkhash:8].js' + }, + miniCssExtractPluginOption: { + ignoreOrder: true, + filename: 'css/[name].[hash].css', + chunkFilename: 'css/[name].[chunkhash].css' + }, + postcss: { + autoprefixer: { + enable: true, + config: {} + }, + cssModules: { + enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true + config: { + namingPattern: 'module', // 转换模式,取值为 global/module + generateScopedName: '[name]__[local]___[hash:base64:5]' + } + } + }, + webpackChain(chain) { + chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin) + } + }, + rn: { + appName: 'taroDemo', + postcss: { + cssModules: { + enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true + } + } + } + } + if (process.env.NODE_ENV === 'development') { + // 本地开发构建配置(不混淆压缩) + return merge({}, baseConfig, devConfig) + } + // 生产构建配置(默认开启压缩混淆等) + return merge({}, baseConfig, prodConfig) +}) diff --git a/collect_information/src/app.config.ts b/collect_information/src/app.config.ts index e1fbfe4..a331b27 100644 --- a/collect_information/src/app.config.ts +++ b/collect_information/src/app.config.ts @@ -6,7 +6,7 @@ export default defineAppConfig({ 'pages/policeManager/index/index', 'pages/mine/mine', 'pages/employeeInfo/employeeInfo', - 'pages/projectManager/myProject/myProject' + 'pages/myProject/myProject', ], window: { backgroundTextStyle: 'light', diff --git a/collect_information/src/app.ts b/collect_information/src/app.ts index 117c29d..b829183 100644 --- a/collect_information/src/app.ts +++ b/collect_information/src/app.ts @@ -3,11 +3,18 @@ import {createPinia} from 'pinia' import './app.scss' import './assets/scss/colorui.scss' import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' +import Taro from "@tarojs/taro"; const pinia = createPinia() pinia.use(piniaPluginPersistedstate) const App = createApp({ onShow(options) { + const token = Taro.getStorageSync('token') + if(token){ + console.log(111) + }else{ + console.log(2222) + } console.log('App onShow.') }, // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 diff --git a/collect_information/src/pages/login/login.vue b/collect_information/src/pages/login/login.vue index f8c2665..0ebac18 100644 --- a/collect_information/src/pages/login/login.vue +++ b/collect_information/src/pages/login/login.vue @@ -33,8 +33,7 @@ import api from "@/request/index"; import {useCounterStore} from '@/store' const store = useCounterStore() -useLoad(() => { -}); +useLoad(() => {}); const onLogin = () => { Taro.login({ success: (res) => { @@ -77,7 +76,5 @@ const onLogin = () => { } }, }); - - }; diff --git a/collect_information/src/pages/myProject/myProject.vue b/collect_information/src/pages/myProject/myProject.vue new file mode 100644 index 0000000..e16bc4a --- /dev/null +++ b/collect_information/src/pages/myProject/myProject.vue @@ -0,0 +1,45 @@ + + + + + + + diff --git a/collect_information/src/pages/projectManager/myProject/myproject.config.ts b/collect_information/src/pages/myProject/myproject.config.ts similarity index 98% rename from collect_information/src/pages/projectManager/myProject/myproject.config.ts rename to collect_information/src/pages/myProject/myproject.config.ts index 65e3f50..7bccd60 100644 --- a/collect_information/src/pages/projectManager/myProject/myproject.config.ts +++ b/collect_information/src/pages/myProject/myproject.config.ts @@ -1,4 +1,3 @@ - export default definePageConfig({ navigationBarTitleText: '我的项目', }) diff --git a/collect_information/src/pages/myProject/myproject.scss b/collect_information/src/pages/myProject/myproject.scss new file mode 100644 index 0000000..867ee38 --- /dev/null +++ b/collect_information/src/pages/myProject/myproject.scss @@ -0,0 +1,31 @@ +.myProject{ + height: 100vh; + overflow: hidden; + background: #f1f1f1; + .myProjectItem{ + //height: 20%; + margin: 20px; + border-radius: 10px; + background: #ffffff; + padding: 15px; + font-size: 28px; + line-height: 50px; + color: #333333; + .myProjectIndex{ + color: #9b9b9f; + } + .project{ + display: flex; + justify-content: space-between; + flex-flow: wrap; + text-align: center; + view{ + width: 45%; + height: 100rpx; + border: 1px solid #cccccc; + line-height: 100rpx; + margin: 8px 0 8px 0; + } + } + } +} diff --git a/collect_information/src/pages/projectManager/index/index.vue b/collect_information/src/pages/projectManager/index/index.vue index c95041b..775a9ab 100644 --- a/collect_information/src/pages/projectManager/index/index.vue +++ b/collect_information/src/pages/projectManager/index/index.vue @@ -11,7 +11,7 @@ + @click="Taro.navigateTo({url: '/pages/myProject/myProject'})"> - - - - 望月湖二期66666666望月湖二期111 - - - - - - - diff --git a/collect_information/types/pages/myProject/index.d.ts b/collect_information/types/pages/myProject/index.d.ts new file mode 100644 index 0000000..1cac21e --- /dev/null +++ b/collect_information/types/pages/myProject/index.d.ts @@ -0,0 +1,36 @@ + interface myProjectList { + address?: string; + city?: string; + cityName?: string; + contactPersonInfo:contactPersonInfo; + districts?: string; + districtsName?: string; + name: string; + province?: string; + provinceName: string; + remark?: string; + serviceProjectList: serviceProjectList[]; + snowFlakeId?: string; + street?: string; + streetName?:string; +} + +interface contactPersonInfo{ + name:string, + telephone:string +} + +interface serviceProjectList { + buildingTotal?: number; + houseTotal?: number; + idNumber?: string; + isRecruitSecurity?: null; + name?: string; + remark?: string; + securityUserTotal?: number; + serviceArea?: number; + snowFlakeId?: string; + staffTotal?: number; + type?:string; +} +