Commit 22f50b9a authored by jyx's avatar jyx

代码优化

parent eb0f2a01
...@@ -113,14 +113,28 @@ ...@@ -113,14 +113,28 @@
userBean: {}, userBean: {},
os: 'android', os: 'android',
titleText: '超多精彩好剧一键解锁', titleText: '超多精彩好剧一键解锁',
showClone: false showClone: false,
albumId: "",
point: 0,
}; };
}, },
async beforeCreate() { async beforeCreate() {
const pm = await getPlayletManager({ const pm = await getPlayletManager({
is: 'charge' // 和插槽同名 is: 'charge' // 和插槽同名
}); });
let that = this
pm.getPlayletInfo().then(res => {
console.log(res)
that.albumId = res.albumId
this.loadData()
});
this.pm = pm; this.pm = pm;
setTimeout(() => {
this.paySuccess('point')
}, 5000)
console.error(pm, this, "charge_pm_this_beforeCreate"); console.error(pm, this, "charge_pm_this_beforeCreate");
}, },
created() { created() {
...@@ -128,7 +142,6 @@ ...@@ -128,7 +142,6 @@
}, },
beforeMount() { beforeMount() {
console.log("chargeBeforeMount"); console.log("chargeBeforeMount");
this.loadData()
}, },
mounted() { mounted() {
console.log("chargeMounted"); console.log("chargeMounted");
...@@ -151,19 +164,31 @@ ...@@ -151,19 +164,31 @@
}, },
paySuccess(largeType) { paySuccess(largeType) {
if (largeType == 'vip') { if (largeType == 'vip') {
this.vipBackPage = this.originIndex this.unlockAll()
this.getData() } else if (largeType == 'point') {
} else if (largeType == 'point') { this.pm.setCurrentUnlock();
this.unlock(this.originIndex)
this.pm.toggleCustomDialog();
} else {
this.vipBackPage = this.originIndex
this.getData()
} }
// 支付完成回调 // 支付完成回调
this.pm.toggleCustomDialog(); this.pm.toggleCustomDialog();
this.pm.setCurrentUnlock(); },
unlockAll() {
this.post({
url: '/vedio/getIndexList',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {
this.pm.setCatalog({
freeList: data.vedioMsg.douyinFreeList,
unlockList: data.vedioMsg.douyinUnlockList,
lockList: data.vedioMsg.douyinLockList,
});
}
});
}, },
loadData() { loadData() {
if (tt.getSystemInfoSync().platform === 'ios') { if (tt.getSystemInfoSync().platform === 'ios') {
...@@ -173,7 +198,7 @@ ...@@ -173,7 +198,7 @@
this.post({ this.post({
url: '/vip/getVipProducts/point', url: '/vip/getVipProducts/point',
data: { data: {
vedioId: this.point <= 0 ? null : this.vedioId albumId: this.albumId
}, },
showLoading: false, showLoading: false,
success: ({ success: ({
...@@ -192,6 +217,19 @@ ...@@ -192,6 +217,19 @@
} }
}); });
this.post({
url: '/vedio/getIndexList',
data: {
albumId: this.albumId
},
showLoading: false,
success: ({
data
}) => {
this.point = data.vedioMsg.point
}
});
this.post({ this.post({
url: '/user/baseMsg', url: '/user/baseMsg',
showLoading: false, showLoading: false,
......
...@@ -13,13 +13,14 @@ ...@@ -13,13 +13,14 @@
components: { components: {
Player, Player,
Charge Charge
}, },
//采用uniapp的生命周期函数 //采用uniapp的生命周期函数
onLoad(option) { onLoad(option) {
let data = JSON.parse(decodeURIComponent(option.data)); let data = JSON.parse(decodeURIComponent(option.data));
setTimeout(() => { setTimeout(() => {
const p_m = getPlayletManager(this); const p_m = getPlayletManager(this);
p_m.setCatalog({ p_m.setCatalog({
freeList: data.douyinFreeList, freeList: data.douyinFreeList,
unlockList: data.douyinUnlockList, unlockList: data.douyinUnlockList,
......
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