This commit is contained in:
TimSpan 2024-12-02 16:16:09 +08:00
commit 93818ca9bf
7 changed files with 77 additions and 88 deletions

View File

@ -5,11 +5,14 @@
"appid": "touristappid", "appid": "touristappid",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": false, "es6": true,
"enhance": false, "enhance": false,
"minified": true,
"minifyWXSS": true,
"minifyWXML": true,
"compileHotReLoad": false, "compileHotReLoad": false,
"postcss": false, "postcss": true,
"minified": false "minified": true
}, },
"compileType": "miniprogram" "compileType": "miniprogram"
} }

View File

@ -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 所覆盖 // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
}) })

View File

@ -30,7 +30,6 @@ class CustomRequest {
BASE_API: string = process.env.TARO_APP_BASE_API; 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>> { private request<T>(url: string, method: keyof Taro.request.Method, options: ApiOptions, params?: object,): Promise<JsonResult<T>> {
console.log(this.BASE_API,'0000000')
return new Promise<JsonResult<T>>((resolve, reject) => { return new Promise<JsonResult<T>>((resolve, reject) => {
if (options.loading) { if (options.loading) {
Taro.showLoading({ Taro.showLoading({

View File

@ -10,3 +10,11 @@
height: 140px height: 140px
} }
} }
.uploadPictures{
display: flex;
justify-content: center;
align-items: center;
width: 220px;
height: 254px;
border: 2px solid #d5d3d3;
}

View File

@ -1,10 +1,16 @@
<template> <template>
<view class="form"> <view class="form">
<nut-form ref="formRef" :model-value="formData" :rules="rules"> <nut-form ref="formRef" :model-value="formData" :rules="rules">
<nut-form-item label="头像" prop="avatar"> <nut-form-item label="头像" prop="avatar">
<view @click="chooseImage"> <!-- <view class="uploadPictures" @click="chooseImage">-->
<image v-if="!Url" src="@/assets/logo/avatar1.png" style="width: 50px; height: 50px"></image> <!-- <view v-if="!formData.photo">-->
<image v-else :src="Url" style="width: 150px; height: 150px"></image> <!-- <IconFont name="uploader" size="25" color="#98a7b0"></IconFont>-->
<!-- </view>-->
<!-- <image v-else :src="minioBaseUrl +formData.photo" style="width: 100%; height: 100%"></image>-->
<!-- </view>-->
<view @click="chooseImage" size>
<image v-if="!formData.photo" src="@/assets/logo/avatar1.png" style="width: 50px; height: 50px"></image>
<image v-else :src="minioBaseUrl +formData.photo" style="width: 160px; height: 128px"></image>
</view> </view>
</nut-form-item> </nut-form-item>
<nut-form-item label="身份证" prop="idCard"> <nut-form-item label="身份证" prop="idCard">
@ -29,7 +35,6 @@
<nut-form-item label="工作岗位" prop="workPost"> <nut-form-item label="工作岗位" prop="workPost">
<nut-input v-model="formData.workPost" placeholder="请输入工作岗位" type="text" /> <nut-input v-model="formData.workPost" placeholder="请输入工作岗位" type="text" />
</nut-form-item> </nut-form-item>
<nut-form-item label="手机号" prop="telephone"> <nut-form-item label="手机号" prop="telephone">
<nut-input v-model="formData.telephone" placeholder="请输入手机号" type="text" /> <nut-input v-model="formData.telephone" placeholder="请输入手机号" type="text" />
</nut-form-item> </nut-form-item>
@ -85,6 +90,7 @@ import dayjs from 'dayjs'
import { SecurityUserFormParams, securityNumberByIdCard } from '@/types/subPages/projectManager/securityUserForm' import { SecurityUserFormParams, securityNumberByIdCard } from '@/types/subPages/projectManager/securityUserForm'
import { FormInstance } from '@nutui/nutui-taro' import { FormInstance } from '@nutui/nutui-taro'
import { generateSimpleObjectName, getResignedObjectUrl } from '@/utils' import { generateSimpleObjectName, getResignedObjectUrl } from '@/utils'
import {IconFont} from "@nutui/icons-vue-taro";
const SEX = enumSelectNodes('Sex') const SEX = enumSelectNodes('Sex')
const minioBaseUrl = process.env.TARO_APP_MINIO_URL const minioBaseUrl = process.env.TARO_APP_MINIO_URL
@ -123,14 +129,14 @@ useLoad((options) => {
telephone: null, telephone: null,
dateOfBirth: null, dateOfBirth: null,
noSecurityNumberDesc: options.noSecurityNumberDesc, noSecurityNumberDesc: options.noSecurityNumberDesc,
photo: options.photo, photo: '',
} }
} else { } else {
const form = JSON.parse(options.securityUser) const form = JSON.parse(options.securityUser)
console.log(form)
formData.value = Object.assign({}, form, { formData.value = Object.assign({}, form, {
idCard: form.idCard.originalValue, idCard: form.idCard.originalValue,
telephone: form.telephone.originalValue, telephone: form.telephone.originalValue,
photo: form.photo
}) })
} }
}) })
@ -188,21 +194,19 @@ const cancel = () => {
const chooseImage = () => { const chooseImage = () => {
Taro.chooseMedia({ Taro.chooseMedia({
count: 1, // count: 1, //
// type: 'image', //
mediaType: ['image', 'video'], mediaType: ['image', 'video'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
maxDuration: 30, sizeType:['original', 'compressed'],
camera: 'back', camera: 'front',
success: async (res) => { success: async (res) => {
console.log('🚀 ~ success: ~ res:', res) Url.value = res.tempFiles[0].tempFilePath
const objectName = generateSimpleObjectName(Url.value, '/securityUser')
const tempFilePath = res.tempFiles[0].tempFilePath
const objectName = generateSimpleObjectName(tempFilePath, '/securityUser')
const uploadUrl = await getResignedObjectUrl(process.env.TARO_APP_MINIO_BUCKET, objectName) const uploadUrl = await getResignedObjectUrl(process.env.TARO_APP_MINIO_BUCKET, objectName)
modelValue.value = '/' + process.env.TARO_APP_MINIO_BUCKET + objectName
// 使 wx.getFileSystemManager().readFileSync // 使 wx.getFileSystemManager().readFileSync
const fs = Taro.getFileSystemManager() const fs = Taro.getFileSystemManager()
const fileData = fs.readFileSync(tempFilePath) // const fileData = fs.readFileSync(Url.value) //
// PUT // PUT
Taro.request({ Taro.request({
url: uploadUrl, // url: uploadUrl, //
@ -212,6 +216,7 @@ const chooseImage = () => {
}, },
data: fileData, // data: fileData, //
success(res) { success(res) {
formData.value.photo = modelValue.value
console.log('上传成功', res) console.log('上传成功', res)
}, },
fail(err) { fail(err) {
@ -223,74 +228,9 @@ const chooseImage = () => {
console.error('选择文件失败', err) 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 = () => { const submit = () => {
console.log(formData.value.photo) formData.value.photo = modelValue.value
formRef.value?.validate().then(async ({ valid }) => { formRef.value?.validate().then(async ({ valid }) => {
if (valid) { if (valid) {
let url: string let url: string

View File

@ -29,6 +29,9 @@ public class ServiceProjectSecurityUserPagerVo {
@Schema(description = "名称") @Schema(description = "名称")
private String name; private String name;
@Schema(description = "照片")
private String photo;
@Desensitized(value = DesensitizedUtil.DesensitizedType.MOBILE_PHONE, keepOriginalField = true) @Desensitized(value = DesensitizedUtil.DesensitizedType.MOBILE_PHONE, keepOriginalField = true)
@Schema(description = "手机号") @Schema(description = "手机号")
private String telephone; private String telephone;
@ -51,6 +54,8 @@ public class ServiceProjectSecurityUserPagerVo {
@Schema(description = "保安证号") @Schema(description = "保安证号")
private String securityNumber; private String securityNumber;
@Schema(description = "无证说明")
private String noSecurityNumberDesc;
@Schema(description = "家庭住址") @Schema(description = "家庭住址")
private String homeAddress; private String homeAddress;

View File

@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class SecurityAssociationDockingServiceTask { 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; private static String TOKEN;
@ -32,7 +32,7 @@ public class SecurityAssociationDockingServiceTask {
public void getToken() { public void getToken() {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("appid", "anfang"); params.put("appid", "anfang");
params.put("appkey", "fcfefda716dc4760af44973bcf157a01"); params.put("appkey", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCg");
//创建请求 //创建请求
HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/get_token"); HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/get_token");
//设置参数 //设置参数