yuminge-app/yun-min-program-plugin-master/packageB/member/helpcenter/helpcenter.js

163 lines
3.2 KiB
JavaScript

// pages/helpcenter/helpcenter.js
// var WxParse = require('../../../wxParse/wxParse.js');
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
customer_open:true,
show1:false,
dataget: [],
title: [],
msgarr: [],
msg: '',
showbox: false,
service_QRcode:'',
service_mobile:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.init();
this._getData();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
init(){
this.setData({
customer_open: true,
show1: false,
service_QRcode: '',
service_mobile: '',
});
},
callPhone(){
wx.makePhoneCall({
phoneNumber: this.data.service_mobile,
});
},
showPop(){
if (this.data.customer_open){
this.setData({
show1: true
});
}
},
closePop(){
this.setData({
show1: false
});
},
_getData() {
var that = this;
let urlStr = app.getNetAddresss("plugin.help-center.api.content.info");
app._getNetWork({
url: urlStr,
success: function(resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res.data.customer_service.customer_open);
that.setData({
dataget: res.data.set_data,
customer_open: res.data.customer_service.customer_open=='1'?true:false,
service_QRcode: res.data.customer_service.service_QRcode,
service_mobile: res.data.customer_service.service_mobile,
});
let msgarr = that.data.msgarr;
let title = that.data.title;
that.data.dataget.map(response => {
title.push(response.title);
msgarr.push(response.content);
});
that.setData({
title: title,
msgarr: msgarr,
msg: msgarr[0]
});
} else {
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
}
}
});
},
show(e) {
let index = e.target.dataset.index;
this.setData({
msg: this.data.msgarr[index],
showbox: true
});
// let article = this.data.msg;
/**
* WxParse.wxParse(bindName , type, data, target,imagePadding)
* 1.bindName绑定的数据名(必填)
* 2.type可以为html或者md(必填)
* 3.data为传入的具体数据(必填)
* 4.target为Page对象,一般为this(必填)
* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)
*/
// WxParse.wxParse('article', 'html', article, this);
},
msgboxclose() {
this.setData({
showbox: false,
msg: ''
});
}
});