130 lines
2.6 KiB
JavaScript
Raw Normal View History

2024-02-21 17:43:11 +08:00
let app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
DOMAIN_NAME: app.IMG_NAME,
imgUrl: [
'/images/timg1.jpg',
'/images/timg1.jpg',
'/images/timg1.jpg',
'/images/vcard.png',
'/images/timg.jpg'
],
homelist: {},
labelList: [
'互联网信息服务',
'数据处理',
'应用软件服务'
]
},
calltap() {
wx.makePhoneCall({
phoneNumber: this.data.homelist.phone
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
let that = this
let img = []
app.AjaxRequest('get', {
'content-type': 'application/json',
'Authorization': 'Bearer ' + app.Getopenid()
}, '/customer/detail?id=' + e.id, {},
function (res) {
console.log(res)
if (res.code == 0) {
wx.setNavigationBarTitle({
title: res.data.name,
})
res.data.bannerImages.forEach(item => {
img.push(app.IMG_NAME+item.name)
})
that.setData({
homelist: res.data,
imgUrl: img
})
}
})
},
clickme() {
this.showModal()
},
//显示对话框
showModal() {
// 显示遮罩层
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
})
this.animation = animation
animation.translateY(300).step()
this.setData({
animationData: animation.export(),
showModalStatus: true
})
animation.translateY(0).step()
this.setData({
animationData: animation.export()
})
},
//隐藏对话框
hideModal() {
// 隐藏遮罩层
var animation = wx.createAnimation({
duration: 200,
timingFunction: "linear",
delay: 0
})
this.animation = animation
animation.translateY(300).step()
this.setData({
animationData: animation.export(),
})
animation.translateY(0).step()
this.setData({
animationData: animation.export(),
showModalStatus: false
})
},
contact() {
wx.showActionSheet({
itemList: ['A', 'B', 'C'],
success(res) {
console.log(res.tapIndex)
},
fail(res) {
console.log(res.errMsg)
}
})
},
previewImg(e) {
//获取当前图片的下标
var index = e.currentTarget.dataset.index
//所有图片
var imgs = this.data.imgUrl
wx.previewImage({
//当前显示图片
current: imgs[index],
//所有图片
urls: imgs
})
},
copy() {
wx.setClipboardData({
data: this.data.homelist.phone
})
}
})