This commit is contained in:
TimSpan 2024-09-30 10:22:06 +08:00
commit c412126bf7
100 changed files with 1233 additions and 1368 deletions

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/policeSecurity.iml" filepath="$PROJECT_DIR$/.idea/policeSecurity.iml" />
</modules>
</component>
</project>

12
.idea/policeSecurity.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,2 +1,3 @@
# 配置文档参考 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,47 +40,44 @@
"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/qrcode": "^1.5.5",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@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",
@ -90,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,58 +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

@ -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="@/assets/images/01.png" 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(['https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',])
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,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,18 +37,21 @@
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{
.projectDetailsTableIndex {
display: flex;
justify-content: flex-end;
text-align: center;
view{
view {
width: 70px;
margin-right: 20px;
}
@ -51,7 +59,8 @@
}
}
}
.projectDetailsButton{
.projectDetailsButton {
position: fixed;
bottom: 19px;
display: flex;
@ -60,12 +69,11 @@
right: 0;
width: 100%;
}
.nutPopup{
.nutPopup {
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
}
}

View File

@ -3,14 +3,14 @@
<view class="projectDetailsItem" style="line-height: 50rpx">
<view>
<view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
<text style="font-size: 18px">{{ enterprisesUnitName }}-----{{ serviceProject?.name }}项目</text>
<!-- <text>进行中</text>-->
</view>
<view>
<view style="float: left;width: 50%;" class="content">
经理名称:{{ detailsList?.projectManagerMiniProgramUserInfo.name }}
经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }}
</view>
<view class="content">手机号:{{ detailsList?.projectManagerMiniProgramUserInfo.telephone }}</view>
<view class="content">手机号:{{ serviceProject?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view>
</view>
</view>
@ -18,28 +18,28 @@
<view class="projectDetailsIndex">
<nut-row>
<nut-col :span="24">
<view class="content">保安证件号{{ detailsList?.idNumber }}</view>
<view class="content">保安证件号{{ serviceProject?.idNumber }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
<view class="content">工作人员数量:{{ serviceProject?.staffTotal }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">保安人员数量:{{ detailsList?.securityUserTotal }}</view>
<view class="content">保安人员数量:{{ serviceProject?.securityUserTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">服务区域面积:{{ detailsList?.serviceArea }}</view>
<view class="content">服务区域面积:{{ serviceProject?.serviceArea }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">楼栋数量:{{ detailsList?.buildingTotal }}</view>
<view class="content">楼栋数量:{{ serviceProject?.buildingTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="4">
<view class="content">户数:{{ detailsList?.houseTotal }}</view>
<view class="content">户数:{{ serviceProject?.houseTotal }}</view>
</nut-col>
</nut-row>
</view>
@ -51,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>
@ -79,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 () => {
@ -99,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)
@ -124,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
@ -142,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="number !== 0">
<view class="myProjectItem" v-for="(item,index) in myProjectList" :key="index">
<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,7 +33,8 @@
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[]>()
@ -41,20 +42,15 @@ const number = ref(0)
const getMyServiceProject = async () => {
const resp = await api.get<MyProjectList[]>(`/projectManageIndex/getMyServiceProject`)
myProjectList.value = resp.data
number.value = resp.data.length
number.value = (resp.data?.length || 0)
}
const projectClick = (items: ServiceProjectList, name: string) => {
console.log(items)
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

@ -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,33 +69,37 @@
right: 0;
width: 100%;
}
.nutPopup{
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
.nutPopup {
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
}
.qrcodeVisibleUrl{
.qrcodeVisibleUrl {
margin-bottom: 5px;
image {
width: 100%;
}
}
.warp{
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
.warpItem{
.warpItem {
width: 90%;
height: 50%;
text-align: center;
.rect{
.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>
@ -98,33 +96,35 @@
<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>
<!-- 二维码-->
<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 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>
@ -134,21 +134,24 @@ 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 content = ref<Records>({} as any)
const serviceProject = ref()
const enterprisesUnitName = ref('')
const securityUserList = ref<ServiceProjectSecurityUserPagerVo[]>([])
const securityUserDetail = ref<ServiceProjectSecurityUserPagerVo>({} as any)
//
const confirmVisible = ref(false);
const detailVisible = ref(false)
const qrcodeVisible = ref(false)
const showOverlay = ref(false)
useLoad(async (options: MyProjectList) => {
nameValue.value = options.name
serviceProjectDetails.value = await JSON.parse(options.item)
useLoad((options) => {
enterprisesUnitName.value = options.enterprisesUnitName
serviceProject.value = JSON.parse(options.serviceProject)
})
useDidShow(async () => {
initServiceProjectSecurityUserList()
@ -159,24 +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,
securityUnitId:serviceProjectDetails.value.securityUnitId,
snowFlakeId: undefined,
serviceProjectId: serviceProject.value.snowFlakeId,
securityUnitId: serviceProject.value.securityUnitId,
name: '',
workPost: '',
sex: 0,
@ -186,9 +189,9 @@ const formAdd = () => {
securityNumber: '',
remark: '',
homeAddress: '',
telephone:''
}
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}&&id=${1}`})
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)
@ -196,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
@ -212,7 +215,7 @@ const initServiceProjectSecurityUserList = () => {
}
//
const onRefresherRefresh = (e) => {
const onRefresherRefresh = () => {
initServiceProjectSecurityUserList()
}
@ -225,55 +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 = ()=>{
const params = {
securityUnitId:serviceProjectDetails.value.securityUnitId,
serviceProjectId:serviceProjectDetails.value.snowFlakeId
const generateMiniProgramQRCode = async () => {
const paramsData = {
path: `/subPages/projectManager/securityUserForm/securityUserForm?uid=${serviceProject.value.securityUnitId}&pid=${serviceProject.value.snowFlakeId}&type=QcCodeInput`,
width: 200,
}
const value = JSON.stringify(params)
const paramsData = {
path:`/subPages/pages/form/form?item=${value}&id=${2}`,
width:200,
}
qrcodeVisible.value = true
Taro.request({
url: 'http://172.10.10.93:8765/projectManageIndex/shareForm_QR_Code',
method:'GET',
data:paramsData,
responseType: 'arraybuffer',
success(res) {
const base64 = Taro.arrayBufferToBase64(res.data);
qrCodeImage.value = 'data:image/jpeg;base64,' + base64
}
})
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 = ()=>{
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,7 +17,7 @@
<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>
@ -43,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
@ -59,19 +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 qrcodeId = ref()
const formData = ref<SecurityUserFormParams>({} as any)
const formRef = ref<FormInstance>(null!)
const rules: FormRules = {
name: [
@ -85,31 +89,23 @@ const rules: FormRules = {
message: "身份证格式错误",
},
],
telephone:[
telephone: [
{required: true, message: "请输入手机号"},
]
};
useLoad((options) => {
qrcodeId.value = options
console.log(JSON.parse(options.item))
if(options.id === '2'){
type.value = options.type;
if (type.value === 'QcCodeInput') {
formData.value = {
serviceProjectId: JSON.parse(options.item).serviceProjectId,
securityUnitId:JSON.parse(options.item).securityUnitId,
name: '',
workPost: '',
serviceProjectId: options.pid,
securityUnitId: options.uid,
sex: 0,
nativePlace: '',
idCard: '',
dateOfBirth: null,
securityNumber: '',
remark: '',
homeAddress: '',
telephone:''
dateOfBirth: null
}
}else{
formData.value = JSON.parse(options.item)
} else {
formData.value = JSON.parse(options.securityUser)
}
})
@ -126,17 +122,16 @@ const idCardBlur = (e: any) => {
formData.value.dateOfBirth = new Date(parseInt(year), parseInt(month) - 1, parseInt(day))
}
const url = ref('')
const submit = () => {
formRef.value?.validate().then(async ({valid}) => {
if (valid) {
if( qrcodeId.value.id === '1'){
url.value = '/projectManageIndex/saveOrUpdateSecurityUser'
}else{
url.value = '/miniProgramUser/qrCodeFormInputSecurityUser'
let url: string;
if (type.value === 'formInput') {
url = '/projectManageIndex/saveOrUpdateSecurityUser'
} else {
url = '/miniProgramUser/qrCodeFormInputSecurityUser'
}
console.log(formData.value)
const resp = await api.post(`${ url.value}`, formData.value)
const resp = await api.post(url, formData.value)
Taro.showToast({
title: resp.message,
icon: 'success',
@ -146,7 +141,7 @@ const submit = () => {
formData.value = {
snowFlakeId: undefined,
serviceProjectId: formData.value.serviceProjectId,
securityUnitId:formData.value.securityUnitId,
securityUnitId: formData.value.securityUnitId,
name: '',
workPost: '',
telephone: '',
@ -162,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,22 +70,28 @@ 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[]
}
interface TokenInfo<T = Record<string, any>> {
/**
* token信息
*/
interface TokenInfo {
/** token名称 **/
name: string;
/** token值 **/
value: string;
extData?: T
/** 拓展属性 **/
extData: {
/** 身份 **/
identity: BaseEnum<MiniProgramUserIdentity>
}
}
/**

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

View File

@ -41,6 +41,8 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/management/getCheckStatus");
//微信小程序注册
whiteList.add("/miniProgramUser/register");
//二维码表单录入保安人员
whiteList.add("/miniProgramUser/qrCodeFormInputSecurityUser");
}
@Override

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

@ -23,6 +23,10 @@ public class SaveOrUpdateSecurityUserParams {
@Schema(description = "服务项目id")
private Long serviceProjectId;
@NotNull(message = "保安单位不能为空")
@Schema(description = "保安单位id")
private Long securityUnitId;
@NotBlank(message = "名字不能为空")
@Schema(description = "名称")
private String name;

View File

@ -53,6 +53,8 @@ public class IndexServiceProjectListVo {
static class ServiceProjectVo {
@Schema(description = "服务项目id")
private Long snowFlakeId;
@Schema(description = "保安单位id")
private Long securityUnitId;
@Schema(description = "项目经理信息")
private Dict projectManagerMiniProgramUserInfo;
@Schema(description = "服务项目名称")

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
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.support.mybatisplus.pojo.params.PageParams;
@ -29,4 +30,11 @@ public interface MiniProgramUserService extends IService<MiniProgramUser> {
* @return 保安人员
*/
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
/**
* 二维码表单录入保安人员
*
* @param params 参数
*/
void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params);
}

View File

@ -2,6 +2,9 @@ package com.changhu.module.miniProgram.service;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import java.util.List;
@ -31,4 +34,9 @@ public interface ProjectManageIndexService {
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
/**
* 分享表单录入的二维码
*/
ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width);
}

View File

@ -13,9 +13,11 @@ import com.changhu.module.miniProgram.mapper.SecurityUserMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
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;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,6 +37,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
@Autowired
private SecurityUserMapper securityUserMapper;
@Autowired
private ProjectManageIndexService projectManageIndexService;
@Override
public void register(MiniProgramUserRegisterParams params) {
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
@ -61,4 +66,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
}

View File

@ -1,5 +1,7 @@
package com.changhu.module.miniProgram.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
@ -10,9 +12,18 @@ import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.io.*;
import java.util.List;
import java.util.Optional;
@ -21,12 +32,16 @@ import java.util.Optional;
* @createTime 2024/9/10 下午3:50
* @desc ProjectManageIndexServiceImpl...
*/
@Slf4j
@Service
public class ProjectManageIndexServiceImpl implements ProjectManageIndexService {
@Autowired
private ServiceProjectMapper serviceProjectMapper;
@Autowired
private WxMaService wxMaService;
@Override
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId());
@ -43,8 +58,6 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
@Override
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//填充保安单位
securityUser.setSecurityUnitId(UserUtil.getUnitId());
//新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId();
if (snowFlakeId == null) {
@ -74,4 +87,18 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
throw new MessageException();
}
}
@Override
public ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width) {
WxMaQrcodeService qrcodeService = wxMaService.getQrcodeService();
try {
File qrcodeFile = qrcodeService.createQrcode(path, width);
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + qrcodeFile.getName())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(qrcodeFile));
} catch (WxErrorException e) {
throw new MessageException("生成表单二维码失败:{}", e.getMessage());
}
}
}

View File

@ -90,10 +90,10 @@ spring:
cache-names: common
data:
redis:
database: 10
password: lonsung301
database: 1
password: redis_csPDNr
port: 6380
host: 172.10.10.238
host: 118.253.177.137
timeout: 10s
lettuce:
pool:
@ -144,9 +144,9 @@ sa-token:
wx:
miniapp:
#微信小程序的appid
appid: wx8902ddbfddb820d1
appid: wx0acd1c4fcf94bdd3
#微信小程序的Secret
secret: 8674decea33df3362245937444944596
secret: 4b700dbacb42ef258537ddc61d964a17
msgDataFormat: JSON
project:

View File

@ -48,6 +48,7 @@
ad4.name as 'streetName',
JSON_ARRAYAGG(JSON_OBJECT(
'snowFlakeId', sp.snow_flake_id,
'securityUnitId',sp.security_unit_id,
'name', sp.name,
'type', sp.type,
'isRecruitSecurity', sp.is_recruit_security,

View File

@ -2,11 +2,12 @@ import {createApp} from 'vue'
import App from '@/App.vue'
import '@/reset.css'
import './index.css'
// iconfont css
import "@/assets/iconfont/iconfont.css";
// 公共样式
import '@/assets/scss/common.scss'
import '@/assets/scss/myAntD.scss'
// iconfont css
import "@/assets/iconfont/iconfont.css";
// vue Router
import router from "@/router";
// pinia stores

View File

@ -126,17 +126,17 @@ const columns: TableProps['columns'] = [
dataIndex:'isRecruitSecurity',
title: '是否自招保安',
customRender: ({text}) => <a-tag>{text?.label}</a-tag>,
width:100
width:120
},
{
dataIndex:'idNumber',
title: '件号',
title: '保安服务许可证',
width:170
},
{
dataIndex:'serviceArea',
title:'服务区域面积',
width:100
width:120
},
{
dataIndex:'buildingTotal',
@ -151,17 +151,17 @@ const columns: TableProps['columns'] = [
{
dataIndex:'staffTotal',
title:'工作人员数量',
width:100
width:120
},
{
dataIndex:'securityUserTotal',
title:'保安人员数量',
width:100
width:120
},
{
dataIndex:'createUserName',
title:'创建人名称',
width:100
width:110
},
{
dataIndex: 'createTime',
@ -190,7 +190,7 @@ const columns: TableProps['columns'] = [
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}>
<a-button type="primary" danger>删除</a-button>
<a-button danger>删除</a-button>
</a-popconfirm>
<a-button type="primary" onClick={ async ()=>{
// console.log(record)
@ -275,6 +275,7 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
enterprisesUnitId:{
type:'select',
label:'企事业单位',
required: true,
options:enterprisesUnitIdList,
componentsProps:{
allowClear:true,
@ -316,7 +317,7 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
},
idNumber: {
type: 'input',
label: '件号',
label: '保安服务许可证',
componentsProps:{
disabled:idNumberDisabled as any
}

View File

@ -96,21 +96,31 @@ const columns: TableProps['columns'] = [
</a-popconfirm>
</a-space>
}
return <a-space >
<a-button
type="primary"
className={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'}
onClick={async () => {
const resp = await api.post('/management/disableOrEnableMiniProgramUser', {
dataId: record.snowFlakeId,
unitOptType: UNIT_TYPE.security
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}
>{record.isEnable.value === 0 ? '禁用' : '启用'}
</a-button>
</a-space>
return (
record.isEnable.value === 0?<a-button
danger
onClick={async () => {
const resp = await api.post('/management/disableOrEnableMiniProgramUser', {
dataId: record.snowFlakeId,
unitOptType: UNIT_TYPE.security
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}
>{record.isEnable.value === 0 ? '禁用' : '启用'}
</a-button>:<a-button
type="primary"
onClick={async () => {
const resp = await api.post('/management/disableOrEnableMiniProgramUser', {
dataId: record.snowFlakeId,
unitOptType: UNIT_TYPE.security
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}
>{record.isEnable.value === 0 ? '禁用' : '启用'}
</a-button>
)
}
},
]