代码优化

This commit is contained in:
BianLzhaoMin 2025-04-08 17:51:41 +08:00
parent c6ecf0c761
commit f24b443062
9 changed files with 91 additions and 65 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 重要事项及宣传类 ---- 上传记录 --> <!-- 重要事项及宣传类 ---- 上传记录 -->
<view class="upload-record"> <view class="upload-record" :style="{ paddingTop: safeAreaInsets?.top + 44 + 'px' }">
<NavBarModal :navBarTitle="`协调照片`" /> <NavBarModal :navBarTitle="`协调照片`" />
<view class="container"> <view class="container">
<view class="search-input"> <view class="search-input">
@ -134,6 +134,7 @@ import NavBarModal from '@/components/NavBarModal/index'
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es' //
import { getCoordinatePhotoListApi } from '@/services/coordinatePhotos.js' import { getCoordinatePhotoListApi } from '@/services/coordinatePhotos.js'
const { safeAreaInsets } = uni.getSystemInfoSync()
const coordinatePhotosList = ref([]) const coordinatePhotosList = ref([])
const total = ref(0) const total = ref(0)

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 重要事项及宣传类 ---- 上传记录 --> <!-- 重要事项及宣传类 ---- 上传记录 -->
<view class="upload-record"> <view class="upload-record" :style="{ paddingTop: safeAreaInsets?.top + 44 + 'px' }">
<NavBarModal :navBarTitle="`重要事项及宣传类`" /> <NavBarModal :navBarTitle="`重要事项及宣传类`" />
<view class="container"> <view class="container">
<view class="search-input"> <view class="search-input">
@ -79,6 +79,7 @@ import NavBarModal from '@/components/NavBarModal/index'
import { ref, reactive, computed } from 'vue' import { ref, reactive, computed } from 'vue'
import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es' //
import { getImportantMattersListApi } from '@/services/importantMatters.js' import { getImportantMattersListApi } from '@/services/importantMatters.js'
const { safeAreaInsets } = uni.getSystemInfoSync()
const importantMattersList = ref([]) const importantMattersList = ref([])
const total = ref(0) const total = ref(0)

View File

