133 lines
2.7 KiB
JavaScript
133 lines
2.7 KiB
JavaScript
// pages/member/ClockPunchRule/ClockPunchRule.js
|
|
var app = getApp();
|
|
// var WxParse = require('../../../wxParse/wxParse.js');
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
ruleContent: '',
|
|
share_title: '',
|
|
share_icon: ''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
this._getRule();
|
|
this._getShareData();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
wx.showShareMenu({
|
|
withShareTicket: false,
|
|
menus: ['shareAppMessage', 'shareTimeline']
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareTimeline(){
|
|
return{
|
|
title:this.data.share_title,
|
|
imageUrl:this.data.share_icon
|
|
};
|
|
},
|
|
onShareAppMessage: function() {
|
|
return {
|
|
title: this.data.share_title,
|
|
imageUrl: this.data.share_icon
|
|
};
|
|
},
|
|
//打卡规则请求数据
|
|
_getRule() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("plugin.clock-in.api.clock-in.get-rule");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
ruleContent: res.data.rule
|
|
});
|
|
// let article = that.data.ruleContent;
|
|
/**
|
|
* 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, that);
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
//获取分享数据
|
|
_getShareData() {
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("plugin.clock-in.api.clock-in.get-set");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
share_title: res.data.share.share_title,
|
|
share_icon: res.data.share.share_icon
|
|
});
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
});
|