Browse Source

应对拍摄临时提交

master
蟑螂恶霸 2 years ago
parent
commit
8c781543ea
  1. 2
      src/views/Home.vue
  2. 183
      src/views/enforce/scanQrCode.vue
  3. 14
      src/views/enforceHome.vue

2
src/views/Home.vue

@ -147,7 +147,7 @@
onMounted(() => { onMounted(() => {
// console.log(useCommon.phonenumber) // console.log(useCommon.phonenumber)
// useCommon.SET_USER_PHONENUMBER(success.data.phonenumber); // useCommon.SET_USER_PHONENUMBER(success.data.phonenumber);
new Vconsolefrom(); // new Vconsolefrom();
const access_key = '6374106c5eb449a4ad6c2430f30796e6'; const access_key = '6374106c5eb449a4ad6c2430f30796e6';
const access_secret = '434fec85aa5846e88bbeb8fac6cf6d7f'; const access_secret = '434fec85aa5846e88bbeb8fac6cf6d7f';

183
src/views/enforce/scanQrCode.vue

@ -17,10 +17,10 @@
<div class="white-body"> <div class="white-body">
<div class="carousel_box"> <div class="carousel_box">
<div class="box-scan-one"> <div class="box-scan-one">
<span class="box-scan-text">扫一扫<br />企业二维码</span> <span class="box-scan-text">扫一扫<br/>企业二维码</span>
</div> </div>
<div class="box-scan-two"> <div class="box-scan-two">
<span class="box-scan-text">即可查看<br />企业信息</span> <span class="box-scan-text">即可查看<br/>企业信息</span>
</div> </div>
</div> </div>
<div class="boutique_box"> <div class="boutique_box">
@ -28,7 +28,7 @@
<div class="boutique_body"> <div class="boutique_body">
<!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> --> <!-- <goodsCard :goodsList="boutique" :cardAttr="boutiqueAttr"></goodsCard> -->
<div class="box-qr-code" @click="toScanPageView"> <div class="box-qr-code" @click="toScanPageView">
<!-- <img src="../../assets/images/scan.png" /> <!-- <img src="../../assets/images/scan.png" />
<span class="box-qr-code-text">执法监督码</span>--> <span class="box-qr-code-text">执法监督码</span>-->
</div> </div>
</div> </div>
@ -53,50 +53,51 @@
<script setup name="Home"> <script setup name="Home">
// import Vconsole from "vconsole"; // import Vconsole from "vconsole";
import { showFailToast } from 'vant'; import {showFailToast} from 'vant';
import {getEnterpriseMerchantAuthorization} from '@/api/Home'; import {getEnterpriseMerchantAuthorization} from '@/api/Home';
import {checkIsExists} from '@/api/enterprise'; import {checkIsExists} from '@/api/enterprise';
import {szyptGetToken} from "../../api/Home"; import {szyptGetToken} from "../../api/Home";
import wx from "weixin-js-sdk"; import wx from "weixin-js-sdk";
const { useCommon } = $globalStore;
const router = useRouter(); const {useCommon} = $globalStore;
let carouselList = reactive([]); // 轮播列表 const router = useRouter();
let boutique = reactive([]); // 精品数据 let carouselList = reactive([]); // 轮播列表
let recommend = reactive([]); // 推荐 let boutique = reactive([]); // 精品数据
let freshMap = reactive({ let recommend = reactive([]); // 推荐
let freshMap = reactive({
refreshLoad: false, // 是否刷新 refreshLoad: false, // 是否刷新
listLoading: false, // 是否加载中 listLoading: false, // 是否加载中
listFinished: false, // 是否加载完成标识 listFinished: false, // 是否加载完成标识
}); });
const data = reactive({}); const data = reactive({});
const boutiqueAttr = reactive({ const boutiqueAttr = reactive({
columnNum: 4, columnNum: 4,
itemClass: "boutique_item", itemClass: "boutique_item",
goodsCradclass: "boutique-crad", goodsCradclass: "boutique-crad",
}); // 商品卡片展示 }); // 商品卡片展示
//获取轮播 //获取轮播
const getCarousel = async () => { const getCarousel = async () => {
// const res = await useHome.getCarousel(); // const res = await useHome.getCarousel();
// if (res?.code === 20000) { // if (res?.code === 20000) {
// carouselList = res?.data; // carouselList = res?.data;
// } // }
}; };
//精品 //精品
const boutiqueGoods = async () => { const boutiqueGoods = async () => {
// const res = await useHome.boutiqueGoods(); // const res = await useHome.boutiqueGoods();
// if (res?.code === 20000) { // if (res?.code === 20000) {
// boutique = res?.data; // boutique = res?.data;
// } // }
}; };
const openScan = () => { const openScan = () => {
let fullUrl = window.location.href; let fullUrl = window.location.href;
let code = fullUrl.substring(fullUrl.indexOf('code=')+5, fullUrl.indexOf('&state=')); let code = fullUrl.substring(fullUrl.indexOf('code=') + 5, fullUrl.indexOf('&state='));
let paramUrl = window.location.href.split("#")[0]; let paramUrl = window.location.href.split("#")[0];
let param = { code: code, url: paramUrl }; let param = {code: code, url: paramUrl};
szyptGetToken(param,success =>{ szyptGetToken(param, success => {
let resMsg = success.data; let resMsg = success.data;
console.log(resMsg); console.log(resMsg);
wx.config({ wx.config({
@ -120,9 +121,10 @@ const openScan = () => {
wx.error((res) => { wx.error((res) => {
console.log("获取失败"); console.log("获取失败");
}); });
},error =>{}); }, error => {
}; });
const ClickScan = () => { };
const ClickScan = () => {
wx.scanQRCode({ wx.scanQRCode({
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有 scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
@ -130,24 +132,24 @@ const ClickScan = () => {
// 页面跳转 // 页面跳转
console.log("=========== 扫码返回 ===========") console.log("=========== 扫码返回 ===========")
console.log(res) console.log(res)
checkIsExists(res,success=>{ // checkIsExists(res, success => {
console.log(success.data) // console.log(success.data)
if(success.data){ // if (success.data) {
router.push({ router.push({
path:"/enterpriseScanPreview", path: "/enterpriseScanPreview",
query:{ query: {
enterpriseNumber: res.resultStr enterpriseNumber: res.resultStr
} }
}) })
}else{ // } else {
showFailToast('企业信息不存在,请确认二维码是否正确!'); // showFailToast('企业信息不存在,请确认二维码是否正确!');
router.push({ // router.push({
path:"/enforce/scanQrCode", // path: "/enforce/scanQrCode",
}) // })
} // }
},error =>{ // }, error => {
//
}) // })
// router.push({ // router.push({
// path: "/enterpriseScanPreview", // path: "/enterpriseScanPreview",
// query: { // query: {
@ -159,66 +161,66 @@ const ClickScan = () => {
console.log('err', res); console.log('err', res);
}, },
}); });
}; };
const toScanPageView = async() =>{ const toScanPageView = async () => {
openScan(); openScan();
// router.push({ // router.push({
// path: "/enforce/scanPage_szy", // path: "/enforce/scanPage_szy",
// query: {} // query: {}
// }); // });
}; };
const toNoScanView = async() =>{ const toNoScanView = async () => {
router.push({ router.push({
path: "/enforce/noScan", path: "/enforce/noScan",
query: {} query: {}
}); });
}; };
const toRegistrationListView = async() =>{ const toRegistrationListView = async () => {
router.push({ router.push({
path: "/enterprise/registrationList", path: "/enterprise/registrationList",
}); });
} }
const toComplaintView = async() =>{ const toComplaintView = async () => {
router.push({ router.push({
path: "/enterprise/complaint", path: "/enterprise/complaint",
}); });
} }
//下拉刷新 //下拉刷新
const onRefresh = () => { const onRefresh = () => {
freshMap.listFinished = false; freshMap.listFinished = false;
freshMap.listLoading = true; freshMap.listLoading = true;
freshMap.refreshLoad = true; freshMap.refreshLoad = true;
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => { // Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => {
// freshMap.refreshLoad = false; // freshMap.refreshLoad = false;
// }); // });
}; };
// 触底加载 // 触底加载
const onLoad = () => { const onLoad = () => {
// recommendGoods(true); // recommendGoods(true);
}; };
onMounted(() => { onMounted(() => {
// new Vconsole(); // new Vconsole();
getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber},success =>{ getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber}, success => {
if(!(success.data == null && success.data.length == 0)){ if (!(success.data == null && success.data.length == 0)) {
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber);
} }
},error =>{ }, error => {
})
}) })
}) // 返回
// 返回 const goBack = () => {
const goBack = () => {
router.go(-1); router.go(-1);
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.home { .home {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
@ -229,6 +231,7 @@ const goBack = () => {
background-image: linear-gradient(to bottom, #ebf3fb, transparent); background-image: linear-gradient(to bottom, #ebf3fb, transparent);
background-size: cover; background-size: cover;
position: relative; position: relative;
.carousel_box { .carousel_box {
position: relative; position: relative;
top: 2%; top: 2%;
@ -238,7 +241,7 @@ const goBack = () => {
background-size: 60%; background-size: 60%;
opacity: 0.75; opacity: 0.75;
.box-scan-one , .box-scan-two{ .box-scan-one, .box-scan-two {
position: absolute; position: absolute;
top: 30%; top: 30%;
left: 15%; left: 15%;
@ -246,14 +249,16 @@ const goBack = () => {
width: 30%; width: 30%;
font-size: 0.4rem; font-size: 0.4rem;
color: #999; color: #999;
.box-scan-text{
.box-scan-text {
margin-top: 70%; margin-top: 70%;
display: block; display: block;
width: 100%; width: 100%;
text-align: center text-align: center
} }
} }
.box-scan-two{
.box-scan-two {
left: auto; left: auto;
right: 12.5%; right: 12.5%;
} }
@ -271,8 +276,10 @@ const goBack = () => {
padding: 0px 0px 10px 0px; padding: 0px 0px 10px 0px;
display: flex; display: flex;
justify-content: center; justify-content: center;
}; }
.box-qr-code{ ;
.box-qr-code {
width: 52%; width: 52%;
text-align: right; text-align: right;
height: 7rem; height: 7rem;
@ -283,19 +290,21 @@ const goBack = () => {
// background-size: cover; // background-size: cover;
// border-radius: 50%; // border-radius: 50%;
// background-image: url("@/assets/images/scan.png"); // background-image: url("@/assets/images/scan.png");
.box-qr-code-text{ .box-qr-code-text {
margin-right: 25%; margin-right: 25%;
margin-top: 70%; margin-top: 70%;
display: block; display: block;
font-size: 0.45333rem; font-size: 0.45333rem;
} }
img{
img {
position: absolute; position: absolute;
top: 0%; top: 0%;
left: 34%; left: 34%;
} }
} }
.box-info{
.box-info {
width: 52%; width: 52%;
text-align: right; text-align: right;
height: 3.66667rem; height: 3.66667rem;
@ -304,14 +313,15 @@ const goBack = () => {
background: url("@/assets/images/item_check.png"); background: url("@/assets/images/item_check.png");
background-size: cover; background-size: cover;
.box-info-text{ .box-info-text {
margin-right: 3%; margin-right: 3%;
margin-top: 2%; margin-top: 2%;
display: block; display: block;
font-size: 17px font-size: 17px
} }
} }
.box-complaint{
.box-complaint {
width: 36%; width: 36%;
text-align: right; text-align: right;
height: 3.66667rem; height: 3.66667rem;
@ -320,7 +330,8 @@ const goBack = () => {
margin-left: 2%; margin-left: 2%;
background: url("@/assets/images/item_complain.png"); background: url("@/assets/images/item_complain.png");
background-size: cover; background-size: cover;
.box-complaint-text{
.box-complaint-text {
margin-right: 5%; margin-right: 5%;
margin-top: 3%; margin-top: 3%;
display: block; display: block;
@ -334,21 +345,21 @@ const goBack = () => {
width: 100%; width: 100%;
} }
} }
} }
.white-body { .white-body {
margin: 0 4%; margin: 0 4%;
width: 92%; width: 92%;
height: 96%; height: 96%;
background-color: #fff; background-color: #fff;
border-radius: 0.25remnpm; border-radius: 0.25 remnpm;
} }
.nocode { .nocode {
width: 100%; width: 100%;
color: #fb7905; color: #fb7905;
font-size: 0.45rem; font-size: 0.45rem;
text-align: center; text-align: center;
line-height: 3; line-height: 3;
} }
</style> </style>

14
src/views/enforceHome.vue

@ -153,7 +153,7 @@
}; };
onMounted(() => { onMounted(() => {
new Vconsolefrom(); // new Vconsolefrom();
let fullUrl = window.location.href; let fullUrl = window.location.href;
let code = fullUrl.substring(fullUrl.indexOf('code=') + 5, fullUrl.indexOf('&state=')); let code = fullUrl.substring(fullUrl.indexOf('code=') + 5, fullUrl.indexOf('&state='));
// getSzyptLoginAuth(route?.query?.code,success =>{ // getSzyptLoginAuth(route?.query?.code,success =>{
@ -162,12 +162,12 @@
useCommon.SET_USER_ID(success.data.userId); useCommon.SET_USER_ID(success.data.userId);
// 如果不是执法用户 则跳转 // 如果不是执法用户 则跳转
if (!success.data.lawOfficer) { // if (!success.data.lawOfficer) {
router.push( // router.push(
{ // {
path: "/noAccess" // path: "/noAccess"
}); // });
} // }
}, error => { }, error => {
}) })

Loading…
Cancel
Save