import WxValidate from ‘utils/WxValidate’;
import constants from ‘vendor/constants’;
import pengtu from ‘vendor/sdk/index’;
//var pengtu = require(’./vendor/sdk/index’);
App({
onLaunch: function () {
// 记载左右码表数据
if (wx.getStorageSync(‘code’) == “”) {
pengtu.request({
login: false,
url: constants.HOSTS + ‘/mb/ch/loadallcode.do’,
success: function (data) {
wx.setStorageSync(‘code’, data.data)
}
})
}
}
pengtu.setLoginUrl(constants.HOSTS +’/mb/wx/login’);
// 获取用户信息
},
loadCode: function (category, fcategory) {
var codes = [];
var code = wx.getStorageSync(‘code’);
for (var i = 0; i < code.length; i++) {
if (fcategory == ‘’) {
if (category == code[i].category) {
codes.push(code[i]);
if (i == code.length) {
return codes;
}else if(category != code[i + 1].category){
return codes;
}
}
} else {
if (fcategory == code[i].fcategory) {
codes.push(code[i]);
if (i == code.length) {
return codes;
}else if (fcategory != code[i + 1].fcategory){
return codes;
}
}
}
}
return codes;
},
})
其他页面 pages
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
index: 0,
wximgurl: constants.WXIMG,
num: 0,
seat: 0,
cut: 0,
picList: [],
arrow: constants.WXIMG+’/images/arrow.png’,
},
onLoad: function (options) {
var firstArea = app.loadCode(‘2018’, ‘’) //t提示 app未定义问题,急!!!!!
}
})