You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hunjianghu/江可飞/小程序开发/pages/detail/detail.js

74 lines
1.5 KiB

6 years ago
Page({
data: {
isLike: true,
// banner
imgUrls: [
"/pages/index/image/suanfa.jpg"
],
6 years ago
'book': [],
6 years ago
// 商品详情介绍
detailImg: [
"/pages/index/image/suanfa.jpg"
],
},
6 years ago
onload:function(options){
var thats = this
wx.request({
url: "http://45.76.158.31:8080/web/GetFrontInfo.do?bookid="+options.id,
header: {
"content-type": "json"
},
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
thats.setData({
book: res.data,
})
//wx.hideNavigationBarLoading()
}
}
})
},
6 years ago
//预览图片
previewImage: function (e) {
var current = e.target.dataset.src;
wx.previewImage({
current: current, // 当前显示图片的http链接
urls: this.data.imgUrls // 需要预览的图片http链接列表
})
},
6 years ago
6 years ago
// 跳到购物车
addCar() {
6 years ago
var reqData="{'BookName':'','BookID':'','count':''}"
wx.request({
url: '',
data: {reqData:reqData},
header: {'Content-Type': 'application/x-www-form-urlencoded'},
method: 'POST',
dataType: 'json',
responseType: 'text',
success: function(res) {
console.log("sucess")
},
fail: function(res) {},
complete: function(res) {},
})
6 years ago
wx.switchTab({
url: '/pages/gouwu/gouwu'
})
},
// 立即购买
immeBuy() {
wx.showToast({
title: '购买成功',
icon: 'success',
duration: 2000
});
},
})