This commit is contained in:
TimSpan 2024-10-28 14:44:42 +08:00
commit 456c7a16b1
118 changed files with 1886 additions and 1599 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@ -1,2 +1,3 @@
TARO_APP_ID="wx8902ddbfddb820d1"
# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config
TARO_APP_ID="wx0acd1c4fcf94bdd3"
TARO_APP_BASE_API="http://172.10.10.93:8765"

View File

@ -1,2 +1 @@
TARO_APP_ID="wx24cc8a872b57ac79"
TARO_APP_BASE_API="http://172.10.10.207:7000"
# TARO_APP_ID="生产环境下的小程序appid"

View File

@ -5,6 +5,15 @@
"taro/vue3"
],
"rules": {
"vue/multi-word-component-names": "off"
// 添加组件命名忽略规则
"vue/multi-word-component-names": [
"error",
{
//需要忽略的组件名
"ignores": [
"index"
]
}
]
}
}

View File

@ -5,8 +5,9 @@ deploy_versions/
node_modules/
.DS_Store
.swc
yarn.lock
components.d.ts
package-lock.json
.idea
components.d.ts
package-lock.json
yarn.lock

View File

@ -1,124 +1,9 @@
// 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)
})
import type { UserConfigExport } from "@tarojs/cli";
export default {
logger: {
quiet: false,
stats: true
},
mini: {},
h5: {}
} satisfies UserConfigExport

View File

