作者 lihongjuan

1

@@ -36,7 +36,8 @@ App({ @@ -36,7 +36,8 @@ App({
36 let that = this; 36 let that = this;
37 let postData = data 37 let postData = data
38 // let baseUrl = 'https://binhai.w.broing.cn/api'; 38 // let baseUrl = 'https://binhai.w.broing.cn/api';
39 - let baseUrl ='http://binhaitest.w.brotop.cn/api' 39 + // let baseUrl ='http://binhaitest.w.brotop.cn/api'
  40 + let baseUrl = 'https://binhai.w.broing.cn/api'
40 //网络请求 41 //网络请求
41 wx.request({ 42 wx.request({
42 url: baseUrl + url, 43 url: baseUrl + url,
@@ -53,9 +54,9 @@ App({ @@ -53,9 +54,9 @@ App({
53 wx.hideLoading(); 54 wx.hideLoading();
54 wx.removeStorageSync('token'); 55 wx.removeStorageSync('token');
55 wx.removeStorageSync('login'); 56 wx.removeStorageSync('login');
56 - wx.navigateTo({  
57 - url: '/pages/register/register?type=1',  
58 - }) 57 + // wx.navigateTo({
  58 + // url: '/pages/register/register?type=1',
  59 + // })
59 } else { 60 } else {
60 wx.showModal({ 61 wx.showModal({
61 title: '提示', 62 title: '提示',
1 { 1 {
2 "pages": [ 2 "pages": [
  3 + "pages/index/index",
3 "pages/register/register", 4 "pages/register/register",
  5 + "pages/login/login",
  6 +
4 "pages/zuji/zuji", 7 "pages/zuji/zuji",
5 8
6 - "pages/index/index", 9 +
7 "pages/messagedetail/messagedetail", 10 "pages/messagedetail/messagedetail",
8 "pages/message/message", 11 "pages/message/message",
9 - "pages/login/login", 12 +
10 "pages/shop_cart/shop_cart", 13 "pages/shop_cart/shop_cart",
11 "pages/classify/classify", 14 "pages/classify/classify",
12 "pages/my/my", 15 "pages/my/my",
@@ -17,22 +17,22 @@ Page({ @@ -17,22 +17,22 @@ Page({
17 page: 1, //页数 17 page: 1, //页数
18 price: 'price desc', //价格排序方式 18 price: 'price desc', //价格排序方式
19 paynum: 'paynum desc', //销量排序方式 19 paynum: 'paynum desc', //销量排序方式
20 - stick:0,  
21 - activity:[],  
22 - xianshilist:[],  
23 - day:'',  
24 - hou :'',  
25 - min :'',  
26 - sec :'',  
27 - endTime:'',  
28 - activitystatus:'',  
29 - showtime:false,  
30 - status1:'',  
31 - status2:'',  
32 - title2:'' 20 + stick: 0,
  21 + activity: [],
  22 + xianshilist: [],
  23 + day: '',
  24 + hou: '',
  25 + min: '',
  26 + sec: '',
  27 + endTime: '',
  28 + activitystatus: '',
  29 + showtime: false,
  30 + status1: '',
  31 + status2: '',
  32 + title2: ''
33 }, 33 },
34 34
35 - scroll(e){ 35 + scroll(e) {
36 // console.log(e.detail.scrollTop) 36 // console.log(e.detail.scrollTop)
37 // if (e.detail.scrollTop >300){ 37 // if (e.detail.scrollTop >300){
38 // console.log(8888) 38 // console.log(8888)
@@ -47,14 +47,32 @@ Page({ @@ -47,14 +47,32 @@ Page({
47 47
48 // console.log(this.data.stick) 48 // console.log(this.data.stick)
49 }, 49 },
50 - moremiao(){ 50 + moremiao() {
  51 + let token = wx.getStorageSync("token")
  52 + if (token == '') {
  53 + wx.showModal({
  54 + title: '提示',
  55 + content: '请先登录',
  56 + success(res) {
  57 + if (res.confirm) {
  58 + wx.navigateTo({
  59 + url: '/pages/register/register',
  60 + })
  61 + } else if (res.cancel) {
  62 + }
  63 + }
  64 + })
  65 +
  66 + }else{
51 wx.navigateTo({ 67 wx.navigateTo({
52 url: '/pages/xianshi/xianshi', 68 url: '/pages/xianshi/xianshi',
53 }) 69 })
  70 + }
  71 +
54 }, 72 },
55 73
56 // 控制活动专区和限时抢购显示隐藏 74 // 控制活动专区和限时抢购显示隐藏
57 - ishow(){ 75 + ishow() {
58 let that = this 76 let that = this
59 let url = '//wb/wb'; 77 let url = '//wb/wb';
60 let data = { 78 let data = {
@@ -62,7 +80,7 @@ Page({ @@ -62,7 +80,7 @@ Page({
62 80
63 } 81 }
64 app.post(url, data, "POST").then((r) => { 82 app.post(url, data, "POST").then((r) => {
65 - console.log('4456789',r) 83 + console.log('4456789', r)
66 that.setData({ 84 that.setData({
67 status1: r.msg.status1, 85 status1: r.msg.status1,
68 status2: r.msg.status2, 86 status2: r.msg.status2,
@@ -71,16 +89,16 @@ Page({ @@ -71,16 +89,16 @@ Page({
71 89
72 90
73 91
74 - }).catch((err) => { }) 92 + }).catch((err) => {})
75 }, 93 },
76 94
77 // 限时抢购 95 // 限时抢购
78 - getxianshi(){ 96 + getxianshi() {
79 let that = this 97 let that = this
80 let url = '/special/get_all'; 98 let url = '/special/get_all';
81 let data = { 99 let data = {
82 - page:1,  
83 - pageNum:4 100 + page: 1,
  101 + pageNum: 4
84 102
85 } 103 }
86 app.post(url, data, "POST").then((r) => { 104 app.post(url, data, "POST").then((r) => {
@@ -89,7 +107,7 @@ Page({ @@ -89,7 +107,7 @@ Page({
89 that.setData({ 107 that.setData({
90 xianshilist: r.msg.list, 108 xianshilist: r.msg.list,
91 endTime: r.msg.residue_time, 109 endTime: r.msg.residue_time,
92 - activitystatus:r.msg.status 110 + activitystatus: r.msg.status
93 }) 111 })
94 var time = that.date_format(r.msg.residue_time); 112 var time = that.date_format(r.msg.residue_time);
95 console.log(time) 113 console.log(time)
@@ -103,10 +121,10 @@ Page({ @@ -103,10 +121,10 @@ Page({
103 121
104 // console.log(that.data.messagelist) 122 // console.log(that.data.messagelist)
105 123
106 - }).catch((err) => { }) 124 + }).catch((err) => {})
107 }, 125 },
108 126
109 -date_format(micro_second) { 127 + date_format(micro_second) {
110 // 总秒数 128 // 总秒数
111 var second = micro_second; 129 var second = micro_second;
112 // var second = Math.floor(micro_second / 1000); 130 // var second = Math.floor(micro_second / 1000);
@@ -124,9 +142,9 @@ date_format(micro_second) { @@ -124,9 +142,9 @@ date_format(micro_second) {
124 // 倒计时 142 // 倒计时
125 countDown() { 143 countDown() {
126 var that = this; 144 var that = this;
127 - console.log('999',that.data.endTime) 145 + console.log('999', that.data.endTime)
128 var time = that.data.endTime; 146 var time = that.data.endTime;
129 - var interval = setInterval(function () { 147 + var interval = setInterval(function() {
130 // 秒数 148 // 秒数
131 let day = parseInt(time / (60 * 60 * 24)); 149 let day = parseInt(time / (60 * 60 * 24));
132 let hou = parseInt(time % (60 * 60 * 24) / 3600); 150 let hou = parseInt(time % (60 * 60 * 24) / 3600);
@@ -153,7 +171,7 @@ date_format(micro_second) { @@ -153,7 +171,7 @@ date_format(micro_second) {
153 }, 171 },
154 172
155 //获取活动专区列表 173 //获取活动专区列表
156 - getzhuanqulist(){ 174 + getzhuanqulist() {
157 let that = this 175 let that = this
158 let url = '/activity/get_all'; 176 let url = '/activity/get_all';
159 let data = { 177 let data = {
@@ -163,7 +181,7 @@ date_format(micro_second) { @@ -163,7 +181,7 @@ date_format(micro_second) {
163 app.post(url, data, "POST").then((r) => { 181 app.post(url, data, "POST").then((r) => {
164 console.log(r) 182 console.log(r)
165 that.setData({ 183 that.setData({
166 - activity:r.msg 184 + activity: r.msg
167 }) 185 })
168 186
169 console.log(that.data.activity) 187 console.log(that.data.activity)
@@ -173,18 +191,35 @@ date_format(micro_second) { @@ -173,18 +191,35 @@ date_format(micro_second) {
173 191
174 // console.log(that.data.messagelist) 192 // console.log(that.data.messagelist)
175 193
176 - }).catch((err) => { }) 194 + }).catch((err) => {})
177 }, 195 },
178 196
179 // 活动专区查看更多 197 // 活动专区查看更多
180 - seeactive(e){  
181 - let id=e.currentTarget.dataset.id 198 + seeactive(e) {
  199 + let id = e.currentTarget.dataset.id
  200 + let token = wx.getStorageSync("token")
  201 + if (token == '') {
  202 + wx.showModal({
  203 + title: '提示',
  204 + content: '请先登录',
  205 + success(res) {
  206 + if (res.confirm) {
182 wx.navigateTo({ 207 wx.navigateTo({
183 - url: '/pages/zhuanqu/zhuanqu?id='+id, 208 + url: '/pages/register/register',
184 }) 209 })
  210 + } else if (res.cancel) {
  211 + }
  212 + }
  213 + })
  214 + }else{
  215 + wx.navigateTo({
  216 + url: '/pages/zhuanqu/zhuanqu?id=' + id,
  217 + })
  218 + }
  219 +
185 }, 220 },
186 221
187 - more(){ 222 + more() {
188 wx.navigateTo({ 223 wx.navigateTo({
189 url: '/pages/classify/classify', 224 url: '/pages/classify/classify',
190 }) 225 })
@@ -212,9 +247,24 @@ date_format(micro_second) { @@ -212,9 +247,24 @@ date_format(micro_second) {
212 }, 247 },
213 //轮播图 248 //轮播图
214 look_more(e) { 249 look_more(e) {
  250 + let token = wx.getStorageSync("token")
215 let id = e.currentTarget.dataset.id 251 let id = e.currentTarget.dataset.id
216 let style = e.currentTarget.dataset.style 252 let style = e.currentTarget.dataset.style
217 - if(style == 2){ 253 + if (token == '') {
  254 + wx.showModal({
  255 + title: '提示',
  256 + content: '请先登录',
  257 + success(res) {
  258 + if (res.confirm) {
  259 + wx.navigateTo({
  260 + url: '/pages/register/register',
  261 + })
  262 + } else if (res.cancel) {
  263 + }
  264 + }
  265 + })
  266 + } else {
  267 + if (style == 2) {
218 wx.navigateTo({ 268 wx.navigateTo({
219 url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src 269 url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
220 }) 270 })
@@ -223,6 +273,8 @@ date_format(micro_second) { @@ -223,6 +273,8 @@ date_format(micro_second) {
223 url: '/pages/shop_detail/shop_detail?id=' + id 273 url: '/pages/shop_detail/shop_detail?id=' + id
224 }) 274 })
225 } 275 }
  276 + }
  277 +
226 }, 278 },
227 279
228 280
@@ -312,12 +364,12 @@ date_format(micro_second) { @@ -312,12 +364,12 @@ date_format(micro_second) {
312 pid: pid 364 pid: pid
313 } 365 }
314 app.post(url, params).then((res) => { 366 app.post(url, params).then((res) => {
315 - console.log('88776654',res) 367 + console.log('88776654', res)
316 wx.hideLoading() 368 wx.hideLoading()
317 if (type == 1) { 369 if (type == 1) {
318 - let obj={  
319 - name:'首页',  
320 - id:'' 370 + let obj = {
  371 + name: '首页',
  372 + id: ''
321 } 373 }
322 res.msg.unshift(obj) 374 res.msg.unshift(obj)
323 that.setData({ 375 that.setData({
@@ -325,7 +377,7 @@ date_format(micro_second) { @@ -325,7 +377,7 @@ date_format(micro_second) {
325 }) 377 })
326 that.get_info(res.msg[0].id, 2) 378 that.get_info(res.msg[0].id, 2)
327 } else if (type == 2) { 379 } else if (type == 2) {
328 - console.log('666',res) 380 + console.log('666', res)
329 // let obj = { 381 // let obj = {
330 // name: '全部', 382 // name: '全部',
331 // id: '' 383 // id: ''
@@ -384,17 +436,17 @@ date_format(micro_second) { @@ -384,17 +436,17 @@ date_format(micro_second) {
384 * 生命周期函数--监听页面加载 436 * 生命周期函数--监听页面加载
385 */ 437 */
386 onLoad: function(options) { 438 onLoad: function(options) {
387 - let that=this 439 + let that = this
388 this.get_banner() 440 this.get_banner()
389 this.get_info(0, 1); 441 this.get_info(0, 1);
390 // 获取活动专区 442 // 获取活动专区
391 this.getzhuanqulist(); 443 this.getzhuanqulist();
392 this.getxianshi(); 444 this.getxianshi();
393 - setTimeout(function(){ 445 + setTimeout(function() {
394 that.setData({ 446 that.setData({
395 - showtime:true 447 + showtime: true
396 }) 448 })
397 - },990) 449 + }, 990)
398 450
399 451
400 452
@@ -438,7 +490,7 @@ date_format(micro_second) { @@ -438,7 +490,7 @@ date_format(micro_second) {
438 // }) 490 // })
439 491
440 let newlist = []; 492 let newlist = [];
441 - r.msg.forEach(function (value, index, array) { 493 + r.msg.forEach(function(value, index, array) {
442 console.log(newlist) 494 console.log(newlist)
443 if (value.status == 1) { 495 if (value.status == 1) {
444 newlist.push(value) 496 newlist.push(value)
@@ -449,7 +501,7 @@ date_format(micro_second) { @@ -449,7 +501,7 @@ date_format(micro_second) {
449 if (newlist.length != 0) { 501 if (newlist.length != 0) {
450 wx.showTabBarRedDot({ 502 wx.showTabBarRedDot({
451 index: 1, 503 index: 1,
452 - success: function (red) { 504 + success: function(red) {
453 505
454 wx.setTabBarBadge({ 506 wx.setTabBarBadge({
455 index: 1, 507 index: 1,
@@ -460,7 +512,7 @@ date_format(micro_second) { @@ -460,7 +512,7 @@ date_format(micro_second) {
460 } 512 }
461 513
462 514
463 - }).catch((err) => { }) 515 + }).catch((err) => {})
464 }, 516 },
465 /** 517 /**
466 * 生命周期函数--监听页面初次渲染完成 518 * 生命周期函数--监听页面初次渲染完成
@@ -76,11 +76,15 @@ Page({ @@ -76,11 +76,15 @@ Page({
76 encryptedData: that.data.encryptedData 76 encryptedData: that.data.encryptedData
77 } 77 }
78 a.post(u, d).then((r) => { 78 a.post(u, d).then((r) => {
  79 + console.log('778899',r)
79 wx.hideLoading() 80 wx.hideLoading()
80 if (r.code == 200) { 81 if (r.code == 200) {
81 wx.setStorageSync('token', r.token); 82 wx.setStorageSync('token', r.token);
82 wx.setStorageSync('login', r.new_login); 83 wx.setStorageSync('login', r.new_login);
83 wx.setStorageSync('tel', r.tel); 84 wx.setStorageSync('tel', r.tel);
  85 + // wx.reLaunch({
  86 + // url: '/pages/index/index'
  87 + // })
84 if (r.new_login == 0) { 88 if (r.new_login == 0) {
85 // 未绑定手机号 89 // 未绑定手机号
86 wx.redirectTo({ 90 wx.redirectTo({
@@ -11,7 +11,9 @@ @@ -11,7 +11,9 @@
11 11
12 <view class='miaotime miaohour boxsizing'>{{sec}}</view> 12 <view class='miaotime miaohour boxsizing'>{{sec}}</view>
13 </view> --> 13 </view> -->
14 -<view class="searchgood commnonpadding"> 14 +
  15 +<view class="empty" wx:if="{{xianshilist.length==0}}">暂无数据</view>
  16 +<view class="searchgood commnonpadding" wx:else>
15 <view class="searchgooditem flextwo boxsizing" wx:for="{{xianshilist}}" wx:key=""> 17 <view class="searchgooditem flextwo boxsizing" wx:for="{{xianshilist}}" wx:key="">
16 <view class="gooditemleft"> 18 <view class="gooditemleft">
17 <image src="{{item.images[0]}}" mode=""></image> 19 <image src="{{item.images[0]}}" mode=""></image>