113 changed files with 1545 additions and 184 deletions
@ -0,0 +1,5 @@ |
|||
<template> |
|||
<div> |
|||
<van-empty description="404" /> |
|||
</div> |
|||
</template> |
|||
@ -0,0 +1,444 @@ |
|||
<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> |
|||
@ -0,0 +1,119 @@ |
|||
<template> |
|||
<div class="login-page"> |
|||
<div class="login-content"> |
|||
<van-nav-bar> |
|||
<template #title> |
|||
<div class="title"> |
|||
企业端登录 |
|||
</div> |
|||
</template> |
|||
</van-nav-bar> |
|||
<van-form @submit="onSubmit"> |
|||
<van-field v-model="loginParam.secretName" name="secretName" label="用户名" placeholder="用户名" |
|||
:rules="[{ required: true, message: '请填写用户名' }]"/> |
|||
<van-field v-model="loginParam.secretKey" type="password" name="secretKey" label="密码" placeholder="密码" |
|||
:rules="[{ required: true, message: '请填写密码' }]"/> |
|||
<div style="margin: 0.42rem"> |
|||
<van-button block type="primary" native-type="submit">登录</van-button> |
|||
</div> |
|||
</van-form> |
|||
<router-link to="/enterprise/register" class="link">还没有账号,去注册</router-link> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script setup> |
|||
import {reactive} from 'vue'; |
|||
import {enterpriseLogin, getEnterpriseInfo} from '../../api/enterprise'; |
|||
import CryptoJS from "crypto-js"; |
|||
import {showFailToast, showToast} from 'vant'; |
|||
import 'vant/es/toast/style'; |
|||
|
|||
const {useCommon} = $globalStore; |
|||
const router = useRouter(); |
|||
const loginParam = reactive({ |
|||
secretName: "", |
|||
secretKey: "" |
|||
}) |
|||
|
|||
const onSubmit = async (values) => { |
|||
values.secretKey = Encrypt(values.secretKey); |
|||
enterpriseLogin({"secretName": loginParam.secretName, "secretKey": values.secretKey}, response => { |
|||
if (response.code === 200) { |
|||
// 企业端登录成功 → 赋值用户基本信息 |
|||
useCommon.SET_USER_PHONENUMBER(response.data.phonenumber.toString()); |
|||
useCommon.SET_USER_ID(response.data.userId); |
|||
useCommon.SET_TOKEN(response.data.token); |
|||
//debugger; |
|||
console.log("message",useCommon.userId); |
|||
// 分离调用:获取关联的企业信息 |
|||
getEnterpriseInfo({userId: response.data.userId}, res => { |
|||
if (res.code === 200 && res.data && Array.isArray(res.data) && res.data.length > 0) { |
|||
const firstEnterprise = res.data[0]; |
|||
useCommon.SET_USER_ENTERPRISE_NUMBER(firstEnterprise.enterpriseNumber || ""); |
|||
useCommon.SET_USER_ENTERPRISE_NAME(firstEnterprise.enterpriseName || ""); |
|||
useCommon.SET_USER_ENTERPRISE_ID(firstEnterprise.enterpriseId || ""); |
|||
if (res.data.length > 1) { |
|||
showToast('您关联了多个企业,已默认选择企业:' + (firstEnterprise.enterpriseName || '')); |
|||
} |
|||
} |
|||
router.push({name: "enterpriseHome"}); |
|||
}, () => { |
|||
// 获取企业信息失败也照常跳转 |
|||
router.push({name: "enterpriseHome"}); |
|||
}); |
|||
} else { |
|||
showFailToast(response.msg || "登录失败"); |
|||
} |
|||
}, error => { |
|||
showFailToast(error?.msg || "登录失败,请检查网络"); |
|||
}) |
|||
}; |
|||
|
|||
const Encrypt = (passWord) => { |
|||
var keyStr = '1234567898745621'; |
|||
var ivStr = keyStr; |
|||
var key = CryptoJS.enc.Utf8.parse(keyStr); |
|||
var iv = CryptoJS.enc.Utf8.parse(ivStr); |
|||
var srcs = CryptoJS.enc.Utf8.parse(passWord); |
|||
var encrypted = CryptoJS.AES.encrypt(srcs, key, { |
|||
iv: iv, |
|||
mode: CryptoJS.mode.CBC, |
|||
padding: CryptoJS.pad.ZeroPadding |
|||
}); |
|||
return CryptoJS.enc.Base64.stringify(encrypted.ciphertext); |
|||
} |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.login-page { |
|||
width: 100%; |
|||
height: 100%; |
|||
display: flex; |
|||
overflow: hidden; |
|||
background-image: url("~@/assets/images/login.jpg"); |
|||
background-repeat: no-repeat; |
|||
background-size: cover; |
|||
opacity: 0.9; |
|||
|
|||
.login-content { |
|||
margin: auto; |
|||
padding: 0.27rem 0.27rem 0.52rem 0.27rem; |
|||
background-color: #fff; |
|||
border-radius: 0.27rem; |
|||
box-shadow: 0 0 0.27rem rgba(0, 0, 0, 0.2); |
|||
opacity: 0.9; |
|||
|
|||
.title { |
|||
font-size: 0.52rem; |
|||
font-weight: 600; |
|||
} |
|||
} |
|||
|
|||
.link { |
|||
font-size: 0.32rem; |
|||
color: #069; |
|||
float: right; |
|||
margin-right: 0.4rem; |
|||
} |
|||
} |
|||
</style> |
|||
@ -0,0 +1,294 @@ |
|||
<template> |
|||
<div class="address_edit"> |
|||
<!-- 导航栏 --> |
|||
<!--<div class="header_body"> |
|||
<header-nav |
|||
:slefBack="true" |
|||
@goBack="goBack" |
|||
:titelText="`执法监督码`" |
|||
> |
|||
</header-nav> |
|||
|
|||
</div> --> |
|||
<!-- 中间 --> |
|||
<div class="warp_body"> |
|||
<div class="white-body"> |
|||
<div class="qr_code"> |
|||
<div class="qr_name"> |
|||
<span>{{ data.enterpriseName }}</span> |
|||
</div> |
|||
<div class="qr_code_img" id="qr_code_img"> |
|||
<van-image |
|||
width="100%" |
|||
height="auto" |
|||
:src="data.qrCodeUrl" |
|||
/> |
|||
</div> |
|||
<span class="qr_code_text">生成时间:{{ data.generateTime }}</span> |
|||
</div> |
|||
<van-action-bar> |
|||
<van-action-bar-button color="#2b75fd" text="下载二维码" @click="download(data.qrCodeUrl)" /> |
|||
<!-- <van-action-bar-button color="#2b75fd" text="二维码管理" @click="toHisrotyView()" />--> |
|||
</van-action-bar> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="register"> |
|||
import axios from "axios"; |
|||
import {baseUrl} from "../../config/env"; |
|||
import html2canvas from "html2canvas" |
|||
import {queryEnterpriseInformationQrCode} from '../../api/enterprise' |
|||
import * as w6s from 'szient-js-sdk'; |
|||
import sha1 from 'crypto-js/sha1'; |
|||
import { reactive } from "vue"; |
|||
const { useMy } = $globalStore |
|||
|
|||
const router = useRouter(); |
|||
const route = useRoute(); |
|||
const data = reactive({ |
|||
qrCodeUrl:"", |
|||
enterpriseName:"", |
|||
generateTime:"", |
|||
}); |
|||
|
|||
|
|||
// 返回 |
|||
const goBack = () => { |
|||
router.go(-1); |
|||
}; |
|||
|
|||
|
|||
onMounted(() => { |
|||
queryEnterpriseInformationQrCode(route?.query?.enterpriseNumber |
|||
,success =>{ |
|||
if(success.success){ |
|||
data.qrCodeUrl = baseUrl + success.data.qrCodeUrl; |
|||
data.enterpriseName = success.data.enterpriseName; |
|||
data.generateTime = success.data.generateTime; |
|||
} |
|||
},error =>{ |
|||
console.log("查询失败") |
|||
}) |
|||
}); |
|||
|
|||
const downloadFile = (url) => { |
|||
const a = document.createElement('a') |
|||
a.href = url |
|||
a.download = "123456" // 下载后文件名 |
|||
a.style.display = 'none' |
|||
document.body.appendChild(a) |
|||
a.click() // 点击下载 |
|||
document.body.removeChild(a) // 下载完成移除元素 |
|||
} |
|||
const download = (url) =>{ |
|||
console.log(url); |
|||
// let e = this.$refs.toast; |
|||
// debugger |
|||
// html2canvas(document.getElementById('download-images'), { |
|||
// allowTaint: true, |
|||
// useCORS: true, // 设置跨域 |
|||
// tainttest: true, // 检测每张图片都已经加载完成 |
|||
// backgroundColor: null, // 背景色, 转换图片可能会有白色底色,不要的话就null |
|||
// }).then((canvas) => { |
|||
// const link = document.createElement("a"); // 创建一个超链接对象实例 |
|||
// link.download = "d2f57b93fd86d266c462a315349c13f8.jpg"; // 设置要下载的图片的名称 |
|||
// link.href = canvas.toDataURL(); // 将图片的URL设置到超链接的href中 |
|||
// link.click(); // 触发超链接的点击事件 |
|||
// }); |
|||
const access_key = '6374106c5eb449a4ad6c2430f30796e6'; |
|||
const access_secret = '434fec85aa5846e88bbeb8fac6cf6d7f'; |
|||
// generateRandomNumber() |
|||
const nonce = "887954"; |
|||
const timestamp = `${Date.now()}`; |
|||
|
|||
const str = [access_secret, nonce, timestamp] |
|||
.sort() |
|||
.reduce((str, item) => str += item, ''); |
|||
|
|||
// 最终还需要转成全小写 |
|||
const signature = sha1(str).toString().toLowerCase(); |
|||
var siqObject = { |
|||
access_key: access_key, |
|||
nonce: nonce, |
|||
timestamp: timestamp, |
|||
signature: signature, |
|||
}; |
|||
console.log(siqObject); |
|||
//深i企鉴权 |
|||
w6s.config(siqObject) |
|||
.then((res) => { |
|||
// 成功 |
|||
console.log("鉴权成功",res); |
|||
w6s.ready(() => { |
|||
// w6s.szient.getAuthCode({ |
|||
// success: function(res) { |
|||
// console.log(res) |
|||
// console.log("认证成功",res); |
|||
// console.log(res.result.result.code) |
|||
// getSiqLoginAuth({code: res.result.result.code},success =>{ |
|||
// console.log(success.data) |
|||
// },error =>{ |
|||
|
|||
// }) |
|||
// }, |
|||
// fail: function(err) { |
|||
// console.log(err) |
|||
// console.log("认证失败",err); |
|||
// }, |
|||
// }); |
|||
w6s.image.saveImages({ |
|||
url: url, |
|||
}); |
|||
w6s.dialog.showToast({ |
|||
title: '二维码下载中,请稍后...', |
|||
duration: 3000, // 毫秒数 |
|||
}); |
|||
}); |
|||
|
|||
}) |
|||
.catch((err) => { |
|||
// 失败 |
|||
// console.log(err) |
|||
console.log("鉴权失败",err); |
|||
}); |
|||
|
|||
|
|||
} |
|||
|
|||
const download2 = (url) => { |
|||
// url为图片地址(上传到后台,拿到链接) |
|||
// 创建下载任务 |
|||
plus.nativeUI.showWaiting('加载中...') |
|||
var dtask = plus.downloader.createDownload(url, {}, function(d, status) { |
|||
// 下载完成 |
|||
if (status == 200) { |
|||
console.log('下载成功,文件保存在' + d.filename) |
|||
plus.gallery.save( |
|||
d.filename, |
|||
function() { |
|||
//保存到相册方法 |
|||
plus.nativeUI.closeWaiting() |
|||
// Toast('已保存到手机相册') //vant框架记得引入 |
|||
}, |
|||
function() { |
|||
plus.nativeUI.closeWaiting() |
|||
// Toast('保存失败,请重试!') |
|||
} |
|||
) |
|||
} else { |
|||
// Toast('保存失败,请重试!') |
|||
} |
|||
}) |
|||
dtask.start() |
|||
} |
|||
|
|||
/** @params |
|||
filename: 文件名称 |
|||
fileurl: 文件路径 |
|||
*/ |
|||
const realDown = (url) => { |
|||
const filename = 123; |
|||
const fileurl = url; |
|||
let ua = navigator.userAgent.toLowerCase() |
|||
if (ua.includes("mac")) { |
|||
//iOS 将文件url转换为文件流 在下载 |
|||
downloadFun ( |
|||
fileurl + |
|||
"?response-content-type=application/octet-stream", |
|||
filename, |
|||
) |
|||
} else { |
|||
//android 直接用插件的方法下载即可 |
|||
download(fileurl,filename) |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
// 创建a标签 实现下载 |
|||
const downloadFun = async (blobFile, fileName) => { |
|||
let blob = new Blob([blobFile], { |
|||
type: "image/jpeg", |
|||
}) |
|||
if (window.navigator.msSaveOrOpenBlob) { |
|||
navigator.msSaveBlob(blob, fileName) |
|||
} else { |
|||
let link = document.createElement("a") |
|||
link.href = window.URL.createObjectURL(blob) |
|||
link.download = fileName |
|||
link.click() |
|||
window.URL.revokeObjectURL(link.href) //释放内存 |
|||
} |
|||
} |
|||
|
|||
const toHisrotyView = () =>{ |
|||
router.push({ path: "/qrCodeHistory", query: {enterpriseNumber: route?.query?.enterpriseNumber} }); |
|||
} |
|||
</script> |
|||
<style lang="less" scoped> |
|||
.address_edit { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100%; |
|||
overflow: hidden; |
|||
background-color: #ebf3fb; |
|||
} |
|||
.warp_body { |
|||
position: relative; |
|||
margin: 0; |
|||
background-image: linear-gradient(to bottom, #ebf3fb, transparent); |
|||
|
|||
.white-body { |
|||
display: flex; |
|||
//align-items: center; |
|||
margin: 0 3%; |
|||
width: 94%; |
|||
height: 100%; |
|||
background-color: #fff; |
|||
border-radius: 0.27rem; |
|||
margin-top: 0.15rem |
|||
} |
|||
.qr_code { |
|||
width: 100%; |
|||
height: 60%; |
|||
background-color:white; |
|||
position: relative; |
|||
margin-top: 20%; |
|||
.qr_code_img { |
|||
margin: 1% 10%; |
|||
width: 80%; |
|||
height: 70%; |
|||
} |
|||
.qr_code_text { |
|||
display: block; |
|||
position: relative; |
|||
width: 100%; |
|||
color: #d3d0d0; |
|||
font-size: 0.4rem; |
|||
text-align: center; |
|||
line-height: 3; |
|||
} |
|||
.qr_name { |
|||
position: relative; |
|||
top: 3%; |
|||
width: 100%; |
|||
height: 10%; |
|||
text-align: center; |
|||
font-size: 0.42rem; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/deep/ .van-image__img { |
|||
display: block; |
|||
width: 100%; |
|||
height: auto; |
|||
} |
|||
|
|||
/deep/ .van-action-bar { |
|||
box-shadow: 0 0 0.27rem #e5e5e5; |
|||
} |
|||
|
|||
</style> |
|||
@ -0,0 +1,479 @@ |
|||
<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.searchValue"--> |
|||
<!-- show-action--> |
|||
<!-- placeholder="请输入关键字查询"--> |
|||
<!-- @search="onSearch"--> |
|||
<!-- >--> |
|||
<!-- <template #action>--> |
|||
<!-- <div @click="onClickButton">搜索</div>--> |
|||
<!-- </template>--> |
|||
<!-- </van-search>--> |
|||
|
|||
|
|||
<!-- 顶部弹出 --> |
|||
<van-popup v-model:show="data.showTop" position="top" :style="{ height: '30%' }"> |
|||
<van-cell-group> |
|||
<van-field |
|||
v-model="searchParam.searchDate" |
|||
label="时间范围" |
|||
@click="" |
|||
readonly |
|||
/> |
|||
</van-cell-group> |
|||
</van-popup> |
|||
<!-- <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(1)" 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="searchFilter" round type="primary" size="mini">筛选</van-button> |
|||
</div> --> |
|||
<div class="search-button-date" style="justify-content: space-between;"> |
|||
<span class="date-select" @click="selectDate">{{ data.dateSearch }}</span> |
|||
<div style="border-color: black;" class="van-hairline--bottom"></div> |
|||
<div style="padding-right: 20px;"> |
|||
<van-button @click="toNewQrCode()" type="primary" |
|||
size="mini">新二维码</van-button> |
|||
</div> |
|||
<!-- <van-button class="search-button" type="primary" size="mini">统计分析</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" @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><span class="card_box_label">生成时间:</span>{{ item.generateTime }} <span |
|||
class="card_box_action"> |
|||
<van-button v-if="item.status == 0" @click="toUnQrCode(item.id)" type="primary" |
|||
size="mini">失效</van-button> |
|||
<van-button v-else type="error" size="mini">已失效</van-button> |
|||
</span></p> |
|||
</div> |
|||
<!-- <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa',padding: '0 5px' }" /> --> |
|||
<div class="van-hairline--bottom"></div> |
|||
<!-- <div class="card_box_span"> |
|||
<p>{{ item.checkItem }}</p> |
|||
</div> --> |
|||
|
|||
<!-- <div class="card_box_span">--> |
|||
<!-- <p><span class="card_box_label">变更原因:</span> {{ item.reasonsChange }}</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-nav></footer-nav> |
|||
</div> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="registrationList"> |
|||
import {showFailToast, showToast} from "vant"; |
|||
import {queryHistoryQrCodeList} from '../../api/enterprise'; |
|||
import {addQrCode, unQrCode} from '../../api/enforce'; |
|||
import {setGoodsNum} from "@/util/util"; |
|||
|
|||
const {useCommon, useShopCard} = $globalStore; |
|||
|
|||
const router = useRouter(); |
|||
const route = useRoute(); |
|||
let allchecked = ref(false); // 是否全选 |
|||
let refreshLoad = ref(false); // 是否加载中 |
|||
let value = ref('') |
|||
let totalPrice = ref(0); // 总钱数 |
|||
|
|||
let searchParam = reactive({ |
|||
//执法事件 |
|||
lawEnforcementIncident: "", |
|||
//执法单位 |
|||
lawEnforcement: "", |
|||
//搜索框 |
|||
searchText: ref(''), |
|||
//时间类型 |
|||
dateType: null, |
|||
//是否投诉 |
|||
isComplaint: null, |
|||
//企业统一信用码 |
|||
enterpriseNumber: ref(useCommon.enterpriseNumber), |
|||
//查询日期 |
|||
searchDate: null, |
|||
beginTime: "", |
|||
endTime: "" |
|||
|
|||
}); |
|||
|
|||
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'], |
|||
showTop: false, |
|||
}); |
|||
|
|||
// 设置初始值为当前时间 |
|||
onMounted(() => { |
|||
console.log(useCommon.enterpriseNumber); |
|||
useCommon.enterpriseNumber = route?.query?.enterpriseNumber; |
|||
// getCard(); |
|||
searchParam.enterpriseNumber = useCommon.enterpriseNumber; |
|||
console.log(useCommon.enterpriseNumber) |
|||
queryList(); |
|||
data.dateSearch = nowDate(new Date()); |
|||
}); |
|||
const queryList = () => { |
|||
queryHistoryQrCodeList(searchParam, success => { |
|||
console.log(success) |
|||
data.dataList = success.data; |
|||
}, error => { |
|||
|
|||
}) |
|||
|
|||
} |
|||
|
|||
const onSearch = (val) => { |
|||
queryRegistrationList( |
|||
{ |
|||
"searchValue": searchParam.searchValue |
|||
} |
|||
, success => { |
|||
console.log(success) |
|||
data.dataList = success.data; |
|||
}, error => { |
|||
|
|||
}) |
|||
}; |
|||
const onClickButton = () => { |
|||
console.log(searchParam.searchValue) |
|||
queryList(); |
|||
} |
|||
|
|||
const toNewQrCode = () => { |
|||
console.log("===========") |
|||
console.log(useCommon.enterpriseNumber) |
|||
addQrCode(useCommon.enterpriseNumber,success => { |
|||
console.log(success) |
|||
if (success.success) { |
|||
showToast('操作成功'); |
|||
queryList(); |
|||
} else { |
|||
showFailToast('操作失败!'); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const toUnQrCode = (id) => { |
|||
unQrCode(id, success => { |
|||
if (success.success) { |
|||
showToast('操作成功'); |
|||
queryList(); |
|||
} else { |
|||
showFailToast('操作失败!'); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const toDetailView = (id) => { |
|||
console.log(id) |
|||
router.push( |
|||
{ |
|||
path: "/enterprise/enterpriseInspectionDetail", |
|||
query: { |
|||
id: id, |
|||
} |
|||
}); |
|||
} |
|||
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]; |
|||
searchParam.searchDate = value.selectedValues[0] + "-" + value.selectedValues[1]; |
|||
data.showDatePicker = false; |
|||
//查询数据 |
|||
queryList(); |
|||
} |
|||
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 searchFilter = () => { |
|||
data.showTop = true; |
|||
queryList(); |
|||
} |
|||
const searchComplaint = (val) => { |
|||
searchParam.isComplaint = val; |
|||
searchParam.dateType = null; |
|||
queryList(); |
|||
} |
|||
const cancelSelectDate = () => { |
|||
data.showDatePicker = false; |
|||
} |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.shop { |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
overflow: hidden; |
|||
background-color: #ebf3fb; |
|||
|
|||
.header_body { |
|||
height: 1.33rem; |
|||
} |
|||
|
|||
.shop-center { |
|||
flex: 1; |
|||
overflow-y: scroll; |
|||
position: relative; |
|||
|
|||
.goods_box { |
|||
display: flex; |
|||
background-color: #fff; |
|||
margin: 0.27rem; |
|||
border-radius: 0.27rem; |
|||
|
|||
.swipe_cell { |
|||
width: 100%; |
|||
} |
|||
|
|||
.card_box { |
|||
display: flex; |
|||
width: 100%; |
|||
padding: 0.27rem 0; |
|||
flex-direction: column; |
|||
|
|||
.card_body { |
|||
background-color: #fff; |
|||
border-radius: 0.27rem; |
|||
flex: 1; |
|||
} |
|||
|
|||
.card_box_span { |
|||
display: flex; |
|||
align-items: center; |
|||
margin: 2% 0; |
|||
padding: 0 3%; |
|||
color: #666; |
|||
font-size: 0.35rem; |
|||
line-height: 1.5; |
|||
|
|||
p { |
|||
display: flex; |
|||
margin: 0; |
|||
} |
|||
} |
|||
|
|||
.card_box_action { |
|||
position: absolute; |
|||
right: 4%; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
.shop_footer_body { |
|||
//height: 101px; |
|||
position: relative; |
|||
|
|||
.footer-one-btn { |
|||
height: 1.33rem; |
|||
bottom: 1.34rem; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.search-button-list { |
|||
height: 0.7rem; |
|||
display: flex; |
|||
flex-direction: row; |
|||
padding-left: 0.27rem; |
|||
margin-top: 0.27rem; |
|||
align-items: end; |
|||
|
|||
.search-button { |
|||
width: 15%; |
|||
height: 90%; |
|||
background: #e3e0e0; |
|||
border-color: #e3e0e0; |
|||
color: #4c4c4c; |
|||
font-size: 0.3rem; |
|||
line-height: 1.5; |
|||
} |
|||
} |
|||
|
|||
.search-button-date { |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: end; |
|||
position: relative; |
|||
|
|||
.date-select { |
|||
margin: 3% 0 0 4%; |
|||
color: #c1bfbf; |
|||
font-size: 0.52rem; |
|||
|
|||
i { |
|||
transform: rotate(90deg); |
|||
font-size: 0.4rem; |
|||
} |
|||
} |
|||
|
|||
.search-button { |
|||
width: 15%; |
|||
height: 80%; |
|||
position: absolute; |
|||
top: 1%; |
|||
right: 1%; |
|||
} |
|||
} |
|||
|
|||
/deep/ .van-search__content { |
|||
height: 0.9rem; |
|||
border: 1px solid #ececec; |
|||
border-radius: 0.15rem 0 0 0.15rem; |
|||
} |
|||
|
|||
/deep/ .van-search__action { |
|||
margin: 0 3% 0 0; |
|||
width: 10%; |
|||
height: 0.9rem; |
|||
background: #1367fe; |
|||
border: 0.01rem solid #1367fe; |
|||
border-radius: 0 0.15rem 0.15rem 0; |
|||
color: #fff; |
|||
text-align: center; |
|||
line-height: 0.9rem; |
|||
} |
|||
|
|||
/deep/ .card_box_span p { |
|||
display: flex; |
|||
} |
|||
|
|||
.card_box_label { |
|||
color: #323233; |
|||
white-space: nowrap; |
|||
} |
|||
</style> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue