作者 kerxins

修改权限

App({
onLaunch: function () {
wx.getSystemInfo({
success: function(res) {
console.log(res)
wx.setStorageSync('device', res.platform)
},
})
},
post: function (url, data, headerParams) {
/**
... ...
... ... @@ -7,13 +7,17 @@ Page({
*/
data: {
memberinfo:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.gethuiyuanstate()
this.gethuiyuanstate();
this.setData({
platform:wx.getStorageSync('device')
})
},
gethuiyuanstate(){
... ...
... ... @@ -21,7 +21,8 @@
</view>
</view>
<view class='center_item' bindtap="historygo">
<view>购买历史</view>
<view wx:if='{{plateform=="ios"}}'>订阅历史</view>
<view wx:else>购买历史</view>
<view class='iconfont icon-tiaozhuanqianwangyoujiantouxiangyouxiayibuxianxing'></view>
</view>
<view class='center_item' bindtap="state">
... ...
... ... @@ -8,12 +8,6 @@
</view>
<!-- <view class='collect_navbox'>
<view class='collect_nav collect_active'>已购买</view>
<view class='collect_nav'>未购买</view>
<view class='collect_nav'>视频</view>
</view> -->
<view class="kindnav">
<view wx:for="{{navbar}}" data-idx="{{index}}" class="kindnav_item {{currentTab==index ? 'kindactive' : ''}}" wx:key="unique" bindtap="navbarTap" data-id="{{item.id}}">{{item}}
... ...
... ... @@ -106,13 +106,38 @@ Page({
//购买并保存
buy(){
var url = '/home/Order/done',that = this;
var params = {
goods_id: that.data.goods_id,
is_custom_logo: 1,
logo: that.data.logolfile,
email: that.data.email
}
this.setData({
sownloadnum:true
})
var header = {
'XX-Token': wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res);
if (res.current_download_num != 0) {
that.setData({
sownloadnum: true
})
that.setData({
payres: res
})
} else if (res.current_download_num == 0) {
that.payment(res)
}
}).catch((err) => {
})
},
surechange(){
let that = this;
console.log(that.data.logolfile)
... ... @@ -122,7 +147,6 @@ Page({
is_custom_logo: 1,
logo: that.data.logolfile,
email: that.data.email
}
var header = {
... ... @@ -130,13 +154,9 @@ Page({
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res);
that.payment(res)
that.payment(res)
}).catch((err) => {
})
... ...
... ... @@ -88,7 +88,7 @@
font-size: 0;
position: absolute;
right:10rpx;
top:9rpx;
top:10rpx;
z-index: 100;
}
.headlogolimg image{
... ...
... ... @@ -47,14 +47,14 @@ Page({
videosrc: "",
tvphide: false,
vid: '',
sownloadnum:false,
payres:'',
beizhu:false,
sownloadnum: false,
payres: '',
beizhu: false,
selectaddress: '请选择收货地址',
shname: '请选择收货人',
shmobile:'收货电话',
detailaddress:'详细地地址',
state:''
shmobile: '收货电话',
detailaddress: '详细地地址',
state: ''
},
/**
... ... @@ -64,11 +64,12 @@ Page({
let that = this;
console.log(options.free)
this.setData({
shopid: options.id
shopid: options.id,
platform: wx.getStorageSync('device')
})
that.showbtn()
console.log(this.data.defo);
console.log(this.data.vid);
// this.txvContext = txvContext.getTxvContext('myVideo');
... ... @@ -77,17 +78,17 @@ Page({
},
//是否显示按钮、
showbtn(){
showbtn() {
let that = this;
var url = '/home/Welcome/paySwitch';
var params = {
}
app.post(url, params).then((res) => {
console.log(res);
that.setData({
state:res.state
state: res.state
})
... ... @@ -152,7 +153,7 @@ Page({
})
} else if (that.data.pic == true && that.data.pdf == false) {
var url = '/home/Goods/freeDownload';
var params = {
id: that.data.shopid,
... ... @@ -164,8 +165,8 @@ Page({
'XX-Token': wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url,params,header).then((res) => {
app.post(url, params, header).then((res) => {
console.log(res)
if (res.msg == "下载成功") {
wx.navigateTo({
... ... @@ -176,18 +177,18 @@ Page({
title: res.msg,
icon: 'none'
})
} else if (res.msg == "您还未填写问卷"){
} else if (res.msg == "您还未填写问卷") {
wx.showToast({
title: res.msg,
icon: 'none'
})
setTimeout(function(){
setTimeout(function () {
wx.navigateTo({
url: '../../questionsurvey/questionsurvey',
})
},1500)
}, 1500)
}
// that.setData({
... ... @@ -202,22 +203,21 @@ Page({
}).catch((err) => {
console.log(err)
if (err.msg == '您还未填写问卷'){
if (err.msg == '您还未填写问卷') {
wx.showToast({
title: '您还未填写问卷',
icon:'none'
icon: 'none'
})
setTimeout(function(){
setTimeout(function () {
wx.navigateTo({
url: '../../questionsurvey/questionsurvey',
})
},1500)
} else if (err.msg == '今日下载次数已用尽'){
}, 1500)
} else if (err.msg == '今日下载次数已用尽') {
wx.showToast({
title: '今日下载次数已用尽',
icon: 'none'
})
}
})
... ... @@ -255,20 +255,29 @@ Page({
})
}
}).catch((err) => {
console.log(err)
wx.showToast({
title: '您还未填写问卷',
icon: 'none'
})
setTimeout(function () {
wx.navigateTo({
url: '../../questionsurvey/questionsurvey',
if (err.msg == '您还未填写问卷') {
wx.showToast({
title: '您还未填写问卷',
icon: 'none'
})
}, 1500)
setTimeout(function () {
wx.navigateTo({
url: '../../questionsurvey/questionsurvey',
})
}, 1500)
} else if (err.msg == '今日下载次数已用尽') {
wx.showToast({
title: '今日下载次数已用尽',
icon: 'none'
})
}
// setTimeout(function () {
// wx.navigateTo({
// url: '../../questionsurvey/questionsurvey',
// })
// }, 1500)
})
}
... ... @@ -495,7 +504,7 @@ Page({
console.log(res);
if (res.goods_price == '免费') {
this.setData({
isfree: 0
})
... ... @@ -507,23 +516,23 @@ Page({
})
if (res.goods_content!=null){
if (res.goods_content != null) {
wxParse.wxParse('content', 'html', res.goods_content, that, 5);
}
} else {
console.log(888)
if (res.is_purchased==true) {
if (res.is_purchased == true) {
//购买过教案
this.setData({
isfree: 1
})
if (res.goods_content!=null){
if (res.goods_content != null) {
wxParse.wxParse('content', 'html', res.goods_content, that, 5);
}
}
} else {
//没购买过教案
console.log(444)
... ... @@ -531,15 +540,15 @@ Page({
isfree: 2
})
if (res.goods_content!=null){
if (res.goods_content != null) {
wxParse.wxParse('content', 'html', res.goods_content, that, 5);
}
}
}
... ... @@ -671,7 +680,7 @@ Page({
that.setData({
logolurl: res.url.url,
logolfile: res.url.file,
changelogol:true
changelogol: true
})
}).catch((err) => {
console.log(err)
... ... @@ -699,10 +708,14 @@ Page({
})
},
gobuy() {
this.data.platform == 'ios'?wx.showModal({
title: '提示',
content: '十分抱歉,由于相关规范,您暂时无法在这里使用该功能',
showCancel: false
}):
this.setData({
selectrue: true,
defo:''
defo: ''
})
},
... ... @@ -716,7 +729,7 @@ Page({
//确定支付
surebuy() {
let that=this;
let that = this;
that.setData({
// beizhu:true,
... ... @@ -726,23 +739,23 @@ Page({
wx.showToast({
title: '请选择logo设置种类',
icon: 'none',
duration:5000
duration: 5000
})
} else {
if (that.data.goodtail.is_purchased==true){
wx.showToast({
title: '您已买过该教案,更换logo不需要付费',
icon:'none',
duration:2000,
})
}else{
if (that.data.goodtail.is_purchased == true) {
wx.showToast({
title: '您已买过该教案,更换logo不需要付费',
icon: 'none',
duration: 2000,
})
} else {
console.log(8989)
var url = '/home/Order/done';
var params = {
goods_id: that.data.shopid,
... ... @@ -786,25 +799,25 @@ Page({
})
}
}
},
//隐藏收货地址
//隐藏收货地址
hidebeizhu(){
hidebeizhu() {
this.setData({
beizhu:false
beizhu: false
})
},
//收货地址购买
surego(){
//收货地址购买
surego() {
let that = this;
that.setData({
beizhu:false
beizhu: false
})
// this.setData({
// selectrue: false
... ... @@ -873,22 +886,13 @@ Page({
icon: 'none'
})
} else {
// console.log(9090)
// that.setData({
// beizhu:true
// })
// console.log(that.data.beizhu)
var url = '/home/Order/done';
var params = {
goods_id: that.data.shopid,
is_custom_logo: that.data.is_custom_logo,
logo: that.data.logolfile,
email: that.data.email
}
var header = {
'XX-Token': wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
... ... @@ -899,35 +903,27 @@ Page({
that.setData({
sownloadnum: true
})
that.setData({
payres:res
payres: res
})
} else if (res.current_download_num==0){
} else if (res.current_download_num == 0) {
that.payment(res)
}
// that.payment(res)
// if(res==){
// }
}).catch((err) => {
})
}
}
},
surechange(){
let that=this;
that.secpay()
surechange() {
let that = this;
that.secpay()
},
... ... @@ -949,8 +945,8 @@ Page({
that.setData({
selectrue: false,
isfree: 1,
changelogol: false,
beizhu:false,
changelogol: false,
beizhu: false,
logolurl: "http://pnb2waalt.bkt.clouddn.com/uplogo.png"
})
... ... @@ -961,13 +957,13 @@ Page({
},
//第二次更换支付
secpay(){
secpay() {
let that = this
wx.requestPayment({
timeStamp: that.data.payres.wx_pay.timeStamp,
nonceStr:that.data.payres.wx_pay.nonceStr,
nonceStr: that.data.payres.wx_pay.nonceStr,
package: that.data.payres.wx_pay.package,
signType:that.data.payres.wx_pay.signType,
signType: that.data.payres.wx_pay.signType,
paySign: that.data.payres.wx_pay.paySign,
success(res) {
console.log(res)
... ... @@ -978,8 +974,8 @@ Page({
selectrue: false,
isfree: 1,
changelogol: false,
sownloadnum:false,
logolurl:"http://pnb2waalt.bkt.clouddn.com/uplogo.png"
sownloadnum: false,
logolurl: "http://pnb2waalt.bkt.clouddn.com/uplogo.png"
})
}
... ... @@ -988,7 +984,7 @@ Page({
})
},
//隐藏第二次支付
cancelchange(){
cancelchange() {
this.setData({
sownloadnum: false
})
... ... @@ -996,9 +992,14 @@ Page({
//更换logo
wantchangelogol() {
this.data.platform == 'ios' ? wx.showModal({
title: '提示',
content: '十分抱歉,由于相关规范,您暂时无法在这里使用该功能',
showCancel: false
}):
this.setData({
selectrue: true,
defo:''
defo: ''
})
},
... ... @@ -1028,7 +1029,7 @@ Page({
success(res) {
console.log(res)
that.setData({
selectaddress: res.provinceName + res.cityName + res.countyName ,
selectaddress: res.provinceName + res.cityName + res.countyName,
shname: res.userName,
shmobile: res.telNumber,
detailaddress: res.detailInfo
... ... @@ -1074,10 +1075,10 @@ Page({
onShow: function () {
this.setData({
againdownhide:false,
againdownhide: false,
// changelogol:false,
// selectrue:false,
logolurl:''
logolurl: ''
})
this.getdetail();
},
... ...
... ... @@ -297,7 +297,10 @@
rturient montes, nascetur ridiculus mus
</view> -->
<view wx:if="{{isfree==2&&goodtail.is_video==0}}" class="fufei">本内容需要付费后才能阅读全文</view>
<view wx:if="{{isfree==2&&goodtail.is_video==0}}" class="fufei">
<text wx:if='{{platform=="ios"}}'>本内容需要订阅后才能阅读全文</text>
<text wx:else>本内容需要付费后才能阅读全文</text>
</view>
</view>
<!--用户评价-->
... ... @@ -355,7 +358,10 @@
</view>
<view wx:if="{{goodtail.is_video==0}}">
<view class="searchall" bindtap="gobuy" wx:if="{{isfree==2&&state==1}}">立即购买</view>
<view class="searchall" bindtap="gobuy" wx:if="{{isfree==2&&state==1}}">
<text wx:if='{{platform=="ios"}}'>立即订阅</text>
<text wx:else>立即购买</text>
</view>
<view class="searchall" bindtap="xiazai" wx:if="{{isfree==0}}">立即下载</view>
... ... @@ -369,3 +375,10 @@
</view>
<!-- 客服 -->
<view class='kefu_box'>
<image src='/img/kefu.png' mode='widthFix'></image>
<button open-type='contact'></button>
</view>
\ No newline at end of file
... ...
... ... @@ -704,4 +704,23 @@ background:linear-gradient(90deg,rgba(14,77,140,1),rgba(31,92,153,1));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap
}
.kefu_box{
width: 120rpx;
height: 120rpx;
position: fixed;
bottom: 300rpx;
right: 40rpx;
}
.kefu_box image{
width: 120rpx;
height: 120rpx;
}
.kefu_box button{
height: 100%;
width: 100%;
position: absolute;
top: 0;
opacity: 0;
}
\ No newline at end of file
... ...