作者 lihongjuan

1

... ... @@ -36,7 +36,8 @@ App({
let that = this;
let postData = data
// let baseUrl = 'https://binhai.w.broing.cn/api';
let baseUrl ='http://binhaitest.w.brotop.cn/api'
// let baseUrl ='http://binhaitest.w.brotop.cn/api'
let baseUrl = 'https://binhai.w.broing.cn/api'
//网络请求
wx.request({
url: baseUrl + url,
... ... @@ -53,9 +54,9 @@ App({
wx.hideLoading();
wx.removeStorageSync('token');
wx.removeStorageSync('login');
wx.navigateTo({
url: '/pages/register/register?type=1',
})
// wx.navigateTo({
// url: '/pages/register/register?type=1',
// })
} else {
wx.showModal({
title: '提示',
... ...
{
"pages": [
"pages/index/index",
"pages/register/register",
"pages/login/login",
"pages/zuji/zuji",
"pages/index/index",
"pages/messagedetail/messagedetail",
"pages/message/message",
"pages/login/login",
"pages/shop_cart/shop_cart",
"pages/classify/classify",
"pages/my/my",
... ...
... ... @@ -17,22 +17,22 @@ Page({
page: 1, //页数
price: 'price desc', //价格排序方式
paynum: 'paynum desc', //销量排序方式
stick:0,
activity:[],
xianshilist:[],
day:'',
hou :'',
min :'',
sec :'',
endTime:'',
activitystatus:'',
showtime:false,
status1:'',
status2:'',
title2:''
stick: 0,
activity: [],
xianshilist: [],
day: '',
hou: '',
min: '',
sec: '',
endTime: '',
activitystatus: '',
showtime: false,
status1: '',
status2: '',
title2: ''
},
scroll(e){
scroll(e) {
// console.log(e.detail.scrollTop)
// if (e.detail.scrollTop >300){
// console.log(8888)
... ... @@ -47,40 +47,58 @@ Page({
// console.log(this.data.stick)
},
moremiao(){
wx.navigateTo({
url: '/pages/xianshi/xianshi',
})
moremiao() {
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/register/register',
})
} else if (res.cancel) {
}
}
})
}else{
wx.navigateTo({
url: '/pages/xianshi/xianshi',
})
}
},
// 控制活动专区和限时抢购显示隐藏
ishow(){
ishow() {
let that = this
let url = '//wb/wb';
let data = {
}
app.post(url, data, "POST").then((r) => {
console.log('4456789',r)
console.log('4456789', r)
that.setData({
status1: r.msg.status1,
status2: r.msg.status2,
title2: r.msg.title2
})
}).catch((err) => { })
}).catch((err) => {})
},
// 限时抢购
getxianshi(){
getxianshi() {
let that = this
let url = '/special/get_all';
let data = {
page:1,
pageNum:4
page: 1,
pageNum: 4
}
app.post(url, data, "POST").then((r) => {
... ... @@ -89,12 +107,12 @@ Page({
that.setData({
xianshilist: r.msg.list,
endTime: r.msg.residue_time,
activitystatus:r.msg.status
activitystatus: r.msg.status
})
var time = that.date_format(r.msg.residue_time);
console.log(time)
that.countDown()
that.countDown()
console.log(that.data.xianshilist)
// that.setData({
... ... @@ -103,12 +121,12 @@ Page({
// console.log(that.data.messagelist)
}).catch((err) => { })
}).catch((err) => {})
},
date_format(micro_second) {
date_format(micro_second) {
// 总秒数
var second = micro_second;
var second = micro_second;
// var second = Math.floor(micro_second / 1000);
// 天数
var day = Math.floor(second / 3600 / 24);
... ... @@ -124,9 +142,9 @@ date_format(micro_second) {
// 倒计时
countDown() {
var that = this;
console.log('999',that.data.endTime)
console.log('999', that.data.endTime)
var time = that.data.endTime;
var interval = setInterval(function () {
var interval = setInterval(function() {
// 秒数
let day = parseInt(time / (60 * 60 * 24));
let hou = parseInt(time % (60 * 60 * 24) / 3600);
... ... @@ -151,19 +169,19 @@ date_format(micro_second) {
timeFormat(param) {
return param < 10 ? '0' + param : param;
},
//获取活动专区列表
getzhuanqulist(){
getzhuanqulist() {
let that = this
let url = '/activity/get_all';
let data = {
}
app.post(url, data, "POST").then((r) => {
console.log(r)
that.setData({
activity:r.msg
activity: r.msg
})
console.log(that.data.activity)
... ... @@ -173,18 +191,35 @@ date_format(micro_second) {
// console.log(that.data.messagelist)
}).catch((err) => { })
}).catch((err) => {})
},
// 活动专区查看更多
seeactive(e){
let id=e.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/zhuanqu/zhuanqu?id='+id,
})
seeactive(e) {
let id = e.currentTarget.dataset.id
let token = wx.getStorageSync("token")
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/register/register',
})
} else if (res.cancel) {
}
}
})
}else{
wx.navigateTo({
url: '/pages/zhuanqu/zhuanqu?id=' + id,
})
}
},
more(){
more() {
wx.navigateTo({
url: '/pages/classify/classify',
})
... ... @@ -212,17 +247,34 @@ date_format(micro_second) {
},
//轮播图
look_more(e) {
let token = wx.getStorageSync("token")
let id = e.currentTarget.dataset.id
let style = e.currentTarget.dataset.style
if(style == 2){
wx.navigateTo({
url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
if (token == '') {
wx.showModal({
title: '提示',
content: '请先登录',
success(res) {
if (res.confirm) {
wx.navigateTo({
url: '/pages/register/register',
})
} else if (res.cancel) {
}
}
})
} else {
wx.navigateTo({
url: '/pages/shop_detail/shop_detail?id=' + id
})
if (style == 2) {
wx.navigateTo({
url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
})
} else {
wx.navigateTo({
url: '/pages/shop_detail/shop_detail?id=' + id
})
}
}
},
... ... @@ -312,12 +364,12 @@ date_format(micro_second) {
pid: pid
}
app.post(url, params).then((res) => {
console.log('88776654',res)
console.log('88776654', res)
wx.hideLoading()
if (type == 1) {
let obj={
name:'首页',
id:''
let obj = {
name: '首页',
id: ''
}
res.msg.unshift(obj)
that.setData({
... ... @@ -325,7 +377,7 @@ date_format(micro_second) {
})
that.get_info(res.msg[0].id, 2)
} else if (type == 2) {
console.log('666',res)
console.log('666', res)
// let obj = {
// name: '全部',
// id: ''
... ... @@ -384,21 +436,21 @@ date_format(micro_second) {
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let that=this
let that = this
this.get_banner()
this.get_info(0, 1);
// 获取活动专区
this.getzhuanqulist();
this.getxianshi();
setTimeout(function(){
setTimeout(function() {
that.setData({
showtime:true
showtime: true
})
},990)
}, 990)
},
//获取购物车数量
get_shopnum() {
... ... @@ -438,7 +490,7 @@ date_format(micro_second) {
// })
let newlist = [];
r.msg.forEach(function (value, index, array) {
r.msg.forEach(function(value, index, array) {
console.log(newlist)
if (value.status == 1) {
newlist.push(value)
... ... @@ -449,7 +501,7 @@ date_format(micro_second) {
if (newlist.length != 0) {
wx.showTabBarRedDot({
index: 1,
success: function (red) {
success: function(red) {
wx.setTabBarBadge({
index: 1,
... ... @@ -460,7 +512,7 @@ date_format(micro_second) {
}
}).catch((err) => { })
}).catch((err) => {})
},
/**
* 生命周期函数--监听页面初次渲染完成
... ...
... ... @@ -76,11 +76,15 @@ Page({
encryptedData: that.data.encryptedData
}
a.post(u, d).then((r) => {
console.log('778899',r)
wx.hideLoading()
if (r.code == 200) {
wx.setStorageSync('token', r.token);
wx.setStorageSync('login', r.new_login);
wx.setStorageSync('tel', r.tel);
// wx.reLaunch({
// url: '/pages/index/index'
// })
if (r.new_login == 0) {
// 未绑定手机号
wx.redirectTo({
... ...
... ... @@ -11,7 +11,9 @@
<view class='miaotime miaohour boxsizing'>{{sec}}</view>
</view> -->
<view class="searchgood commnonpadding">
<view class="empty" wx:if="{{xianshilist.length==0}}">暂无数据</view>
<view class="searchgood commnonpadding" wx:else>
<view class="searchgooditem flextwo boxsizing" wx:for="{{xianshilist}}" wx:key="">
<view class="gooditemleft">
<image src="{{item.images[0]}}" mode=""></image>
... ...