diff --git a/project.config.json b/project.config.json
index 9c37520..d83a08e 100644
--- a/project.config.json
+++ b/project.config.json
@@ -12,5 +12,37 @@
"appid": "wx815bf59d472c0a63",
"projectname": "game",
"miniprogramRoot": "dist/",
- "condition": {}
+ "condition": {
+ "search": {
+ "current": -1,
+ "list": []
+ },
+ "conversation": {
+ "current": -1,
+ "list": []
+ },
+ "plugin": {
+ "current": -1,
+ "list": []
+ },
+ "game": {
+ "list": []
+ },
+ "miniprogram": {
+ "current": 0,
+ "list": [
+ {
+ "id": 0,
+ "name": "支付返回",
+ "pathName": "pages/gameInfo",
+ "query": "id=1100309",
+ "scene": 1038,
+ "referrerInfo": {
+ "appId": "wxbf333d56b4de3905",
+ "extraData": "{ \"type\": \"item\", \"event_type\": \"pay_result\", \"success\": true, \"gid\": 1100309 }"
+ }
+ }
+ ]
+ }
+ }
}
\ No newline at end of file
diff --git a/src/app.wpy b/src/app.wpy
index e10bf44..c89662f 100644
--- a/src/app.wpy
+++ b/src/app.wpy
@@ -32,9 +32,7 @@ export default class extends wepy.app {
'pages/gameInfo',
'pages/login',
'pages/search',
- 'pages/product',
- 'pages/jumppage',
- 'pages/buyvip'
+ 'pages/jumppage'
],
window: {
backgroundTextStyle: 'light',
@@ -121,7 +119,16 @@ export default class extends wepy.app {
console.log('app.onShow');
console.log(options);
if (options.scene === 1038) { //从小程序返回
- jcEvent.emit(jcEvent.events.NEED_UPDATE_SCORE, {})
+ jcEvent.emit(jcEvent.events.NEED_UPDATE_SCORE, {});
+ let referrerInfo = options.referrerInfo;
+ let data = referrerInfo.extraData;
+ if (data && data.event_type === 'pay_result') {
+ if (data.type === 'item' ) {
+ jcEvent.emit(jcEvent.events.BUY_ITEM_RESULT, data);
+ } else {
+ jcEvent.emit(jcEvent.events.BUY_VIP_RESULT, data);
+ }
+ }
}
}
getUserInfo() {
diff --git a/src/common/jc-event.js b/src/common/jc-event.js
index 98d7fe6..199ff9a 100644
--- a/src/common/jc-event.js
+++ b/src/common/jc-event.js
@@ -30,6 +30,8 @@ export default {
UPDATE_RECENT_GAMES: 'update-recent-games',
UPDATE_GAME_STATUS: 'update-game-status',
NEED_UPDATE_SCORE: 'need-update-score',
- NEED_UPDATE_CFG: 'need-update-cfg'
+ NEED_UPDATE_CFG: 'need-update-cfg',
+ BUY_ITEM_RESULT: 'buy-item-result',
+ BUY_VIP_RESULT: 'buy-vip-result'
}
}
diff --git a/src/components/z-action-sheet.wpy b/src/components/z-action-sheet.wpy
index efdd842..290dc53 100644
--- a/src/components/z-action-sheet.wpy
+++ b/src/components/z-action-sheet.wpy
@@ -57,7 +57,7 @@
target="miniProgram"
open-type="navigate"
app-id="wxbf333d56b4de3905"
- path="/pages/product?{{params}}}"
+ path="/pages/product?{{config.params}}}"
extra-data=""
version="develop"
>促销开通
diff --git a/src/pages/buyvip.wpy b/src/pages/buyvip.wpy
deleted file mode 100644
index df8c40f..0000000
--- a/src/pages/buyvip.wpy
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
- 5元购买一个月
- 30元购买终身卡
-
-
- 购买一个月
- 购买终身VIP
-
-
-
-
-
diff --git a/src/pages/gameInfo.wpy b/src/pages/gameInfo.wpy
index 6f3beaa..1f87e33 100644
--- a/src/pages/gameInfo.wpy
+++ b/src/pages/gameInfo.wpy
@@ -140,14 +140,6 @@
this.showAll = this.$parent.showAll();
console.log(this.id);
let self = this;
- jcEvent.on(jcEvent.events.BUY_GAME_SUCCESS, this, data => {
- self.record.owned = true;
- self.bottomActionCfg.mainBtnIconClass = 'icon-merge';
- self.bottomActionCfg.mainBtnTitle = '开始游戏';
- self.bottomActionCfg.primary = true;
- jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id});
- self.$apply();
- });
jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => {
this.getUserInfo();
});
@@ -157,6 +149,28 @@
this.showAll = !cfg ? false : !cfg.hide_main;
this.$apply();
})
+ jcEvent.on(jcEvent.events.BUY_ITEM_RESULT, this, data => {
+ this.zActionSheetCfg.hide = true;
+ if (data.success) {
+ wepy.showToast({
+ title: '开通成功',
+ icon: 'none',
+ duration: 2000
+ });
+ self.record.owned = true;
+ self.bottomActionCfg.mainBtnIconClass = 'icon-merge';
+ self.bottomActionCfg.mainBtnTitle = '开始游戏';
+ self.bottomActionCfg.primary = true;
+ jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id});
+ } else {
+ wepy.showToast({
+ title: '开通失败',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ self.$apply();
+ });
this.getRecord();
}
onShow() {
@@ -254,9 +268,9 @@
}
}
onUnload() {
- jcEvent.remove(jcEvent.events.BUY_GAME_SUCCESS, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
+ jcEvent.remove(jcEvent.events.BUY_ITEM_RESULT, this);
}
async requestAd(text) {
try {
diff --git a/src/pages/index.wpy b/src/pages/index.wpy
index 2b25e68..2919d6e 100644
--- a/src/pages/index.wpy
+++ b/src/pages/index.wpy
@@ -97,11 +97,6 @@
wepy.navigateTo({
url: '/pages/search'
})
- },
- buy_vip() {
- wepy.navigateTo({
- url: '/pages/buyvip'
- })
}
};
@@ -165,6 +160,22 @@
this.showAll = !cfg ? false : !cfg.hide_main;
this.$apply();
})
+ jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
+ if (data.success) {
+ wepy.showToast({
+ title: '购买成功',
+ icon: 'none',
+ duration: 2000
+ })
+ this.getUserInfo();
+ } else {
+ wepy.showToast({
+ title: '购买失败',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
}
getAllData() {
this.getRecords();
@@ -178,7 +189,7 @@
jcEvent.remove(jcEvent.events.UPDATE_GAME_STATUS, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
- jcEvent.remove(jcEvent.events.UPDATE_MY_GAMES, this);
+ jcEvent.remove(jcEvent.events.BUY_VIP_RESULT, this);
}
onShow() {
let cfg = wepy.getStorageSync('cfg');
diff --git a/src/pages/product.wpy b/src/pages/product.wpy
deleted file mode 100644
index 12ef009..0000000
--- a/src/pages/product.wpy
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
-
-