|
|
@ -52,7 +52,10 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup name="Home"> |
|
|
<script setup name="Home"> |
|
|
|
|
|
import Vconsole from "vconsole"; |
|
|
import {getEnterpriseMerchantAuthorization} from '@/api/Home'; |
|
|
import {getEnterpriseMerchantAuthorization} from '@/api/Home'; |
|
|
|
|
|
import {szyptGetToken} from "../../api/Home"; |
|
|
|
|
|
import wx from "weixin-js-sdk"; |
|
|
const { useCommon } = $globalStore; |
|
|
const { useCommon } = $globalStore; |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
|
let carouselList = reactive([]); // 轮播列表 |
|
|
let carouselList = reactive([]); // 轮播列表 |
|
|
@ -86,13 +89,66 @@ const boutiqueGoods = async () => { |
|
|
// } |
|
|
// } |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const toScanPageView = async() =>{ |
|
|
const openScan = () => { |
|
|
|
|
|
let fullUrl = window.location.href; |
|
|
|
|
|
let code = fullUrl.substring(fullUrl.indexOf('code=')+5, fullUrl.indexOf('&state=')); |
|
|
|
|
|
let paramUrl = window.location.href.split("#")[0]; |
|
|
|
|
|
let param = { code: code, url: paramUrl }; |
|
|
|
|
|
szyptGetToken(param,success =>{ |
|
|
|
|
|
let resMsg = success.data; |
|
|
|
|
|
console.log(resMsg); |
|
|
|
|
|
wx.config({ |
|
|
|
|
|
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 |
|
|
|
|
|
debug: false, |
|
|
|
|
|
// 必填,公众号的唯一标识 |
|
|
|
|
|
appId: resMsg.corpid, |
|
|
|
|
|
// 必填,生成签名的时间戳 |
|
|
|
|
|
timestamp: resMsg.timestamp, |
|
|
|
|
|
// 必填,生成签名的随机串 |
|
|
|
|
|
nonceStr: resMsg.nonceStr, |
|
|
|
|
|
// 必填,签名,见附录1 |
|
|
|
|
|
signature: resMsg.signature, |
|
|
|
|
|
// 必填,需要使用的JS接口列表,所有JS接口列表见附录2 |
|
|
|
|
|
jsApiList: ["scanQRCode"], |
|
|
|
|
|
}); |
|
|
|
|
|
wx.ready(() => { |
|
|
|
|
|
//微信扫一扫请求操作 |
|
|
|
|
|
ClickScan() |
|
|
|
|
|
}); |
|
|
|
|
|
wx.error((res) => { |
|
|
|
|
|
console.log("获取失败"); |
|
|
|
|
|
}); |
|
|
|
|
|
},error =>{}); |
|
|
|
|
|
}; |
|
|
|
|
|
const ClickScan = () => { |
|
|
|
|
|
wx.scanQRCode({ |
|
|
|
|
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, |
|
|
|
|
|
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有 |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
// 页面跳转 |
|
|
|
|
|
console.log("=========== 扫码返回 ===========") |
|
|
|
|
|
console.log(res) |
|
|
router.push({ |
|
|
router.push({ |
|
|
path: "/enforce/scanPage_szy", |
|
|
path: "/enterpriseScanPreview", |
|
|
query: {} |
|
|
query: { |
|
|
|
|
|
enterpriseNumber: res.resultStr |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
cancel: (res) => { |
|
|
|
|
|
console.log('err', res); |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const toScanPageView = async() =>{ |
|
|
|
|
|
openScan(); |
|
|
|
|
|
// router.push({ |
|
|
|
|
|
// path: "/enforce/scanPage_szy", |
|
|
|
|
|
// query: {} |
|
|
|
|
|
// }); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const toNoScanView = async() =>{ |
|
|
const toNoScanView = async() =>{ |
|
|
router.push({ |
|
|
router.push({ |
|
|
path: "/enforce/noScan", |
|
|
path: "/enforce/noScan", |
|
|
@ -127,6 +183,7 @@ const onLoad = () => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
|
|
|
// 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); |
|
|
|