Commit 22f50b9a authored by jyx's avatar jyx

代码优化

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