小程序
This commit is contained in:
parent
8d588076da
commit
184a981526
|
@ -8,5 +8,4 @@ node_modules/
|
|||
yarn.lock
|
||||
components.d.ts
|
||||
package-lock.json
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 所覆盖
|
||||
|
|
|
@ -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 = () => {
|
|||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<template>
|
||||
<view class="myProject">
|
||||
<view class="myProjectItem" v-for="(item,index) in myProjectList" :key="index">
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text>{{item?.name}}</text>
|
||||
<!--<text>进行中</text>-->
|
||||
</view>
|
||||
<view class="myProjectIndex">地址:
|
||||
<text>{{item?.provinceName}}{{item.cityName}}{{item.districtsName}}{{item.streetName}}</text>
|
||||
</view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text>项目负责人:{{item?.contactPersonInfo.name}}</text>
|
||||
<text>电话:{{item?.contactPersonInfo.telephone}}</text>
|
||||
</view>
|
||||
<view class="project" >
|
||||
<view v-for="(items,index) in item.serviceProjectList" :key="index">{{items.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from "@/request/index";
|
||||
import {onMounted, ref} from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import './myproject.scss'
|
||||
|
||||
|
||||
const myProjectList = ref<myProjectList[]>()
|
||||
const getMyServiceProject = async () => {
|
||||
const token = Taro.getStorageSync('token')
|
||||
const resp = await api.get<myProjectList[]>(`/projectManageIndex/getMyServiceProject`, {
|
||||
token: token.value
|
||||
})
|
||||
myProjectList.value = resp.data
|
||||
console.log(resp.data)
|
||||
}
|
||||
onMounted(async () => {
|
||||
await getMyServiceProject()
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--<style scoped lang="scss">-->
|
||||
|
||||
<!--</style>-->
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '我的项目',
|
||||
})
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
<nut-grid :column-num="3">
|
||||
<nut-grid-item
|
||||
text="我的项目"
|
||||
@click="Taro.navigateTo({url: '/pages/projectManager/myProject/myProject'})">
|
||||
@click="Taro.navigateTo({url: '/pages/myProject/myProject'})">
|
||||
</nut-grid-item>
|
||||
<nut-grid-item
|
||||
text="警保风采"
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
.myProject{
|
||||
background: red;
|
||||
height: 100vh;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<template>
|
||||
<view class="myProject">
|
||||
<view>
|
||||
<text></text>
|
||||
<view>望月湖二期66666666望月湖二期111</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from "@/request/index";
|
||||
import {onMounted} from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
const getMyServiceProject = async()=>{
|
||||
console.log(11112)
|
||||
const token = Taro.getStorageSync('token')
|
||||
const resp = await api.get(`/projectManageIndex/getMyServiceProject`,{
|
||||
token:token.value
|
||||
})
|
||||
console.log(resp.data)
|
||||
}
|
||||
|
||||
|
||||
const dataList = [
|
||||
{
|
||||
address:'12313',
|
||||
name:'望月湖',
|
||||
provincename:'湖南省',
|
||||
remark:'123123',
|
||||
streetName:'望月湖街道'
|
||||
}
|
||||
]
|
||||
onMounted(async ()=>{
|
||||
await getMyServiceProject()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue