银花优选微信小程序修改后的最新版本代码
This commit is contained in:
194
pages/othershop/index.js
Normal file
194
pages/othershop/index.js
Normal file
@@ -0,0 +1,194 @@
|
||||
//获取应用实例
|
||||
var app = getApp()
|
||||
var sopenFrame=null
|
||||
var that=null
|
||||
var that0=null
|
||||
Page({
|
||||
data: {
|
||||
indicatorDots: true,
|
||||
vertical: false,
|
||||
autoplay: true,
|
||||
interval: 6000,
|
||||
duration: 1000,
|
||||
loadingHidden: false, // loading
|
||||
nodataHidden:false,
|
||||
t:8,
|
||||
images:[],
|
||||
images0:[],
|
||||
groups:[]
|
||||
},onShow: function () {
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
that0=this;
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var userInfodata = wx.getStorageSync("userInfo")
|
||||
var sel=3;
|
||||
var ifsel=0;
|
||||
if(userId&&userInfodata){
|
||||
var userInfo = JSON.parse(userInfodata)
|
||||
|
||||
ifsel=userInfo.bdshEnable;
|
||||
}
|
||||
|
||||
if(ifsel==1){
|
||||
sel=2;
|
||||
that0.getTabBar().setData({
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "/pages/index/index",
|
||||
"text": "首页",
|
||||
"iconPath": "/images/footer-icon-01.png",
|
||||
"selectedIconPath": "/images/footer-icon-01-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/news/index",
|
||||
"iconPath": "/images/footer-icon-05.png",
|
||||
"selectedIconPath": "/images/footer-icon-05-active.png",
|
||||
"text": "资讯"
|
||||
},
|
||||
|
||||
{
|
||||
"pagePath": "/pages/my/index",
|
||||
"text": "我的",
|
||||
"iconPath": "/images/footer-icon-04.png",
|
||||
"selectedIconPath": "/images/footer-icon-04-active.png"
|
||||
}
|
||||
]
|
||||
})
|
||||
}else{
|
||||
that0.getTabBar().setData({
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "/pages/index/index",
|
||||
"text": "首页",
|
||||
"iconPath": "/images/footer-icon-01.png",
|
||||
"selectedIconPath": "/images/footer-icon-01-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/news/index",
|
||||
"iconPath": "/images/footer-icon-05.png",
|
||||
"selectedIconPath": "/images/footer-icon-05-active.png",
|
||||
"text": "资讯"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/business/index",
|
||||
"iconPath": "/images/footer-icon-02.png",
|
||||
"selectedIconPath": "/images/footer-icon-02-active.png",
|
||||
"text": "门店"
|
||||
},
|
||||
|
||||
{
|
||||
"pagePath": "/pages/my/index",
|
||||
"text": "我的",
|
||||
"iconPath": "/images/footer-icon-04.png",
|
||||
"selectedIconPath": "/images/footer-icon-04-active.png"
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
that0.getTabBar().setData({
|
||||
selected: sel
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onLoad: function() {
|
||||
that = this
|
||||
|
||||
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")
|
||||
var selcityid = wx.getStorageSync("selcityid")
|
||||
var selcountyid = wx.getStorageSync("selcountyid")
|
||||
var dlMemberId = wx.getStorageSync("dlMemberId")
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"getothershopdata",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
selcityid:(!selcityid?"":selcityid),
|
||||
selcountyid:(!selcountyid?"":selcountyid),
|
||||
dlMemberId:(!dlMemberId?"":dlMemberId),
|
||||
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{
|
||||
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