13 changed files with 997 additions and 362 deletions
@ -0,0 +1,325 @@ |
|||
<template> |
|||
<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="toRegisterView"> |
|||
<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-nav></footer-nav> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup name="Home"> |
|||
import Vconsolefrom from 'vconsole'; |
|||
import * as w6s from 'szient-js-sdk'; |
|||
import sha1 from 'crypto-js/sha1'; |
|||
import {getEnterpriseMerchantAuthorization, getSiqLoginAuth, getSiqLoginAuthTest} from '../api/Home'; |
|||
import {showSuccessToast} from "vant"; |
|||
import 'vant/es/toast/style'; |
|||
|
|||
const {useCommon} = $globalStore; |
|||
const router = useRouter(); |
|||
const route = useRoute(); |
|||
let carouselList = 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 toRegisterView = 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: { |
|||
isSelect: true |
|||
} |
|||
}); |
|||
} |
|||
|
|||
//下拉刷新 |
|||
const onRefresh = () => { |
|||
freshMap.listFinished = false; |
|||
freshMap.listLoading = true; |
|||
freshMap.refreshLoad = true; |
|||
// Promise.all([getCarousel(), boutiqueGoods(), recommendGoods()]).then(() => { |
|||
// freshMap.refreshLoad = false; |
|||
// }); |
|||
}; |
|||
|
|||
// 触底加载 |
|||
const onLoad = () => { |
|||
// recommendGoods(true); |
|||
}; |
|||
|
|||
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 = (phoneNumber) => { |
|||
getEnterpriseMerchantAuthorization({merchantTel: phoneNumber}, success => { |
|||
if (!(success.data == null && success.data.length == 0)) { |
|||
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); |
|||
} |
|||
}, error => { |
|||
}) |
|||
} |
|||
|
|||
onMounted(() => { |
|||
// console.log(useCommon.phonenumber) |
|||
// useCommon.SET_USER_PHONENUMBER(success.data.phonenumber); |
|||
new Vconsolefrom(); |
|||
|
|||
const access_key = '6374106c5eb449a4ad6c2430f30796e6'; |
|||
const access_secret = '434fec85aa5846e88bbeb8fac6cf6d7f'; |
|||
// generateRandomNumber() |
|||
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(); |
|||
|
|||
// //深i企鉴权测试 |
|||
// getSiqLoginAuthTest({userId: "1608644307579883522", userName: "汪鑫"},success =>{ |
|||
// useCommon.SET_USER_ENTERPRISE_NUMBER(success.data.enterpriseNumber); |
|||
// useCommon.SET_USER_PHONENUMBER(success.data.phonenumber.toString()); |
|||
// console.log("phone : "+useCommon.phonenumber); |
|||
// },error =>{}) |
|||
|
|||
w6s.config({ |
|||
access_key: access_key, |
|||
nonce: nonce, |
|||
timestamp: timestamp, |
|||
signature: signature, |
|||
}) |
|||
.then((res) => { |
|||
// 成功 |
|||
console.log("鉴权", res); |
|||
|
|||
}) |
|||
.catch((err) => { |
|||
// 失败 |
|||
// console.log(err) |
|||
console.log("鉴权", err); |
|||
// todo 临时工 |
|||
getEnterpriseMerchant(useCommon.phonenumber.toString()); |
|||
}); |
|||
|
|||
w6s.ready(() => { |
|||
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); |
|||
getEnterpriseMerchant(success.data.phonenumber.toString()); |
|||
}, error => { |
|||
console.log("error : " + error) |
|||
}) |
|||
}, |
|||
fail: function (err) { |
|||
console.log(err) |
|||
console.log("认证", err); |
|||
}, |
|||
}); |
|||
}); |
|||
|
|||
// getEnterpriseMerchantAuthorization({merchantTel: useCommon.phonenumber},success =>{ |
|||
// if(!(success.data == null && success.data.length == 0)){ |
|||
// console.log("success.data[0].enterpriseNumber :" + success.data[0].enterpriseNumber) |
|||
// 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 { |
|||
position: relative; |
|||
background: url("../assets/images/bg_c.jpg"); |
|||
background-size: cover; |
|||
overflow-x: hidden; |
|||
|
|||
.carousel_box { |
|||
height: 150px; |
|||
width: 100%; |
|||
padding-bottom: 10px; |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
.boutique_box { |
|||
position: absolute; |
|||
width: 100%; |
|||
bottom: 1%; |
|||
|
|||
.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_code.png"); |
|||
background-size: cover; |
|||
|
|||
.box-qr-code-text { |
|||
margin: 0.35rem 0.5rem 0 0; |
|||
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_check.png"); |
|||
background-size: cover; |
|||
|
|||
.box-info-text { |
|||
margin: 0.35rem 0.5rem 0 0; |
|||
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: 0.35rem 0.5rem 0 0; |
|||
display: block; |
|||
font-size: 17px |
|||
} |
|||
} |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<div v-if="visible" class="van-overlay"></div> |
|||
<div v-if="visible" class="popup"> |
|||
<div class="popup-title">用户查询</div> |
|||
<!-- 关闭按钮 --> |
|||
<label class="close-button" @click="closePopup"></label> |
|||
|
|||
<!-- 弹窗的内容 --> |
|||
<div class="popup-content"> |
|||
<div class="subsearch"> |
|||
<input class="searchbox" v-model="searchParam.userName" placeholder="请输入用户名/执法证件号搜索" /> |
|||
</div> |
|||
<div class="btnbox"> |
|||
<button class='btn-reset' @click="cancel()">重置</button> |
|||
<button class='btn-search' @click="queryList()">搜索</button> |
|||
</div> |
|||
|
|||
<div class="search-result"> |
|||
<div class="case-item" v-for="(item, index) in dataList" :key="index" @click="selectData(item)"> |
|||
<div class="case-title">姓名:{{ item.userName }}</div> |
|||
<div class="case-depart">电话:{{ item.phonenumber }}</div> |
|||
<div class="case-time">执法证件号:{{ item.lawCertificateNum }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { ref } from 'vue' |
|||
import {queryAUsers} from '../../api/user' |
|||
const { useCommon } = $globalStore |
|||
export default { |
|||
props: { |
|||
visible: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
content: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
}, |
|||
data(){ |
|||
return{ |
|||
searchParam: { |
|||
//搜索框 |
|||
userName: '', |
|||
userId:'', |
|||
dataScopeId:"", |
|||
}, |
|||
dataList:[] |
|||
} |
|||
}, |
|||
created(){ |
|||
// this.queryList() |
|||
console.log(useCommon.userId); |
|||
if(useCommon.userId == null || useCommon.userId == ''){ |
|||
this.searchParam.dataScopeId = 1731; |
|||
}else{ |
|||
this.searchParam.dataScopeId = useCommon.userId; |
|||
} |
|||
}, |
|||
methods: { |
|||
closePopup() { |
|||
this.$emit('close'); |
|||
}, |
|||
queryList(){ |
|||
queryAUsers(this.searchParam,success=>{ |
|||
this.dataList = success.data |
|||
},error =>{}) |
|||
}, |
|||
cancel() { |
|||
this.searchParam.userName = ''; |
|||
this.queryList() |
|||
}, |
|||
selectData(item){ |
|||
this.$emit("reciveData",item); |
|||
this.$emit('close'); |
|||
}, |
|||
} |
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.popup { |
|||
position: fixed; |
|||
z-index: 999; |
|||
top: 3rem; |
|||
left: 0; |
|||
width: 100%; |
|||
height: calc(100% - 3rem);; |
|||
background: #fff; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.popup-title { |
|||
margin: 0.3rem 0 0; |
|||
width: 100%; |
|||
height: 1rem; |
|||
border-bottom: 1px solid #f3f4f5; |
|||
text-align: center; |
|||
font-size: 0.42rem; |
|||
font-weight: 550; |
|||
} |
|||
|
|||
.close-button { |
|||
position: absolute; |
|||
top: 0.15rem; |
|||
right: 0.1rem; |
|||
width: 0.8rem; |
|||
height: 0.8rem; |
|||
background-color: rgba(255, 255, 255, .5); |
|||
border: 0.05rem solid rgba(255, 255, 255, .7); |
|||
border-radius: 50%; |
|||
transform: rotate(45deg); |
|||
} |
|||
|
|||
.close-button:before, |
|||
.close-button:after { |
|||
content: ''; |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
background: #333; |
|||
border-radius: 50%; |
|||
transform: translate(-50%, -50%); |
|||
height: 0.4rem; |
|||
width: 0.02rem; |
|||
} |
|||
|
|||
.close-button:after { |
|||
height: 0.02rem; |
|||
width: 0.4rem; |
|||
} |
|||
|
|||
.popup-content { |
|||
margin: 0.25rem 3% 0; |
|||
padding-bottom: 3rem; |
|||
width: 94%; |
|||
height: calc(100% - 1.6rem); |
|||
overflow-y: auto; |
|||
font-size: 0.38rem; |
|||
} |
|||
|
|||
.subsearch { |
|||
width: 100%; |
|||
height: 1.25rem; |
|||
} |
|||
|
|||
.searchbox { |
|||
margin: 2% 3%; |
|||
padding: 0.15rem 0.3rem 0.1rem 1.15rem; |
|||
width: 94%; |
|||
height: 1.0rem; |
|||
background: #f6f7fe url(../../assets/images/icon_sou.png) no-repeat; |
|||
background-position: left 0.5rem center; |
|||
background-size: auto 50%; |
|||
box-sizing: border-box; |
|||
border: 1px solid rgba(0,0,0,.05); |
|||
border-radius: 0.5rem; |
|||
color: #999999; |
|||
outline: none; |
|||
} |
|||
|
|||
.subtitle { |
|||
margin: 0.5rem 0 0.25rem; |
|||
font-size: 0.4rem; |
|||
font-weight: 600; |
|||
} |
|||
|
|||
.quick-item { |
|||
display: flex; |
|||
} |
|||
|
|||
.quick-item span { |
|||
display: inline-block; |
|||
margin: 1% 0 2% 3.5%; |
|||
padding: 2% 3.75%; |
|||
background: #f2f3f4; |
|||
border: 0; |
|||
border-radius: 8px; |
|||
color: #4c4c4c; |
|||
} |
|||
|
|||
.quick-item span.seled { |
|||
background: #e9f2fb; |
|||
color: #1367fe; |
|||
} |
|||
|
|||
.btnbox { |
|||
display: flex; |
|||
justify-content: center; |
|||
margin: 5% 2%; |
|||
width: 96%; |
|||
height: 1.0rem; |
|||
} |
|||
|
|||
.btn-reset, |
|||
.btn-search { |
|||
display: inline-block; |
|||
margin: 0 2%; |
|||
padding: 0; |
|||
width: 60%; |
|||
color: #fff; |
|||
font-size: 0.35rem; |
|||
border-radius: 1rem; |
|||
background: #1367fe; |
|||
border: 1px solid #1367fe; |
|||
text-align: center; |
|||
} |
|||
|
|||
.btn-reset { |
|||
width: 35%; |
|||
background-color: #fff; |
|||
border-color: rgba(19, 103, 254, .7); |
|||
color: #1367fe; |
|||
} |
|||
|
|||
.search-result { |
|||
width: 100%; |
|||
padding-bottom: 2rem; |
|||
} |
|||
|
|||
.case-item { |
|||
margin: 3% 2%; |
|||
padding: 2% 0; |
|||
width: 96%; |
|||
font-size: 0.3rem; |
|||
border-bottom: 1px solid #f4f4f4; |
|||
color: #999; |
|||
line-height: 2; |
|||
} |
|||
|
|||
.case-title { |
|||
margin: 2% 0; |
|||
font-size: 0.38rem; |
|||
color: #333; |
|||
line-height: 1.25; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
Loading…
Reference in new issue