174 lines
3.2 KiB
JavaScript
174 lines
3.2 KiB
JavaScript
// packageC/video_goods/videoAgreement/videoAgreement.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
backgroundUrl: "",
|
|
checked: true,
|
|
isDisagree: false,
|
|
showAgreement: false,
|
|
protocol_content: ""
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.init();
|
|
this.getBackground();
|
|
this.getAgreement();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
init() {
|
|
this.setData({
|
|
checked: true,
|
|
backgroundUrl: "",
|
|
isDisagree: false,
|
|
showAgreement: false,
|
|
protocol_content: ""
|
|
});
|
|
},
|
|
//获取背景图
|
|
getBackground() {
|
|
let urlStr = app.getNetAddresss("plugin.video-share.frontend.set.getBackground");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
validate_page: 1
|
|
}, // validate_page 实名认证判断
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
this.setData({
|
|
backgroundUrl: res.data.background
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1500
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
getAgreement() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("plugin.video-share.frontend.set.getAgreement");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {},
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
protocol_content: res.data.agreement
|
|
});
|
|
} else {
|
|
that.setData({
|
|
protocol_content: res.msg
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
gotoRelease() {
|
|
if (this.data.checked) {
|
|
try {
|
|
wx.removeStorageSync('shareVideoPath');
|
|
} catch (e) {
|
|
// Do something when catch error
|
|
}
|
|
wx.navigateTo({
|
|
url: '/packageC/video_goods/releaseVideo/releaseVideo'
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请先勾选阅读并同意《用户协议》',
|
|
duration: 1500
|
|
});
|
|
this.setData({
|
|
isDisagree: false
|
|
});
|
|
setTimeout(() => {
|
|
this.setData({
|
|
isDisagree: true
|
|
});
|
|
}, 0);
|
|
}
|
|
},
|
|
agreementbtn(e) {
|
|
let agreeBol = e.detail;
|
|
this.setData({
|
|
checked: agreeBol
|
|
});
|
|
},
|
|
gotoAgreement() {
|
|
this.setData({
|
|
showAgreement: true
|
|
});
|
|
},
|
|
popClose() {
|
|
this.setData({
|
|
showAgreement: false
|
|
});
|
|
}
|
|
}); |