From 90202e7e9512f28ff8e42b2b67418163d7bbf91c Mon Sep 17 00:00:00 2001 From: wangyilin <1454641981@qq.com> Date: Mon, 2 Dec 2024 13:48:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E4=BF=9D=E5=AE=89=E8=AF=81=E5=8F=B7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collect_information/src/request/index.ts | 1 - .../securityUserForm/securityUserForm.vue | 93 +++---------------- 2 files changed, 14 insertions(+), 80 deletions(-) diff --git a/collect_information/src/request/index.ts b/collect_information/src/request/index.ts index b1dacfa..dd5e7ca 100644 --- a/collect_information/src/request/index.ts +++ b/collect_information/src/request/index.ts @@ -30,7 +30,6 @@ class CustomRequest { BASE_API: string = process.env.TARO_APP_BASE_API; private request(url: string, method: keyof Taro.request.Method, options: ApiOptions, params?: object,): Promise> { - console.log(this.BASE_API,'0000000') return new Promise>((resolve, reject) => { if (options.loading) { Taro.showLoading({ diff --git a/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue b/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue index 3c9fe8e..3d027b6 100644 --- a/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue +++ b/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue @@ -2,9 +2,9 @@ - - - + + + @@ -112,6 +112,7 @@ const rules: FormRules = { } useLoad((options) => { + console.log(options) type.value = options.type if (type.value === 'QcCodeInput') { formData.value = { @@ -123,14 +124,14 @@ useLoad((options) => { telephone: null, dateOfBirth: null, noSecurityNumberDesc: options.noSecurityNumberDesc, - photo: options.photo, + photo: '', } } else { const form = JSON.parse(options.securityUser) - console.log(form) formData.value = Object.assign({}, form, { idCard: form.idCard.originalValue, telephone: form.telephone.originalValue, + photo: form.photo }) } }) @@ -188,21 +189,19 @@ const cancel = () => { const chooseImage = () => { Taro.chooseMedia({ count: 1, // 选择一个文件 - // type: 'image', // 可以选择所有文件类型 mediaType: ['image', 'video'], sourceType: ['album', 'camera'], maxDuration: 30, - camera: 'back', + camera: 'front', success: async (res) => { - console.log('🚀 ~ success: ~ res:', res) - - const tempFilePath = res.tempFiles[0].tempFilePath - const objectName = generateSimpleObjectName(tempFilePath, '/securityUser') + Url.value = res.tempFiles[0].tempFilePath + const objectName = generateSimpleObjectName(Url.value, '/securityUser') const uploadUrl = await getResignedObjectUrl(process.env.TARO_APP_MINIO_BUCKET, objectName) + + modelValue.value = '/' + process.env.TARO_APP_MINIO_BUCKET + objectName // 使用 wx.getFileSystemManager().readFileSync 读取文件的二进制内容 const fs = Taro.getFileSystemManager() - const fileData = fs.readFileSync(tempFilePath) // 返回的是文件的二进制内容 - + const fileData = fs.readFileSync(Url.value) // 返回的是文件的二进制内容 // 发送 PUT 请求上传二进制文件 Taro.request({ url: uploadUrl, // 后端上传接口 @@ -212,6 +211,7 @@ const chooseImage = () => { }, data: fileData, // 传递二进制数据 success(res) { + formData.value.photo = modelValue.value console.log('上传成功', res) }, fail(err) { @@ -223,74 +223,9 @@ const chooseImage = () => { console.error('选择文件失败', err) }, }) - - // Taro.chooseImage({ - // count: 1, - // sizeType: ['original', 'compressed'], - // sourceType: ['album', 'camera'], - // success: async (resp) => { - // Url.value = resp.tempFilePaths[0] - // console.log(resp.tempFilePaths[0]) - // const objectName = generateSimpleObjectName(resp.tempFiles[0].path, '/securityUser') - // const uploadUrl = await getResignedObjectUrl(process.env.TARO_APP_MINIO_BUCKET, objectName) - // modelValue.value = '/' + process.env.TARO_APP_MINIO_BUCKET + objectName; - // console.log(modelValue) - // // Taro.request({ - // // url: uploadUrl, - // // data: resp.tempFiles, - // // method: 'PUT', - // // header: { - // // 'content-type': 'application/json' - // // }, - // // success: (resp) => { - // // console.log(resp) - // // } - // // }) - // Taro.getFileSystemManager().readFile({ - // filePath: resp.tempFiles[0].path, // 文件路径 - // encoding: 'base64', // 指定编码为 base64 - // success (res) { - // console.log(res.data) - // // 成功回调,这里可以创建一个 Blob 对象 - // const blob = b64toBlob(res.data, 'image/jpeg'); // 根据实际情况指定 MIME 类型 - // // 创建一个 File 对象 - // const file = new File([blob], 'filename.jpg', {type: 'image/jpeg'}); - // console.log(file) - // Taro.request({ - // url:uploadUrl, - // data: file, - // method:'PUT', - // success:(res)=>{ - // console.log(res) - // } - // }) - // // 现在你可以使用 file 变量了 - // }, - // fail (err) { - // console.error('读取文件失败:', err); - // } - // }); - // } - // }) } -const b64toBlob = (b64Data, contentType = '', sliceSize = 512) => { - const byteCharacters = atob(b64Data) - const byteArrays: any = [] - for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) { - const slice = byteCharacters.slice(offset, offset + sliceSize) - - const byteNumbers = new Array(slice.length) - for (let i = 0; i < slice.length; i++) { - byteNumbers[i] = slice.charCodeAt(i) - } - const byteArray = new Uint8Array(byteNumbers) - byteArrays.push(byteArray) - } - return new Blob(byteArrays, { type: contentType }) -} - const submit = () => { - console.log(formData.value.photo) + formData.value.photo = modelValue.value formRef.value?.validate().then(async ({ valid }) => { if (valid) { let url: string From 5df4d702114e461a947fe75ad66d95c29d26835d Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Mon, 2 Dec 2024 15:19:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/vo/ServiceProjectSecurityUserPagerVo.java | 5 +++++ .../changhu/task/SecurityAssociationDockingServiceTask.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/ServiceProjectSecurityUserPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/ServiceProjectSecurityUserPagerVo.java index 639122a..ba17501 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/ServiceProjectSecurityUserPagerVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/ServiceProjectSecurityUserPagerVo.java @@ -29,6 +29,9 @@ public class ServiceProjectSecurityUserPagerVo { @Schema(description = "名称") private String name; + @Schema(description = "照片") + private String photo; + @Desensitized(value = DesensitizedUtil.DesensitizedType.MOBILE_PHONE, keepOriginalField = true) @Schema(description = "手机号") private String telephone; @@ -51,6 +54,8 @@ public class ServiceProjectSecurityUserPagerVo { @Schema(description = "保安证号") private String securityNumber; + @Schema(description = "无证说明") + private String noSecurityNumberDesc; @Schema(description = "家庭住址") private String homeAddress; diff --git a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java index 05b797b..f2af01a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java +++ b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java @@ -20,7 +20,7 @@ import org.springframework.stereotype.Component; @Component public class SecurityAssociationDockingServiceTask { - private static final String BASE_HOST = "http://tkgl.3589hn.cn"; + private static final String BASE_HOST = "http://baxh.3589hn.cn"; private static String TOKEN; @@ -32,7 +32,7 @@ public class SecurityAssociationDockingServiceTask { public void getToken() { JSONObject params = new JSONObject(); params.put("appid", "anfang"); - params.put("appkey", "fcfefda716dc4760af44973bcf157a01"); + params.put("appkey", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCg"); //创建请求 HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/get_token"); //设置参数 From 6d0c45931b709095bfcc54fbae4c7b4be1e48523 Mon Sep 17 00:00:00 2001 From: wangyilin <1454641981@qq.com> Date: Mon, 2 Dec 2024 16:09:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E4=BF=9D=E5=AE=89=E8=AF=81=E5=8F=B7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collect_information/project.config.json | 9 +++-- collect_information/src/app.ts | 34 +++++++++++++++++++ .../securityUserForm/securityUserForm.scss | 8 +++++ .../securityUserForm/securityUserForm.vue | 13 ++++--- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/collect_information/project.config.json b/collect_information/project.config.json index 2d18dde..780ca20 100644 --- a/collect_information/project.config.json +++ b/collect_information/project.config.json @@ -5,11 +5,14 @@ "appid": "touristappid", "setting": { "urlCheck": false, - "es6": false, + "es6": true, "enhance": false, + "minified": true, + "minifyWXSS": true, + "minifyWXML": true, "compileHotReLoad": false, - "postcss": false, - "minified": false + "postcss": true, + "minified": true }, "compileType": "miniprogram" } diff --git a/collect_information/src/app.ts b/collect_information/src/app.ts index 28f74dd..b9729bb 100644 --- a/collect_information/src/app.ts +++ b/collect_information/src/app.ts @@ -24,6 +24,40 @@ const App = createApp({ }) } }, + onShow(){ + const updateManager = Taro.getUpdateManager() + updateManager.onCheckForUpdate(function(res) { + // 请求完新版本信息的回调 + if (res.hasUpdate) { + // 新版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate() + } + }) + updateManager.onUpdateReady(function() { + // 新版本已经准备好,可以提示用户更新 + Taro.showModal({ + title: '更新提示', + content: '发现新版本,是否重启应用?', + success: function (res) { + if (res.confirm) { + // 新的版本已经准备好,调用 applyUpdate 应用新版本 + updateManager.applyUpdate() + } + } + }).then(res=>{ + console.log(res) + }) + }) + updateManager.onUpdateFailed(function() { + // 新版本下载失败,可进行一些提示用户的操作 + Taro.showModal({ + title: '已有新版本', + content: '请删除当前小程序,重新从搜索界面打开获取最新版本', + }).then(res => { + console.log(res) + }) + }) + } // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 }) diff --git a/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.scss b/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.scss index c0a88ff..89857bc 100644 --- a/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.scss +++ b/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.scss @@ -10,3 +10,11 @@ height: 140px } } +.uploadPictures{ + display: flex; + justify-content: center; + align-items: center; + width: 220px; + height: 254px; + border: 2px solid #d5d3d3; +} diff --git a/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue b/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue index 3d027b6..a01a944 100644 --- a/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue +++ b/collect_information/src/subPages/projectManager/securityUserForm/securityUserForm.vue @@ -1,7 +1,13 @@