银花优选微信小程序修改后的最新版本代码
This commit is contained in:
137
pages/othershop00/index.js
Normal file
137
pages/othershop00/index.js
Normal file
@@ -0,0 +1,137 @@
|
||||
//获取应用实例
|
||||
var app = getApp()
|
||||
var sopenFrame=null
|
||||
var that=null
|
||||
Page({
|
||||
data: {
|
||||
indicatorDots: true,
|
||||
vertical: false,
|
||||
autoplay: true,
|
||||
interval: 6000,
|
||||
duration: 1000,
|
||||
loadingHidden: false, // loading
|
||||
nodataHidden:true,
|
||||
t:9,
|
||||
images:[],
|
||||
images0:[],
|
||||
groups:[]
|
||||
},onShow: function () {
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setData({
|
||||
selected: 2
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onLoad: function(options) {
|
||||
that = this
|
||||
if(options.t){
|
||||
that.setData({
|
||||
t:options.t
|
||||
});
|
||||
} if(that.data.t==9){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "客服专区1"
|
||||
})
|
||||
}else{
|
||||
wx.setNavigationBarTitle({
|
||||
title: " 事业联盟部"
|
||||
})
|
||||
}
|
||||
|
||||
that.rdata(0)
|
||||
}, // 下拉刷新
|
||||
onPullDownRefresh: function () {
|
||||
//在当前页面显示导航条加载动画
|
||||
wx.showNavigationBarLoading();
|
||||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||||
wx.showLoading({
|
||||
title: '刷新中...',
|
||||
})
|
||||
that.rdata(1);//第一次加载数据
|
||||
},rdata:function(tt) {
|
||||
|
||||
try{
|
||||
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"getothershopdata",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
t:that.data.t
|
||||
},
|
||||
method:"GET",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/json" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
that.setData({
|
||||
images: res.data.pic,
|
||||
images0: res.data.productlbs,
|
||||
groups: res.data.productlb,
|
||||
loadingHidden:true
|
||||
})
|
||||
if(res.data.productlb.length==0){
|
||||
that.setData({
|
||||
nodataHidden:false
|
||||
})
|
||||
}else{
|
||||
that.setData({
|
||||
nodataHidden:true
|
||||
})
|
||||
}
|
||||
}else{
|
||||
if(res.data.msg=="您未登录"){
|
||||
wx.removeStorageSync('userId')
|
||||
wx.removeStorageSync('LoginId')
|
||||
}
|
||||
}
|
||||
if(tt==1){
|
||||
//隐藏loading 提示框
|
||||
wx.hideLoading();
|
||||
//隐藏导航条加载动画
|
||||
wx.hideNavigationBarLoading();
|
||||
//停止下拉刷新
|
||||
wx.stopPullDownRefresh();
|
||||
}
|
||||
}
|
||||
})
|
||||
}catch(err){
|
||||
wx.showToast({
|
||||
title: err,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},gotolb:function(e) {
|
||||
var id = e.currentTarget.dataset.id
|
||||
wx.navigateTo({
|
||||
url: "../list/index?id="+id
|
||||
})
|
||||
},gotodetail:function(e) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
if(userId&&LoginId){
|
||||
var id = e.currentTarget.dataset.id
|
||||
wx.navigateTo({
|
||||
url: "../details/index?id="+id
|
||||
})
|
||||
}else{
|
||||
wx.navigateTo({
|
||||
url: "../login/index"
|
||||
})
|
||||
}
|
||||
},onslide: function (e) {
|
||||
var url = e.currentTarget.dataset.id
|
||||
|
||||
wx.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user