@ -3,13 +3,13 @@ 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'
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',
date: '2024-9-14',
designWidth(input: any) {
// 配置 NutUI 375 尺寸
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
@ -26,6 +26,7 @@ export default defineConfig(async (merge, {command, mode}) => {
},
sourceRoot: 'src',
outputRoot: 'dist',
// 开启 HTML 插件
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
copy: {

View File

@ -2,7 +2,7 @@
"name": "collect_information",
"version": "1.0.0",
"private": true,
"description": "智慧派出所信息采集小程序",
"description": "警保联动小程序",
"templateInfo": {
"name": "default",
"typescript": true,
@ -40,35 +40,33 @@
"author": "",
"dependencies": {
"@babel/runtime": "^7.21.5",
"@nutui/icons-vue-taro": "^0.0.9",
"@nutui/nutui-taro": "^4.3.5",
"@tarojs/components": "3.6.25",
"@tarojs/helper": "3.6.25",
"@tarojs/plugin-framework-vue3": "3.6.25",
"@nutui/nutui-taro": "^4.3.13",
"@tarojs/components": "3.6.26",
"@tarojs/helper": "3.6.26",
"@tarojs/plugin-framework-vue3": "3.6.26",
"@tarojs/plugin-html": "^3.6.26",
"@tarojs/plugin-platform-alipay": "3.6.25",
"@tarojs/plugin-platform-h5": "3.6.25",
"@tarojs/plugin-platform-harmony-hybrid": "3.6.25",
"@tarojs/plugin-platform-jd": "3.6.25",
"@tarojs/plugin-platform-qq": "3.6.25",
"@tarojs/plugin-platform-swan": "3.6.25",
"@tarojs/plugin-platform-tt": "3.6.25",
"@tarojs/plugin-platform-weapp": "3.6.25",
"@tarojs/runtime": "3.6.25",
"@tarojs/shared": "3.6.25",
"@tarojs/taro": "3.6.25",
"dayjs": "^1.11.10",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^4.0.1",
"@tarojs/plugin-platform-alipay": "3.6.26",
"@tarojs/plugin-platform-h5": "3.6.26",
"@tarojs/plugin-platform-harmony-hybrid": "3.6.26",
"@tarojs/plugin-platform-jd": "3.6.26",
"@tarojs/plugin-platform-qq": "3.6.26",
"@tarojs/plugin-platform-swan": "3.6.26",
"@tarojs/plugin-platform-tt": "3.6.26",
"@tarojs/plugin-platform-weapp": "3.6.26",
"@tarojs/runtime": "3.6.26",
"@tarojs/shared": "3.6.26",
"@tarojs/taro": "3.6.26",
"dayjs": "^1.11.13",
"pinia": "^2.2.2",
"vue": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@nutui/auto-import-resolver": "^1.0.0",
"@tarojs/cli": "3.6.25",
"@tarojs/taro-loader": "3.6.25",
"@tarojs/cli": "3.6.26",
"@tarojs/taro-loader": "3.6.26",
"@tarojs/test-utils-vue3": "^0.1.1",
"@tarojs/webpack5-runner": "3.6.25",
"@tarojs/webpack5-runner": "3.6.26",
"@types/jest": "^29.3.1",
"@types/node": "^18.15.11",
"@types/webpack-env": "^1.13.6",
@ -76,10 +74,10 @@
"@typescript-eslint/parser": "^6.2.0",
"@vue/babel-plugin-jsx": "^1.0.6",
"@vue/compiler-sfc": "^3.0.0",
"babel-preset-taro": "3.6.25",
"babel-preset-taro": "3.6.26",
"css-loader": "3.4.2",
"eslint": "^8.12.0",
"eslint-config-taro": "3.6.25",
"eslint-config-taro": "3.6.26",
"eslint-plugin-vue": "^8.0.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.5.0",
@ -89,8 +87,8 @@
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.1.0",
"unplugin-vue-components": "^0.26.0",
"vue-loader": "^17.0.0",
"unplugin-vue-components": "^0.27.4",
"vue-loader": "^17.1.0",
"webpack": "5.78.0"
}
}

View File

@ -1,32 +1,15 @@
{
"miniprogramRoot": "dist/",
"miniprogramRoot": "./dist",
"projectname": "collect_information",
"description": "智慧派出所信息采集小程序",
"description": "警保联动小程序",
"appid": "touristappid",
"setting": {
"urlCheck": false,
"es6": false,
"enhance": false,
"compileHotReLoad": true,
"compileHotReLoad": false,
"postcss": false,
"minified": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": true
"minified": false
},
"compileType": "miniprogram",
"libVersion": "3.5.0",
"srcMiniprogramRoot": "dist/",
"packOptions": {
"ignore": [],
"include": []
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"appid": "wx8902ddbfddb820d1"
"compileType": "miniprogram"
}

View File

@ -1,62 +0,0 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "collect_information",
"setting": {
"compileHotReLoad": true
},
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/projectManager/myProject/myProject",
"pathName": "pages/projectManager/myProject/myProject",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/mine/mine",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/login/login",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/mine/mine",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/index/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/index/dataEntry/buildFloorEntry/buildFloorEntry",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/register/register",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
}
}

View File

@ -1,59 +1,38 @@
import {MINI_PROGRAM_USER_CONFIG} from "@/config";
const tabBarItems = Object.values(MINI_PROGRAM_USER_CONFIG).map(item => item.tabBarList).flat()
export default defineAppConfig({
pages: [
'pages/login/login',
'pages/register/register',
'pages/projectManager/index/index',
'pages/policeManager/index/index',
'pages/mine/mine',
'pages/employeeInfo/employeeInfo',
...tabBarItems.map(i => i.pagePath)
],
subPackages: [
{
root: "subPages/projectManager",
pages: [
'myProject/myProject',
'myProject/projectDetails/projectDetails',
'securityUserForm/securityUserForm',
]
}, {
root: "subPages/police",
pages: [
'myEnterprisesUnit/myEnterprisesUnit',
'myEnterprisesUnit/projectDetails/projectDetails'
]
}
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#4e87ff',
navigationBarTitleText: '',
navigationBarTextStyle:'white',
navigationBarTextStyle: 'white',
},
subpackages: [
{
root: "subPages",
pages: [
'pages/policeManager/index',
'pages/policeDetails/index',
'pages/myProject/myProject',
'pages/projectDetails/projectDetails',
'pages/form/form'
]
}
],
tabBar: {
custom: true,
list: [
{
pagePath: 'pages/projectManager/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/policeManager/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/employeeInfo/employeeInfo',
text: '员工信息',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/mine/mine',
text: '我的',
iconPath: "assets/mine/my.png",
selectedIconPath: "assets/mine/my-active.png"
},
]
list: tabBarItems
}
})

View File

@ -1,4 +0,0 @@
*{
margin: 0;
padding: 0;
}

View File

@ -1,35 +1,28 @@
import {createApp} from 'vue'
import {createPinia} from 'pinia'
import {useCounterStore} from '@/store'
import './app.scss'
import './assets/scss/colorui.scss'
import '@/app.scss'
import '@/assets/css/main.css'
import {pinia} from "@/store";
import Taro from "@tarojs/taro";
import {MINI_PROGRAM_USER_CONFIG} from "@/config";
import {useUserStore} from "@/store/userStore";
import {initEnum} from "@/enums";
const pinia = createPinia()
// import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
// pinia.use(piniaPluginPersistedstate)
const App = createApp({
onShow(options) {
// try {
// const store = useCounterStore()
// const token = Taro.getStorageSync('token')
// console.log(token)
// if (token) {
// Taro.switchTab({
// url: '/pages/mine/mine'
// // url: '/pages/projectManager/index/index'
//
// })
// store.setSelected(2)
// } else {
// console.log(2222)
// }
// console.log('App onShow.')
// } catch (err) {
// console.log(err)
//
// }
onLaunch(opt) {
initEnum()
if (opt.path === 'subPages/projectManager/securityUserForm/securityUserForm' && opt.query.type === 'QcCodeInput') {
return
}
const tokenInfo = useUserStore().getTokenInfo();
if (tokenInfo) {
Taro.switchTab({
url: MINI_PROGRAM_USER_CONFIG[tokenInfo.extData.identity.value].toIndex
})
} else {
Taro.navigateTo({
url: '/pages/login/login',
})
}
},
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,225 +0,0 @@
<template>
<view>
<nut-form ref="formRef" :model-value="formParams" :rules="rules">
<nut-form-item label="街道/社区:" prop="streetCommunity">
<view @click="streetCommunitySmallCommunityVisible = true">
{{ streetCommunitySmallCommunityLabel || "请选择街道/小区" }}
</view>
</nut-form-item>
<nut-form-item label="楼栋/门户:" prop="residentialDivision">
<view @click="buildingFloorHouseVisible = true">
{{ buildingFloorHouseLabel || "请选择楼栋/门户" }}
</view>
</nut-form-item>
<nut-form-item label="姓名:" prop="name">
<nut-input
v-model="formParams.name"
placeholder="请输入姓名"
type="text"
/>
</nut-form-item>
<nut-form-item label="性别:" prop="sex">
<nut-radio-group v-model="formParams.sex" direction="horizontal">
<nut-radio v-for="item in SEX" :key="item.value" :label="item.value"
>{{ item.label }}
</nut-radio>
</nut-radio-group>
</nut-form-item>
<nut-form-item label="出生日期:" prop="dataOfBirth">
<view @click="dataOfBirthVisible = true">
{{
dayjs(formParams.dataOfBirth).format("YYYY-MM-DD") ||
"请选择出生日期"
}}
</view>
</nut-form-item>
<nut-form-item label="身份证:" prop="idCard">
<nut-input
v-model="formParams.idCard"
placeholder="请输入身份证"
type="text"
/>
</nut-form-item>
<nut-form-item label="手机号:" prop="phone">
<nut-input
v-model="formParams.phone"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="户籍地:" prop="householdRegistrationAddress">
<nut-input
v-model="formParams.householdRegistrationAddress"
placeholder="请输入户籍地"
type="text"
/>
</nut-form-item>
</nut-form>
<nut-cascader
v-model:visible="streetCommunitySmallCommunityVisible"
v-model="formParams.streetCommunitySmallCommunityIds"
:options="streetCommunitySmallCommunityTreeData"
title="选择街道/社区"
text-key="label"
@change="streetCommunitySmallCommunityChange"
></nut-cascader>
<nut-cascader
v-model:visible="buildingFloorHouseVisible"
v-model="formParams.buildingFloorHouseIds"
:options="buildingFloorHouseTreeData"
title="选择楼栋/门户"
text-key="label"
@change="buildingFloorHouseChange"
></nut-cascader>
<nut-popup v-model:visible="dataOfBirthVisible" position="bottom">
<nut-date-picker
v-model="formParams.dataOfBirth"
:min-date="min"
:max-date="max"
:three-dimensional="false"
@confirm="dataOfBirthVisible = false"
></nut-date-picker>
</nut-popup>
</view>
</template>
<script setup lang="ts">
import { SEX } from "@/enums";
import dayjs from "dayjs";
import { ref, watch } from "vue";
import type { FormRules } from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import api from "@/request";
import type { FormInstance } from "@nutui/nutui-taro";
import { useLoad } from "@tarojs/taro";
const emits = defineEmits(["update:modelValue"]);
const props = withDefaults(
defineProps<{
modelValue: PersonnelInformation;
}>(),
{
modelValue: () => {
return {
name: "",
sex: 0,
dataOfBirth: new Date(),
idCard: "",
phone: "",
householdRegistrationAddress: "",
streetCommunitySmallCommunityIds: [],
buildingFloorHouseIds: [],
} as PersonnelInformation;
},
}
);
const defaultParams = { ...props.modelValue };
const formRef = ref<FormInstance>();
const formParams = ref<PersonnelInformation>({
...props.modelValue,
});
const rules: FormRules = {
name: [
{ required: true, message: "请输入姓名" },
{
validator: (value) => {
return !(value.length < 2 || value.length >= 20);
},
message: "名字在2~20字符之间",
},
],
sex: [{ required: true, message: "请选择性别" }],
idCard: [
{ required: true, message: "请输入身份证" },
{
regex:
/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
message: "身份证格式错误",
},
],
phone: [
{ required: true, message: "请输入手机号码" },
{
regex: /^400(-?)[0-9]{7}$|^1\d{10}$|^0[0-9]{2,3}-[0-9]{7,8}$/,
message: "手机格式错误",
},
],
};
watch(formParams.value, (n) => {
emits("update:modelValue", n);
});
const dataOfBirthVisible = ref(false);
const min = new Date(1920, 0, 1);
const max = new Date(2025, 10, 1);
defineExpose<{
validate: () => Promise<unknown>;
resetForm: () => void;
}>({
validate: async (): Promise<unknown> => {
const result = (await formRef.value?.validate()) as any;
if (result.valid) {
return Promise.resolve("校验通过");
}
return Promise.reject("校验不通过");
},
resetForm: () => {
for (let key in defaultParams) {
formParams.value[key] = defaultParams[key];
}
streetCommunitySmallCommunityLabel.value = "";
buildingFloorHouseLabel.value = "";
buildingFloorHouseTreeData.value = [];
},
});
const streetCommunitySmallCommunityTreeData = ref<TreeNode<string>[]>([]);
const streetCommunitySmallCommunityVisible = ref<boolean>(false);
const streetCommunitySmallCommunityLabel = ref<string>("");
const streetCommunitySmallCommunityChange = (
value: string,
pathNodes: Record<string, any>[]
) => {
buildingFloorHouseLabel.value = "";
formParams.value.buildingFloorHouseIds = [];
buildingFloorHouseTreeData.value = [];
streetCommunitySmallCommunityLabel.value = pathNodes
.map((e) => e.text)
.join(",");
getBuildingFloorHouseTreeBySmallCommunityId(value[value.length - 1]);
};
const buildingFloorHouseVisible = ref<boolean>(false);
const buildingFloorHouseLabel = ref<string>("");
const buildingFloorHouseChange = (
value: string,
pathNodes: Record<string, any>[]
) => (buildingFloorHouseLabel.value = pathNodes.map((e) => e.text).join(","));
const buildingFloorHouseTreeData = ref<TreeNode<string>[]>([]);
const getBuildingFloorHouseTreeBySmallCommunityId = (
smallCommunityId: string
) => {
api
.get<TreeNode<string>[]>(
"/residentialDivision/getBuildingFloorHouseTreeBySmallCommunityId",
{ smallCommunityId }
)
.then((resp) => {
buildingFloorHouseTreeData.value = resp.data as TreeNode<string>[];
});
};
useLoad(() => {
api
.get<TreeNode<string>[]>(
"/residentialDivision/streetCommunitySmallCommunityTree"
)
.then((resp) => {
streetCommunitySmallCommunityTreeData.value =
resp.data as TreeNode<string>[];
});
});
</script>

View File

@ -0,0 +1,46 @@
import {UserConfig} from "@/types/config";
/**
*
*/
export const CLIENT_TYPE = 'MINI_PROGRAM'
/**
*
*/
export const MINI_PROGRAM_USER_CONFIG: Record<MiniProgramUserIdentity, UserConfig> = {
police: {
toIndex: '/pages/police/index/index',
tabBarList: [
{
pagePath: 'pages/police/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/police/mine/index',
text: '警察我的',
iconPath: "assets/mine/my.png",
selectedIconPath: "assets/mine/my-active.png"
},
]
},
project_manager: {
toIndex: '/pages/projectManager/index/index',
tabBarList: [
{
pagePath: 'pages/projectManager/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/projectManager/mine/index',
text: '项目经理我的',
iconPath: "assets/mine/my.png",
selectedIconPath: "assets/mine/my-active.png"
},
]
}
}

View File

@ -1,34 +1,42 @@
<template>
<!--https://developers.weixin.qq.com/community/develop/doc/000c84de0cc590bbe54b97edf5e414?highLine=%25E8%2587%25AA%25E5%25AE%259A%25E4%25B9%2589tabbar-->
<!--微信官方 回复 关于 自定义tabbar切换时会闪烁-->
<view class="tab-bar">
<view class="tab-bar-border"></view>
<view v-for="(item, index) in list" :key="index" class="tab-bar-item" @tap="switchTab(index, item.pagePath)">
<image :src="selected === index ? item.selectedIconPath : item.iconPath"/>
<view :style="{ color: selected === index ? selectedColor : color }">{{ item.text }}</view>
</view>
</view>
<cover-view class="tab-bar">
<cover-view class="tab-bar-border"></cover-view>
<cover-view
class="tab-bar-item"
v-for="(item, index) in tabBarList"
:key="item.pagePath"
@tap="switchTab(index, item.pagePath)">
<cover-image :src="selected === index ? '/' + item.selectedIconPath : '/' + item.iconPath"/>
<cover-view :style="{ color: selected === index ? selectedColor : color }">{{ item.text }}</cover-view>
</cover-view>
</cover-view>
</template>
<script setup>
import Taro from '@tarojs/taro'
import {computed} from 'vue'
import {useCounterStore} from '@/store'
<script setup lang="ts">
import {MINI_PROGRAM_USER_CONFIG} from "@/config";
import Taro from "@tarojs/taro";
import {useTabBarStore} from "@/store/tabBarStore";
import {storeToRefs} from "pinia";
import {useUserStore} from "@/store/userStore";
import {computed} from "vue";
const {tokenInfo} = storeToRefs(useUserStore())
/**
* 默认 TabBar 与自定义 TabBar 的最大不同点在于 <p>默认 TabBar 在所有 TabBar 页共享一个组件实例而自定义 TabBar 在各个 TabBar 页面初始化时都会创建一个新的组件实例</p>
* 也就是说各个 TabBar 页内的自定义 TabBar 组件实例的状态是不共享的因此对 TabBar 的状态管理例如 selected 选中态则尤为重要
*/
const tabBarStore = useTabBarStore()
const {selected} = storeToRefs(tabBarStore)
const store = useCounterStore()
const selected = computed(() => store.getSelected)
const color = '#000000'
const selectedColor = '#DC143C'
const list = computed(() => store.getList)
function switchTab(index, url) {
setSelected(index)
Taro.switchTab({url})
}
const tabBarList = computed(() => tokenInfo.value ? MINI_PROGRAM_USER_CONFIG[tokenInfo.value.extData.identity.value].tabBarList : []);
function setSelected(index) {
store.setSelected(index) // 使 Pinia action
const switchTab = (index: number, path: string) => {
tabBarStore.setSelected(index)
Taro.switchTab({url: '/' + path})
}
</script>
@ -63,12 +71,12 @@ function setSelected(index) {
flex-direction: column;
}
.tab-bar-item image {
.tab-bar-item cover-image {
width: 54px;
height: 54px;
}
.tab-bar-item view {
.tab-bar-item cover-view {
font-size: 20px;
}
</style>

View File

@ -1,34 +1,40 @@
export const SEX: SelectNode<number>[] = [
{
value: 0,
label: "男",
},
{
value: 1,
label: "女",
},
{
value: 2,
label: "隐藏",
import api from "@/request";
import Taro from "@tarojs/taro";
type EnumType =
'CheckStatus'
| 'DeleteFlag'
| 'IsEnable'
| 'IsOrNot'
| 'Sex'
| 'ServiceProjectType'
| 'MiniProgramUserIdentity'
export const initEnum = () => {
api.get<Record<EnumType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {
Taro.setStorageSync('enumMap', resp.data)
})
};
export const enumSelectNodes = <T, >(enumType: EnumType): SelectNodeVo<T>[] => Taro.getStorageSync('enumMap')?.[enumType]
export const getEnumByValue = <T, >(enumType: EnumType, value: T): null | SelectNodeVo<T> => {
const enumList = enumSelectNodes<T>(enumType);
if (!enumList) {
return null;
}
];
export const IDENTITY: SelectNode<string>[] = [
{
label: "公安",
value: "police"
},
{
label: "项目经理",
value: "project_manager"
},
]
export const getLabelByEnumValue = (enums: SelectNode<any>[], value: any): string => {
for (let i = 0; i < enums.length; i++) {
if (enums[i].value === value) {
return enums[i].label
for (let i = 0; i < enumList.length; i++) {
if (value === enumList[i].value) {
return enumList[i]
}
}
return '-'
}
return null;
};
export const getEnumLabelByValue = <T, >(enumType: EnumType, value: T): string => {
const enums = getEnumByValue(enumType, value)
if (!enums) {
return '-'
}
return enums.label;
};

View File

@ -1,4 +0,0 @@
export default definePageConfig({
// navigationBarTitleText: '自定义导航栏',
navigationStyle: "custom"
})

View File

@ -1,21 +0,0 @@
<template>
<view style="height: 42px;background: #3d69dc"></view>
<view></view>
<view></view>
</template>
<script setup lang="ts">
import Taro, {useLoad } from "@tarojs/taro";
import './employeeInfo.scss'
useLoad(() => {
// TaroSetNavigationBarTitle()
})
</script>
<style scoped lang="scss">
.dropdown{
background: red;
height: 100px;
}
</style>

View File

@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '登录',
navigationBarTitleText: '登录',
})

View File

@ -1,73 +1,45 @@
<template>
<view class="SignMultiple">
<view class="urlIndex">
<view class="urlTitle">
<view class="urlWelcome">
<view style="font-size: 26px">Welcome</view>
<view class="urlHibiscus">
<view class="contact">
<image
src='https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png'
mode="scaleToFill"
class="image"
/>
<text>欢迎</text>
</view>
</view>
</view>
</view>
<view class="content">
<view class="bg"></view>
<view class="bg2"></view>
<view class="tips">
<text class="title">登录</text>
<text class="subtitle">欢迎再次回来~</text>
</view>
<view class="SignItem">
<view class="Cancel">
<nut-button block type="success" @click="onLogin">一键授权</nut-button>
</view>
<view class="form-box">
<image src="@/assets/logo/guohui.png"/>
<view class="btn margin-top-lg" @click="login">一键登录</view>
</view>
</view>
</template>
<script setup lang="ts">
import "./login.scss";
import Taro, {useLoad} from "@tarojs/taro";
import api from "@/request/index";
import Taro from "@tarojs/taro";
import api from "@/request";
import {CLIENT_TYPE, MINI_PROGRAM_USER_CONFIG} from "@/config";
import {useUserStore} from "@/store/userStore";
import {useCounterStore} from '@/store'
const store = useCounterStore()
useLoad(() => {});
const onLogin = () => {
const {saveTokenInfo} = useUserStore()
const login = () => {
Taro.login({
success: (res) => {
if (res.code) {
api.post<LoginUserInfo>("/login", {
clientType: 'MINI_PROGRAM',
api.post<TokenInfo>("/login", {
clientType: CLIENT_TYPE,
loginParams: {
code: res.code
}
}).then(async (resp) => {
const {
extData: {
identity: {value}
}
} = resp.data
if (value === 'police') {
store.updateHomePagePath('/pages/policeManager/index/index') //
} else {
store.updateHomePagePath('/pages/projectManager/index/index') //
}
// list Pinia
await Taro.setStorageSync('list', store.list)
await Taro.setStorage({
key: "token",
data: resp.data,
success(res) {
Taro.switchTab({
// url: '/pages/projectManager/index/index'
url: store.list[0].pagePath
})
},
}, {loading: true}).then(async ({data: tokenInfo}) => {
//
saveTokenInfo(tokenInfo!)
//
await Taro.switchTab({
url: MINI_PROGRAM_USER_CONFIG[tokenInfo!.extData.identity.value].toIndex
})
}).catch((error) => {
if (error.code === 402) {
}).catch(err => {
//
if (err.code === 402) {
//
Taro.navigateTo({
url: "/pages/register/register",
});
@ -78,3 +50,81 @@ const onLogin = () => {
});
};
</script>
<style lang="scss">
.content {
width: 100vw;
height: 100vh;
background-color: #ffffff;
.tips {
padding-top: 200rpx;
padding-left: 80rpx;
display: flex;
flex-direction: column;
.title {
line-height: 70rpx;
font-weight: bold;
font-size: 50rpx;
}
.subtitle {
line-height: 70rpx;
font-size: 35rpx;
font-weight: bold;
color: #b0b0b1;
}
}
.bg {
position: fixed;
top: -250rpx;
right: -250rpx;
width: 600rpx;
height: 600rpx;
border-radius: 100%;
background-color: #00baef;
z-index: 2
}
.bg2 {
position: fixed;
top: -150rpx;
right: -300rpx;
width: 600rpx;
height: 600rpx;
border-radius: 100%;
background-color: #ade8f9;
z-index: 1;
}
.form-box {
padding-top: 180rpx;
padding-left: 70rpx;
width: 610rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
image {
width: 200px;
height: 200px;
}
.btn {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100rpx;
border-radius: 100rpx;
color: #FFFFFF;
background: linear-gradient(to right, #00c6fc, #9adcf1);
}
}
}
</style>

View File

@ -1,5 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '我的',
navigationBarBackgroundColor:'#3d69dc',
navigationBarTextStyle:'white'
})

View File

@ -1,84 +0,0 @@
.message {
height: 100vh;
background-color: #fff;
}
.login-container {
height: 205rpx;
display: flex;
align-items: center;
background-image: url('../../assets/images/banner.jpg');
background-repeat: no-repeat;
background-position: right;
overflow: hidden;
padding: 18rpx;
box-sizing: border-box;
.contact {
height: 100rpx;
width: 100rpx;
border-radius: 50%;
border: solid 1px gray;
.image {
width: 100%;
height: 100%;
border-radius: 50%
}
}
.tips-text {
display: flex;
font-size: 28rpx;
color: #fff;
line-height: 50rpx;
margin-left: 20rpx;
flex-direction: column;
justify-content: space-evenly;
}
}
.userIndex {
.exit {
height: 100rpx;
line-height: 40px;
border-bottom: solid 0.5px #ebebf7;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
// margin-bottom: 30rpx;
color: #7d7d7d;
.exitItem {
display: flex;
align-items: center;
margin-left: 30rpx;
}
.exitItemIndex {
height: 40rpx;
width: 40rpx;
border-radius: 50%;
// border: solid 1px gray;
display: block;
line-height: 48rpx;
image {
width: 100%;
height: 100%;
}
}
.iconScope {
width: 8px;
height: 8px;
display: inline-block;
border: solid 2px #ccc;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
border-bottom: white;
border-left: white;
}
}
}

View File

@ -1,17 +0,0 @@
<template>
<view class="message">
我的我的我的我的
</view>
</template>
<script setup lang="ts">
import './mine.scss'
import {ref} from "vue";
import Taro, {useLoad,useDidShow} from "@tarojs/taro";
</script>

View File

@ -1,4 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '首页',
})

View File

@ -0,0 +1,47 @@
.swiperDemoItem {
color: #3886d0;
display: flex;
padding: 20px 0 0 50px;
overflow: hidden;
height: 70rpx;
.swiperDemoIndex {
width: 15px;
height: 45px;
background-image: linear-gradient(to bottom, #5d9cf9, #317ad9);
//background: rgb();
border-radius: 20px;
margin-right: 15px;
}
}
.subModule {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-right: -3px;
margin-left: -1px;
.subModuleItem {
width: 33%;
height: 180rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 10rpx;
border: 1px solid #ccc;
border-left: 0;
margin-top: -1px;
.subModuleIndex {
width: 65rpx;
height: 65rpx;
image {
width: 100%;
height: 100%;
}
}
}
}

View File

@ -0,0 +1,58 @@
<template>
<view>
<view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px">
<image src="@/assets/images/01.png" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item>
</nut-swiper>
</view>
<view class="swiperDemoItem">
<view class="swiperDemoIndex"></view>
<view>请选择</view>
</view>
<!--九宫格-->
<view>
<view class="subModule">
<view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
<view class="subModuleIndex">
<image :src="item.icon"></image>
</view>
<view style=" font-size: 12px;color: #414141;margin-top: 9px">{{ item.name }}</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png'
import './index.scss'
const list = ref(['https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',])
const swiperRef = ref() //
const subModuleList = ref([
{
id: 0,
icon: icon,
name: '企事业单位',
url: '/subPages/police/myEnterprisesUnit/myEnterprisesUnit'
},
{
id: 1,
icon: icon,
name: '警保风采',
url: ''
},
{
id: 2,
icon: icon,
name: '待定',
url: ''
}
])
const subNavigation = async (url: string) => Taro.navigateTo({url})
</script>

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '首页',
})

View File

@ -0,0 +1,9 @@
<template>
<view>
警察我的
</view>
</template>
<script setup lang="ts">
</script>

View File

@ -1,39 +0,0 @@
page {
background-color: #f0f0f0;
}
.content {
width: 702rpx;
margin: 10rpx auto;
background-color: #fff;
border-radius: 10rpx;
height: 500rpx;
display: grid;
/* 定义两列每列占据50%的宽度 */
grid-template-columns: repeat(2, 1fr);
/* 定义两行每行占据1fr分数单位表示剩余空间的一部分 */
grid-template-rows: repeat(2, 1fr);
/* 可选:增加一些间隙 */
gap: 10px;
.grid-item {
//width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.grid-item-image {
height: 150rpx;
width: 150rpx;
background-color: #f0f0f0;
border-radius: 50%;
}
.grid-item-text {
}
}
}

View File

@ -1,85 +0,0 @@
<template>
<view>
<view class="swiper-demo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 150px">
<img :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item>
</nut-swiper>
</view>
<view class="margin-top">
<nut-grid :column-num="3">
<nut-grid-item
text="企事业单位"
@click="Taro.navigateTo({url: '/subPages/pages/policeManager/index'})">
</nut-grid-item>
<nut-grid-item
text="警保风采"
@click="Taro.navigateTo({url: '/pages/index/dataEntry/personnelInformationEntry/personnelInformationEntry'})">
</nut-grid-item>
<nut-grid-item text=".....">
</nut-grid-item>
</nut-grid>
</view>
</view>
</template>
<script setup lang="ts">
import './index.scss'
import {ref} from 'vue'
import Taro from "@tarojs/taro";
const list = ref([
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg',
'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
])
const swiperRef = ref()
</script>
<!--<template>-->
<!-- <view>-->
<!-- <view class="content">-->
<!-- <div @tap="routerPush(1)" class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">企事业单位</view>-->
<!-- </div>-->
<!-- <div class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">监督考核</view>-->
<!-- </div>-->
<!-- <div class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">警保风采</view>-->
<!-- </div>-->
<!-- <div class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">三色预警</view>-->
<!-- </div>-->
<!-- </view>-->
<!-- </view>-->
<!--</template>-->
<!--<script setup lang="ts">-->
<!--import Taro from "@tarojs/taro";-->
<!--const routerPush = (path) => {-->
<!-- switch (path) {-->
<!-- case 1:-->
<!-- Taro.navigateTo({-->
<!-- url: '/subPages/pages/policeManager/index',-->
<!-- })-->
<!-- }-->
<!--}-->
<!--import './index.scss'-->
<!--</script>-->
<!--<style scoped lang="scss">-->
<!--</style>-->

View File

@ -1,4 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '首页',
navigationBarTitleText: '首页',
})

View File

@ -0,0 +1,48 @@
.swiperDemoItem {
color: #3886d0;
display: flex;
padding: 20px 0 0 50px;
overflow: hidden;
height: 70rpx;
.swiperDemoIndex {
width: 15px;
height: 45px;
background-image: linear-gradient(to bottom, #5d9cf9, #317ad9);
//background: rgb();
border-radius: 20px;
margin-right: 15px;
}
}
.subModule {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-right: -3px;
margin-left: -1px;
.subModuleItem {
width: 33%;
height: 180rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 10rpx;
border: 1px solid #ccc;
border-left: 0;
margin-top: -1px;
.subModuleIndex {
width: 65rpx;
height: 65rpx;
image {
width: 100%;
height: 100%;
}
}
}
}

View File

@ -1,41 +1,58 @@
<template>
<view>
<view class="swiper-demo">
<view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 150px">
<img :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/>
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px">
<image :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item>
</nut-swiper>
</view>
<view class="margin-top">
<nut-grid :column-num="3">
<nut-grid-item
text="我的项目"
@click="Taro.navigateTo({url: '/subPages/pages/myProject/myProject'})">
</nut-grid-item>
<nut-grid-item
text="警保风采"
@click="Taro.navigateTo({url: '/pages/index/dataEntry/personnelInformationEntry/personnelInformationEntry'})">
</nut-grid-item>
<nut-grid-item text=".....">
</nut-grid-item>
</nut-grid>
<view class="swiperDemoItem">
<view class="swiperDemoIndex"></view>
<view>请选择</view>
</view>
<!--九宫格-->
<view>
<view class="subModule">
<view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
<view class="subModuleIndex">
<image :src="item.icon"></image>
</view>
<view style=" font-size: 12px;color: #414141;margin-top: 9px">{{ item.name }}</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import './index.scss'
import {ref} from 'vue'
import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png'
import './index.scss'
const list = ref([
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg',
'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
const list = ref(['/assets/images/01.png',])
const swiperRef = ref() //
const subModuleList = ref([
{
id: 0,
icon: icon,
name: '我的项目',
url: '/subPages/projectManager/myProject/myProject'
},
{
id: 1,
icon: icon,
name: '警保风采',
url: ''
},
{
id: 2,
icon: icon,
name: '待定',
url: ''
}
])
const swiperRef = ref()
const subNavigation = async (url: string) => Taro.navigateTo({url})
</script>

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的',
})

View File

@ -0,0 +1,9 @@
<template>
<view>
项目经理我的
</view>
</template>
<script setup lang="ts">
</script>

View File

@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '用户注册'
navigationBarTitleText: '注册'
})

View File

@ -27,7 +27,7 @@
}
.nickNameInput{
color: black;
color: black;
}
.contact {

View File

@ -11,9 +11,9 @@
</nut-form-item>
<nut-form-item label="姓名:" prop="name">
<nut-input
v-model="formData.name"
placeholder="请输入您的昵称"
type="text"
v-model="formData.name"
placeholder="请输入您的昵称"
type="text"
/>
</nut-form-item>
<nut-form-item label="性别:" prop="sex">
@ -26,18 +26,18 @@
<nut-form-item label="身份:">
<nut-radio-group v-model="formData.identity">
<nut-radio
v-for="item in IDENTITY"
:key="item.value"
:label="item.value"
v-for="item in IDENTITY"
:key="item.value"
:label="item.value"
>{{ item.label }}
</nut-radio>
</nut-radio-group>
</nut-form-item>
<nut-form-item label="手机号:">
<nut-input
v-model="formData.telephone"
placeholder="请输入手机号码"
type="text"
v-model="formData.telephone"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="行政区划:" prop="name">
@ -47,21 +47,21 @@
</nut-form-item>
<nut-form-item label="单位:" name="unitId">
<view @click="unitsList" style="color: #808080">
{{ selectedLabel || '请选择单位'}}
{{ selectedLabel || '请选择单位' }}
</view>
</nut-form-item>
</nut-form>
<nut-cascader
v-model:visible="visible"
v-model="TreeValue"
title="选择地址"
:options="TreeData"
@change="change"
text-key="label"
v-model:visible="visible"
v-model="TreeValue"
title="选择地址"
:options="TreeData"
@change="change"
text-key="label"
></nut-cascader>
<nut-popup v-model:visible="show" position="bottom">
<nut-picker
:field-names="{
:field-names="{
text: 'label',
children: 'extData'
}" v-model="formData.unitId" :columns="columns" title="请选择单位" @confirm="confirm" @cancel="show = false"/>
@ -75,19 +75,23 @@
<script setup lang="ts">
import './register.scss'
import {onMounted, ref, watch} from "vue";
import {IDENTITY, SEX} from "@/enums";
import {enumSelectNodes} from "@/enums";
import Taro from "@tarojs/taro";
import api from '@/request/index'
import type {FormInstance} from "@nutui/nutui-taro";
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import {RegisterParams} from "@/types/pages/register";
const IDENTITY = enumSelectNodes('MiniProgramUserIdentity')
const SEX = enumSelectNodes('Sex')
const formData = ref<RegisterParams>({
avatar: "https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png",
name: "",
sex:0,
telephone:'',
sex: 0,
telephone: '',
identity: 'police',
unitId:''
unitId: ''
});
const show = ref(false)
const visible = ref(false)
@ -95,7 +99,7 @@ const TreeValue = ref<Record<string, any>[]>([])
const TreeData = ref(['']);
const streetCommunitySmallCommunityLabel = ref<string>("");
const getAdministrativeDivisionTree = async () => {
const resp = await api.get<TreeNode<string>[]>('/common/administrativeDivisionTree')
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree')
TreeData.value = resp.data as any
console.log(resp.data)
}
@ -105,34 +109,34 @@ const change = (value: string, pathNodes: Record<string, any>[]) => {
}
const columns = ref([])
const unitsList = async () => {
if(streetCommunitySmallCommunityLabel.value !== ''){
if (streetCommunitySmallCommunityLabel.value !== '') {
show.value = true
const queryUnitListByIdentityQueryParams = {
identity: formData.value.identity,
administrativeDivisionCodes: TreeValue.value
}
const resp = await api.post<TreeNode<string>[]>('/common/queryUnitListByIdentity', queryUnitListByIdentityQueryParams)
const resp = await api.post<TreeNodeVo<string>[]>('/common/queryUnitListByIdentity', queryUnitListByIdentityQueryParams)
columns.value = resp.data as any
}else{
Taro.showToast({
title:'请先选择行政区划',
})
} else {
Taro.showToast({
title: '请先选择行政区划',
})
}
}
const selectedLabel = ref ('')
const selectedLabel = ref('')
const confirm = ({selectedOptions, selectedValue}) => {
Object.keys(selectedOptions).forEach((e)=>{
Object.keys(selectedOptions).forEach((e) => {
selectedLabel.value = selectedOptions[e].label
formData.value.unitId = selectedOptions[e].value
})
console.log(formData.value.unitId,selectedLabel.value)
console.log(formData.value.unitId, selectedLabel.value)
show.value = false
}
//
watch(()=>formData.value.identity,(value)=>{
watch(() => formData.value.identity, (value) => {
formData.value.unitId = ''
selectedLabel.value = ''
})
@ -149,7 +153,7 @@ const register = async () => {
telephone: formData.value.telephone,
sex: formData.value.sex,
identity: formData.value.identity,
unitId:formData.value.unitId
unitId: formData.value.unitId
}
const resp = await api.post<string>('/miniProgramUser/register', miniProgramUserRegisterParams, {loading: true})
Taro.showToast({
@ -167,7 +171,7 @@ const register = async () => {
})
},
})
}else{
} else {
Taro.showToast({
title: res.errMsg,
icon: 'error',
@ -181,7 +185,7 @@ const register = async () => {
const rules: FormRules = {
name: [
{ required: true, message: "请输入姓名" },
{required: true, message: "请输入姓名"},
{
validator: (value) => {
return !(value.length < 2 || value.length >= 20);
@ -189,9 +193,9 @@ const rules: FormRules = {
message: "名字在2~20字符之间",
},
],
sex: [{ required: true, message: "请选择性别" }],
sex: [{required: true, message: "请选择性别"}],
telephone: [
{ required: true, message: "请输入手机号码" },
{required: true, message: "请输入手机号码"},
{
regex: /^400(-?)[0-9]{7}$|^1\d{10}$|^0[0-9]{2,3}-[0-9]{7,8}$/,
message: "手机格式错误",
@ -207,11 +211,10 @@ const onChooseAvatar = (e) => {
//
const getNickname = (e) => {
formData.value.name = e.detail.value
console.log( formData.value.name)
console.log(formData.value.name)
}
onMounted(async () => {
await getAdministrativeDivisionTree()
await getAdministrativeDivisionTree()
})
</script>

View File

@ -1,26 +1,33 @@
import Taro from "@tarojs/taro";
import {ApiOptions} from "../../types/request";
import {type} from "os";
import {ApiOptions} from "@/types/request";
import {useUserStore} from "@/store/userStore";
/**
*
* @param chain
*/
const requestInterceptor = (chain: Taro.Chain) => {
const requestParams = chain.requestParams
const token = Taro.getStorageSync('token')
if (token) {
requestParams.header = {
...requestParams.header,
token: token.value
}
const tokenInfo = useUserStore().getTokenInfo()
const {header} = requestParams;
const customHeader: Record<string, any> = {}
//添加token
tokenInfo && (customHeader[tokenInfo.name] = tokenInfo.value);
requestParams.header = {
...header,
...customHeader
}
return chain.proceed(requestParams)
}
class CustomRequest {
BASE_API: string
//所有的拦截器
const interceptors = [requestInterceptor];
//注册拦截器
interceptors.forEach((interceptorItem) => Taro.addInterceptor(interceptorItem));
public constructor() {
this.BASE_API = process.env.TARO_APP_BASE_API
Taro.addInterceptor(requestInterceptor)
}
class CustomRequest {
BASE_API: string = process.env.TARO_APP_BASE_API;
private request<T>(url: string, method: keyof Taro.request.Method, options: ApiOptions, params?: object,): Promise<JsonResult<T>> {
return new Promise<JsonResult<T>>((resolve, reject) => {
@ -29,7 +36,6 @@ class CustomRequest {
title: '请求中...',
}).then()
}
Taro.request<JsonResult<T>, object>({
url: this.BASE_API + url,
data: params,
@ -37,10 +43,14 @@ class CustomRequest {
...options,
success: (result) => {
Taro.hideLoading()
if (result.header['Content-Type'] === 'application/octet-stream') {
resolve(result.data)
return
}
const jsonResult = result.data
if (jsonResult.code !== 200) {
if ([401].includes(jsonResult.code)) {
//todo 重新登录 跳转登录页 提示错误
// 重新登录 跳转登录页 提示错误
}
Taro.showToast({
title: jsonResult.message,
@ -49,8 +59,9 @@ class CustomRequest {
duration: 2000
}).then()
reject(jsonResult);
} else {
resolve(jsonResult);
}
resolve(jsonResult);
},
fail: (res) => {
Taro.hideLoading()
@ -61,13 +72,16 @@ class CustomRequest {
duration: 2000
}).then()
reject(res.errMsg);
console.log(res.errMsg, '000')
}
})
})
}
get<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> {
options.header = {
...options.header,
"content-type": 'application/x-www-form-urlencoded'
}
return this.request<T>(url, "GET", options, params)
}
@ -76,12 +90,17 @@ class CustomRequest {
}
delete<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> {
options.header = {
...options.header,
"content-type": 'application/x-www-form-urlencoded'
}
return this.request(url, "DELETE", options, params)
}
put<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> {
return this.request(url, "PUT", options, params)
}
}
const api = new CustomRequest();

View File

@ -1,51 +1,3 @@
import {defineStore} from 'pinia'
import Taro from '@tarojs/taro'
export const useCounterStore = defineStore('counter', {
state: () => {
return {
userInfo: {},
selected: 0,
list: Taro.getStorageSync('list') || [
{
pagePath: '/pages/projectManager/index/index',
text: '首页',
iconPath: "/assets/mine/punch.png",
selectedIconPath: "/assets/mine/punch-active.png"
},
{
pagePath: '/pages/employeeInfo/employeeInfo',
text: '员工信息',
iconPath: "/assets/mine/punch.png",
selectedIconPath: "/assets/mine/punch-active.png"
},
{
pagePath: '/pages/mine/mine',
text: '我的',
iconPath: "/assets/mine/my.png",
selectedIconPath: "/assets/mine/my-active.png"
},
]
}
},
actions: {
setSelected(index: number) {
this.selected = index
},
updateHomePagePath(newPath: string) {
this.list[0].pagePath = newPath
// 更新 list 后存储到小程序本地存储
Taro.setStorageSync('list', this.list)
}
},
getters: {
getSelected: (state) => state.selected,
getList: (state) => state.list
},
persist: {
// key: 'my-store', // 存储到 localStorage 的 key
// storage: localStorage, // 持久化方式为 localStorage
// paths: ['list'] // 持久化 list
}
})
import {createPinia} from 'pinia'
export const pinia = createPinia()

View File

@ -0,0 +1,14 @@
import {defineStore} from "pinia";
import {ref} from "vue";
export const useTabBarStore = defineStore('tabBar', () => {
const selected = ref<number>(0)
const setSelected = (index: number) => {
selected.value = index;
}
return {
selected,
setSelected
}
})

View File

@ -0,0 +1,40 @@
import {defineStore} from "pinia";
import {ref} from "vue";
import Taro from "@tarojs/taro";
export const useUserStore = defineStore('userStore', () => {
/** 获取token信息 **/
const getTokenInfo = (): TokenInfo | null => {
const ti = Taro.getStorageSync('tokenInfo')
// 如果 ti 存在且不是空字符串,则返回 ti否则返回 null
return (ti !== undefined && ti !== null && ti !== '') ? ti : null;
}
/** 用户token信息 **/
const tokenInfo = ref<TokenInfo | null>(getTokenInfo())
/** 保存token信息 **/
const saveTokenInfo = (t: TokenInfo) => {
tokenInfo.value = t;
Taro.setStorageSync('tokenInfo', tokenInfo.value)
}
/** 清楚token信息 */
const clearTokenInfo = () => {
tokenInfo.value = null
Taro.removeStorageSync('tokenInfo')
}
/**
*
* 退
*/
const resetUserInfo = () => {
clearTokenInfo()
}
return {
tokenInfo,
saveTokenInfo,
getTokenInfo,
resetUserInfo
}
})

View File

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '项目人员录入',
})

View File

@ -1,8 +0,0 @@
.form{
.formButton{
display: flex;
margin-top: auto;
justify-content: space-around;
margin-bottom: 30px
}
}

View File

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '我的项目',
})

View File

@ -1,31 +0,0 @@
.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;
}
}
}
}

View File

@ -1,53 +0,0 @@
.projectDetails{
height: 100vh;
overflow: hidden;
background: #f1f1f1;
display: flex;
flex-direction: column;
.projectDetailsItem{
height: 18%;
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 65px;
color: #333333;
.projectDetailsIndex{
.content{
color: #9b9b9f;
}
}
}
.projectDetailsTableDrop{
height: 80%;
.projectDetailsTable{
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 50px;
color: #333333;
.projectDetailsTableItem{
//display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
font-size: 24px;
margin-bottom: 15px
}
}
}
.projectDetailsButton{
position: fixed;
bottom: 19px;
display: flex;
-webkit-justify-content: space-around;
margin-bottom: 10rpx;
right: 0;
width: 100%;
}
}

View File

@ -1,4 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '企事业单位',
})

View File

@ -13,8 +13,9 @@
<text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view>
<view class="project">
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index">
{{ items.name }}
<view @click="projectClick(item?.name,serviceProject)" v-for="(serviceProject,index) in item.serviceProjectList"
:key="index">
{{ serviceProject.name }}
</view>
</view>
</view>
@ -25,33 +26,21 @@
import api from "@/request/index";
import {onMounted, ref} from "vue";
import Taro from "@tarojs/taro";
import './index.scss'
import './myEnterprisesUnit.scss'
import {MyProjectList, ServiceProjectList} from "@/types/subPages/projectManager/myProject";
const myProjectList = ref<MyProjectList[]>()
const getMyServiceProject = async () => {
const token = Taro.getStorageSync('token')
const resp = await api.get<MyProjectList[]>(`/policeIndex/getUnitServiceProjectList`, {
token: token.value
})
const resp = await api.get<MyProjectList[]>(`/policeIndex/getUnitServiceProjectList`)
myProjectList.value = resp.data
console.log(resp.data)
}
const projectClick = (items: ServiceProjectList, name: string) => {
console.log(name, JSON.stringify(items))
const projectClick = (enterprisesUnitName: string, serviceProject: ServiceProjectList) => {
Taro.navigateTo({
url: `/subPages/pages/policeDetails/index?name=${name}&item=${JSON.stringify(items)}`,
url: `/subPages/police/myEnterprisesUnit/projectDetails/projectDetails?enterprisesUnitName=${enterprisesUnitName}&serviceProject=${JSON.stringify(serviceProject)}`,
})
}
onMounted(async () => {
await getMyServiceProject()
})
</script>

View File

@ -1,10 +1,11 @@
.projectDetails{
.projectDetails {
height: 100vh;
overflow: hidden;
background: #f1f1f1;
display: flex;
flex-direction: column;
.projectDetailsItem{
.projectDetailsItem {
margin: 10px 20px 10px 20px;
border-radius: 10px;
background: #ffffff;
@ -12,19 +13,23 @@
font-size: 28px;
line-height: 65px;
color: #333333;
.projectDetailsIndex{
.projectDetailsIndex {
display: flex;
flex-wrap: wrap;
line-height: 44rpx;
margin-bottom: 20px;
.content{
color: #9b9b9f;
}
.content {
color: #9b9b9f;
}
}
}
.projectDetailsTableDrop{
.projectDetailsTableDrop {
height: 80%;
.projectDetailsTable{
.projectDetailsTable {
margin: 20px;
border-radius: 10px;
background: #ffffff;
@ -32,26 +37,30 @@
font-size: 28px;
line-height: 50px;
color: #333333;
.projectDetailsTableItem{
.projectDetailsTableItem {
//display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
font-size: 24px;
margin-bottom: 15px;
.projectDetailsTableIndex{
display: flex;
justify-content: flex-end;
text-align: center;
view{
width: 70px;
margin-right: 20px;
}
.projectDetailsTableIndex {
display: flex;
justify-content: flex-end;
text-align: center;
view {
width: 70px;
margin-right: 20px;
}
}
}
}
}
.projectDetailsButton{
.projectDetailsButton {
position: fixed;
bottom: 19px;
display: flex;
@ -60,12 +69,11 @@
right: 0;
width: 100%;
}
.nutPopup{
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
.nutPopup {
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
}
}

View File

@ -1,33 +1,45 @@
<template>
<view class="projectDetails">
<view class="projectDetailsItem">
<view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
<!--<text>进行中</text>-->
<view class="projectDetailsItem" style="line-height: 50rpx">
<view>
<view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ enterprisesUnitName }}-----{{ serviceProject?.name }}项目</text>
<!-- <text>进行中</text>-->
</view>
<view>
<view style="float: left;width: 50%;" class="content">
经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }}
</view>
<view class="content">手机号:{{ serviceProject?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view>
</view>
</view>
<view class="projectDetailsItem">
<view class="projectDetailsIndex">
<nut-row>
<nut-col :span="12">
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">保安人员数量:{{ detailsList?.securityUserTotal }}</view>
<nut-col :span="24">
<view class="content">保安证件号{{ serviceProject?.idNumber }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">服务区域面积:{{ detailsList?.serviceArea }}</view>
<view class="content">工作人员数量:{{ serviceProject?.staffTotal }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">楼栋数量:{{ detailsList?.buildingTotal }}</view>
<view class="content">保安人员数量:{{ serviceProject?.securityUserTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="16">
<view class="content">证件号{{ detailsList?.idNumber }}</view>
<nut-col :span="12">
<view class="content">服务区域面积:{{ serviceProject?.serviceArea }}</view>
</nut-col>
<nut-col :span="8">
<view class="content">户数:{{ detailsList?.houseTotal }}</view>
<nut-col :span="12">
<view class="content">楼栋数量:{{ serviceProject?.buildingTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="4">
<view class="content">户数:{{ serviceProject?.houseTotal }}</view>
</nut-col>
</nut-row>
</view>
@ -39,7 +51,7 @@
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
>
<view class="projectDetailsTable" v-for="(item,index) in projectData" :key="index">
<view class="projectDetailsTable" v-for="(item,index) in securityUserList" :key="index">
<view>
<view class="projectDetailsTableItem">
<view>
@ -67,17 +79,19 @@
</template>
<script setup lang="ts">
import Taro, {useLoad} from "@tarojs/taro";
import './index.scss'
import './projectDetails.scss'
import {ref} from "vue";
import api from "@/request/index";
import * as dayjs from 'dayjs'
import dayjs from 'dayjs'
import {ServiceProjectSecurityUserPagerVo} from "@/types/subPages/projectManager/myProject";
const detailsList = ref()
const nameValue = ref('')
const projectData = ref<Records<string>[]>([])
useLoad(async (options: MyProjectList) => {
nameValue.value = options.name
detailsList.value = await JSON.parse(options.item)
const serviceProject = ref()
const enterprisesUnitName = ref('')
const securityUserList = ref<ServiceProjectSecurityUserPagerVo[]>([])
useLoad(async (options) => {
enterprisesUnitName.value = options.enterprisesUnitName
serviceProject.value = JSON.parse(options.serviceProject)
console.log(serviceProject.value);
await projectDetailsTable()
})
const projectDetailsTable = async () => {
@ -87,22 +101,20 @@ const projectDetailsTable = async () => {
})
const queryParams = {
params: {
serviceProjectId: detailsList.value?.snowFlakeId,
serviceProjectId: serviceProject.value.snowFlakeId,
},
page: {
size: 4,
current: current.value
}
}
const resp = await api.post<ProjectData>('/miniProgramUser/securityUserPager', queryParams)
projectData.value = [...projectData.value, ...resp?.data.records]
total.value = resp?.data.total
const resp = await api.post<PagerVo<ServiceProjectSecurityUserPagerVo>>('/miniProgramUser/securityUserPager', queryParams)
securityUserList.value = [...securityUserList.value, ...resp.data!.records]
total.value = resp.data!.total
isRefresher.value = false
Taro.hideLoading()
}
const formAdd = () => {
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(detailsList.value)}`})
}
const total = ref<any>(null)
const current = ref(1)
const isRefresher = ref(false)
@ -112,17 +124,16 @@ const upper = (e) => {
console.log('到顶了:', e)
}
// /
const lower = (e) => {
if (total.value === projectData.value.length) return
if (total.value > projectData.value.length) {
console.log('触底了:', e)
const lower = () => {
if (total.value === securityUserList.value.length) return
if (total.value > securityUserList.value.length) {
current.value = current.value + 1
projectDetailsTable()
}
}
//
const onRefresherRefresh = (e) => {
projectData.value = []
securityUserList.value = []
total.value = null
current.value = 1 //
isRefresher.value = true
@ -130,4 +141,3 @@ const onRefresherRefresh = (e) => {
projectDetailsTable()
}
</script>

View File

@ -0,0 +1,35 @@
.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;
}
}
}
}

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的项目',
})

View File

@ -1,10 +1,9 @@
<template>
<view class="myProject">
<view v-if="myProjectList">
<view class="myProjectItem" v-for="(item,index) in myProjectList" :key="index">
<view v-if="number !== 0">
<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>
@ -14,13 +13,14 @@
<text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view>
<view class="project">
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index">
{{ items.name }}
<view @click="projectClick(item.name,serviceProject)"
v-for="(serviceProject,index) in item.serviceProjectList" :key="index">
{{ serviceProject.name }}
</view>
</view>
</view>
</view>
<view v-else class="myProject" >
<view v-else class="myProject">
<nut-empty image="empty" description="暂无项目">
<div style="margin-top: 10px">
</div>
@ -33,25 +33,24 @@
import api from "@/request/index";
import {onMounted, ref} from "vue";
import Taro from "@tarojs/taro";
import './myproject.scss'
import './myProject.scss'
import {MyProjectList, ServiceProjectList} from "@/types/subPages/projectManager/myProject";
const myProjectList = ref<MyProjectList[]>()
const number = ref(0)
const getMyServiceProject = async () => {
const resp = await api.get<MyProjectList[]>(`/projectManageIndex/getMyServiceProject`)
myProjectList.value = resp.data
console.log(myProjectList.value.length)
number.value = (resp.data?.length || 0)
}
const projectClick = (items: ServiceProjectList, name: string) => {
const projectClick = (enterprisesUnitName: string, serviceProject: ServiceProjectList) => {
Taro.navigateTo({
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`,
url: `/subPages/projectManager/myProject/projectDetails/projectDetails?enterprisesUnitName=${enterprisesUnitName}&serviceProject=${JSON.stringify(serviceProject)}`,
})
}
onMounted(async () => {
await getMyServiceProject()
})
</script>
<!--<style scoped lang="scss">-->
<!--</style>-->

View File

@ -0,0 +1,105 @@
.projectDetails {
height: 100vh;
overflow: hidden;
background: #f1f1f1;
display: flex;
flex-direction: column;
.projectDetailsItem {
margin: 10px 20px 10px 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 65px;
color: #333333;
.projectDetailsIndex {
display: flex;
flex-wrap: wrap;
line-height: 44rpx;
margin-bottom: 20px;
.content {
color: #9b9b9f;
}
}
}
.projectDetailsTableDrop {
height: 80%;
.projectDetailsTable {
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 50px;
color: #333333;
.projectDetailsTableItem {
//display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
font-size: 24px;
margin-bottom: 15px;
.projectDetailsTableIndex {
display: flex;
justify-content: flex-end;
text-align: center;
view {
width: 70px;
margin-right: 20px;
}
}
}
}
}
.projectDetailsButton {
position: fixed;
bottom: 19px;
display: flex;
-webkit-justify-content: space-around;
margin-bottom: 10rpx;
right: 0;
width: 100%;
}
.nutPopup {
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
}
.qrcodeVisibleUrl {
margin-bottom: 5px;
image {
width: 100%;
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
.warpItem {
width: 90%;
height: 50%;
text-align: center;
.rect {
width: 100%;
height: 100%;
}
}
}
}

View File

@ -3,17 +3,15 @@
<view class="projectDetailsItem" style="line-height: 50rpx">
<view>
<view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{
'-----' + serviceProjectDetails?.name
}}项目
<text style="font-size: 18px">{{ enterprisesUnitName }}-----{{ serviceProject?.name }}
</text>
<text>进行中</text>
</view>
<view>
<view style="float: left;width: 50%;" class="content">
经理名称:{{ serviceProjectDetails?.projectManagerMiniProgramUserInfo.name }}
经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }}
</view>
<view class="content">手机号:{{ serviceProjectDetails?.projectManagerMiniProgramUserInfo.telephone }}</view>
<view class="content">手机号:{{ serviceProject?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view>
</view>
</view>
@ -21,28 +19,28 @@
<view class="projectDetailsIndex">
<nut-row>
<nut-col :span="24">
<view class="content">保安证件号{{ serviceProjectDetails?.idNumber }}</view>
<view class="content">保安证件号{{ serviceProject?.idNumber }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">工作人员数量:{{ serviceProjectDetails?.staffTotal }}</view>
<view class="content">工作人员数量:{{ serviceProject?.staffTotal }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">保安人员数量:{{ serviceProjectDetails?.securityUserTotal }}</view>
<view class="content">保安人员数量:{{ serviceProject?.securityUserTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">服务区域面积:{{ serviceProjectDetails?.serviceArea }}</view>
<view class="content">服务区域面积:{{ serviceProject?.serviceArea }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">楼栋数量:{{ serviceProjectDetails?.buildingTotal }}</view>
<view class="content">楼栋数量:{{ serviceProject?.buildingTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="4">
<view class="content">户数:{{ serviceProjectDetails?.houseTotal }}</view>
<view class="content">户数:{{ serviceProject?.houseTotal }}</view>
</nut-col>
</nut-row>
</view>
@ -54,7 +52,7 @@
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
>
<view class="projectDetailsTable" v-for="(item,index) in projectData" :key="index">
<view class="projectDetailsTable" v-for="(item,index) in securityUserList" :key="index">
<view>
<view class="projectDetailsTableItem">
<view>
@ -74,7 +72,7 @@
</view>
<view class="projectDetailsTableIndex">
<view style="color: #3a6bbe" @click="detail(item)">详情</view>
<view style="color: #ffa60d" @click="projectEdit(item)">编辑</view>
<view style="color: #ffa60d" @click="securityUserEdit(item)">编辑</view>
<view style="color: red" @click="deleteUssrID(item.snowFlakeId)">删除</view>
</view>
</view>
@ -85,9 +83,8 @@
</view>
<view class="projectDetailsButton">
<nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button>
<nut-button style="width: 45%" type="info">二维码录入</nut-button>
<nut-button style="width: 45%" type="info" @click="generateMiniProgramQRCode">二维码录入</nut-button>
</view>
<view>
<nut-dialog
content="是否确认删除该用户?"
@ -99,35 +96,62 @@
<nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible">
<slot>
<view style="margin-bottom: 5px">
<view>籍贯{{ content.nativePlace }}</view>
<view>公司{{ content.securityUnitName }}</view>
<view>家庭地址{{ content.homeAddress }}</view>
<view>备注{{ content.remark }}</view>
<view>籍贯{{ securityUserDetail.nativePlace }}</view>
<view>公司{{ securityUserDetail.securityUnitName }}</view>
<view>家庭地址{{ securityUserDetail.homeAddress }}</view>
<view>备注{{ securityUserDetail.remark }}</view>
</view>
</slot>
</nut-dialog>
</view>
<!-- 二维码-->
<view>
<nut-dialog no-cancel-btn content="二维码" v-model:visible="qrcodeVisible">
<slot>
<view class="qrcodeVisibleUrl" @click="showImage">
<image style="width: 100%" show-menu-by-longpress='1' :lazy-load="true" :src="qrCodeImage"
mode="aspectFit"/>
</view>
</slot>
</nut-dialog>
</view>
<nut-overlay v-model:visible="showOverlay">
<view class="warp">
<view class="warpItem">
<movable-area :scale-area="true">
<movable-view direction="all" style="width: 348px; height: 300px;" :scale="true" :scale-min="1"
:scale-max="4" :scale-value="1" :x="2" :y="10">
<image class="rect" show-menu-by-longpress='1' :src="qrCodeImage" mode="widthFix"/>
</movable-view>
</movable-area>
</view>
</view>
</nut-overlay>
</view>
</template>
<script setup lang="ts">
import Taro, {useLoad, useDidShow} from "@tarojs/taro";
import Taro, {useDidShow, useLoad} from "@tarojs/taro";
import './projectDetails.scss'
import {ref} from "vue";
import api from "@/request/index";
import * as dayjs from 'dayjs'
import dayjs from 'dayjs'
import {ServiceProjectSecurityUserPagerVo} from "@/types/subPages/projectManager/myProject";
import {SecurityUserFormParams} from "@/types/subPages/projectManager/securityUserForm";
const serviceProjectDetails = ref()
const nameValue = ref('')
const projectData = ref<Records[]>([])
const serviceProject = ref()
const enterprisesUnitName = ref('')
const securityUserList = ref<ServiceProjectSecurityUserPagerVo[]>([])
const content = ref<Records>({} as any)
const securityUserDetail = ref<ServiceProjectSecurityUserPagerVo>({} as any)
//
const confirmVisible = ref(false);
const detailVisible = ref(false)
useLoad(async (options: MyProjectList) => {
nameValue.value = options.name
serviceProjectDetails.value = await JSON.parse(options.item)
const qrcodeVisible = ref(false)
const showOverlay = ref(false)
useLoad((options) => {
enterprisesUnitName.value = options.enterprisesUnitName
serviceProject.value = JSON.parse(options.serviceProject)
})
useDidShow(async () => {
initServiceProjectSecurityUserList()
@ -138,23 +162,24 @@ const projectDetailsTable = async () => {
})
const queryParams = {
params: {
serviceProjectId: serviceProjectDetails.value?.snowFlakeId,
serviceProjectId: serviceProject.value.snowFlakeId,
},
page: {
size: 4,
current: current.value
}
}
const resp = await api.post<ProjectData>('/miniProgramUser/securityUserPager', queryParams)
projectData.value = [...projectData.value, ...resp?.data.records]
total.value = resp?.data.total
const resp = await api.post<PagerVo<ServiceProjectSecurityUserPagerVo>>('/miniProgramUser/securityUserPager', queryParams)
securityUserList.value = [...securityUserList.value, ...resp.data!.records]
total.value = resp.data!.total
isRefresher.value = false
Taro.hideLoading()
}
const formAdd = () => {
const params = {
serviceProjectId: serviceProjectDetails.value.snowFlakeId,
snowFlakeId: undefined,
serviceProjectId: serviceProject.value.snowFlakeId,
securityUnitId: serviceProject.value.securityUnitId,
name: '',
workPost: '',
sex: 0,
@ -163,9 +188,10 @@ const formAdd = () => {
dateOfBirth: null,
securityNumber: '',
remark: '',
homeAddress: ''
}
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
homeAddress: '',
telephone: ''
} as SecurityUserFormParams
Taro.navigateTo({url: `/subPages/projectManager/securityUserForm/securityUserForm?securityUser=${JSON.stringify(params)}&&type=formInput`})
}
const total = ref<any>(null)
const current = ref(1)
@ -173,15 +199,15 @@ const isRefresher = ref(false)
const scrollTop = ref(0)
const toView = ref('demo2')
// /
const lower = (e) => {
if (total.value === projectData.value.length) return
if (total.value > projectData.value.length) {
const lower = () => {
if (total.value === securityUserList.value.length) return
if (total.value > securityUserList.value.length) {
current.value = current.value + 1
projectDetailsTable()
}
}
const initServiceProjectSecurityUserList = () => {
projectData.value = []
securityUserList.value = []
total.value = null
current.value = 1 //
isRefresher.value = true
@ -189,7 +215,7 @@ const initServiceProjectSecurityUserList = () => {
}
//
const onRefresherRefresh = (e) => {
const onRefresherRefresh = () => {
initServiceProjectSecurityUserList()
}
@ -202,26 +228,43 @@ const deleteUssrID = (snowFlakeId: string) => {
}
//
const dialogOk = async () => {
await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`, {securityUserId: securityUserId.value}, {
header: {
"content-type": 'application/x-www-form-urlencoded'
}
})
await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`, {securityUserId: securityUserId.value})
initServiceProjectSecurityUserList()
}
//
const detail = (item) => {
const detail = (item: ServiceProjectSecurityUserPagerVo) => {
detailVisible.value = true
content.value = item
securityUserDetail.value = item
}
const projectEdit = (item) => {
const securityUserEdit = (item: ServiceProjectSecurityUserPagerVo) => {
const params = {...item, sex: item.sex.value}
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
Taro.navigateTo({url: `/subPages/projectManager/securityUserForm/securityUserForm?securityUser=${JSON.stringify(params)}&type=formInput`})
}
const qrCodeImage = ref('')
const generateMiniProgramQRCode = async () => {
const paramsData = {
path: `/subPages/projectManager/securityUserForm/securityUserForm?uid=${serviceProject.value.securityUnitId}&pid=${serviceProject.value.snowFlakeId}&type=QcCodeInput`,
width: 200,
}
qrcodeVisible.value = true
const resp = await api.get('/projectManageIndex/shareForm_QR_Code', paramsData, {
header: {
"content-type": 'application/x-www-form-urlencoded'
},
responseType: 'arraybuffer'
})
qrCodeImage.value = 'data:image/jpeg;base64,' + Taro.arrayBufferToBase64(resp as unknown as ArrayBuffer);
}
const showImage = () => {
showOverlay.value = true
qrcodeVisible.value = false
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,8 @@
.form {
.formButton {
display: flex;
margin-top: auto;
justify-content: space-around;
margin-bottom: 30px
}
}

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '项目人员录入',
})

View File

@ -17,13 +17,17 @@
<nut-form-item label="出生日期" prop="dateOfBirth">
<view @click="showPicker = true">
{{
dayjs(formData.dateOfBirth).isValid() ? dayjs(formData.dateOfBirth).format('YYYY-MM-DD') : '请选择出生年月'
formData.dateOfBirth ? dayjs(formData.dateOfBirth).format('YYYY-MM-DD') : '请选择出生年月'
}}
</view>
</nut-form-item>
<nut-form-item label="工作岗位" prop="workPost">
<nut-input v-model="formData.workPost" placeholder="请输入工作岗位" type="text"/>
</nut-form-item>
<nut-form-item label="手机号" prop="telephone">
<nut-input v-model="formData.telephone" placeholder="请输入手机号" type="text"/>
</nut-form-item>
<nut-form-item label="籍贯" prop="nativePlace">
<nut-input v-model="formData.nativePlace" placeholder="请输入籍贯" type="text"/>
</nut-form-item>
@ -39,7 +43,7 @@
</nut-form>
<view class="formButton">
<nut-button style="width: 45%" type="success" size="small" @click="submit">提交</nut-button>
<nut-button style="width: 45%" size="small" @click="formRef.value?.reset()">重置表单</nut-button>
<nut-button style="width: 45%" size="small" @click="formRef?.reset()">重置表单</nut-button>
</view>
<nut-popup v-model:visible="showPicker" position="bottom">
<nut-date-picker
@ -55,17 +59,23 @@
</template>
<script setup lang="ts">
import {ref} from "vue";
import {SEX} from "@/enums";
import {enumSelectNodes} from "@/enums";
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import api from "@/request";
import './form.scss'
import './securityUserForm.scss'
import Taro, {useLoad} from "@tarojs/taro";
import dayjs from "dayjs";
import {SecurityUserFormParams} from "@/types/subPages/projectManager/securityUserForm";
import {FormInstance} from "@nutui/nutui-taro";
const SEX = enumSelectNodes('Sex')
const showPicker = ref(false)
const formData = ref<formDate>({} as any)
const formRef = ref(null)
const type = ref<'formInput' | 'QcCodeInput'>(null!);
const formData = ref<SecurityUserFormParams>({} as any)
const formRef = ref<FormInstance>(null!)
const rules: FormRules = {
name: [
@ -78,11 +88,25 @@ const rules: FormRules = {
regex: /^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))((0[1-9])|([12][0-9])|(30|31))\d{3}(\d|X)$)/,
message: "身份证格式错误",
},
],
telephone: [
{required: true, message: "请输入手机号"},
]
};
useLoad((options) => {
formData.value = JSON.parse(options.item)
type.value = options.type;
if (type.value === 'QcCodeInput') {
formData.value = {
serviceProjectId: options.pid,
securityUnitId: options.uid,
sex: 0,
idCard: '',
dateOfBirth: null
}
} else {
formData.value = JSON.parse(options.securityUser)
}
})
const idCardBlur = (e: any) => {
@ -101,7 +125,13 @@ const idCardBlur = (e: any) => {
const submit = () => {
formRef.value?.validate().then(async ({valid}) => {
if (valid) {
const resp = await api.post('/projectManageIndex/saveOrUpdateSecurityUser', formData.value)
let url: string;
if (type.value === 'formInput') {
url = '/projectManageIndex/saveOrUpdateSecurityUser'
} else {
url = '/miniProgramUser/qrCodeFormInputSecurityUser'
}
const resp = await api.post(url, formData.value)
Taro.showToast({
title: resp.message,
icon: 'success',
@ -111,6 +141,7 @@ const submit = () => {
formData.value = {
snowFlakeId: undefined,
serviceProjectId: formData.value.serviceProjectId,
securityUnitId: formData.value.securityUnitId,
name: '',
workPost: '',
telephone: '',
@ -126,7 +157,3 @@ const submit = () => {
})
}
</script>
<style scoped lang="scss">
</style>

View File

@ -1,67 +0,0 @@
import Taro from "@tarojs/taro";
/**
*
* @param {*} scope
* @param {*} successCallback
* @param {*} failCallback
*/
export function pullAuth(scope, successCallback, failCallback) {
const map = new Map([
['scope.userInfo', '用户信息'],
['scope.userLocation', '地理位置'],
['scope.userLocationBackground', '后台定位'],
['scope.address', '通信地址'],
['scope.record', '录音功能'],
['scope.writePhotosAlbum', '保存到相册'],
['scope.camera', '摄像头'],
['scope.invoice', '获取发票'],
['scope.invoiceTitle', '发票抬头'],
['scope.werun', '微信运动步数'],
])
Taro.getSetting({
success(res) {
if (!res.authSetting[scope]) {
Taro.authorize({
scope,
success(){ // 允许授权
successCallback()
},
fail(){ // 拒绝授权
if (map.has(scope)) {
let word = map.get(scope)
Taro.showModal({
content:`检测到您没打开${word}权限,是否去设置打开?`,
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
Taro.openSetting({
success: (res) => {
successCallback()
},
fail: () => {
failCallback()
},
})
}else{
failCallback()
}
}
})
} else {
Taro.showToast({
title: '无此授权功能'
})
failCallback()
}
}
})
} else {
successCallback()
}
}
})
}

View File

@ -9,9 +9,9 @@
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"outDir": "lib",
"noUnusedLocals": false,
"noUnusedParameters": false,
"strictNullChecks": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"sourceMap": true,
"rootDir": ".",
"jsx": "preserve",
@ -21,8 +21,12 @@
"node_modules/@types"
],
"paths": {
// TS5090 leading './'
"@/*": [
"src/*"
"./src/*"
],
"@/types/*": [
"./types/*"
]
}
},

View File

@ -0,0 +1,8 @@
import Taro from "@tarojs/taro";
export interface UserConfig {
/** 跳转的首页地址 **/
toIndex: string;
/** 身份对应的tabBar列表 **/
tabBarList: Taro.TabBarItem[]
}

View File

@ -22,7 +22,8 @@ declare namespace NodeJS {
* @description env `TARO_APP_ID`便 appid dist/project.config.json
* @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
*/
TARO_APP_ID: string,
TARO_APP_ID: string
/** 后台服务接口地址 **/
TARO_APP_BASE_API: string
}
}
@ -31,18 +32,37 @@ declare module '@tarojs/components' {
export * from '@tarojs/components/types/index.vue3'
}
/**
*
*/
type MiniProgramUserIdentity = 'police' | 'project_manager'
/**
*
*/
interface SelectNode<T> {
value: T,
label: string,
options?: SelectNode<T>[]
orderIndex?: number,
disabled?: boolean,
extData?: Record<string, any>
interface SelectNodeVo<T, E = Record<string, any>> {
value: T;
label: string;
orderIndex?: number;
disabled?: boolean;
extData?: E
}
/**
*
*/
interface TreeNodeVo<T, E = Record<string, any>> {
value: T;
parentValue: T;
label: string;
orderIndex?: number;
children?: TreeNodeVo<T>[]
extData?: E;
}
/**
*
*/
interface JsonResult<T> {
code: number;
data?: T;
@ -50,13 +70,35 @@ interface JsonResult<T> {
}
/**
*
*
*/
interface TreeNode<T> {
value: T,
parentValue: T,
label: string,
orderIndex?: number,
extData?: Record<string, any>,
children?: TreeNode<T>[]
interface PagerVo<T> {
size: number,
total: number;
current: number;
records: T[]
}
/**
* token信息
*/
interface TokenInfo {
/** token名称 **/
name: string;
/** token值 **/
value: string;
/** 拓展属性 **/
extData: {
/** 身份 **/
identity: BaseEnum<MiniProgramUserIdentity>
}
}
/**
*
*/
interface BaseEnum<T, E = Record<string, any>> {
value: T;
label: string;
extData: E;
}

View File

@ -1,39 +0,0 @@
interface PersonnelInformation {
name: string,
sex: number,
dataOfBirth: Date | string,
idCard: string,
phone: string,
householdRegistrationAddress: string,
streetCommunitySmallCommunityIds: string[],
buildingFloorHouseIds: string[]
}
interface EnterUserInfoSaveOrUpdateParams {
snowFlakeId?: string,
streetId?: string,
communityId?: string,
smallCommunityId?: string,
buildingId?: string,
floorId?: string,
houseId?: string,
name: string,
sex: number,
dateOfBirth?: Date | string
idCard: string
phone: string
householdRegistrationAddress?: string
optFlag: null | 0 | 1
}
interface SystemExitsPopulationInformationVo {
snowFlakeId: string,
name: string,
sex: number,
residentialDivisionDetail: string,
createTime: string,
createUserName: string
}

View File

@ -1,5 +0,0 @@
interface LoginUserInfo {
clientType?: string;
avatar?: string;
}

View File

@ -1,44 +0,0 @@
interface MyProjectList {
item?:any,
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;
projectManagerMiniProgramUserInfo?:ProgramUserInfo
}
interface ProgramUserInfo{
idCard: null
name: string
telephone: string
}

View File

@ -1,29 +0,0 @@
interface Records{
createTime?: string;
dateOfBirth?: string;
homeAddress?: string;
idCard?: string;
name?: string;
nativePlace?: string;
remark?: string;
securityNumber?: string;
securityUnitId?: string;
securityUnitName?: string;
serviceProjectId?: string;
snowFlakeId:string;
workPost?:string;
sex?:Sex
}
interface ProjectData<T> {
current?:string;
pages?:string;
records?: Records[];
size?: string;
total?: string;
data: Records[];
}
interface Sex {
value:number,
label:string
}

View File

@ -1,8 +0,0 @@
interface RegisterParams {
avatar: string;
name: string;
sex:number,
telephone:string,
identity: string;
unitId: any
}

View File

@ -0,0 +1,8 @@
export interface RegisterParams {
avatar: string;
name: string;
sex: number,
telephone: string,
identity: string;
unitId: string
}

View File

@ -1,9 +0,0 @@
import Taro from "@tarojs/taro";
export interface ApiOptions
extends Omit<
Taro.request.Option,
"url" | "method" | "data" | "success" | "fail"
> {
loading?: boolean;
}

View File

@ -0,0 +1,5 @@
import Taro from "@tarojs/taro";
export interface ApiOptions extends Omit<Taro.request.Option, "url" | "method" | "data" | "success" | "fail"> {
loading?: boolean;
}

View File

@ -0,0 +1,61 @@
export interface MyProjectList {
item?: any,
address?: string;
city?: string;
cityName?: string;
contactPersonInfo: ContactPersonInfo;
districts?: string;
districtsName?: string;
name: string;
province?: string;
provinceName: string;
remark?: string;
serviceProjectList: ServiceProjectList[];
snowFlakeId?: string;
securityUnitId: string;
street?: string;
streetName?: string;
}
export interface ContactPersonInfo {
name: string;
telephone: string
}
export interface ServiceProjectList {
buildingTotal?: number;
houseTotal?: number;
idNumber?: string;
isRecruitSecurity?: null;
name?: string;
remark?: string;
securityUserTotal?: number;
serviceArea?: number;
snowFlakeId?: string;
staffTotal?: number;
type?: string;
projectManagerMiniProgramUserInfo?: ProgramUserInfo
}
export interface ProgramUserInfo {
idCard: null
name: string
telephone: string
}
export interface ServiceProjectSecurityUserPagerVo {
createTime?: string;
dateOfBirth?: string;
homeAddress?: string;
idCard?: string;
name?: string;
nativePlace?: string;
remark?: string;
securityNumber?: string;
securityUnitId?: string;
securityUnitName?: string;
serviceProjectId?: string;
snowFlakeId: string;
workPost?: string;
sex: BaseEnum<number>
}

View File

@ -1,5 +1,6 @@
interface formDate {
export interface SecurityUserFormParams {
snowFlakeId?: string;
securityUnitId: string;
serviceProjectId: string;
name?: string;
workPost?: string;
@ -7,7 +8,7 @@ interface formDate {
sex: number;
nativePlace?: string;
idCard: string;
dateOfBirth?: Date;
dateOfBirth?: Date | null;
securityNumber?: string;
remark?: string;
homeAddress?: string

Binary file not shown.

View File

@ -0,0 +1,17 @@
package com.changhu.common.annotation;
import com.changhu.common.enums.OpenApiType;
import java.lang.annotation.*;
/**
* @author 20252
* @createTime 2024/10/9 下午5:14
* @desc 检查openApi
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface CheckOpenApi {
OpenApiType value();
}

View File

@ -0,0 +1,21 @@
package com.changhu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:10
* @desc OpenApiType...
*/
@Getter
@AllArgsConstructor
public enum OpenApiType {
Information_on_enterprises_and_institutions("获取企事业单位信息", Arrays.asList("1fe0aaf3-45a4-4be3-a989-75e914a3f36e", "1fe0aaf3-45a4-a989-75e914a3f36e"));
private final String desc;
private final List<String> openApiKeys;
}

View File

@ -52,8 +52,16 @@ public class JavaClassToTsUtil {
* @return ts类型
*/
private static String convertJavaTypeToTS(Class<?> type) {
Set<Class<?>> stringList = Set.of(String.class);
Set<Class<?>> boolList = Set.of(Boolean.class, boolean.class);
Set<Class<?>> stringList = Set.of(
String.class,
LocalDateTime.class,
LocalDate.class,
LocalTime.class
);
Set<Class<?>> boolList = Set.of(
Boolean.class,
boolean.class
);
Set<Class<?>> numberList = Set.of(
Integer.class, int.class,
Double.class, double.class,
@ -63,15 +71,12 @@ public class JavaClassToTsUtil {
BigDecimal.class,
Byte.class, byte.class
);
Set<Class<?>> dateList = Set.of(LocalDateTime.class, LocalDate.class, LocalTime.class);
if (stringList.contains(type)) {
return "string";
} else if (boolList.contains(type)) {
return "boolean";
} else if (numberList.contains(type)) {
return "number";
} else if (dateList.contains(type)) {
return "Dayjs";
} else {
return "unsupported";
}

View File

@ -3,9 +3,11 @@ package com.changhu.config;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import com.changhu.support.interceptor.JsonBodyInterceptor;
import com.changhu.support.interceptor.OpenApiInterceptor;
import com.changhu.support.interceptor.UserTypeInterceptor;
import org.jetbrains.annotations.NotNull;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -25,6 +27,7 @@ public class WebConfig implements WebMvcConfigurer {
public WebConfig() {
whiteList.add("/common/**");
whiteList.add("/open/**");
whiteList.add("/test/**");
whiteList.add("/login");
whiteList.add("/logout");
@ -41,6 +44,8 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/management/getCheckStatus");
//微信小程序注册
whiteList.add("/miniProgramUser/register");
//二维码表单录入保安人员
whiteList.add("/miniProgramUser/qrCodeFormInputSecurityUser");
}
@Override
@ -53,6 +58,20 @@ public class WebConfig implements WebMvcConfigurer {
registry.addInterceptor(new JsonBodyInterceptor());
// 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端
registry.addInterceptor(new UserTypeInterceptor());
// 注册开放接口 拦截器 用于校验第三方是否携带指定apiKey
registry.addInterceptor(new OpenApiInterceptor())
.addPathPatterns("/open/**");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "OPTION", "PUT", "DELETE")
.allowedHeaders("Content-Type", "X-Requested-With", "accept", "Origin", "Access-Control-Request-Method",
"Access-Control-Request-Headers", "Authorization","Token","*")
.allowCredentials(true)
.maxAge(3600);
}
@Override

View File

@ -0,0 +1,47 @@
package com.changhu.controller;
import cn.hutool.core.util.IdUtil;
import com.changhu.common.annotation.CheckOpenApi;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.enums.OpenApiType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.service.OpenApiService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author 20252
* @createTime 2024/10/9 下午5:02
* @desc 可以给第三方对接的controller
*/
@Tag(name = "开放接口")
@JsonBody
@RequestMapping("/open")
public class OpenController {
@Autowired
private OpenApiService openApiService;
@Operation(summary = "获取企事业单位列表")
@CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions)
@GetMapping("/getEnterprisesUnit")
public List<SelectNodeVo<Long>> getEnterprisesUnit(@Schema(description = "行政区划代码") @RequestParam String code,
@Schema(description = "行政区划等级") @RequestParam Integer level) {
return openApiService.getEnterprisesUnit(code, level);
}
@Operation(summary = "企事业单位详情")
@CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions)
@GetMapping("/enterprisesUnitDetailById")
public EnterprisesUnitDetailDTO enterprisesUnitDetailById(@Schema(description = "企事业单位id") @RequestParam Long enterprisesUnitId) {
return openApiService.enterprisesUnitDetailById(enterprisesUnitId);
}
}

View File

@ -6,6 +6,8 @@ import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -36,4 +38,12 @@ public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
*/
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(@Param("enterprisesUnitId") Long enterprisesUnitId);
}

View File

@ -6,8 +6,12 @@ import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* service_project (服务项目) 服务类
* author: luozhun
@ -29,4 +33,12 @@ public interface ServiceProjectService extends IService<ServiceProject> {
* @param params 参数
*/
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId);
}

View File

@ -11,9 +11,13 @@ import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParam
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.management.service.ServiceProjectService;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* service_project (服务项目) 服务实现类
* author: luozhun
@ -36,4 +40,9 @@ public class ServiceProjectServiceImpl extends ServiceImpl<ServiceProjectMapper,
throw new MessageException();
}
}
@Override
public List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId) {
return baseMapper.getServiceProjectByEnterprisesUnitId(enterprisesUnitId);
}
}

View File

@ -3,6 +3,7 @@ package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
@ -34,6 +35,12 @@ public class MiniProgramUserController {
miniProgramUserService.register(params);
}
@Operation(summary = "二维码表单录入保安人员")
@PostMapping("/qrCodeFormInputSecurityUser")
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
miniProgramUserService.qrCodeFormInputSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {

View File

@ -9,7 +9,11 @@ import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -42,7 +46,15 @@ public class ProjectManageIndexController {
@Operation(summary = "保存或更新保安人员")
@PostMapping("/saveOrUpdateSecurityUser")
public void saveOrUpdateSecurityUser(@RequestBody SaveOrUpdateSecurityUserParams params) {
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
@JsonBody(value = false)
@Operation(summary = "获取表单分享二维码")
@GetMapping(value = "/shareForm_QR_Code")
public ResponseEntity<Resource> shareForm_QR_Code(@Schema(description = "要生成的路径") @RequestParam String path,
@Schema(description = "生成二维码的宽度") @RequestParam(defaultValue = "430") Integer width) {
return projectManageIndexService.shareForm_QR_Code(path, width);
}
}

View File

@ -3,6 +3,7 @@ package com.changhu.module.miniProgram.pojo.entity;
import java.io.Serial;
import java.io.Serializable;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
@ -56,7 +57,7 @@ public class SecurityUser extends BaseEntity implements Serializable {
/**
* 性别
*/
private Integer sex;
private Sex sex;
/**
* 籍贯

Some files were not shown because too many files have changed in this diff Show More