@ -112,11 +112,7 @@
@afterRead="onAfterReadVrImgList" @afterRead="onAfterReadVrImgList"
:deletable="props.addAndEditFormType != 3" :deletable="props.addAndEditFormType != 3"
:fileList="addAndEditModel.vrImgList" :fileList="addAndEditModel.vrImgList"
:maxCount=" :maxCount="props.addAndEditFormType == 3 ? addAndEditModel.vrImgList.length : 9"
props.addAndEditFormType == 3
? addAndEditModel.vrImgList.length
: 9 - addAndEditModel.vrImgList
"
/> />
</up-form-item> </up-form-item>
<TitleTipModal :TitleTip="`整改信息`" /> <TitleTipModal :TitleTip="`整改信息`" />
@ -163,9 +159,7 @@
@afterRead="onAfterReadCorrectionImgList" @afterRead="onAfterReadCorrectionImgList"
:fileList="addAndEditModel.correctionImgList" :fileList="addAndEditModel.correctionImgList"
:maxCount=" :maxCount="
props.addAndEditFormType == 3 props.addAndEditFormType == 3 ? addAndEditModel.correctionImgList.length : 9
? addAndEditModel.correctionImgList.length
: 9 - addAndEditModel.correctionImgList
" "
/> />
</up-form-item> </up-form-item>
@ -315,6 +309,7 @@ const addAndEditModel = reactive({
rectDesc: '', // rectDesc: '', //
vrImgList: [], // vrImgList: [], //
correctionImgList: [], // correctionImgList: [], //
rectStatus: 0,
}) })
// //
@ -521,11 +516,7 @@ const onAfterReadVrImgList = (event) => {
} }
// //
const onDeletePicVrImgList = (event) => { const onDeletePicVrImgList = (event) => {
if ( if (props.addAndEditFormType == 2 && addAndEditModel.vrImgList[event.index].isEdit) {
props.addAndEditFormType == 2 &&
addAndEditModel.vrImgList[event.index].id &&
addAndEditModel.vrImgList[event.index].idEdit
) {
deleteFileList.push({ id: addAndEditModel.vrImgList[event.index].id }) deleteFileList.push({ id: addAndEditModel.vrImgList[event.index].id })
} }
@ -544,12 +535,8 @@ const onAfterReadCorrectionImgList = (event) => {
} }
// //
const onDeleteCorrectionImgList = (event) => { const onDeleteCorrectionImgList = (event) => {
if ( if (props.addAndEditFormType == 2 && addAndEditModel.correctionImgList[event.index].isEdit) {
props.addAndEditFormType == 2 && deleteFileList.push({ id: addAndEditModel.correctionImgList[event.index].id })
addAndEditModel.correctionImgList[event.index].id &&
addAndEditModel.correctionImgList[event.index].idEdit
) {
deleteFileList.push({ id: addAndEditModel.correctionImgList[event.index]?.id })
} }
addAndEditModel.correctionImgList.splice(event.index, 1) addAndEditModel.correctionImgList.splice(event.index, 1)
@ -618,6 +605,7 @@ const onSubmitForm = debounce(() => {
rectUserName, // rectUserName, //
rectTime, // rectTime, //
rectDesc, // rectDesc, //
rectStatus,
} = addAndEditModel } = addAndEditModel
const addParams = { const addParams = {
@ -638,6 +626,7 @@ const onSubmitForm = debounce(() => {
rectDesc, // rectDesc, //
fileList: [...successVrImgList, ...successCorrectionImgList], fileList: [...successVrImgList, ...successCorrectionImgList],
uploadType: 2, uploadType: 2,
rectStatus: addAndEditModel.correctionImgList.length > 0 ? 1 : 0,
} }
const SED_API = const SED_API =
@ -669,11 +658,11 @@ const onSubmitForm = debounce(() => {
sendLoading.value = false sendLoading.value = false
if (res.code === 200) { if (res.code === 200) {
uni.$u.toast(res.data) uni.$u.toast(res.data)
// setTimeout(() => { setTimeout(() => {
// uni.navigateBack({ uni.navigateBack({
// delta: 1, delta: 1,
// }) })
// }, 500) }, 500)
} else { } else {
uni.$u.toast(res.data) uni.$u.toast(res.data)
} }
@ -757,6 +746,7 @@ const getFormDetail = async () => {
rectDesc, // rectDesc, //
rectPhotoList, rectPhotoList,
vioPhotoList, vioPhotoList,
rectStatus,
} = res.data } = res.data
let rectPhotoListEdit = [] let rectPhotoListEdit = []
@ -798,6 +788,7 @@ const getFormDetail = async () => {
rectDesc, // rectDesc, //
vrImgList: vioPhotoListEdit, vrImgList: vioPhotoListEdit,
correctionImgList: rectPhotoListEdit, correctionImgList: rectPhotoListEdit,
rectStatus,
}) })
getProcedureData(majorId) getProcedureData(majorId)

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 质量检查 ---- 上传记录 --> <!-- 质量检查 ---- 上传记录 -->
<view class="upload-record"> <view class="upload-record" :style="{ paddingTop: safeAreaInsets?.top + 44 + 'px' }">
<NavBarModal :navBarTitle="`质量检查`" /> <NavBarModal :navBarTitle="`质量检查`" />
<view class="container"> <view class="container">
<view class="search-input"> <view class="search-input">
@ -83,7 +83,6 @@ import { ref, computed } from 'vue'
import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es' //
import { getQualityInspectionListApi } from '@/services/qualityInspection.js' import { getQualityInspectionListApi } from '@/services/qualityInspection.js'
const { safeAreaInsets } = uni.getSystemInfoSync() const { safeAreaInsets } = uni.getSystemInfoSync()
const upListRef = ref(null) //
const total = ref(0) const total = ref(0)
const qualityInspectionList = ref([]) const qualityInspectionList = ref([])

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 安全违章 ---- 上传记录 --> <!-- 安全违章 ---- 上传记录 -->
<view class="upload-record"> <view class="upload-record" :style="{ paddingTop: safeAreaInsets?.top + 44 + 'px' }">
<NavBarModal :navBarTitle="`安全措施落实`" /> <NavBarModal :navBarTitle="`安全措施落实`" />
<view class="container"> <view class="container">
<view class="search-input"> <view class="search-input">
@ -83,6 +83,7 @@ import NavBarModal from '@/components/NavBarModal/index'
import { ref, reactive, computed } from 'vue' import { ref, reactive, computed } from 'vue'
import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es' //
import { getSafetyMeasureListApi } from '@/services/safetyMeasure.js' import { getSafetyMeasureListApi } from '@/services/safetyMeasure.js'
const { safeAreaInsets } = uni.getSystemInfoSync()
const safetyMeasureList = ref([]) const safetyMeasureList = ref([])
const total = ref(0) const total = ref(0)

View File

@ -112,11 +112,7 @@
@afterRead="onAfterReadVrImgList" @afterRead="onAfterReadVrImgList"
:fileList="addAndEditModel.vrImgList" :fileList="addAndEditModel.vrImgList"
:deletable="props.addAndEditFormType != 3" :deletable="props.addAndEditFormType != 3"
:maxCount=" :maxCount="props.addAndEditFormType == 3 ? addAndEditModel.vrImgList.length : 9"
props.addAndEditFormType == 3
? addAndEditModel.vrImgList.length
: 9 - addAndEditModel.vrImgList.length
"
/> />
</up-form-item> </up-form-item>
<TitleTipModal :TitleTip="`整改信息`" /> <TitleTipModal :TitleTip="`整改信息`" />
@ -163,9 +159,7 @@
:deletable="props.addAndEditFormType != 3" :deletable="props.addAndEditFormType != 3"
:fileList="addAndEditModel.correctionImgList" :fileList="addAndEditModel.correctionImgList"
:maxCount=" :maxCount="
props.addAndEditFormType == 3 props.addAndEditFormType == 3 ? addAndEditModel.correctionImgList.length : 9
? addAndEditModel.correctionImgList.length
: 9 - addAndEditModel.correctionImgList.length
" "
/> />
</up-form-item> </up-form-item>
@ -315,6 +309,7 @@ const addAndEditModel = reactive({
rectDesc: '', // rectDesc: '', //
vrImgList: [], // vrImgList: [], //
correctionImgList: [], // correctionImgList: [], //
rectStatus: 0,
}) })
// //
@ -512,11 +507,7 @@ const onAfterReadVrImgList = (event) => {
} }
// //
const onDeletePicVrImgList = (event) => { const onDeletePicVrImgList = (event) => {
if ( if (props.addAndEditFormType == 2 && addAndEditModel.vrImgList[event.index].isEdit) {
props.addAndEditFormType == 2 &&
addAndEditModel.vrImgList[event.index].id &&
addAndEditModel.vrImgList[event.index].idEdit
) {
deleteFileList.push({ id: addAndEditModel.vrImgList[event.index].id }) deleteFileList.push({ id: addAndEditModel.vrImgList[event.index].id })
} }
@ -535,12 +526,8 @@ const onAfterReadCorrectionImgList = (event) => {
} }
// //
const onDeleteCorrectionImgList = (event) => { const onDeleteCorrectionImgList = (event) => {
if ( if (props.addAndEditFormType == 2 && addAndEditModel.correctionImgList[event.index].isEdit) {
props.addAndEditFormType == 2 && deleteFileList.push({ id: addAndEditModel.correctionImgList[event.index].id })
addAndEditModel.correctionImgList[event.index].id &&
addAndEditModel.correctionImgList[event.index].idEdit
) {
deleteFileList.push({ id: addAndEditModel.correctionImgList[event.index]?.id })
} }
addAndEditModel.correctionImgList.splice(event.index, 1) addAndEditModel.correctionImgList.splice(event.index, 1)
@ -609,6 +596,7 @@ const onSubmitForm = debounce(() => {
rectUserName, // rectUserName, //
rectTime, // rectTime, //
rectDesc, // rectDesc, //
rectStatus,
} = addAndEditModel } = addAndEditModel
const addParams = { const addParams = {
@ -629,6 +617,7 @@ const onSubmitForm = debounce(() => {
rectDesc, // rectDesc, //
fileList: [...successVrImgList, ...successCorrectionImgList], fileList: [...successVrImgList, ...successCorrectionImgList],
uploadType: 2, uploadType: 2,
rectStatus: addAndEditModel.correctionImgList.length > 0 ? 1 : 0,
} }
const SED_API = const SED_API =
@ -748,12 +737,13 @@ const getFormDetail = async () => {
rectDesc, // rectDesc, //
rectPhotoList, rectPhotoList,
vioPhotoList, vioPhotoList,
rectStatus,
} = res.data } = res.data
let rectPhotoListEdit = [] let rectPhotoListEdit = []
let vioPhotoListEdit = [] let vioPhotoListEdit = []
if (rectPhotoList?.length > 0) { if (rectPhotoList.length > 0) {
rectPhotoListEdit = rectPhotoList.map((e) => { rectPhotoListEdit = rectPhotoList.map((e) => {
return { return {
isEdit: true, isEdit: true,
@ -762,7 +752,7 @@ const getFormDetail = async () => {
} }
}) })
} }
if (vioPhotoList?.length > 0) { if (vioPhotoList.length > 0) {
vioPhotoListEdit = vioPhotoList.map((e) => { vioPhotoListEdit = vioPhotoList.map((e) => {
return { return {
isEdit: true, isEdit: true,
@ -789,6 +779,7 @@ const getFormDetail = async () => {
rectDesc, // rectDesc, //
vrImgList: vioPhotoListEdit, vrImgList: vioPhotoListEdit,
correctionImgList: rectPhotoListEdit, correctionImgList: rectPhotoListEdit,
rectStatus,
}) })
getProcedureData(majorId) getProcedureData(majorId)

26
src/utils/env.js Normal file
View File

@ -0,0 +1,26 @@
const ENV = process.env.NODE_ENV
const platform = uni.getSystemInfoSync().platform
// let BASE_URL = 'http://192.168.2.188:21907/gz_att_wechat' // 本地
// let BASE_URL = 'http://192.168.0.14:21907/gz_att_wechat' // 测试服务地址
// let BASE_URL = 'https://jj.jypxks.com/gz_att_wechat' // 生产服务地址
// let BASE_URL = 'http://192.168.0.50:1907/gz_att_wechat' // 孙亮
let BASE_URL = 'http://192.168.2.131:1907/gz_att_wechat' // 孙亮
// 如果是浏览器调试会产生跨域 则配置请求基地址为 api 或其他 必须与vue.config.js 中配置的代理一致 解决跨域问题
// if (ENV === 'development' && (platform === 'h5' || platform === 'windows')) {
// BASE_URL = 'api'
// }
// // 生产则直接配置 线上ip 或者 nginx代理的路径
// if (ENV === 'production' && (platform === 'h5' || platform === 'windows')) {
// BASE_URL = '/prod-api'
// }
// // app不产生跨域 直接配置请求基地址 开发环境
// if (ENV === 'development' && (platform === 'android' || platform === 'ios')) {
// BASE_URL = 'https://test-cc.zhgkxt.com/sgzbgl-api'
// }
// // app不产生跨域 直接配置请求基地址 生产环境
// if (ENV === 'production' && (platform === 'android' || platform === 'ios')) {
// BASE_URL = 'http://*****'
// }
export default BASE_URL

View File

@ -23,20 +23,36 @@ const httpInterceptor = {
options.url = baseURL + options.url options.url = baseURL + options.url
} }
if (options?.isPassWord) { // if (options?.isPassWord) {
if (options.isEncrypt) { // if (options.isEncrypt) {
if (options.data) { // if (options.data) {
options.data = cloneDeep(options.data) // 参数深拷贝 避免影响视图 // options.data = cloneDeep(options.data) // 参数深拷贝 避免影响视图
for (const key in options.data) { // for (const key in options.data) {
options.data[key] = encrypt(options.data[key]) // options.data[key] = encrypt(options.data[key])
} // }
// }
// } else {
// if (!options.isNull) {
// options.data = {
// // encryptedData: encrypt(JSON.stringify(options.data)),
// encryptedData: JSON.stringify(options.data),
// }
// }
// }
// }
if (options.isEncrypt) {
if (options.data) {
options.data = cloneDeep(options.data) // 参数深拷贝 避免影响视图
for (const key in options.data) {
options.data[key] = encrypt(options.data[key])
} }
} else { }
if (!options.isNull) { } else {
options.data = { if (!options.isNull) {
// encryptedData: encrypt(JSON.stringify(options.data)), options.data = {
encryptedData: JSON.stringify(options.data), encryptedData: encrypt(JSON.stringify(options.data)),
} // encryptedData: JSON.stringify(options.data),
} }
} }
} }

View File

@ -9,9 +9,9 @@ export default defineConfig({
// 在此处编写代理规则 // 在此处编写代理规则
'/api': { '/api': {
// target: 'http://192.168.0.133:11997', // 梁超 // target: 'http://192.168.0.133:11997', // 梁超
// target: 'http://192.168.0.137:11997', // 方亮 target: 'http://192.168.0.137:11997', // 方亮
// target: 'http://192.168.0.60:11997', // 赵福海 // target: 'http://192.168.0.60:11997', // 赵福海
target: 'http://192.168.0.39:11997', // 陈长文 // target: 'http://192.168.0.39:11997', // 陈长文
changeOrigin: true, changeOrigin: true,
rewrite: (path) => { rewrite: (path) => {
return path.replace(/\/api/, '') return path.replace(/\/api/, '')