123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { connect } from 'herculex';
- import { parseUrlQuery, prefixPagePath, dynamicPageName } from "../../../../core/utils/index";
- import { toast } from "../../../../core/utils/jsapi";
- Component(connect({
- mapStateToProps: {
- titleBarHeight: state => state.$global.titleBarHeight
- }
- })({
- props: {},
- data: {
- defaultData: {
- logo: 'https://gw.alipayobjects.com/mdn/rms_ce4c6f/afts/img/A*hkCKTJY-nXMAAAAAAAAAAABkARQnAQ',
- tips: '通行证已过期',
- desc: '请重新扫码登记'
- }
- },
- methods: {
- onScan() {
- // my.scan({
- // scanType: ['qrCode'],
- my.ap.navigateToAlipayPage({
- appCode: 'alipayScan',
- success: res => {
- // 解析扫码结果,缓存小区信息,跳转页面
- if (!res.qrCode) return;
- const app = parseUrlQuery(res.qrCode);
- const query = parseUrlQuery(app.page);
- if (query.pageCode !== 'visitReasonPage' || !query.communityCode) {
- this.commit({
- errorType: 'NOCOMMUNITY',
- errorMsg: '小区不存在',
- errorBrief: '请扫描正确的二维码'
- });
- return;
- }
- my.redirectTo({
- url: `${prefixPagePath}/${dynamicPageName}/index?pageCode=${query.pageCode}&communityCode=${query.communityCode}&communityName=${query.communityName || ''}&sceneCode=${query.sceneCode || ''}`
- });
- },
- fail: error => {
- if (error.code === 11) {
- toast('扫码操作失败');
- }
- }
- });
- }
- }
- }));
|