You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
444 lines
13 KiB
444 lines
13 KiB
<template>
|
|
<!-- <Loading class="loading-div" type="spinner" v-show="isLoading" color="#1989fa"/>
|
|
<div class="home app_content" v-if="!isLoading"> -->
|
|
<div class="home app_content">
|
|
<!-- 导航栏 -->
|
|
<!-- <div class="header_body">-->
|
|
<!-- <header-nav :leftArrow="false" titelText="执法监督码"></header-nav>-->
|
|
<!-- </div>-->
|
|
|
|
<!-- 中间 -->
|
|
<div class="warp_body">
|
|
<div class="logobox"></div>
|
|
<!-- <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="showEnterpriseQRCode">
|
|
<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>
|
|
<!-- </refresh-list> -->
|
|
</div>
|
|
|
|
<!-- 底部 -->
|
|
<div class="footer_body">
|
|
<footer-nav></footer-nav>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup name="enterpriseHome">
|
|
import Vconsolefrom from 'vconsole';
|
|
import * as w6s from 'szient-js-sdk';
|
|
import sha1 from 'crypto-js/sha1';
|
|
import {Loading} from 'vant';
|
|
import {getEnterpriseMerchantAuthorization, getSiqLoginAuth, siqCode} from '../../api/enterprise';
|
|
import {showSuccessToast} from "vant";
|
|
import 'vant/es/toast/style';
|
|
|
|
const {useCommon} = $globalStore;
|
|
const router = useRouter();
|
|
const route = useRoute();
|
|
let carouselList = reactive([]); // 轮播列表
|
|
const isLoading = ref(true);
|
|
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 boutiqueGoods = async () => {
|
|
};
|
|
|
|
const showEnterpriseQRCode = async () => {
|
|
/*if (useCommon.enterpriseNumber == null || useCommon.enterpriseNumber == "") {
|
|
router.push({path: "/enterprise/register"});
|
|
} else {*/
|
|
router.push({
|
|
path: "/enterprise/qrCode",
|
|
query: {
|
|
enterpriseNumber: useCommon.enterpriseNumber,
|
|
}
|
|
});
|
|
//}
|
|
};
|
|
|
|
const toRegistrationListView = async () => {
|
|
router.push({
|
|
path: "/enterprise/registrationList",
|
|
});
|
|
}
|
|
const toComplaintView = async () => {
|
|
router.push({
|
|
path: "/enterprise/complaint",
|
|
query: {
|
|
comOrOpi: 0,
|
|
isSelect: true
|
|
}
|
|
});
|
|
}
|
|
|
|
//下拉刷新
|
|
const onRefresh = () => {
|
|
freshMap.listFinished = false;
|
|
freshMap.listLoading = true;
|
|
freshMap.refreshLoad = true;
|
|
};
|
|
|
|
// 触底加载
|
|
const onLoad = () => {
|
|
};
|
|
|
|
const generateRandomNumber = () => {
|
|
const min = 100000;
|
|
const max = 999999;
|
|
const randomNum = (Math.floor(Math.random() * (max - min + 1)) + min);
|
|
return randomNum.toString().padStart(6, '0');
|
|
}
|
|
|
|
const getEnterpriseMerchant = (enterpriseNum, phoneNumber) => {
|
|
getEnterpriseMerchantAuthorization({enterpriseNumber: enterpriseNum, merchantTel: phoneNumber}, success => {
|
|
//debugger;
|
|
//console.log('------------->>>: ', success.data[0].enterpriseNumber)
|
|
if (success.data != null && success.data.length > 0) {
|
|
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber);
|
|
}
|
|
}, error => {
|
|
})
|
|
}
|
|
|
|
// 判断用户信息是否已完整(企业端登录后已写入store)
|
|
const hasUserInfo = () => {
|
|
return useCommon.userId
|
|
&& useCommon.enterpriseName
|
|
&& useCommon.enterpriseNumber
|
|
&& useCommon.enterpriseId;
|
|
};
|
|
|
|
onMounted(() => {
|
|
console.log(useCommon.firstLoad);
|
|
console.log(useCommon);
|
|
isLoading.value = useCommon.firstLoad;
|
|
|
|
// 如果store中已存在完整的用户和企业信息,则跳过w6s鉴权
|
|
if (hasUserInfo()) {
|
|
console.log("用户信息已存在,跳过w6s鉴权");
|
|
isLoading.value = false;
|
|
getEnterpriseMerchant(useCommon.enterpriseNumber.toString(), useCommon.phonenumber.toString());
|
|
useCommon.SET_IS_FIRST_LOAD(false);
|
|
return;
|
|
}
|
|
|
|
siqCode(null, success => {
|
|
let access_key = "";
|
|
let access_secret = "";
|
|
if (success.success) {
|
|
access_key = success.data.accessKey;
|
|
access_secret = success.data.accessSecret;
|
|
}
|
|
|
|
const nonce = generateRandomNumber();
|
|
const timestamp = `${Date.now()}`;
|
|
|
|
const str = [access_secret, nonce, timestamp]
|
|
.sort()
|
|
.reduce((str, item) => str += item, '');
|
|
|
|
// 最终还需要转成全小写
|
|
const signature = sha1(str).toString().toLowerCase();
|
|
|
|
w6s.config({
|
|
access_key: access_key,
|
|
nonce: nonce,
|
|
timestamp: timestamp,
|
|
signature: signature,
|
|
}).then((res) => {
|
|
console.log("鉴权", res);
|
|
}).catch((err) => {
|
|
console.log("鉴权", err);
|
|
//getEnterpriseMerchant(useCommon.enterpriseNumber.toString(), useCommon.phonenumber.toString());
|
|
});
|
|
|
|
w6s.ready(() => {
|
|
w6s.header.setTitle('深圳市行政执法监督码');
|
|
w6s.szient.getAuthCode({
|
|
success: function (res) {
|
|
console.log(res)
|
|
console.log("认证", res);
|
|
console.log("code: " + res.result.result.code);
|
|
getSiqLoginAuth({code: res.result.result.code}, success => {
|
|
useCommon.SET_USER_PHONENUMBER(success.data.phonenumber.toString());
|
|
useCommon.SET_USER_ID(success.data.userId);
|
|
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data.enterpriseNumber);
|
|
console.log(success.data);
|
|
useCommon.SET_TOKEN(success.data.token);
|
|
console.log(useCommon.userId);
|
|
console.log(useCommon.firstLoad);
|
|
if (useCommon.firstLoad) {
|
|
isLoading.value = false;
|
|
}
|
|
//设置已经初始化
|
|
useCommon.SET_IS_FIRST_LOAD(false)
|
|
getEnterpriseMerchant(success.data.enterpriseNumber.toString(), success.data.phonenumber.toString());
|
|
if (useCommon.firstLoad) {
|
|
isLoading.value = false;
|
|
}
|
|
}, error => {
|
|
console.log("error : " + error)
|
|
})
|
|
},
|
|
fail: function (err) {
|
|
console.log(err)
|
|
console.log("认证", err);
|
|
},
|
|
});
|
|
});
|
|
|
|
});
|
|
const {VITE_BASE_URL, access_key, access_secret} = import.meta.env;
|
|
console.log(VITE_BASE_URL);
|
|
const apiUrl = ref(import.meta.env.accessKey);
|
|
console.log(access_key);
|
|
console.log(access_secret);
|
|
});
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.home {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
background-color: #f4f4f4;
|
|
|
|
.warp_body {
|
|
position: relative;
|
|
margin: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #c6e6ff url("../../assets/images/bg_c.jpg") no-repeat top;
|
|
background-size: auto 100%;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
|
|
.carousel_box {
|
|
height: 4rem;
|
|
width: 100%;
|
|
padding-bottom: 0.27rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.boutique_box {
|
|
position: absolute;
|
|
width: 100%;
|
|
bottom: 1%;
|
|
|
|
.boutique_body {
|
|
padding: 0 0 0.27rem 0;
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.box-qr-code {
|
|
position: relative;
|
|
margin: 2% 0;
|
|
width: 90%;
|
|
height: 3.67rem;
|
|
text-align: right;
|
|
border-radius: 0.27rem;
|
|
|
|
.box-qr-code-text {
|
|
position: absolute;
|
|
z-index: 10;
|
|
top: 0.35rem;
|
|
right: 0.35rem;
|
|
display: block;
|
|
font-size: 0.5rem;
|
|
}
|
|
}
|
|
|
|
.box-qr-code::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: -0.14rem;
|
|
left: -0.14rem;
|
|
z-index: 0;
|
|
width: calc(100% + 0.13rem);
|
|
height: calc(100% + 0.13rem);
|
|
background-color: #fff;
|
|
border: 0.14rem solid rgba(255, 255, 255, 0.5);
|
|
border-radius: 0.27rem;
|
|
}
|
|
|
|
.box-qr-code::after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 1;
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 0.27rem;
|
|
background: #fff url("../../assets/images/item_code.jpg") no-repeat left;
|
|
background-size: auto 100%;
|
|
border: 1px solid #8db4ff;
|
|
}
|
|
|
|
.box-info {
|
|
position: relative;
|
|
margin-right: 2%;
|
|
width: 50%;
|
|
height: 3.67rem;
|
|
text-align: right;
|
|
border-radius: 0.27rem;
|
|
|
|
.box-info-text {
|
|
position: absolute;
|
|
z-index: 10;
|
|
top: 0.35rem;
|
|
right: 0.35rem;
|
|
display: block;
|
|
font-size: 0.5rem;
|
|
}
|
|
}
|
|
|
|
.box-info::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: -0.14rem;
|
|
left: -0.14rem;
|
|
z-index: 0;
|
|
width: calc(100% + 0.13rem);
|
|
height: calc(100% + 0.13rem);
|
|
background-color: #fff;
|
|
border: 0.14rem solid rgba(255, 255, 255, 0.5);
|
|
border-radius: 0.27rem;
|
|
}
|
|
|
|
.box-info::after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 1;
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 0.27rem;
|
|
background: #fff url("../../assets/images/item_checkc.jpg") no-repeat left;
|
|
background-size: auto 100%;
|
|
border: 1px solid #8db4ff;
|
|
}
|
|
|
|
.box-complaint {
|
|
position: relative;
|
|
margin-left: 3%;
|
|
width: 35%;
|
|
height: 3.67rem;
|
|
text-align: right;
|
|
border-radius: 0.27rem;
|
|
|
|
.box-complaint-text {
|
|
position: absolute;
|
|
z-index: 10;
|
|
top: 0.35rem;
|
|
right: 0.35rem;
|
|
display: block;
|
|
font-size: 0.5rem;
|
|
}
|
|
}
|
|
}
|
|
|
|
.box-complaint::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: -0.14rem;
|
|
left: -0.14rem;
|
|
z-index: 0;
|
|
width: calc(100% + 0.13rem);
|
|
height: calc(100% + 0.13rem);
|
|
background-color: #fff;
|
|
border: 0.14rem solid rgba(255, 255, 255, 0.5);
|
|
border-radius: 0.27rem;
|
|
}
|
|
|
|
.box-complaint::after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 1;
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 0.27rem;
|
|
background: #fff url("../../assets/images/item_complain.jpg") no-repeat left;
|
|
background-size: auto 100%;
|
|
border: 1px solid #8db4ff;
|
|
}
|
|
|
|
.recommend_box {
|
|
.recommend_body {
|
|
width: 100%;
|
|
}
|
|
}
|
|
}
|
|
|
|
.logobox {
|
|
position: relative;
|
|
top: 4%;
|
|
left: 5%;
|
|
z-index: 99;
|
|
width: 82%;
|
|
height: 10vh;
|
|
background: url("../../assets/images/logo.png") no-repeat;
|
|
background-size: 100% auto;
|
|
}
|
|
|
|
@media screen and (max-width: 380px) {
|
|
.home .warp_body {
|
|
background: #c6e6ff url("../../assets/images/bg_c.jpg") no-repeat top;
|
|
background-size: 100% auto;
|
|
}
|
|
}
|
|
|
|
@media screen and (min-width: 540px) {
|
|
.home .warp_body {
|
|
background: #c6e6ff url("../../assets/images/bg_c.jpg") no-repeat top;
|
|
background-size: 100% auto;
|
|
}
|
|
}
|
|
|
|
.loading-div {
|
|
position: absolute;
|
|
top: 45%;
|
|
left: 48%;
|
|
}
|
|
|
|
</style>
|
|
|