20 changed files with 1425 additions and 27 deletions
|
After Width: | Height: | Size: 161 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,52 @@ |
|||
/** |
|||
* 执法端页面 |
|||
*/ |
|||
const routes = [ |
|||
//执法端首页
|
|||
{ |
|||
path: "/enforceHome", |
|||
name: "enforceHome", |
|||
component: () => import("@/views/enforceHome.vue"), |
|||
meta: { |
|||
isKeepAlive: true, |
|||
}, |
|||
}, |
|||
//执法端扫码入企页面
|
|||
{ |
|||
path: "/enforce/scanQrCode", |
|||
name: "scanQrCode", |
|||
component: () => import("@/views/enforce/scanQrCode.vue"), |
|||
meta: { |
|||
isKeepAlive: true, |
|||
}, |
|||
}, |
|||
//执法端扫码页面
|
|||
{ |
|||
path: "/enforce/scanPage", |
|||
name: "scanPage", |
|||
component: () => import("@/views/enforce/scanPage.vue"), |
|||
meta: { |
|||
isKeepAlive: true, |
|||
}, |
|||
}, |
|||
//公布执法计划页面
|
|||
{ |
|||
path: "/enforce/enforcementPlan", |
|||
name: "enforcementPlan", |
|||
component: () => import("@/views/enforce/enforcementPlan.vue"), |
|||
meta: { |
|||
isKeepAlive: true, |
|||
}, |
|||
}, |
|||
//新增公布执法计划
|
|||
{ |
|||
path: "/enforce/enforcementPlanAdd", |
|||
name: "enforcementPlanAdd", |
|||
component: () => import("@/views/enforce/enforcementPlanAdd.vue"), |
|||
meta: { |
|||
isKeepAlive: true, |
|||
}, |
|||
}, |
|||
] |
|||
|
|||
export {routes} |
|||
@ -0,0 +1,375 @@ |
|||
|
|||
<template> |
|||
<div class="shop app_content"> |
|||
<!-- 导航栏 --> |
|||
<div class="header_body"> |
|||
<header-nav |
|||
:slefBack="true" |
|||
@goBack="goBack" |
|||
:titelText="`公布执法检查计划`" |
|||
> |
|||
</header-nav> |
|||
</div> |
|||
<van-search |
|||
v-model="searchParam.searchText" |
|||
show-action |
|||
placeholder="请输入关键字查询" |
|||
@search="onSearch" |
|||
> |
|||
<template #action> |
|||
<div @click="onClickButton">搜索</div> |
|||
</template> |
|||
</van-search> |
|||
<!-- <div class="search-button-list"> |
|||
<van-button plain hairline class="search-button" @click="searchDateType()" round type="primary" size="mini">全部</van-button> |
|||
<van-button plain hairline class="search-button" @click="searchDateType(2)" round type="primary" size="mini">本月</van-button> |
|||
<van-button plain hairline class="search-button" @click="searchDateType(3)" round type="primary" size="mini">本季度</van-button> |
|||
<van-button plain hairline class="search-button" @click="searchDateType(1)" round type="primary" size="mini">本年度</van-button> |
|||
<van-button plain hairline class="search-button" @click="searchComplaint(1)" round type="primary" size="mini">投诉</van-button> |
|||
</div> --> |
|||
<div class="search-button-date"> |
|||
<span class="date-select" @click="selectDate">{{ data.dateSearch }}</span> |
|||
<div style="border-color: black;" class="van-hairline--bottom"></div> |
|||
<van-button class="search-button" type="primary" size="mini" @click="openPlanAddView">创建</van-button> |
|||
<van-popup v-model:show="data.showDatePicker" position="bottom"> |
|||
<van-date-picker |
|||
title="选择日期" |
|||
v-model="data.currentDate" |
|||
:min-date="data.minDate" |
|||
:max-date="data.maxDate" |
|||
:columns-type="data.columnsType" |
|||
@confirm="onDateConfirm" |
|||
@cancel="cancelSelectDate" |
|||
/> |
|||
</van-popup> |
|||
</div> |
|||
|
|||
<!-- 中间 --> |
|||
<div class="shop-center"> |
|||
<lodding-card :isLodding="isLodding"> |
|||
<refresh-list v-model:freshMap="freshMap" :classMap="classMap" @refresh="onRefresh" @onLoad="onLoad" |
|||
:resetScroll="resetScroll" class="refresh_box"> |
|||
<div class="refresh_content" v-if="data?.dataList.length"> |
|||
<div class="goods_box" v-for="(item, index) in data?.dataList" :key="index"> |
|||
<van-swipe-cell class="swipe_cell"> |
|||
<div class="card_box"> |
|||
<div class="card_box_span"> |
|||
<p>发布时间:{{ item.createTime }} <span class="card_box_action"> |
|||
<van-button @click="toComplaintView(item.id,item.lawEnforcementIncident)" type="primary" size="mini">投诉</van-button> |
|||
</span></p> |
|||
</div> |
|||
<!-- <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa',padding: '0 5px' }" /> --> |
|||
<div style="border-color: aqua; border: 2px;" class="van-hairline--bottom"></div> |
|||
<div class="card_box_span"> |
|||
<p style="font-size: 16px;font-weight: bold;">{{ item.planName }}</p> |
|||
</div> |
|||
|
|||
<div class="card_box_span"> |
|||
<p><span class="card_box_label">执法区域:</span> {{ item.enforcementArea }}</p> |
|||
</div> |
|||
<div class="card_box_span"> |
|||
<p><span class="card_box_label">执法部门:</span> {{ item.enforcementDepartment }}</p> |
|||
</div> |
|||
<div class="card_box_span"> |
|||
<p><span class="card_box_label">执法计划:</span> {{ item.fileObject.fileName }}</p> |
|||
</div> |
|||
</div> |
|||
</van-swipe-cell> |
|||
</div> |
|||
</div> |
|||
<van-empty v-else class="no_data" description="暂无数据" /> |
|||
</refresh-list> |
|||
</lodding-card> |
|||
</div> |
|||
|
|||
<!-- 底部 --> |
|||
<div class="shop_footer_body"> |
|||
<footer-enforcement-nav></footer-enforcement-nav> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="enforcementInspectionProgram"> |
|||
import {queryEnforcementInspectionProgramList} from "@/api/enforce"; |
|||
import { setGoodsNum } from "@/util/util"; |
|||
const { useCommon, useShopCard } = $globalStore; |
|||
|
|||
const router = useRouter(); |
|||
let allchecked = ref(false); // 是否全选 |
|||
let refreshLoad = ref(false); // 是否加载中 |
|||
let value = ref('') |
|||
let totalPrice = ref(0); // 总钱数 |
|||
|
|||
let searchParam = reactive({ |
|||
//搜索框 |
|||
searchText: ref(''), |
|||
//日期查询 |
|||
searchDate: ref('') |
|||
}); |
|||
|
|||
const data = reactive({ |
|||
cartList: [], |
|||
dataList: [], |
|||
dateSearch: ref(), |
|||
showDatePicker:false, |
|||
currentDate:ref(['2024', '01']), |
|||
minDate: new Date(2020, 0, 1), |
|||
maxDate: new Date(2125, 5, 1), |
|||
columnsType :['year', 'month'], |
|||
}); |
|||
|
|||
// 设置初始值为当前时间 |
|||
onMounted(() => { |
|||
console.log(useCommon.enterpriseNumber); |
|||
// getCard(); |
|||
searchParam.enterpriseNumber = useCommon.enterpriseNumber; |
|||
console.log(useCommon.enterpriseNumber) |
|||
queryList(); |
|||
data.dateSearch = nowDate(new Date()); |
|||
}); |
|||
const queryList = () =>{ |
|||
queryEnforcementInspectionProgramList(searchParam,success =>{ |
|||
console.log(success) |
|||
data.dataList = success.data; |
|||
},error =>{ |
|||
|
|||
}) |
|||
} |
|||
|
|||
const onSearch = (val) => { |
|||
queryEnforcementInspectionProgramList( |
|||
{ |
|||
"searchText": searchParam.searchText |
|||
} |
|||
,success =>{ |
|||
console.log(success) |
|||
data.dataList = success.data; |
|||
},error =>{ |
|||
|
|||
}) |
|||
}; |
|||
const onClickButton = () =>{ |
|||
console.log(searchParam.searchText) |
|||
queryList(); |
|||
} |
|||
|
|||
const toComplaintView = (id,name) =>{ |
|||
console.log(id,name) |
|||
router.push( |
|||
{ |
|||
path: "/enterprise/complaint", |
|||
query: { |
|||
id: id, |
|||
lawEnforcementIncident: name |
|||
} |
|||
}); |
|||
} |
|||
onActivated(() => { |
|||
}); |
|||
|
|||
onDeactivated(() => { |
|||
|
|||
}); |
|||
|
|||
// 返回 |
|||
const goBack = () => { |
|||
router.go(-1); |
|||
}; |
|||
|
|||
let resetScroll = ref(0); // 滚动记录 |
|||
let isLodding = ref(true); // 是否加载中 |
|||
let freshMap = reactive({ |
|||
refreshLoad: false, // 是否刷新 |
|||
listLoading: false, // 是否加载中 |
|||
listFinished: false, // 是否加载完成标识 |
|||
}); |
|||
|
|||
|
|||
//下拉刷新 |
|||
const onRefresh = () => { |
|||
freshMap.listFinished = false; |
|||
freshMap.listLoading = true; |
|||
getGoodslist(); |
|||
}; |
|||
|
|||
// 触底加载 |
|||
const onLoad = () => { |
|||
freshMap.listFinished = true; |
|||
getGoodslist(true); |
|||
}; |
|||
|
|||
|
|||
|
|||
//获取分类下的商品列表 |
|||
const getGoodslist = async (onLoad) => { |
|||
// const res = await useClassify.classifyGoods(); |
|||
// if (res?.code === 20000) { |
|||
// goodsList = onLoad ? goodsList.concat(res?.data) : res?.data; |
|||
// freshMap.refreshLoad = false; |
|||
// freshMap.listLoading = false; |
|||
// freshMap.listFinished = res?.listFinished; |
|||
// if (goodsList.length > 50) { |
|||
// freshMap.listFinished = true; |
|||
// } |
|||
// } |
|||
freshMap.refreshLoad = false; |
|||
freshMap.listLoading = false; |
|||
freshMap.listFinished = true; |
|||
isLodding.value = false; |
|||
}; |
|||
|
|||
onMounted(async () => { |
|||
// let res = await getClassify(); |
|||
// if (res && res?.length) { |
|||
// classifyId = res?.[0]?.id; |
|||
// classifyId && getGoodslist(); |
|||
// } else { |
|||
// isLodding.value = false; |
|||
// } |
|||
queryList(); |
|||
isLodding.value = false; |
|||
}); |
|||
|
|||
const selectDate = () =>{ |
|||
data.showDatePicker = true; |
|||
console.log(data.showDatePicker) |
|||
} |
|||
|
|||
const onDateConfirm = (value)=> { |
|||
console.log(value); |
|||
value.selectedValues.forEach((item,index) => { |
|||
console.log(item); |
|||
}); |
|||
data.dateSearch = value.selectedValues[0] + "/" + value.selectedValues[1] |
|||
data.showDatePicker = false; |
|||
} |
|||
const nowDate = (time) => { |
|||
var year = time.getFullYear(); // 年 |
|||
var month = (time.getMonth() + 1).toString().padStart(2, '0'); // 月 |
|||
var date = time.getDate().toString().padStart(2, '0'); // 日 |
|||
var hour = time.getHours().toString().padStart(2, '0'); // 时 |
|||
var minute = time.getMinutes().toString().padStart(2, '0'); // 分 |
|||
var second = time.getSeconds().toString().padStart(2, '0'); // 秒 |
|||
return ( |
|||
year + "/" + month |
|||
) |
|||
} |
|||
|
|||
|
|||
const searchDateType = (val) =>{ |
|||
searchParam.dateType = val; |
|||
searchParam.isComplaint = null; |
|||
queryList(); |
|||
} |
|||
const searchComplaint = (val) =>{ |
|||
searchParam.isComplaint = val; |
|||
searchParam.dateType = null; |
|||
queryList(); |
|||
} |
|||
|
|||
const openPlanAddView = () =>{ |
|||
router.push( |
|||
{ |
|||
path: "/enforce/enforcementPlanAdd", |
|||
query: {} |
|||
}); |
|||
} |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.shop { |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
overflow: hidden; |
|||
background-color: #f4f4f4; |
|||
|
|||
.header_body { |
|||
height: 50px; |
|||
} |
|||
|
|||
.shop-center { |
|||
flex: 1; |
|||
overflow-y: scroll; |
|||
position: relative; |
|||
|
|||
.goods_box { |
|||
display: flex; |
|||
background-color: #fff; |
|||
margin: 6px; |
|||
border-radius: 10px; |
|||
|
|||
.swipe_cell { |
|||
width: 100%; |
|||
} |
|||
|
|||
.card_box { |
|||
display: flex; |
|||
width: 100%; |
|||
padding: 10px,0px; |
|||
flex-direction: column; |
|||
.card_body { |
|||
background-color: #fff; |
|||
border-radius: 10px; |
|||
flex: 1; |
|||
} |
|||
.card_box_span{ |
|||
font-size: 13px; |
|||
padding-left: 5%; |
|||
height: 35px; |
|||
align-items: center; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
.card_box_action{ |
|||
position: absolute; |
|||
right: 4%; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
.shop_footer_body { |
|||
height: 101px; |
|||
position: relative; |
|||
.footer-one-btn { |
|||
height: 50px; |
|||
bottom: 51px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.search-button-list{ |
|||
height: 3%; |
|||
display: flex; |
|||
flex-direction: row; |
|||
padding-left: 10px; |
|||
margin-top: 6px; |
|||
align-items: end; |
|||
.search-button{ |
|||
width: 15%; |
|||
height: 80%; |
|||
} |
|||
} |
|||
.search-button-date{ |
|||
height: 3%; |
|||
display: flex; |
|||
flex-direction: row; |
|||
padding-left: 10px; |
|||
margin-top: 15px; |
|||
align-items: end; |
|||
position: relative; |
|||
.date-select{ |
|||
font-size: 20px; |
|||
margin-left: 2%; |
|||
} |
|||
.search-button{ |
|||
width: 15%; |
|||
height: 80%; |
|||
position: absolute; |
|||
top: 1%; |
|||
right: 1%; |
|||
} |
|||
} |
|||
|
|||
</style> |
|||
@ -0,0 +1,332 @@ |
|||
<template> |
|||
<div class="address_edit"> |
|||
<!-- 导航栏 --> |
|||
<div class="header_body"> |
|||
<header-nav |
|||
:slefBack="true" |
|||
@goBack="goBack" |
|||
:titelText="`执法检查计划`" |
|||
> |
|||
</header-nav> |
|||
</div> |
|||
<!-- 中间 --> |
|||
<div class="warp_body"> |
|||
<van-cell-group> |
|||
<van-field |
|||
v-model="submitData.planYear" |
|||
required |
|||
label="计划年度" |
|||
placeholder="必填" |
|||
readonly |
|||
:rules="[{ required: true, message: '请选择年度计划' }]" |
|||
@click="selectDate" |
|||
/> |
|||
<van-popup v-model:show="data.showDatePicker" position="bottom"> |
|||
<van-date-picker |
|||
title="选择日期" |
|||
v-model="data.currentDate" |
|||
:min-date="data.minDate" |
|||
:max-date="data.maxDate" |
|||
:columns-type="data.columnsType" |
|||
@confirm="onDateConfirm" |
|||
@cancel="cancelSelectDate" |
|||
/> |
|||
</van-popup> |
|||
<van-field |
|||
v-model="submitData.planName" |
|||
label="计划名称" |
|||
placeholder="请输入" |
|||
required |
|||
:rules="[{ required: true, message: '请输入计划名称' }]" |
|||
/> |
|||
<van-field |
|||
v-model="submitData.enforcementDepartment" |
|||
label="执法部门" |
|||
placeholder="请选择" |
|||
@click="" |
|||
required |
|||
:rules="[{ required: true, message: '请选择执法部门'}]" |
|||
/> |
|||
<van-field |
|||
v-model="submitData.enforcementTime" |
|||
label="执法时间" |
|||
placeholder="请选择" |
|||
clickable |
|||
is-link |
|||
readonly |
|||
required |
|||
:rules="[{ required: true, message: '请选择执法时间'}]" |
|||
@click="selectEnforcementTime" |
|||
/> |
|||
<van-popup v-model:show="data.showPicker" position="bottom"> |
|||
<van-date-picker |
|||
title="选择日期" |
|||
v-model="data.currentDate1" |
|||
:min-date="data.minDate" |
|||
:max-date="data.maxDate" |
|||
:columns-type="data.columnsTypes" |
|||
@confirm="onEnforcementTimeConfirm" |
|||
@cancel="cancelEnforcementTime" |
|||
/> |
|||
</van-popup> |
|||
<van-field |
|||
v-model="submitData.enforcementArea" |
|||
label="执法区域" |
|||
placeholder="请输入" |
|||
required |
|||
:rules="[{ required: true, message: '请输入执法区域'}]" |
|||
/> |
|||
<div class="file-upload"> |
|||
<div class="file-upload-center"> |
|||
文件上传 <span>(不多于9张)</span> |
|||
</div> |
|||
<van-uploader v-model="submitData.fileListObj" class="file" :after-read="uploadFiles" multiple @oversize="onOversize" :before-delete="deleteFile" accept="file"> |
|||
<template #preview-cover="{ file }"> |
|||
<div class="preview-cover van-ellipsis">{{ file.name }}</div> |
|||
</template> |
|||
</van-uploader> |
|||
</div> |
|||
</van-cell-group> |
|||
<van-action-bar> |
|||
<van-action-bar-button color="#be99ff" text="保存" @click="submit" /> |
|||
</van-action-bar> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="register"> |
|||
|
|||
import { showSuccessToast,showLoadingToast,closeToast } from 'vant'; |
|||
import {addEnforcementInspectionProgram} from '@/api/enforce' |
|||
import {getDict} from '../../api/Home' |
|||
import {uploadFile} from '../../util/fileUpload' |
|||
import { reactive, ref } from "vue"; |
|||
const { useMy } = $globalStore |
|||
|
|||
const router = useRouter(); |
|||
const route = useRoute(); |
|||
let queryaddressId = ref(""); |
|||
const data = reactive({ |
|||
searchResult: [], |
|||
showPicker: false, |
|||
columns: [], |
|||
selectTypeValue : ref[0], |
|||
showDatePicker: ref(false), |
|||
columnsType :['year'], |
|||
columnsTypes :['year','month','day'], |
|||
currentDate: ref(['2024']), |
|||
minDate: new Date(2020, 0, 1), |
|||
maxDate: new Date(2125, 5, 1), |
|||
currentDate1: ref(['2024','03','01']), |
|||
}); |
|||
//保存参数 |
|||
const submitData = reactive({ |
|||
//关联案件ID |
|||
relId:"", |
|||
//计划年度 |
|||
planYear:"", |
|||
//计划名称 |
|||
planName:"", |
|||
//执法部门 |
|||
enforcementDepartment:"", |
|||
//执法部门ID |
|||
enforcementDepartmentId:"", |
|||
//执法时间 |
|||
enforcementTime:"", |
|||
//执法区域 |
|||
enforcementArea:"", |
|||
//后台保存图片列表 |
|||
fileList:[], |
|||
//vant组件上传照片列表 |
|||
fileListObj:[], |
|||
}) |
|||
|
|||
|
|||
// 返回 |
|||
const goBack = () => { |
|||
router.go(-1); |
|||
}; |
|||
|
|||
|
|||
const submit = () =>{ |
|||
// console.log(submitData); |
|||
showSuccessToast('保存成功'); |
|||
addEnforcementInspectionProgram(submitData,success =>{ |
|||
|
|||
console.log(success) |
|||
//跳转企业二维码地址 |
|||
if(success.success){ |
|||
console.log("保存成功"); |
|||
showSuccessToast('保存成功'); |
|||
goBack(); |
|||
} |
|||
},error=>{ |
|||
console.log("保存失败") |
|||
}) |
|||
} |
|||
//消息提醒 |
|||
// const toast = showLoadingToast({ |
|||
// duration: 0, |
|||
// forbidClick: true, |
|||
// message: '提交成功', |
|||
// }); |
|||
// let second = 3; |
|||
// const timer = setInterval(() => { |
|||
// second--; |
|||
// if (second) { |
|||
// } else { |
|||
// clearInterval(timer); |
|||
// closeToast(); |
|||
// } |
|||
// }, 1000); |
|||
// 保存地址操作 |
|||
const onSave = () => { |
|||
router.replace({ name: "addressList" }); |
|||
}; |
|||
|
|||
const onConfirm = (value)=> { |
|||
data.showPicker = false; |
|||
console.log(value) |
|||
submitData.enforceType = value.selectedValues[0]; |
|||
submitData.enforceTypeText = value.selectedOptions[0].text; |
|||
} |
|||
const selectType = () =>{ |
|||
data.showPicker = true; |
|||
// console.log(data) |
|||
} |
|||
|
|||
const uploadFiles = (file) =>{ |
|||
uploadFile(file,(res) =>{ |
|||
console.log(file.fileName); |
|||
submitData.fileList.push({ |
|||
fileUrl:res.url, |
|||
fileName: file.file.name |
|||
}) |
|||
console.log(submitData.fileList); |
|||
}); |
|||
|
|||
} |
|||
const deleteFile = (file,index) =>{ |
|||
console.log(index); |
|||
submitData.fileListObj.filter((item, indexs) => { |
|||
if (index.index == indexs) { |
|||
submitData.fileListObj.splice(indexs, 1);//splice 删除 |
|||
} |
|||
}); |
|||
submitData.fileList.filter((item, indexs) => { |
|||
if (index.index == indexs) { |
|||
submitData.fileList.splice(indexs, 1);//splice 删除 |
|||
} |
|||
}); |
|||
console.log(submitData.fileList); |
|||
return true; |
|||
} |
|||
onMounted(() => { |
|||
console.log(route?.query?.id); |
|||
console.log(route?.query?.lawEnforcementIncident); |
|||
submitData.relId = route?.query?.id; |
|||
submitData.lawEnforcementIncident = route?.query?.lawEnforcementIncident; |
|||
getDict({"dictType": "caseType"},success =>{ |
|||
console.log(success); |
|||
success.data.forEach(res =>{ |
|||
console.log(res) |
|||
var obj = { text: res.dictLabel, value: res.dictValue }; |
|||
data.columns.push(obj) |
|||
}) |
|||
},error =>{ |
|||
|
|||
}) |
|||
}); |
|||
|
|||
const selectDate = () =>{ |
|||
data.showDatePicker = true; |
|||
console.log(data.showDatePicker) |
|||
} |
|||
const onDateConfirm = (value)=> { |
|||
console.log(value); |
|||
|
|||
value.selectedValues.forEach((item,index) => { |
|||
console.log(item); |
|||
submitData.planYear = item; |
|||
}); |
|||
// submitData.establishmentTime = "2023-04-21" |
|||
data.showDatePicker = false; |
|||
} |
|||
//取消日期选择 |
|||
const cancelSelectDate = () =>{ |
|||
data.showDatePicker = false; |
|||
} |
|||
//取消 |
|||
const cancelEnforcementTime = () =>{ |
|||
data.showPicker = false; |
|||
} |
|||
|
|||
const selectEnforcementTime = () =>{ |
|||
data.showPicker = true; |
|||
} |
|||
|
|||
const onEnforcementTimeConfirm = (value)=> { |
|||
console.log(value); |
|||
|
|||
value.selectedValues.forEach((item,index) => { |
|||
console.log(item); |
|||
}); |
|||
submitData.enforcementTime = value.selectedValues[0] + "-" + value.selectedValues[1] + "-" + value.selectedValues[2] + " 00:00:00"; |
|||
data.showPicker = false; |
|||
} |
|||
|
|||
|
|||
</script> |
|||
<style lang="less" scoped> |
|||
.address_edit { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
background-color: #f4f4f4; |
|||
} |
|||
/* vant4的 Toast 和 Popup 样式冲突,会导致 Toast 变成白底 */ |
|||
.van-popup.van-toast{ |
|||
background: var(--van-toast-background) !important; |
|||
box-sizing: content-box !important; |
|||
/* 下面3条css,影响不大 */ |
|||
transition: all var(--van-duration-fast) !important; |
|||
width: var(--van-toast-default-width) !important; |
|||
max-width: var(--van-toast-max-width) !important; |
|||
} |
|||
.van-popup.van-toast .van-toast__icon{ |
|||
font-size: var(--van-toast-icon-size) !important; |
|||
} |
|||
.file-upload{ |
|||
height: 165px; |
|||
position: relative; |
|||
} |
|||
.file-upload-center{ |
|||
position: absolute; |
|||
height: 20%; |
|||
top: 10%; |
|||
left: 2%; |
|||
font-size: 18px; |
|||
span { |
|||
font-size: 13px; |
|||
color: rgb(221, 229, 227); |
|||
} |
|||
} |
|||
.file{ |
|||
position: absolute; |
|||
bottom: 10%; |
|||
left: 2%; |
|||
} |
|||
|
|||
.preview-cover { |
|||
position: absolute; |
|||
bottom: 0; |
|||
box-sizing: border-box; |
|||
width: 100%; |
|||
padding: 4px; |
|||
color: #fff; |
|||
font-size: 12px; |
|||
text-align: center; |
|||
background: rgba(0, 0, 0, 0.3); |
|||
} |
|||
</style> |
|||
@ -0,0 +1,119 @@ |
|||
<template> |
|||
<div class="scan-page"> |
|||
<!-- 返回导航栏 --> |
|||
<!-- left-text="取消" --> |
|||
<van-nav-bar title="扫描二维码/条形码" left-arrow |
|||
fixed class="scan-index-bar" @click-left="clickIndexLeft()" |
|||
></van-nav-bar> |
|||
<!-- 扫码区域 --> |
|||
<video ref="video" id="video" class="scan-video" autoplay></video> |
|||
<!-- 提示语 --> |
|||
<div v-show="tipShow" class="scan-tip">{{ tipMsg }}</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { BrowserMultiFormatReader } from '@zxing/library'; |
|||
import { Toast, Dialog, Notify } from 'vant'; |
|||
|
|||
export default { |
|||
name: 'ScanCodePage', // 扫码页面 |
|||
data() { |
|||
return { |
|||
codeReader: null, |
|||
tipShow: false, // 是否展示提示 |
|||
tipMsg: '', // 提示文本内容 |
|||
scanText: '', // 扫码结果文本内容 |
|||
} |
|||
}, |
|||
created() { |
|||
this.openScan(); |
|||
}, |
|||
watch: { |
|||
'$route'(to, from) { |
|||
if(to.path == '/ScanCodePage'){ // 当处于该页面时 |
|||
this.openScan(); |
|||
} |
|||
} |
|||
}, |
|||
destroyed(){ |
|||
this.codeReader.reset(); |
|||
this.codeReader = null; |
|||
}, |
|||
methods: { |
|||
async openScan() { // 初始化摄像头 |
|||
this.codeReader = await new BrowserMultiFormatReader(); |
|||
this.codeReader.getVideoInputDevices().then(videoDevices => { |
|||
this.tipMsg = '正在调用摄像头...'; |
|||
this.tipShow = true; |
|||
console.log('get-videoDevices', videoDevices); |
|||
|
|||
// 默认获取摄像头列表里的最后一个设备id,通过几部测试机发现一般前置摄像头位于列表里的前面几位,所以一般获取最后一个的是后置摄像头 |
|||
let firstDeviceId = videoDevices[videoDevices.length - 1].deviceId; |
|||
// 一般获取了手机的摄像头列表里不止一个,有的手机摄像头高级多层,会有变焦摄像头等情况,需要做处理 |
|||
if (videoDevices.length > 1) { |
|||
// 一般通过判断摄像头列表项里的 label 字段,'camera2 0, facing back' 字符串含有 'back' 和 '0',大部分机型是这样,如果有些机型没有,那就还是默认获取最后一个 |
|||
firstDeviceId = videoDevices.find(el => { return el.label.indexOf('back') > -1 && el.label.indexOf('0') > -1 }) ? |
|||
videoDevices.find(el => { return el.label.indexOf('back') > -1 && el.label.indexOf('0') > -1 }).deviceId : |
|||
videoDevices[videoDevices.length - 1].deviceId; |
|||
} |
|||
console.log('get-firstDeviceId', firstDeviceId); |
|||
|
|||
this.decodeFromInputVideoFunc(firstDeviceId); |
|||
}).catch(err => { |
|||
this.tipShow = false; |
|||
console.error(err); |
|||
}); |
|||
}, |
|||
decodeFromInputVideoFunc(firstDeviceId) { // 使用摄像头扫描 |
|||
this.codeReader.reset(); // 重置 |
|||
this.codeReader.decodeFromInputVideoDeviceContinuously(firstDeviceId, 'video', (result, err) => { |
|||
this.tipMsg = '正在尝试识别...'; |
|||
if (result) { |
|||
console.log('扫码结果', result); |
|||
this.scanText = result.text; |
|||
if (this.scanText) { |
|||
this.tipShow = false; |
|||
Dialog.confirm({ // 获取到扫码结果进行弹窗提示,这部分接下去的代码根据需要,读者自行编写了 |
|||
title: '扫码结果', |
|||
message: this.scanText, |
|||
}).then(() => { // 点击确认 |
|||
|
|||
}).catch(() => { // 点击取消 |
|||
|
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
clickIndexLeft(){ // 返回上一页 |
|||
// this.$destroy(); |
|||
this.$router.go(-1); |
|||
// window.location.href = document.referrer; |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.scan-index-bar{ |
|||
background-image: linear-gradient( -45deg, #42a5ff ,#59cfff); |
|||
.van-nav-bar__title, .van-nav-bar__arrow, .van-nav-bar__text{ |
|||
color: #fff !important; |
|||
} |
|||
} |
|||
.scan-page{ |
|||
min-height: 100vh; |
|||
background-color: #363636; |
|||
overflow-y: hidden; |
|||
.scan-video{ |
|||
height: 85vh; |
|||
} |
|||
.scan-tip{ |
|||
width: 100vw; |
|||
text-align: center; |
|||
color: white; |
|||
font-size: 5vw; |
|||
} |
|||
} |
|||
</style> |
|||
@ -0,0 +1,256 @@ |
|||
<template> |
|||
<div class="home app_content"> |
|||
<!-- 导航栏 --> |
|||
<div class="header_body"> |
|||
<!-- <header-nav :leftArrow="false" titelText="扫码入企"></header-nav> --> |
|||
<header-nav |
|||
:slefBack="true" |
|||
@goBack="goBack" |
|||
:titelText="`扫码入企`" |
|||
> |
|||
</header-nav> |
|||
</div> |
|||
|
|||
<!-- 中间 --> |
|||
<div class="warp_body"> |
|||
<!-- <refresh-list v-model:freshMap="freshMap" @refresh="onRefresh" @onLoad="onLoad"> --> |
|||
<div class="carousel_box"> |
|||
<div class="box-scan-one"> |
|||
<span class="box-scan-text">扫一扫企业二维码</span> |
|||
</div> |
|||
<div class="box-scan-two"> |
|||
<span class="box-scan-text">即可查看企业信息</span> |
|||
</div> |
|||
</div> |
|||
<div class="boutique_box"> |
|||
<!-- <van-cell :border="false" title="精品" /> --> |
|||
<div class="boutique_body"> |
|||
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> --> |
|||
<div class="box-qr-code" @click="toScanPageView"> |
|||
<img src="../../assets/images/scan.png" /> |
|||
<span class="box-qr-code-text">执法监督码</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- <div class="recommend_box"> |
|||
<van-cell :border="false" title="推荐" /> |
|||
<div class="recommend_body"> |
|||
<goodsCard :goodsList="recommend"></goodsCard> |
|||
</div> |
|||
</div> --> |
|||
<!-- </refresh-list> --> |
|||
</div> |
|||
|
|||
<!-- 底部 --> |
|||
<!-- <div class="footer_body"> |
|||
<footer-nav></footer-nav> |
|||
</div> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="Home"> |
|||
import {getEnterpriseMerchantAuthorization} from '@/api/Home'; |
|||
const { useCommon } = $globalStore; |
|||
const router = useRouter(); |
|||
let carouselList = reactive([]); // 轮播列表 |
|||
let boutique = reactive([]); // 精品数据 |
|||
let recommend = reactive([]); // 推荐 |
|||
let freshMap = reactive({ |
|||
refreshLoad: false, // 是否刷新 |
|||
listLoading: false, // 是否加载中 |
|||
listFinished: false, // 是否加载完成标识 |
|||
}); |
|||
const data = reactive({}); |
|||
const boutiqueAttr = reactive({ |
|||
columnNum: 4, |
|||
itemClass: "boutique_item", |
|||
goodsCradclass: "boutique-crad", |
|||
}); // 商品卡片展示 |
|||
|
|||
//获取轮播 |
|||
const getCarousel = async () => { |
|||
// const res = await useHome.getCarousel(); |
|||
// if (res?.code === 20000) { |
|||
// carouselList = res?.data; |
|||
// } |
|||
}; |
|||
|
|||
//精品 |
|||
const boutiqueGoods = async () => { |
|||
// const res = await useHome.boutiqueGoods(); |
|||
// if (res?.code === 20000) { |
|||
// boutique = res?.data; |
|||
// } |
|||
}; |
|||
|
|||
const toScanPageView = async() =>{ |
|||
router.push({ |
|||
path: "/enforce/scanPage", |
|||
query: {} |
|||
}); |
|||
}; |
|||
|
|||
const toRegistrationListView = async() =>{ |
|||
router.push({ |
|||
path: "/enterprise/registrationList", |
|||
}); |
|||
} |
|||
const toComplaintView = async() =>{ |
|||
router.push({ |
|||
path: "/enterprise/complaint", |
|||
}); |
|||
} |
|||
|
|||
//下拉刷新 |
|||
const onRefresh = () => { |
|||
freshMap.listFinished = false; |
|||
freshMap.listLoading = true; |
|||
freshMap.refreshLoad = true; |
|||
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => { |
|||
// freshMap.refreshLoad = false; |
|||
// }); |
|||
}; |
|||
|
|||
// 触底加载 |
|||
const onLoad = () => { |
|||
// recommendGoods(true); |
|||
}; |
|||
|
|||
onMounted(() => { |
|||
getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber},success =>{ |
|||
if(!(success.data == null && success.data.length == 0)){ |
|||
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); |
|||
} |
|||
},error =>{ |
|||
}) |
|||
}) |
|||
// 返回 |
|||
const goBack = () => { |
|||
router.go(-1); |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.home { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
background-color: #f4f4f4; |
|||
|
|||
.warp_body { |
|||
background-color: rgb(163, 156, 156); |
|||
background-size: cover; |
|||
position: relative; |
|||
.carousel_box { |
|||
height: 150px; |
|||
width: 100%; |
|||
padding-bottom: 10px; |
|||
position: relative; |
|||
.box-scan-one{ |
|||
position: absolute; |
|||
top: 30%; |
|||
left: 15%; |
|||
font-size: 14px; |
|||
background-color: beige; |
|||
height: 100px; |
|||
width: 30%; |
|||
.box-scan-text{ |
|||
margin-top: 70%; |
|||
display: block; |
|||
font-size: 12px; |
|||
width: 100%; |
|||
text-align: center |
|||
} |
|||
} |
|||
.box-scan-two{ |
|||
position: absolute; |
|||
top: 30%; |
|||
right: 15%; |
|||
font-size: 14px; |
|||
background-color: beige; |
|||
height: 100px; |
|||
width: 30%; |
|||
.box-scan-text{ |
|||
margin-top: 70%; |
|||
display: block; |
|||
font-size: 12px; |
|||
width: 100%; |
|||
text-align: center |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
.boutique_box { |
|||
position: absolute; |
|||
width: 100%; |
|||
bottom: 30%; |
|||
.boutique_body { |
|||
padding: 0px 0px 10px 0px; |
|||
display: flex; |
|||
justify-content: center; |
|||
}; |
|||
.box-qr-code{ |
|||
width: 47%; |
|||
text-align: right; |
|||
height: 4.66667rem; |
|||
background-color: var(--van-primary-color); |
|||
border-radius: 0.26667rem; |
|||
// background-size: cover; |
|||
border-radius: 50%; |
|||
// background-image: url("@/assets/images/scan.png"); |
|||
.box-qr-code-text{ |
|||
margin-right: 25%; |
|||
margin-top: 70%; |
|||
display: block; |
|||
font-size: 0.45333rem; |
|||
} |
|||
img{ |
|||
position: absolute; |
|||
top: 0%; |
|||
left: 34%; |
|||
} |
|||
} |
|||
.box-info{ |
|||
width: 52%; |
|||
text-align: right; |
|||
height: 3.66667rem; |
|||
background-color: #ff976a; |
|||
border-radius: 10px; |
|||
background: url("@/assets/images/item_check.png"); |
|||
background-size: cover; |
|||
|
|||
.box-info-text{ |
|||
margin-right: 3%; |
|||
margin-top: 2%; |
|||
display: block; |
|||
font-size: 17px |
|||
} |
|||
} |
|||
.box-complaint{ |
|||
width: 36%; |
|||
text-align: right; |
|||
height: 3.66667rem; |
|||
background-color: #ff976a; |
|||
border-radius: 10px; |
|||
margin-left: 2%; |
|||
background: url("@/assets/images/item_complain.png"); |
|||
background-size: cover; |
|||
.box-complaint-text{ |
|||
margin-right: 5%; |
|||
margin-top: 3%; |
|||
display: block; |
|||
font-size: 17px |
|||
} |
|||
} |
|||
} |
|||
|
|||
.recommend_box { |
|||
.recommend_body { |
|||
width: 100%; |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
@ -0,0 +1,209 @@ |
|||
<template> |
|||
<div class="home app_content"> |
|||
<!-- 导航栏 --> |
|||
<div class="header_body"> |
|||
<header-nav :leftArrow="false" titelText="首页"></header-nav> |
|||
</div> |
|||
|
|||
<!-- 中间 --> |
|||
<div class="warp_body"> |
|||
<!-- <refresh-list v-model:freshMap="freshMap" @refresh="onRefresh" @onLoad="onLoad"> --> |
|||
<div class="carousel_box" @onLoad="onLoad"> |
|||
<carousel-card v-if="carouselList.length" v-model:carouselList="carouselList"></carousel-card> |
|||
</div> |
|||
<div class="boutique_box"> |
|||
<!-- <van-cell :border="false" title="精品" /> --> |
|||
<div class="boutique_body"> |
|||
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> --> |
|||
<div class="box-qr-code" @click="toScanCodeView"> |
|||
<span class="box-qr-code-text">扫码入企</span> |
|||
</div> |
|||
</div> |
|||
<div class="boutique_body"> |
|||
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> --> |
|||
<div class="box-info" @click="toRegistrationListView"> |
|||
<span class="box-info-text" >历史检查信息</span> |
|||
</div> |
|||
<div class="box-complaint" @click="toComplaintView"> |
|||
<span class="box-complaint-text">统计分析</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- <div class="recommend_box"> |
|||
<van-cell :border="false" title="推荐" /> |
|||
<div class="recommend_body"> |
|||
<goodsCard :goodsList="recommend"></goodsCard> |
|||
</div> |
|||
</div> --> |
|||
<!-- </refresh-list> --> |
|||
</div> |
|||
|
|||
<!-- 底部 --> |
|||
<div class="footer_body"> |
|||
<footer-enforcement-nav></footer-enforcement-nav> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="Home"> |
|||
import {getEnterpriseMerchantAuthorization} from '../api/Home'; |
|||
const { useCommon } = $globalStore; |
|||
const router = useRouter(); |
|||
let carouselList = reactive([]); // 轮播列表 |
|||
let boutique = reactive([]); // 精品数据 |
|||
let recommend = reactive([]); // 推荐 |
|||
let freshMap = reactive({ |
|||
refreshLoad: false, // 是否刷新 |
|||
listLoading: false, // 是否加载中 |
|||
listFinished: false, // 是否加载完成标识 |
|||
}); |
|||
const data = reactive({}); |
|||
const boutiqueAttr = reactive({ |
|||
columnNum: 4, |
|||
itemClass: "boutique_item", |
|||
goodsCradclass: "boutique-crad", |
|||
}); // 商品卡片展示 |
|||
|
|||
//获取轮播 |
|||
const getCarousel = async () => { |
|||
// const res = await useHome.getCarousel(); |
|||
// if (res?.code === 20000) { |
|||
// carouselList = res?.data; |
|||
// } |
|||
}; |
|||
|
|||
//精品 |
|||
const boutiqueGoods = async () => { |
|||
// const res = await useHome.boutiqueGoods(); |
|||
// if (res?.code === 20000) { |
|||
// boutique = res?.data; |
|||
// } |
|||
}; |
|||
|
|||
/**扫码入企 */ |
|||
const toScanCodeView = async() =>{ |
|||
router.push({ path: "/enforce/scanQrCode" }); |
|||
}; |
|||
|
|||
const toRegistrationListView = async() =>{ |
|||
router.push({ |
|||
path: "/enterprise/registrationList", |
|||
}); |
|||
} |
|||
const toComplaintView = async() =>{ |
|||
router.push({ |
|||
path: "/enterprise/complaint", |
|||
}); |
|||
} |
|||
|
|||
//下拉刷新 |
|||
const onRefresh = () => { |
|||
freshMap.listFinished = false; |
|||
freshMap.listLoading = true; |
|||
freshMap.refreshLoad = true; |
|||
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => { |
|||
// freshMap.refreshLoad = false; |
|||
// }); |
|||
}; |
|||
|
|||
// 触底加载 |
|||
const onLoad = () => { |
|||
// recommendGoods(true); |
|||
}; |
|||
|
|||
onMounted(() => { |
|||
getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber},success =>{ |
|||
if(!(success.data == null && success.data.length == 0)){ |
|||
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); |
|||
} |
|||
},error =>{ |
|||
}) |
|||
}); |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.home { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
background-color: #f4f4f4; |
|||
|
|||
.warp_body { |
|||
background: url("../assets/images/bg_el.jpg"); |
|||
background-size: cover; |
|||
position: relative; |
|||
.carousel_box { |
|||
height: 150px; |
|||
width: 100%; |
|||
padding-bottom: 10px; |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
.boutique_box { |
|||
position: absolute; |
|||
width: 100%; |
|||
bottom: 3%; |
|||
.boutique_body { |
|||
padding: 0px 0px 10px 0px; |
|||
display: flex; |
|||
justify-content: center; |
|||
}; |
|||
.box-qr-code{ |
|||
width: 90%; |
|||
text-align: right; |
|||
height: 3.66667rem; |
|||
background-color: #ff976a; |
|||
border-radius: 10px; |
|||
background: url("../assets/images/item_scan.png"); |
|||
background-size: cover; |
|||
.box-qr-code-text{ |
|||
margin-right: 3%; |
|||
margin-top: 2%; |
|||
display: block; |
|||
font-size: 17px |
|||
} |
|||
} |
|||
.box-info{ |
|||
width: 52%; |
|||
text-align: right; |
|||
height: 3.66667rem; |
|||
background-color: #ff976a; |
|||
border-radius: 10px; |
|||
background: url("../assets/images/item_checkc.png"); |
|||
background-size: cover; |
|||
|
|||
.box-info-text{ |
|||
margin-right: 3%; |
|||
margin-top: 2%; |
|||
display: block; |
|||
font-size: 17px |
|||
} |
|||
} |
|||
.box-complaint{ |
|||
width: 36%; |
|||
text-align: right; |
|||
height: 3.66667rem; |
|||
background-color: #ff976a; |
|||
border-radius: 10px; |
|||
margin-left: 2%; |
|||
background: url("../assets/images/item_count.png"); |
|||
background-size: cover; |
|||
.box-complaint-text{ |
|||
margin-right: 5%; |
|||
margin-top: 3%; |
|||
display: block; |
|||
font-size: 17px |
|||
} |
|||
} |
|||
} |
|||
|
|||
.recommend_box { |
|||
.recommend_body { |
|||
width: 100%; |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue