分享二维码
This commit is contained in:
parent
34b1054ccc
commit
bd47d8b3f5
|
@ -1,2 +1,2 @@
|
||||||
TARO_APP_ID="wx8902ddbfddb820d1"
|
TARO_APP_ID="wx0acd1c4fcf94bdd3"
|
||||||
TARO_APP_BASE_API="http://172.10.10.93:8765"
|
TARO_APP_BASE_API="http://172.10.10.93:8765"
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
<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-input v-model="formData.telephone" placeholder="请输入手机号" type="text"/>
|
||||||
|
</nut-form-item>
|
||||||
<nut-form-item label="籍贯" prop="nativePlace">
|
<nut-form-item label="籍贯" prop="nativePlace">
|
||||||
<nut-input v-model="formData.nativePlace" placeholder="请输入籍贯" type="text"/>
|
<nut-input v-model="formData.nativePlace" placeholder="请输入籍贯" type="text"/>
|
||||||
</nut-form-item>
|
</nut-form-item>
|
||||||
|
@ -67,6 +71,8 @@ const showPicker = ref(false)
|
||||||
const formData = ref<formDate>({} as any)
|
const formData = ref<formDate>({} as any)
|
||||||
const formRef = ref(null)
|
const formRef = ref(null)
|
||||||
|
|
||||||
|
const qrcodeId = ref()
|
||||||
|
|
||||||
const rules: FormRules = {
|
const rules: FormRules = {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: "请输入姓名"},
|
{required: true, message: "请输入姓名"},
|
||||||
|
@ -78,11 +84,33 @@ const rules: FormRules = {
|
||||||
regex: /^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))((0[1-9])|([12][0-9])|(30|31))\d{3}(\d|X)$)/,
|
regex: /^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))((0[1-9])|([12][0-9])|(30|31))\d{3}(\d|X)$)/,
|
||||||
message: "身份证格式错误",
|
message: "身份证格式错误",
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
telephone:[
|
||||||
|
{required: true, message: "请输入手机号"},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
useLoad((options) => {
|
useLoad((options) => {
|
||||||
formData.value = JSON.parse(options.item)
|
qrcodeId.value = options
|
||||||
|
console.log(JSON.parse(options.item))
|
||||||
|
if(options.id === '2'){
|
||||||
|
formData.value = {
|
||||||
|
serviceProjectId: JSON.parse(options.item).serviceProjectId,
|
||||||
|
securityUnitId:JSON.parse(options.item).securityUnitId,
|
||||||
|
name: '',
|
||||||
|
workPost: '',
|
||||||
|
sex: 0,
|
||||||
|
nativePlace: '',
|
||||||
|
idCard: '',
|
||||||
|
dateOfBirth: null,
|
||||||
|
securityNumber: '',
|
||||||
|
remark: '',
|
||||||
|
homeAddress: '',
|
||||||
|
telephone:''
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
formData.value = JSON.parse(options.item)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const idCardBlur = (e: any) => {
|
const idCardBlur = (e: any) => {
|
||||||
|
@ -98,10 +126,17 @@ const idCardBlur = (e: any) => {
|
||||||
formData.value.dateOfBirth = new Date(parseInt(year), parseInt(month) - 1, parseInt(day))
|
formData.value.dateOfBirth = new Date(parseInt(year), parseInt(month) - 1, parseInt(day))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const url = ref('')
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
formRef.value?.validate().then(async ({valid}) => {
|
formRef.value?.validate().then(async ({valid}) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const resp = await api.post('/projectManageIndex/saveOrUpdateSecurityUser', formData.value)
|
if( qrcodeId.value.id === '1'){
|
||||||
|
url.value = '/projectManageIndex/saveOrUpdateSecurityUser'
|
||||||
|
}else{
|
||||||
|
url.value = '/miniProgramUser/qrCodeFormInputSecurityUser'
|
||||||
|
}
|
||||||
|
console.log(formData.value)
|
||||||
|
const resp = await api.post(`${ url.value}`, formData.value)
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: resp.message,
|
title: resp.message,
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
|
@ -111,6 +146,7 @@ const submit = () => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
snowFlakeId: undefined,
|
snowFlakeId: undefined,
|
||||||
serviceProjectId: formData.value.serviceProjectId,
|
serviceProjectId: formData.value.serviceProjectId,
|
||||||
|
securityUnitId:formData.value.securityUnitId,
|
||||||
name: '',
|
name: '',
|
||||||
workPost: '',
|
workPost: '',
|
||||||
telephone: '',
|
telephone: '',
|
||||||
|
|
|
@ -45,6 +45,7 @@ const getMyServiceProject = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const projectClick = (items: ServiceProjectList, name: string) => {
|
const projectClick = (items: ServiceProjectList, name: string) => {
|
||||||
|
console.log(items)
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`,
|
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`,
|
||||||
})
|
})
|
||||||
|
|
|
@ -66,6 +66,27 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.qrcodeVisibleUrl{
|
||||||
|
margin-bottom: 5px;
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.warp{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
.warpItem{
|
||||||
|
width: 90%;
|
||||||
|
height: 50%;
|
||||||
|
text-align: center;
|
||||||
|
.rect{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="projectDetailsButton">
|
<view class="projectDetailsButton">
|
||||||
<nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button>
|
<nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button>
|
||||||
<nut-button style="width: 45%" type="info">二维码录入</nut-button>
|
<nut-button style="width: 45%" type="info" @click="generateMiniProgramQRCode">二维码录入</nut-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<nut-dialog
|
<nut-dialog
|
||||||
content="是否确认删除该用户?"
|
content="是否确认删除该用户?"
|
||||||
|
@ -107,6 +106,27 @@
|
||||||
</slot>
|
</slot>
|
||||||
</nut-dialog>
|
</nut-dialog>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 二维码-->
|
||||||
|
<view>
|
||||||
|
<nut-dialog no-cancel-btn content="二维码" v-model:visible="qrcodeVisible">
|
||||||
|
<slot>
|
||||||
|
<view class="qrcodeVisibleUrl" @click="showImage">
|
||||||
|
<image style="width: 100%" show-menu-by-longpress='1' :lazy-load="true" :src="qrCodeImage" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
</slot>
|
||||||
|
</nut-dialog>
|
||||||
|
</view>
|
||||||
|
<nut-overlay v-model:visible="showOverlay">
|
||||||
|
<view class="warp">
|
||||||
|
<view class="warpItem">
|
||||||
|
<movable-area :scale-area="true">
|
||||||
|
<movable-view direction="all" style="width: 348px; height: 300px;" :scale="true" :scale-min="1" :scale-max="4" :scale-value="1" :x="2" :y="10">
|
||||||
|
<image class="rect" show-menu-by-longpress='1' :src="qrCodeImage" mode="widthFix" />
|
||||||
|
</movable-view>
|
||||||
|
</movable-area>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</nut-overlay>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -116,7 +136,6 @@ import {ref} from "vue";
|
||||||
import api from "@/request/index";
|
import api from "@/request/index";
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
|
|
||||||
|
|
||||||
const serviceProjectDetails = ref()
|
const serviceProjectDetails = ref()
|
||||||
const nameValue = ref('')
|
const nameValue = ref('')
|
||||||
const projectData = ref<Records[]>([])
|
const projectData = ref<Records[]>([])
|
||||||
|
@ -124,7 +143,8 @@ const content = ref<Records>({} as any)
|
||||||
// 控制模态框的显示状态
|
// 控制模态框的显示状态
|
||||||
const confirmVisible = ref(false);
|
const confirmVisible = ref(false);
|
||||||
const detailVisible = ref(false)
|
const detailVisible = ref(false)
|
||||||
|
const qrcodeVisible = ref(false)
|
||||||
|
const showOverlay = ref(false)
|
||||||
|
|
||||||
useLoad(async (options: MyProjectList) => {
|
useLoad(async (options: MyProjectList) => {
|
||||||
nameValue.value = options.name
|
nameValue.value = options.name
|
||||||
|
@ -155,6 +175,7 @@ const projectDetailsTable = async () => {
|
||||||
const formAdd = () => {
|
const formAdd = () => {
|
||||||
const params = {
|
const params = {
|
||||||
serviceProjectId: serviceProjectDetails.value.snowFlakeId,
|
serviceProjectId: serviceProjectDetails.value.snowFlakeId,
|
||||||
|
securityUnitId:serviceProjectDetails.value.securityUnitId,
|
||||||
snowFlakeId: undefined,
|
snowFlakeId: undefined,
|
||||||
name: '',
|
name: '',
|
||||||
workPost: '',
|
workPost: '',
|
||||||
|
@ -164,9 +185,10 @@ const formAdd = () => {
|
||||||
dateOfBirth: null,
|
dateOfBirth: null,
|
||||||
securityNumber: '',
|
securityNumber: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
homeAddress: ''
|
homeAddress: '',
|
||||||
|
telephone:''
|
||||||
}
|
}
|
||||||
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
|
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}&&id=${1}`})
|
||||||
}
|
}
|
||||||
const total = ref<any>(null)
|
const total = ref<any>(null)
|
||||||
const current = ref(1)
|
const current = ref(1)
|
||||||
|
@ -220,7 +242,34 @@ const projectEdit = (item) => {
|
||||||
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
|
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const qrCodeImage = ref('')
|
||||||
|
const generateMiniProgramQRCode = ()=>{
|
||||||
|
const params = {
|
||||||
|
securityUnitId:serviceProjectDetails.value.securityUnitId,
|
||||||
|
serviceProjectId:serviceProjectDetails.value.snowFlakeId
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const showImage = ()=>{
|
||||||
|
showOverlay.value = true
|
||||||
|
qrcodeVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -60,3 +60,19 @@ interface TreeNode<T> {
|
||||||
extData?: Record<string, any>,
|
extData?: Record<string, any>,
|
||||||
children?: TreeNode<T>[]
|
children?: TreeNode<T>[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface TokenInfo<T = Record<string, any>> {
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
extData?: T
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基本枚举类型
|
||||||
|
*/
|
||||||
|
interface BaseEnum<T, E = Record<string, any>> {
|
||||||
|
value: T;
|
||||||
|
label: string;
|
||||||
|
extData: E;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
interface formDate {
|
interface formDate {
|
||||||
snowFlakeId?: string;
|
snowFlakeId?: string;
|
||||||
|
securityUnitId:string;
|
||||||
serviceProjectId: string;
|
serviceProjectId: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
workPost?: string;
|
workPost?: string;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
remark?: string;
|
remark?: string;
|
||||||
serviceProjectList: ServiceProjectList[];
|
serviceProjectList: ServiceProjectList[];
|
||||||
snowFlakeId?: string;
|
snowFlakeId?: string;
|
||||||
|
securityUnitId:string;
|
||||||
street?: string;
|
street?: string;
|
||||||
streetName?:string;
|
streetName?:string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue