Commit ee0f3a2e authored by gaodapeng's avatar gaodapeng

增加首页跳转到扫码页

parent 0f20aa29
......@@ -13,3 +13,8 @@ export const ACTION_GO_BALANCE = "ACTION_GO_BALANCE";
//请求商品条码
export const ACTION_REQUEST_GOOD_INFO = "ACTION_REQUEST_GOOD_INFO";
//去扫码页面
export const ACTION_GO_SCAN = "ACTION_GO_SCAN";
//获取店铺信息
export const ACTION_STORE_INFO = "ACTION_STORE_INFO";
\ No newline at end of file
......@@ -2,6 +2,8 @@ import { Page } from '../../utils/scan';
import { API_USE_COUPON } from '../../const/apiurl'
var api = require("../../utils/api.js");
import { ACTION_GO_SCAN } from '../../const/actioncmd'
Page({
data: {
scanDialogDisplay: 0
......@@ -11,6 +13,43 @@ Page({
},
onshow(){
my.ix.onBuddyMessage({
success: (res) => {
console.info(`onBuddyMessage success: ${JSON.stringify(res)}`);
if(res.action == ACTION_GO_SCAN){
//跳转到扫码页面
my.redirectTo({
url: "/pages/scan/scan"
});
my.ix.sendBuddyMessage({
// 填入目标小程序的 AppID
target: getApp().globalData.backScreenAppId,
data: {
action: ACTION_GO_SCAN,
data: null
},
success: (res) => {
console.info(`sendBuddyMessage success: ${JSON.stringify(res)}`);
},
fail: (res) => {
console.info(`sendBuddyMessage failed: ${JSON.stringify(res)}`);
}
});
} else {
//未知指令
}
}
});
},
onHide() {
// 页面隐藏
//关闭后屏监听
my.ix.offBuddyMessage();
},
onReady() {
if (my.canIUse('hideBackHome')) {
my.hideBackHome();
......@@ -18,9 +57,7 @@ Page({
},
homeTap() {
my.redirectTo({
url: "/pages/scan/scan"
});
},
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment