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.

65 lines
1.5 KiB

var WXAPI = require('./server.js');
2 years ago
function formatTime(date) {
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
function formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
}
function getUesrBgplus(that, app, is) {
WXAPI.appCart({
openid: app.globalData.userInfo.openid,
}).then(res => {
2 years ago
if (res.code == 200) {
var data = res;
2 years ago
if (is) {
that.setData({
cart: data.cart
2 years ago
})
return null
}
if (data.cart) {
2 years ago
wx.setTabBarBadge({
index: 3,
text: data.cart,
2 years ago
})
} else {
wx.removeTabBarBadge({
index: 3
})
}
}
2 years ago
});
}
/*
* 假设你访问的后台登录路径是https://www.baidu.com/LKT/index.php?module=Login
* 那么你在这里填的路径应该是https://www.baidu.com/LKT/index.php?module=api&software_name=3&edition=1.0
*/
function getUrl() {
2 years ago
//如果不想安装后台服务,请使用注释这一行做简单数据体验
2 years ago
return 'http://192.168.0.73:18001'
2 years ago
}
module.exports = {
formatTime: formatTime,
getUesrBgplus: getUesrBgplus,
getUrl: getUrl
2 years ago
}
function checkStringEmpty(data) {
if (null == data || "" == data) {
return false;
}
return true;
}