onLoad: function (options) {
var that = this;
var mainClass = that.data.mainClass;
var childClass = that.data.childClass;
var page = that.data.page;
var userNew = '';
var timestamp = (new Date()).valueOf();
try {
var value = swan.getStorageSync('userNew')
if (value) {
userNew = value;
}
} catch (e) {
}
swan.getSystemInfo({
success: res => {
var czxt = res.system.split(" ")[0];
that.setData({
czxt: czxt
})
//导航高度
}, fail(err) {
console.log(err);
}
})
// swan.showLoading({
// title: '加载中',
// })
swan.request({
url: app.pzURl + '/wxxcxweb/ImgInterface/' + app.configName, //仅为示例,并非真实的接口地址
data: {},
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
console.log(res)
if (userNew != '') {
if ((userNew.userno == res.data.userName) && (res.data.qzzx == 1)) {
swan.request({
url: app.pzURl + '/wxxcxweb/ImgInterface/zcSign.php', //仅为示例,并非真实的接口地址
data: {
ctype: '14',
c_lb: '24',
c_times: timestamp
},
header: {
'content-type': 'application/json' // 默认值
},
success: function (resbdqm) {
console.log(resbdqm)
swan.request({
url: res.data.waibou + '/asp_pub/savepubdata.asp', //仅为示例,并非真实的接口地址
data: {
c_lb: '24',
c_ac: resbdqm.data,
c_acdate: timestamp,
c_uid: userNew.userno,
c_openid: userNew.openId,
c_unionid: userNew.c_unionid,
c_wx_type: '1',
c_istjr: '0',
c_czfs: '2'
},
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
if (res.data == 1) {
try {
swan.removeStorageSync('userNew')
} catch (e) {
// Do something when catch error
}
try {
swan.removeStorageSync('wxNews')
} catch (e) {
// Do something when catch error
}
}
}
})
}
})
}
}
that.setData({
pzconfig: res.data,
CarouselImgs: res.data.adqjyqhImg
})
app.pzxx = res.data;
swan.request({
url: app.pzURl + '/wxxcxweb/ImgInterface/yqhGetCategory.php', //仅为示例,并非真实的接口地址
data: { ctype: app.navTypes },
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
console.log(res)
that.setData({
chirdcate: res.data
})
that.getData(mainClass, childClass, page)
}
})
}
})
},
getData: function (mian, child, page) {
var that = this;
var num = that.data.num;
var timestamp = (new Date()).valueOf();
var listData = that.data.listData;
var pzxx = that.data.pzconfig;
var remindcontent = "加载中"
if (page == 1) {
listData = []
}
swan.request({
url: app.pzURl + '/wxxcxweb/ImgInterface/zcSign.php', //仅为示例,并非真实的接口地址
data: {
ctype: 3,
times: timestamp,
c_lb: '46',
c_app: app.lysz,
c_uid: 'admin',
c_sort: mian,
c_tmp_type: 0
},
header: {
'content-type': 'application/json' // 默认值
},
success: function (qmres) {
console.log(1)
console.log(qmres)
swan.request({
url: app.pzURl + '/asp_pub/readpubxml.asp', //仅为示例,并非真实的接口地址
data: {
c_lb: '46',
c_ac: qmres.data.acSign,
c_acdate: timestamp,
c_app: app.lysz,
c_uid: 'admin',
c_sort: mian,
c_xl: child,
c_type: 0,
c_title: '',
c_yszt: '',
c_ac2: qmres.data.acSign2,
page: page,
i_num: num
},
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
var xmlParser = new Parser.DOMParser();
var doc = xmlParser.parseFromString(res.data);
var prepay_id = doc.getElementsByTagName("date_count")[0].firstChild.nodeValue;
if (prepay_id == num) {
remindcontent = '加载中'
} else {
remindcontent = '已经到底了'
}
for (var i = 0; i < prepay_id; i++) {
var option = {};
option.c_id = doc.getElementsByTagName("c_id")[i].firstChild.nodeValue;
option.c_sort = doc.getElementsByTagName("c_sort")[i].firstChild.nodeValue;
option.c_xl = doc.getElementsByTagName("c_xl")[i].firstChild.nodeValue;
option.c_type = doc.getElementsByTagName("c_type")[i].firstChild.nodeValue;
option.c_sceneid = doc.getElementsByTagName("c_sceneid")[i].firstChild.nodeValue;
option.c_sceneurl = doc.getElementsByTagName("c_sceneurl")[i].firstChild.nodeValue;
option.c_title = doc.getElementsByTagName("c_title")[i].firstChild.nodeValue;
if (option.c_title != '') {
option.c_title = option.c_title.replace(/\?|\&|\'|\"|\<|\>|\@/g, '')
}
option.c_pic = doc.getElementsByTagName("c_pic")[i].firstChild.nodeValue;
option.c_price = doc.getElementsByTagName("c_price")[i].firstChild.nodeValue;
option.c_dzcount = doc.getElementsByTagName("c_dzcount")[i].firstChild.nodeValue;
option.c_formset = doc.getElementsByTagName("c_formset")[i].firstChild.nodeValue;
option.c_addset = doc.getElementsByTagName("c_addset")[i].firstChild.nodeValue;
option.c_xcsset = doc.getElementsByTagName("c_xcsset")[i].firstChild.nodeValue;
if (option.c_type == 1 || option.c_type == 3) {
if (option.c_sceneurl.indexOf('http') != -1) {
var parn = /((http|https):\/\/)+(\w+\.)+(\w+)/
var http = option.c_sceneurl.match(parn)[0]
option.c_sceneurl = option.c_sceneurl.replace(http, pzxx.eqy)
} else if (option.c_sceneurl.indexOf('https') != -1) {
option.c_sceneurl = option.c_sceneurl;
} else {
option.c_sceneurl = pzxx.eqy + "/v/" + option.c_sceneurl;
}
} else if (option.c_type == 2 || option.c_type == 4) {
if (option.c_sceneurl.indexOf('http') != -1) {
var parn = /((http|https):\/\/)+(\w+\.)+(\w+)/
var http = option.c_sceneurl.match(parn)[0]
option.c_sceneurl = option.c_sceneurl.replace(http, pzxx.wyx)
} else if (option.c_sceneurl.indexOf('https') != -1) {
option.c_sceneurl = option.c_sceneurl;
} else {
option.c_sceneurl = pzxx.wyx + "/v/" + option.c_sceneurl;
}
} else if (option.c_type == 5 || option.c_type == 6) {
if (option.c_sceneurl.indexOf('http') != -1) {
var parn = /((http|https):\/\/)+(\w+\.)+(\w+)/
var http = option.c_sceneurl.match(parn)[0]
option.c_sceneurl = option.c_sceneurl.replace(http, pzxx.waibou)
} else if (option.c_sceneurl.indexOf('https') != -1) {
option.c_sceneurl = option.c_sceneurl;
} else {
option.c_sceneurl = pzxx.waibou + "/v/" + option.c_sceneurl;
}
}
option.c_smurl = doc.getElementsByTagName("c_smurl")[i].firstChild.nodeValue;
if (option.c_smurl.indexOf('http') != -1) {
var parn = /((http|https):\/\/)+(\w+\.)+(\w+)/
var http = option.c_smurl.match(parn)[0]
option.c_smurl = option.c_smurl.replace(http, pzxx.wyx)
}
option.c_dzurl = doc.getElementsByTagName("c_dzurl")[i].firstChild.nodeValue;
option.c_tag = doc.getElementsByTagName("c_tag")[i].firstChild.nodeValue;
option.c_iszx = doc.getElementsByTagName("c_iszx")[i].firstChild.nodeValue;
listData.push(option);
}
swan.hideLoading()
that.setData({
listData: listData,
remindcontent: remindcontent,
pageNum: prepay_id,
page: page
})
}
})
}
})
},