12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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: {},
- didMount() {},
- methods: {
- onHandleScan() {
- // my.scan({
- // scanType: ['qrCode'],
- my.ap.navigateToAlipayPage({
- appCode: 'alipayScan',
- success: res => {
- // console.log(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('扫码操作失败');
- }
- }
- });
- }
- }
- }));
|