diff --git a/app.js b/app.js index c651837..bd8fb24 100644 --- a/app.js +++ b/app.js @@ -20,23 +20,22 @@ App({ var logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs); - }, //控制授权登入 - userlogin: function (page) { - if (this.globalData.userInfo.openid == '' || !this.globalData.userInfo.openid) { + // isLogin: function (page) { + // if (this.globalData.userInfo.openid == '' || !this.globalData.userInfo.openid) { - if (page) { - return true - } else { - wx.navigateTo({ - // url: 'pages/login/login' - }) - } - } else { - console.log(this.globalData.userInfo) - } - }, + // if (page) { + // return true + // } else { + // wx.navigateTo({ + // // url: 'pages/login/login' + // }) + // } + // } else { + // console.log(this.globalData.userInfo) + // } + // }, onShow: function (options) { var referee_openid = options.query.userid ? options.query.userid : ''; @@ -75,7 +74,6 @@ App({ if (userinfo.nickName) { that.globalData.userInfo = userinfo; } - } }); }, @@ -89,7 +87,7 @@ App({ gender: stype.gender, referee_openid: this.globalData.userInfo.referee_openid || '' }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; if (data.status == 0) { wx.showToast({ @@ -122,7 +120,7 @@ App({ callback() } else { - that.showToast(res.err); + that.showToast(res.message); } }); }, @@ -137,7 +135,8 @@ App({ }, globalData: { userInfo: {}, - userlogin: wx.getStorageSync('userlogin'), + isLogin: false, + accessId: wx.getStorageSync('accessId'), }, redirect: function (url, param) { wx.navigateTo({ diff --git a/app.json b/app.json index 5d68335..fc2645a 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "pages": [ "pages/index/index", - "pages/search/search", + "pages/category/category", "pages/user/user", "pages/new/new", "pages/set/set", @@ -67,16 +67,10 @@ "text": "首页" }, { - "pagePath": "pages/new/new", - "iconPath": "images/icons/new.png", - "selectedIconPath": "images/icons/newopen.png", - "text": "新品" - }, - { - "pagePath": "pages/search/search", - "iconPath": "images/icons/seach.png", - "selectedIconPath": "images/icons/seachopen.png", - "text": "搜索" + "pagePath": "pages/category/category", + "iconPath": "images/icons/category.png", + "selectedIconPath": "images/icons/categoryopen.png", + "text": "全部分类" }, { "pagePath": "pages/cart/cart", @@ -88,7 +82,7 @@ "pagePath": "pages/user/user", "iconPath": "images/icons/me.png", "selectedIconPath": "images/icons/meopen.png", - "text": "个人中心" + "text": "我的" } ] }, diff --git a/app.wxss b/app.wxss index 4ca4d9b..953726b 100644 --- a/app.wxss +++ b/app.wxss @@ -1,10 +1,10 @@ /**app.wxss**/ - page { - background: #fff; font-family: '微软雅黑'; + background: #fff; height:100%; width:100%; + font-family: "Helvetica Neue",Arial,"PingFang SC","Microsoft YaHei",sans-serif; } .container { height: 100%; diff --git a/images/home_title_bg.png b/images/home_title_bg.png new file mode 100644 index 0000000..5f4673c Binary files /dev/null and b/images/home_title_bg.png differ diff --git a/images/icons/Back_home.png b/images/icons/Back_home.png new file mode 100644 index 0000000..3bcc6f7 Binary files /dev/null and b/images/icons/Back_home.png differ diff --git a/images/icons/cart.png b/images/icons/cart.png index a34ee0b..99480d4 100644 Binary files a/images/icons/cart.png and b/images/icons/cart.png differ diff --git a/images/icons/cartopen.png b/images/icons/cartopen.png index 511ceac..477f50c 100644 Binary files a/images/icons/cartopen.png and b/images/icons/cartopen.png differ diff --git a/images/icons/category.png b/images/icons/category.png new file mode 100644 index 0000000..62f994c Binary files /dev/null and b/images/icons/category.png differ diff --git a/images/icons/categoryopen.png b/images/icons/categoryopen.png new file mode 100644 index 0000000..857f5bd Binary files /dev/null and b/images/icons/categoryopen.png differ diff --git a/images/icons/home.png b/images/icons/home.png index 89ef419..94358fe 100644 Binary files a/images/icons/home.png and b/images/icons/home.png differ diff --git a/images/icons/homeopen.png b/images/icons/homeopen.png index eaa2db0..3d4289f 100644 Binary files a/images/icons/homeopen.png and b/images/icons/homeopen.png differ diff --git a/images/icons/me.png b/images/icons/me.png index cf96537..bb987f1 100644 Binary files a/images/icons/me.png and b/images/icons/me.png differ diff --git a/images/icons/meopen.png b/images/icons/meopen.png index 38ac62e..5343658 100644 Binary files a/images/icons/meopen.png and b/images/icons/meopen.png differ diff --git a/images/icons/seach.png b/images/icons/seach.png deleted file mode 100644 index 87cce0f..0000000 Binary files a/images/icons/seach.png and /dev/null differ diff --git a/images/icons/seachopen.png b/images/icons/seachopen.png deleted file mode 100644 index dc2baf6..0000000 Binary files a/images/icons/seachopen.png and /dev/null differ diff --git a/images/pass.png b/images/pass.png new file mode 100644 index 0000000..ffd9c1d Binary files /dev/null and b/images/pass.png differ diff --git a/images/user.png b/images/user.png new file mode 100644 index 0000000..c52e993 Binary files /dev/null and b/images/user.png differ diff --git a/pages/address/address.js b/pages/address/address.js index f3e0136..5750bf7 100644 --- a/pages/address/address.js +++ b/pages/address/address.js @@ -66,7 +66,7 @@ Page({ WXAPI.addressManagement({ openid: app.globalData.userInfo.openid, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var sheng = data.sheng; var shi = data.shi; @@ -137,7 +137,7 @@ Page({ WXAPI.getCityArr({ count: count, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; that.setData({ shi: data.shi @@ -157,7 +157,7 @@ Page({ count: count, column: column, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; that.setData({ xian: data.xian @@ -178,7 +178,7 @@ Page({ shi: rew[1], xuan: rew[2] }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var province = data.province; var city = data.city; @@ -233,7 +233,7 @@ Page({ county: e.detail.value.county, address: e.detail.value.address }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; wx.showToast({ title: data.info, diff --git a/pages/address/address.wxml b/pages/address/address.wxml index 2130578..fd35847 100644 --- a/pages/address/address.wxml +++ b/pages/address/address.wxml @@ -20,7 +20,7 @@ - + diff --git a/pages/address/index.js b/pages/address/index.js index 88c62d7..a4c410a 100644 --- a/pages/address/index.js +++ b/pages/address/index.js @@ -34,7 +34,7 @@ Page({ openid: app.globalData.userInfo.openid, id_arr: carts }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; wx.showToast({ title: '地址已清空', @@ -92,7 +92,7 @@ Page({ WXAPI.addressIndex({ openid: app.globalData.userInfo.openid }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var address = data.adds; if (address == '') { @@ -219,7 +219,7 @@ Page({ openid: app.globalData.userInfo.openid, addr_id: addrId }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var cartId = that.data.cartId; if (cartId != '0' || cartId == 'group') { @@ -258,7 +258,7 @@ Page({ openid: app.globalData.userInfo.openid, id_arr: addrId }).then(res => { - if (res.status == 1) { + if (res.code == 200) { that.DataonLoad(); } else { wx.showToast({ @@ -278,7 +278,7 @@ Page({ WXAPI.addressIndex({ openid: app.globalData.userInfo.openid, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var address = data.adds; that.numbers = data.adds; diff --git a/pages/address/upaddress.js b/pages/address/upaddress.js index 2453a4a..a486225 100644 --- a/pages/address/upaddress.js +++ b/pages/address/upaddress.js @@ -56,7 +56,7 @@ Page({ openid: app.globalData.userInfo.openid, id_arr: that.data.id_arr, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var address = data.adds; var province = data.province; @@ -79,7 +79,7 @@ Page({ WXAPI.addressManagement({ openid: app.globalData.userInfo.openid, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var sheng = data.sheng; var shi = data.shi; @@ -143,7 +143,7 @@ Page({ WXAPI.getCityArr({ count: count, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; that.setData({ shi: data.shi @@ -163,7 +163,7 @@ Page({ count: count, column: column, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; that.setData({ xian: data.xian @@ -184,7 +184,7 @@ Page({ shi: rew[1], xuan: rew[2] }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; var province = data.province; var city = data.city; @@ -237,7 +237,7 @@ Page({ county: e.detail.value.county, address: e.detail.value.address }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; wx.showModal({ title: '提示', @@ -260,7 +260,7 @@ Page({ // from_id: formId, // userid: app.globalData.userInfo.openid // }).then(res => { - // if (res.status == 1) { + // if (res.code == 200) { // var data = res; // } diff --git a/pages/article/article.js b/pages/article/article.js index 22f3fa5..159d47e 100644 --- a/pages/article/article.js +++ b/pages/article/article.js @@ -41,50 +41,36 @@ Page({ // 获取文章详情 y_detail: function (id) { var that = this; - wx.request({ - url: app.d.ceshiUrl + '&action=envelope&m=index', - method: 'post', - data: { - id: id, - }, - header: { //请求头 - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var status = res.data.status; - if (status == 1) { - var article = res.data.article; - var content = article['0'].content; - //绑定页面数据,使用插件titstu - WxParse.wxParse('content', 'html', content, that, 3); + WXAPI.envelopeIndex({ + id: id, + }).then(res => { + if (res.code == 200) { + var data = res; + var article = data.article; + var content = article['0'].content; + //绑定页面数据,使用插件titstu + WxParse.wxParse('content', 'html', content, that, 3); + that.setData({ + article: article['0'], + title:article['0'].Article_title, + }); + + if (article['0'].Article_title !='关于我们'){ that.setData({ - article: article['0'], - title:article['0'].Article_title, - }); - - if (article['0'].Article_title !='关于我们'){ - that.setData({ - titstu:true, - }); - } - //设置动态标题 - wx.setNavigationBarTitle({ - title: article['0'].Article_title - }); - } else { - //返回错误提示 - wx.showToast({ - title: res.data.err, - duration: 2000, + titstu:true, }); } - }, - error: function (e) { + //设置动态标题 + wx.setNavigationBarTitle({ + title: article['0'].Article_title + }); + } else { + //返回错误提示 wx.showToast({ - title: '网络异常!', + title: res.err, duration: 2000, }); - }, + } }); }, // 转发分享 @@ -102,33 +88,21 @@ Page({ path: '/pages/index/index?id?p_openid=' + app.globalData.userInfo.openid, success: function (res) { // 转发成功 - wx.request({ - url: app.d.ceshiUrl + '&action=envelope&m=share', - method: 'post', - data: { - id: id, - openid: app.globalData.userInfo.openid - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - wx.showToast({ - title: res.data.err, - duration: 2000 + WXAPI.envelopeShare({ + id: id, + openid: app.globalData.userInfo.openid + }).then(res => { + if (res.code == 200) { + var data = res; + wx.navigateTo({ + url: '../share/index?id=' + id + '&n=1', }); - if (res.data.info == 1) { - wx.navigateTo({ - url: '../share/index?id=' + id + '&n=1', - }); - } - }, - fail: function (e) { + } else { wx.showToast({ - title: '网络异常!err:getsessionkeys', + title: res.err, duration: 2000 }); - }, + } }); }, fail: function (res) { @@ -138,25 +112,17 @@ Page({ }, storage: function () { var that = this; - wx.request({ - url: app.d.ceshiUrl + '&action=app&m=user', - method: 'post', - data: { - nickName: app.globalData.userInfo.nickName, - headimgurl: app.globalData.userInfo.avatarUrl, - sex: app.globalData.userInfo.gender, - openid: app.globalData.userInfo.openid, - p_openid: app.globalData.userInfo.p_openid, - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - - }, - fail: function (e) { - - }, + WXAPI.appUser({ + nickName: app.globalData.userInfo.nickName, + headimgurl: app.globalData.userInfo.avatarUrl, + sex: app.globalData.userInfo.gender, + openid: app.globalData.userInfo.openid, + p_openid: app.globalData.userInfo.p_openid, + }).then(res => { + if (res.code == 200) { + var data = res; + + } }); }, //分享朋友圈 查看保存图片 @@ -167,25 +133,21 @@ Page({ icon: 'loading', duration: 1500, }); - - app.request.wxRequest({ - url: '&action=getcode&m=product_share', - data: { - scene: 'id=' + that.data.id + '&p_openid=' + app.globalData.userInfo.openid, - path: 'pages/article/article', - id: app.globalData.userInfo.user_id, - pid: that.data.id, - type: 1 - }, - method: 'post', - success: function (res) { - console.log(res) + WXAPI.getcodeProductShare({ + scene: 'id=' + that.data.id + '&p_openid=' + app.globalData.userInfo.openid, + path: 'pages/article/article', + id: app.globalData.userInfo.user_id, + pid: that.data.id, + type: 1 + }).then(res => { + if (res.code == 200) { + var data = res; that.setData({ maskHidden: true, imagePath: res.url, }); } - }) + }); var animation = wx.createAnimation({ duration: 200, diff --git a/pages/bangding/bangding.js b/pages/bangding/bangding.js index 85ee38c..0348b82 100644 --- a/pages/bangding/bangding.js +++ b/pages/bangding/bangding.js @@ -124,58 +124,41 @@ Page({ date: date }); var that = this; - wx.request({ - url: app.d.ceshiUrl + '&action=user&m=perfect_index', - method: 'post', - data: { - user_id: app.globalData.userInfo.user_id - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - console.log(res) - var status = res.data.status; - if (status == 1) { - var data = res.data.data; + WXAPI.userPerfectIndex({ + user_id: app.globalData.userInfo.user_id + }).then(res => { + if (res.code == 200) { + var data = res; - var items = that.data.items; - for (var i = 0; i < items.length; i++) { - if (items[i].name == data.sex) { - items[i].checked = true; - } else { - items[i].checked = false; - } - } - if (data.province) { - var region = [data.province, data.city, data.county]; - } else { - var region = that.data.region; - } - if (data.birthday) { - var date = data.birthday + var items = that.data.items; + for (var i = 0; i < items.length; i++) { + if (items[i].name == data.sex) { + items[i].checked = true; } else { - var date = that.data.date; + items[i].checked = false; } - - - that.setData({ - name: data.name, - mobile: data.mobile, - binding: res.data.binding, - items: items, - region: region, - date: date, - wx_id: data.wechat_id, - sex: data.sex, - remind: '' - }); } - }, - error: function (e) { - wx.showToast({ - title: '网络异常!', - duration: 2000 + if (data.province) { + var region = [data.province, data.city, data.county]; + } else { + var region = that.data.region; + } + if (data.birthday) { + var date = data.birthday + } else { + var date = that.data.date; + } + + that.setData({ + name: data.name, + mobile: data.mobile, + binding: data.binding, + items: items, + region: region, + date: date, + wx_id: data.wechat_id, + sex: data.sex, + remind: '' }); } }); @@ -205,35 +188,21 @@ Page({ showCancel: false, content: '同意授权', success: function (res) { - wx.request({ - url: app.d.ceshiUrl + '&action=user&m=secret_key', - method: 'post', - data: { - encryptedData: encryptedData, // 加密数据 - iv: iv, // 加密算法 - sessionId: app.globalData.userInfo.session_key - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var status = res.data.status; - if (status == 1) { - that.setData({ - islogin: true, - mobile: res.data.info - }) - } else { - app.getUserInfo(that, res_d); - } - }, - error: function (e) { - wx.showToast({ - title: '网络异常!', - duration: 2000 - }); + WXAPI.userSecretKey({ + encryptedData: encryptedData, // 加密数据 + iv: iv, // 加密算法 + sessionId: app.globalData.userInfo.session_key + }).then(res => { + if (res.code == 200) { + var data = res; + that.setData({ + islogin: true, + mobile: data.info + }) + } else { + app.getUserInfo(that, res_d); } - }) + }); } }) } @@ -265,50 +234,34 @@ Page({ }) wx.hideToast() } else { - - wx.request({ - url: app.d.ceshiUrl + '&action=user&m=perfect', - method: 'post', - data: { - user_id: app.globalData.userInfo.user_id, - name: res.detail.value.name, - mobile: that.data.mobile, - province: province, - city: city, - county: county, - wx_id: res.detail.value.wx_id, - sex: sex, - date: that.data.date, - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var status = res.data.status; - if (status == 1) { - wx.showToast({ - title: res.data.succ, - icon: 'success', - duration: 3000 - }) - - } else { - wx.showToast({ - title: res.data.err ? res.data.err : '非法操作!', - icon: 'none', - duration: 1500 - }); - } - wx.navigateBack({ - delta: 1 - }); - }, - error: function (e) { + WXAPI.userPerfect({ + user_id: app.globalData.userInfo.user_id, + name: res.detail.value.name, + mobile: that.data.mobile, + province: province, + city: city, + county: county, + wx_id: res.detail.value.wx_id, + sex: sex, + date: that.data.date, + }).then(res => { + if (res.code == 200) { + var data = res; wx.showToast({ - title: '网络异常!', - duration: 2000 + title: res.message, + icon: 'success', + duration: 3000 + }) + } else { + wx.showToast({ + title: res.message ? res.message : '非法操作!', + icon: 'none', + duration: 1500 }); } + wx.navigateBack({ + delta: 1 + }); }); } }, diff --git a/pages/cart/cart.js b/pages/cart/cart.js index 40aeb2c..abb950a 100644 --- a/pages/cart/cart.js +++ b/pages/cart/cart.js @@ -46,8 +46,8 @@ Page({ num: num, cart_id: cart_id }).then(res => { - if (res.status == 1) { - util.getUesrBgplus(that, app, false) + if (res.code == 200) { + // util.getUesrBgplus(that, app, false) // 只有大于一件的时候,才能normal状态,否则disable状态 var minusStatus = num <= 1 ? 'disabled' : 'normal'; // 购物车数据 @@ -82,13 +82,13 @@ Page({ WXAPI.productDelAllCart({ user_id: that.data.user_id, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { wx.showToast({ title: '操作成功!', duration: 2500 }); that.loadProductData(); - util.getUesrBgplus(that, app, false) + // util.getUesrBgplus(that, app, false) } else { wx.showToast({ title: '操作失败!', @@ -169,8 +169,8 @@ Page({ user_id: that.data.user_id, carts: toastStr, }).then(res => { - util.getUesrBgplus(that, app, false) - if (res.status == 1) { + // util.getUesrBgplus(that, app, false) + if (res.code == 200) { wx.showToast({ title: '操作成功!', duration: 2000 @@ -200,8 +200,8 @@ Page({ num: num, cart_id: cart_id }).then(res => { - if (res.status == 1) { - util.getUesrBgplus(that, app, false) + if (res.code == 200) { + // util.getUesrBgplus(that, app, false) // 只有大于一件的时候,才能normal状态,否则disable状态 var minusStatus = num <= 1 ? 'disabled' : 'normal'; // 购物车数据 @@ -325,10 +325,10 @@ Page({ bgcolor: app.d.bgcolor, user_id: app.globalData.userInfo.openid }); - wx.setNavigationBarColor({ - frontColor: app.d.frontColor,// - backgroundColor: app.d.bgcolor //页面标题为路由参数 - }); + // wx.setNavigationBarColor({ + // frontColor: app.d.frontColor,// + // backgroundColor: app.d.bgcolor //页面标题为路由参数 + // }); this.loadProductData(); this.sum(); }, @@ -355,8 +355,8 @@ Page({ res.confirm && WXAPI.productDelcart({ carts: carts, }).then(res => { - util.getUesrBgplus(that, app, false) - if (res.status == 1) { + // util.getUesrBgplus(that, app, false) + if (res.code == 200) { that.loadProductData(); } else { @@ -380,18 +380,24 @@ Page({ // 数据加载 loadProductData: function () { var that = this; - - WXAPI.productShopping({ - user_id: app.globalData.userInfo.openid + WXAPI.cartIndex({ + accessId: app.globalData.accessId, + storeId: 239, + page: 1 }).then(res => { - if (res.status == 1) { - var data = res; + if (res.code == 200) { + var data = res.data; that.setData({ - carts: data.cart, + carts: data.list, selectedAllStatus: false, total: '¥0.00', remind: '' }); + } else { + wx.showToast({ + title: res.message, + duration: 2000 + }); } }); }, @@ -412,7 +418,7 @@ Page({ num: num, cart_id: carid }).then(res => { - if (res.status == 1) { + if (res.code == 200) { // 只有大于一件的时候,才能normal状态,否则disable状态 var minusStatus = num <= 1 ? 'disabled' : 'normal'; // 购物车数据 diff --git a/pages/cart/cart.json b/pages/cart/cart.json index 7e8086e..81e14a0 100644 --- a/pages/cart/cart.json +++ b/pages/cart/cart.json @@ -1,3 +1,4 @@ { + "usingComponents": {}, "navigationBarTitleText": "购物车" } \ No newline at end of file diff --git a/pages/search/search.js b/pages/category/category.js similarity index 86% rename from pages/search/search.js rename to pages/category/category.js index b4d2ab7..50f66f3 100644 --- a/pages/search/search.js +++ b/pages/category/category.js @@ -1,3 +1,4 @@ +// pages/category/category.js var app = getApp(); var WxSearch = require('../../wxSearch/wxSearch.js') var WXAPI = require('../../utils/server.js'); @@ -21,19 +22,25 @@ Page({ search: function (e) { var that = this; WXAPI.searchIndex({ - keyword:'百货' + accessId: app.globalData.accessId, + storeId: 239, }).then(res => { - if (res.status == 1) { - var data = res; + if (res.code == 200) { + var data = res.data; that.setData({ - cateItems: data.List, + cateItems: data, hotwords: data.hot, - curNav: data.List[0].cate_id + curNav: data[0].cate_id }); that.onReady(); that.setData({ remind: '' }); + } else { + wx.showToast({ + title: res.message, + duration: 2000 + }); } }); }, @@ -45,16 +52,15 @@ Page({ that.setData({ color:app.d.bgcolor, }) - wx.setNavigationBarColor({ - frontColor: app.d.frontColor, - backgroundColor: app.d.bgcolor, //页面标题为路由参数 - animation: { - duration: 400, - timingFunc: 'easeIn' - } - }), + // wx.setNavigationBarColor({ + // frontColor: app.d.frontColor, + // backgroundColor: app.d.bgcolor, //页面标题为路由参数 + // animation: { + // duration: 400, + // timingFunc: 'easeIn' + // } + // }), this.search(); - }, //事件处理函数 switchRightTab: function (e) { diff --git a/pages/category/category.json b/pages/category/category.json new file mode 100644 index 0000000..e629cbd --- /dev/null +++ b/pages/category/category.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "全部分类" +} \ No newline at end of file diff --git a/pages/search/search.wxml b/pages/category/category.wxml similarity index 98% rename from pages/search/search.wxml rename to pages/category/category.wxml index f433d53..1dfa667 100644 --- a/pages/search/search.wxml +++ b/pages/category/category.wxml @@ -1,3 +1,4 @@ + @@ -68,3 +69,4 @@ + diff --git a/pages/search/search.wxss b/pages/category/category.wxss similarity index 99% rename from pages/search/search.wxss rename to pages/category/category.wxss index 4f4915f..6838dfb 100644 --- a/pages/search/search.wxss +++ b/pages/category/category.wxss @@ -1,3 +1,4 @@ +/* pages/category/category.wxss */ @import "/wxSearch/wxSearch.wxss"; page{ background: #fff; diff --git a/pages/coupon/index.js b/pages/coupon/index.js index cc2b6f1..e06eb1c 100644 --- a/pages/coupon/index.js +++ b/pages/coupon/index.js @@ -130,9 +130,11 @@ Page({ }, // 点击领取 receive: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } if (e.currentTarget.dataset.point == '领取') { diff --git a/pages/coupon/index.json b/pages/coupon/index.json index 8f11dd7..d79eb04 100644 --- a/pages/coupon/index.json +++ b/pages/coupon/index.json @@ -1,6 +1,5 @@ { - "navigationBarTitleText": "优惠券", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "优惠券" + } \ No newline at end of file diff --git a/pages/distribution/detail.js b/pages/distribution/detail.js index 4c5fac1..83170c8 100644 --- a/pages/distribution/detail.js +++ b/pages/distribution/detail.js @@ -196,7 +196,7 @@ Page({ skuBeanList: res.data.skuBeanList, zhekou: res.data.zhekou != '' ? res.data.zhekou : false, }); - util.getUesrBgplus(that, app, true) + // util.getUesrBgplus(that, app, true) that.setData({ remind: false }); @@ -212,8 +212,8 @@ Page({ url: '../../pages/draw/draw' }); } else { - util.getUesrBgplus(that, app, true) - util.getUesrBgplus(that, app, false) + // util.getUesrBgplus(that, app, true) + // util.getUesrBgplus(that, app, false) wx.switchTab({ url: '../index/index' }) @@ -355,11 +355,13 @@ Page({ }, //跳转cart go_cart: function () { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } - util.getUesrBgplus(this, app, false) + // util.getUesrBgplus(this, app, false) wx.switchTab({ url: '../cart/cart' }) @@ -571,7 +573,7 @@ Page({ icon: 'success', duration: 2000 }); - util.getUesrBgplus(that, app, true) + // util.getUesrBgplus(that, app, true) that.setData({ showModalStatus: false }); @@ -664,9 +666,11 @@ Page({ }, // 添加到收藏 addFavorites: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var that = this; wx.request({ @@ -773,9 +777,11 @@ Page({ }, add_fromid: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var that = this; @@ -835,9 +841,11 @@ Page({ }, // 弹窗 set_share: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var taht = this; var show_share = taht.data.show_share; diff --git a/pages/distribution/detail.json b/pages/distribution/detail.json index 25aca8e..ae4a221 100644 --- a/pages/distribution/detail.json +++ b/pages/distribution/detail.json @@ -1,6 +1,4 @@ { - "navigationBarTitleText": "商品详情", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "商品详情" } \ No newline at end of file diff --git a/pages/group_buy/cantuan.js b/pages/group_buy/cantuan.js index 68b346b..201bc20 100644 --- a/pages/group_buy/cantuan.js +++ b/pages/group_buy/cantuan.js @@ -398,9 +398,11 @@ Page({ }) }, getUserformid: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var formid = e.detail.formId; this.sendFormid(formid) @@ -457,8 +459,8 @@ Page({ let that = this if (e.detail.errMsg == 'getUserInfo:ok') { //获取成功设置状态 - app.globalData.userlogin = true; - wx.setStorageSync('userlogin', true); + app.globalData.isLogin = true; + wx.setStorageSync('isLogin', true); //设置用户信息本地存储 try { wx.setStorageSync('userInfo', e.detail.userInfo); @@ -474,7 +476,7 @@ Page({ duration: 1500, }) that.setData({ - userlogin: false + isLogin: false }) that.getOP(e.detail.userInfo) } else { @@ -485,7 +487,7 @@ Page({ }) //没有授权需要弹框 that.setData({ - userlogin: true + isLogin: true }); } }, @@ -515,19 +517,19 @@ Page({ //没有授权需要弹框 if (!res.authSetting['scope.userInfo']) { that.setData({ - userlogin: true + isLogin: true }); } else { //判断用户已经授权。不需要弹框 - if (app.globalData.userlogin) { + if (app.globalData.isLogin) { that.setData({ - userlogin: false + isLogin: false }) - app.globalData.userlogin = true; - wx.setStorageSync('userlogin', true); + app.globalData.isLogin = true; + wx.setStorageSync('isLogin', true); } else { that.setData({ - userlogin: true + isLogin: true }); } } diff --git a/pages/group_buy/cantuan.json b/pages/group_buy/cantuan.json index 0a2d570..da00d7b 100644 --- a/pages/group_buy/cantuan.json +++ b/pages/group_buy/cantuan.json @@ -1,6 +1,4 @@ { - "navigationBarTitleText": "我的团", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "我的团" } \ No newline at end of file diff --git a/pages/group_buy/cantuan.wxml b/pages/group_buy/cantuan.wxml index 5af7878..3388947 100644 --- a/pages/group_buy/cantuan.wxml +++ b/pages/group_buy/cantuan.wxml @@ -172,8 +172,8 @@ - - + + 获取微信授权信息 diff --git a/pages/group_buy/detail.js b/pages/group_buy/detail.js index 6cbdc1b..c860e1d 100644 --- a/pages/group_buy/detail.js +++ b/pages/group_buy/detail.js @@ -175,9 +175,11 @@ Page({ }, //分享朋友圈 查看保存图片 user_share: function () { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var that = this; wx.showToast({ @@ -333,9 +335,11 @@ Page({ }, 1000) }, joinGroup: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var id = e.currentTarget.dataset.id; app.redirect('group_buy/cantuan', 'id=' + id + '&groupid=' + this.data.groupid + '&man_num=' + this.data.itemData.man_num + '&pro_id=' + this.gid + '&sum=' + this.data.sum); @@ -347,9 +351,11 @@ Page({ }, goToBuy: function () { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var that = this; var obj = ''; @@ -410,9 +416,11 @@ Page({ }) }, getUserformid: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var formid = e.detail.formId; @@ -447,9 +455,11 @@ Page({ }, addShopCart: function () { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } //添加到购物车 var that = this; @@ -499,10 +509,11 @@ Page({ // 弹窗 setModalStatus: function (e) { - - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var animation = wx.createAnimation({ @@ -738,9 +749,11 @@ Page({ // 弹窗 set_share: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var taht = this; diff --git a/pages/group_buy/detail.json b/pages/group_buy/detail.json index 25aca8e..ae4a221 100644 --- a/pages/group_buy/detail.json +++ b/pages/group_buy/detail.json @@ -1,6 +1,4 @@ { - "navigationBarTitleText": "商品详情", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "商品详情" } \ No newline at end of file diff --git a/pages/group_buy/group.json b/pages/group_buy/group.json index 7b8aed9..50c8af0 100644 --- a/pages/group_buy/group.json +++ b/pages/group_buy/group.json @@ -1,6 +1,4 @@ { - "navigationBarTitleText": "爱拼才会赢", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "爱拼才会赢" } \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 9430a13..e6257db 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -16,11 +16,10 @@ Page({ circular: true, // 是否采用衔接滑动 scrollLeft: 0, //tab标题的滚动条位置 current: 0, //当前选中的Tab项 - current1: 0, page: 1, index: 1, cont: 1, - tabid: 0, + tabid: 58, loading: false, remind: '加载中', showModal: false, @@ -38,11 +37,7 @@ Page({ var that = this; that.getMore(); }, - current1Change: function (e) { - this.setData({ - current1: e.detail.current, - }) - }, + imgW: function (e) { var $width = e.detail.width, //获取图片真实宽度 $height = e.detail.height, @@ -59,35 +54,34 @@ Page({ images: image }) }, - getMore: function (_e) { + getMore: function () { var that = this; var page = that.data.page; - var index = that.data.tabid; + var cid = that.data.tabid; var current = that.data.current; that.setData({ page: page + 1 }); WXAPI.indexGetMore({ page: page, - index: index, + cid: cid, }).then(res => { - if (res.status == 1) { - var data = res; + if (res.code == 200) { + var data = res.data; wx.hideNavigationBarLoading() //完成停止加载 wx.stopPullDownRefresh() //停止下拉刷新 that.setData({ loading: false, }); - - if (data.prolist == '' || data.status == 0) { + if (data == '') { return false; } else { - var twoList = that.data.twoList; - twoList[current].twodata.push(...prolist) - var indexTwoData = twoList[0].twodata + var titleList = that.data.titleList; + titleList[current].list.push(...prolist) + var indexList = titleList[0].list that.setData({ - twoList: twoList, - indexTwoData: indexTwoData + titleList: titleList, + indexList: indexList }); } } @@ -155,65 +149,83 @@ Page({ loadProductDetail: function () { var that = this; - var userinfo = wx.getStorageSync('userInfo'); - if (userinfo.nickName) { - app.globalData.userInfo = userinfo; - } - var openid = app.globalData.userInfo.openid ? app.globalData.userInfo.openid : false; - var user_id = ''; - if (openid) { - user_id = app.globalData.userInfo.user_id; - } + // var userinfo = wx.getStorageSync('userInfo'); + // if (userinfo.nickName) { + // app.globalData.userInfo = userinfo; + // } + // var openid = app.globalData.userInfo.openid ? app.globalData.userInfo.openid : false; + // var user_id = ''; + // if (openid) { + // user_id = app.globalData.userInfo.user_id; + // } WXAPI.homeIndex({ - user_id: user_id + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + latitude: 28.227965, + longitude: 112.951227, }).then(res => { - // if (res.status == 1) { - var data = res; - var banner = data.banner; // 轮播图 - var twoList = data.twoList; //产品显示 - var bgcolor = data.bgcolor; //产品显示 - var plug = data.plug; - var title = data.title; - app.d.bgcolor = bgcolor; - var arr = Object.keys(twoList[0].distributor); - var banner_num = Object.keys(banner); // 轮播图 - var notice = data.notice; - var indexTwoData = twoList[0].twodata // 获取首页的数据对象 - + if (res.code == 200) { + var data = res.data; + var titleList = data.list2; //标题导航栏 + var indexList = [] + if (titleList) { + indexList = titleList[0].list // 获取首页的数据对象 + } app.globalData.logoimg = data.logo - app.globalData.title = data.title that.setData({ - distributor: arr, - inforList: notice, - banner: banner, - banner_num: banner_num, - twoList: twoList, - indexTwoData: indexTwoData, - bgcolor: bgcolor, - plug: plug, - mch_name: title, + inforList: data.notice, //滚动公告条 + banner: data.banner, // 轮播图 + titleList: titleList, + indexList: indexList, + r_mch: data.r_mch, //优选店铺 + plug: data.nav_list, //首页类型模块 + mch_name: data.title, logo: data.logo, - djname: data.djname, - zjList: data.list - }); - - wx.setNavigationBarColor({ - frontColor: app.d.frontColor, - backgroundColor: app.d.bgcolor //页面标题为路由参数 - }); - wx.setNavigationBarTitle({ - title: title, - success: function () { }, + zjList: data.Marketing_list, + memberPlugin: data.memberPlugin //是否显示会员权益条 }); + // wx.setNavigationBarColor({ + // frontColor: app.d.frontColor, + // backgroundColor: app.d.bgcolor //页面标题为路由参数 + // }); that.setData({ remind: '' }); - console.log(data.list.length) - if (data.list.length) { + // console.log(data.Marketing_list.length) + if (data.Marketing_list.length) { that.listnsg(); } - // } - // else { - // that.showToast(data.err); - // } + } else { + wx.showToast({ + title: res.message, + duration: 2000 + }); + } + }); + //新品上市 + WXAPI.newArrivalIndex({ + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + }).then(res => { + if (res.code == 200) { + var data = res.data + that.setData({ + newImgList: data.list + }) + } + }); + //好物优选 + WXAPI.recommendIndex({ + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + }).then(res => { + if (res.code == 200) { + var data = res.data + that.setData({ + recommendImgList: data.list + }) + } }); }, onHide: function () { @@ -284,16 +296,16 @@ Page({ that.nextpic(data); cont_time = timestamp; } - that.checkCor(e); + // that.checkCor(); }, nextpic: function (data) { this.setData({ current: data.pos, - tabid: data.tabid + tabid: data.tabid, }); }, //设置点击tab大于第七个是自动跳到后面 - checkCor: function (_e) { + checkCor: function (e) { if (this.data.current > 4) { this.setData({ scrollLeft: 800 @@ -310,13 +322,13 @@ Page({ contentChange: function (e) { var that = this; var id = e.detail.current; - var tabid = that.data.twoList[id].id; + var tabid = that.data.titleList[id].cid; this.setData({ current: id, tabid: tabid, page: 1, }) - this.checkCor(); + // this.checkCor(); }, onShow: function () { console.log(app) @@ -326,12 +338,12 @@ Page({ that.onLoad(); app.d.indexchase = false; } - util.getUesrBgplus(that, app, false) + // util.getUesrBgplus(that, app, false) }, onReady: function () { this.pop = this.selectComponent("#pop") }, - onLoad: function (_e) { + onLoad: function (e) { var that = this; that.loadProductDetail(); }, @@ -356,8 +368,8 @@ Page({ let that = this if (e.detail.errMsg == 'getUserInfo:ok') { //获取成功设置状态 - app.globalData.userlogin = true; - wx.setStorageSync('userlogin', true); + app.globalData.isLogin = true; + wx.setStorageSync('isLogin', true); //设置用户信息本地存储 try { wx.setStorageSync('userInfo', e.detail.userInfo); @@ -373,7 +385,7 @@ Page({ duration: 1500, }) that.setData({ - userlogin: false + isLogin: false }) that.getOP(e.detail.userInfo) } @@ -401,19 +413,19 @@ Page({ // 没有授权需要弹框 if (!res.authSetting['scope.userInfo']) { that.setData({ - userlogin: true + isLogin: true }); } else { //判断用户已经授权。不需要弹框 - if (app.globalData.userlogin) { + if (app.globalData.isLogin) { that.setData({ - userlogin: false + isLogin: false }) - app.globalData.userlogin = true; - wx.setStorageSync('userlogin', true); + app.globalData.isLogin = true; + wx.setStorageSync('isLogin', true); } else { that.setData({ - userlogin: true + isLogin: true }); } } @@ -446,7 +458,7 @@ Page({ avatarUrl: avatarUrl, gender: gender }).then(res => { - if (res.status == 1) { + if (res.code == 200) { wx.showToast({ title: '授权成功!', success: 2000 @@ -458,10 +470,12 @@ Page({ getqx(event) { let name = event.currentTarget.dataset.name - if (name === "签到" || name === "钱包") { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + if (name === "会员中心" || name === "钱包") { + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } } diff --git a/pages/index/index.json b/pages/index/index.json index e6a04cd..7cc2cc3 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,6 +1,4 @@ { - "usingComponents": { - "pop": "../login/login" - }, + "usingComponents": {}, "navigationBarTitleText": "互利商城" } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 151b789..c368651 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,3 +1,4 @@ + @@ -26,7 +27,7 @@ -
+ + + + + + + + + + + - + + @@ -72,25 +94,12 @@ - - - - - - - - {{list.name}} - - - - - - - - + + + - + {{icons.name}} @@ -100,7 +109,7 @@ - + - - - - + + + + + + + 新品上市 + 上新好物优选购 + + + + + - - - - - {{twos.product_title}} + + + + + 好物优选 + 品质好物优先选 + + + + + + + + + + + + + 优选店铺 + + + 更多 + + + + + + + + {{item.name}} + {{item.distance}}km + + + + + + + + + + + + + - - 销量:{{twos.volume}} + ¥ {{item.price}}原价:¥{{item.price_yh}} + 销量:{{item.volume}} - - - - - - {{twodata.name}} + --> + + + + + + + {{item.pname}} + {{item.english_name}} + + + + + + + {{list.product_title}} - 新品 - 热销 - 推荐 + 新品 + 热销 + 推荐 - - - ¥ {{twodata.price_yh}} - 销量:{{twodata.volume}} + ¥ {{list.price}} + 销量:{{list.volume}} + @@ -187,15 +259,17 @@ - + - + - 没有更多数据了 + 没有更多数据了 - - + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 2aa8b36..4fc539f 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -38,9 +38,6 @@ .clearfix{ clear: both; } -.swiper-box{ - width: 100%; -} .vipBlock{ background-color: #fff; height: 60rpx; @@ -113,16 +110,17 @@ } page { flex-direction: column; - font-family: '微软雅黑'; height: 100%; width: 100%; display:flex; - background:#eee; + background-color:#f4f5f6; + overflow-y: auto; } .page{ height:100%; width:100%; } + .tab-h{ height: 100rpx; width: 100%; @@ -133,32 +131,23 @@ page { background: #F7F7F7; font-size: 16px; white-space: nowrap; - /* position: fixed; - top: 0; - left: 0; - z-index: 99; */ } .tab-text{ padding:0 5px; text-align: center; } -.out scroll-view{ +scroll-view{ + width: 100%; height: 100%; - overflow-y: scroll; + /* overflow-y: scroll; */ } -.tablist { +/* .tablist { display: flex; background: #f5f5f5; height: 100rpx; transform:translate3d(0,0,0); } -swiper { - display:block; - width: 95%; - margin: 0 auto; - height:180px; -} .tablist .item { flex: auto; @@ -168,34 +157,44 @@ swiper { align-items: center; font-size: 11pt; color: #353535; -} +} */ -.tablist .item.select { - color: #FF6347; +/* .tablist .item.select { + color: #FF6347; } .select .tab-text{ - border-bottom: 2px solid #FF6347; -} + border-bottom: 2px solid #FF6347; +} */ .content{ - height: 0px; - display: flex; - justify-content: center; - align-items: center; + height: 0px; + display: flex; + justify-content: center; + align-items: center; } .out{ - flex: auto; - width: 100%; - height: 100%; + flex: auto; + width: 100%; + height: 100%; } +swiper { + display:block; + width: 100%; + margin: 0 auto; + height:150px; +} +.swiper-box{ + margin-left: 25rpx; + width: 700rpx; + border-radius: 18rpx; + overflow: hidden; +} .swiper-slide { - overflow: auto; - -webkit-overflow-scrolling: touch; + overflow: auto; + -webkit-overflow-scrolling: touch; } - - .slide-image { width: 100%; height: 100%; @@ -250,9 +249,9 @@ swiper { padding-top: 15rpx; } .cont { - width: 95%; + width: 100%; margin: 0 auto; - padding-top: 10rpx; + /* padding-top: 10rpx; */ } .cont_0 { width: 100%; @@ -331,10 +330,10 @@ swiper { padding: 1% 5% 0 5%; font-weight: 700; overflow:hidden; -text-overflow:ellipsis; -display:-webkit-box; --webkit-line-clamp:1; --webkit-box-orient:vertical; + text-overflow:ellipsis; + display:-webkit-box; + -webkit-line-clamp:1; + -webkit-box-orient:vertical; } .gmxx { padding-left:20rpx; @@ -374,11 +373,13 @@ display:-webkit-box; color: #666; } -.icons { - /* height: 370rpx; */ - padding: 20rpx 10rpx; - padding-bottom: 0; +.section { + width: 100%; + margin: 0 auto; + background:#fff; + margin-bottom:15rpx; margin-top: 10rpx; + } .icons swiper-item { @@ -391,15 +392,19 @@ display:-webkit-box; } .icons{ -float:left; -display:flex; -/* flex-direction:column; */ -align-items:center; -flex-wrap:wrap; -width:98%; -text-align:center; -margin:10rpx 0; -align-content:flex-start; + padding: 20rpx 10rpx; + padding-bottom: 0; + margin-top: 10rpx; + display:flex; + /* flex-direction:column; */ + align-items:center; + flex-wrap:wrap; + width:93%; + text-align:center; + margin:10rpx 0; + align-content:flex-start; + margin-left: 2.5%; + background-color: #f4f5f6; } .icons .icon image { @@ -413,18 +418,22 @@ align-content:flex-start; font-size: 12px; /* line-height: 2; */ } -.unit{ - height: 40%; - vertical-align: top; - margin-left: -15rpx; - display:flex; - align-items:center; - justify-content: center; - flex-wrap: wrap; - width: 20%; - text-align: center; - margin: 10rpx 0; +.icon { + height: 40%; + vertical-align: top; + display:flex; + align-items:center; + justify-content: center; + flex-wrap: wrap; + width: 20%; + text-align: center; + margin: 10rpx 0; +} +.img{ + height: 100%; + width: 100%; } + .units{ display:flex; align-items:center; @@ -435,16 +444,7 @@ align-content:flex-start; justify-content:space-around; box-shadow: 3px 3px 3px #ccc; } -.unit image { - margin:0 auto; - width:55px; - height:55px; -} -.unit view { - width: 100%; - height:100%; -} -.icon { +.unit{ height: 40%; vertical-align: top; margin-left: -15rpx; @@ -456,23 +456,23 @@ align-content:flex-start; text-align: center; margin: 10rpx 0; } -.img{ - height: 95%; - width: 95%; +.unit image { + margin:0 auto; + width:55px; + height:55px; +} +.unit view { + width: 100%; + height:100%; } + .class_p{ display: flex; align-items: center; justify-content: center; height: 100%; } -.section { - width: 95%; - margin: 0 auto; - background:#fff; - margin-bottom:15rpx; - margin-top: 10rpx; -} + @font-face {font-family: "iconfont"; src: url('iconfont.eot?t=1521691402490'); /* IE9*/ @@ -616,7 +616,13 @@ button{ .loading-more-bar{ text-align: center; margin-bottom: 20rpx; opacity: 0; } .loading-more-bar.active{ opacity: 1; } -.scroll-view-x{background-color: #fff;white-space: nowrap;width: 95%;margin: 0 auto;} +/* .scroll-view-x{ + background-color: #fff; + white-space: nowrap; + width: 95%; + margin: 0 auto; +} */ + .navigator_second{ /* width:150rpx; */ text-align:center; @@ -644,14 +650,14 @@ button{ box-shadow: 3px 3px 3px #ccc; } -.title-bar { position: relative; border-bottom: 1rpx solid #eee; height: 100rpx;margin-bottom:10px; } +/* .title-bar { position: relative; border-bottom: 1rpx solid #eee; height: 100rpx;margin-bottom:10px; } .title-bar wx-image { width: 38rpx; height: 38rpx; } .title-bar .title { margin: 0 40rpx; } .title-bar .title-line { display: inline-block; height: 2rpx; width: 30rpx; background: #bbb; } .title-bar .title wx-image { margin-right: 24rpx; } .title-bar wx-navigator { position: absolute; right: 0; top: 0; bottom: 0; padding: 0 20rpx; } -.title-bar wx-navigator wx-image { width: 12rpx; height: 22rpx; margin-left: 16rpx; } -.flex-y-center { +.title-bar wx-navigator wx-image { width: 12rpx; height: 22rpx; margin-left: 16rpx; } */ +/* .flex-y-center { display:-webkit-box; display:-webkit-flex; display:flex; @@ -660,9 +666,9 @@ button{ -ms-flex-align:center; -ms-grid-row-align:center; align-items:center; -} +} */ -.flex-x-center { +/* .flex-x-center { display:-webkit-box; display:-webkit-flex; display:flex; @@ -670,7 +676,7 @@ button{ -webkit-justify-content:center; -ms-flex-pack:center; justify-content:center; -} +} */ .vipText2_img{ height: 100%; @@ -730,4 +736,188 @@ button{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -} \ No newline at end of file +} +/* 优选好物 */ +.content_top { + display: flex; + justify-content: space-between; + margin: 25rpx 25rpx; +} +.content_top-box{ + display: flex; + width: 340rpx; + height: 250rpx; + flex-direction: column; + background-color: #fff; + border-radius: 25rpx; + border-right: 2rpx solid #F4F5F6; +} +.content_top-box-top{ + display: flex; + height: 88rpx; + line-height: 88rpx; +} +.content_top-box-top-title{ +font-weight: 600; +color: #333333; +font-size: 30rpx; +margin-left: 24rpx; +} +.content_top-box-bottom-img{ + width: 136rpx; + height: 136rpx; + border-radius: 25rpx; + margin-left: 24rpx; + border: 2rpx solid #e9e9e9; +} +.content_top-box-top-txt{ + font-size: 24rpx; + color: #999999; + margin-left: 8rpx; +} +.content_top-box-bottom{ + display: flex; +} +/* 优选店铺 */ +.mch_content{ + display: flex; + justify-content: space-between; + padding: 0 30rpx; + margin: 30rpx 0; + width: 100%; + overflow: hidden; + overflow-x: scroll; + box-sizing: border-box; +} +.mch_content_item{ + display: flex; + flex-direction: column; + width:198rpx; + height:316rpx; + background:rgba(255,255,255,1); + border-radius:10rpx; + margin-right: 8rpx; +} +.mch_content_item image{ + width:198rpx; + height:216rpx; + border-radius:10rpx 10rpx 0rpx 0rpx; +} +.mch_content_item view{ + font-size: 26rpx; + line-height: 26rpx; + color: #000000; + margin: 20rpx 14rpx 18rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-family: serif; +} +.mch_content_item text{ + color: #999999; + font-size: 26rpx; + line-height: 26rpx; + margin: 0 14rpx; + font-family: serif; +} +.mch { + background-color: #ffffff; + width: 690rpx; + margin: 0 auto; + border-radius: 16rpx; +} +.mch .home_title { + padding-top: 20rpx; + margin-left: 25rpx; + display: flex; + justify-content: space-between; + align-items: center; + position: relative; +} +.home_title .mch_name { + font-family: serif; + font-size: 35rpx; + position: absolute; + color: #FA5555; +} +.home_title .home_title_bg { + width: 119rpx; + height: 19rpx; + margin-top: 27rpx; + margin-left: 23rpx; +} + +.home_title .more { + color: #999999; + font-size: 28rpx; + font-family: serif; +} +.more image { + width: 22rpx; + height: 22rpx; + margin-left: 8rpx; + margin-right: 20rpx; +} +/* 分类导航 */ +.scroll-view_x { + margin-top: 20rpx; + width: 100%; + height: 120rpx; +} +.seckill_content_view { + display: flex; + height: 120rpx; +} + +.goods_title_item{ + display: flex; + align-items: center; + justify-content: space-between; + flex-direction: column; + height: 60rpx; + padding: 0 30rpx; + position: relative; +} + +.goods_title_item:not(:last-child){ + border-right: 1px solid #A1CECE; +} + +.goods_title_item.active view{ + color: #333333; + font-weight: bold; + font-family: serif; +} + +.goods_title_item.active text{ + color:#FA5151; + font-family: serif; +} + +.goods_title_item.active:after{ + content: ''; + position: absolute; + bottom: -16rpx; + left: 50%; + transform: translateX(-50%); + width:30rpx; + height:6rpx; + background:rgba(250, 81, 81, 1.0); + border-radius:3rpx; +} + +.goods_title_item view{ + text-align: center; + font-size: 34rpx; + color: #020202; + line-height: 34rpx; + white-space: nowrap; + font-family: serif; +} +.goods_title_item text{ + color: #666666; + font-size: 22rpx; + line-height: 22rpx; + white-space: nowrap; + font-family: serif; +} diff --git a/pages/login/login.js b/pages/login/login.js index 2acdb91..253964f 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -3,15 +3,30 @@ var WXAPI = require('../../utils/server.js'); Page({ data: { + navTab: [{'type':'验证码登录','status':0},{'type':'密码登录','status':1}], + currentIndex: 1, click: false, //是否显示弹窗内容 option: false, //显示弹窗或关闭弹窗的操作动画 logoimg: '', loadtitle:'', - thvm:{} - }, - myCatchTouch: function () { - return; + thvm:{}, + account: '', + password: '', }, + //密码登录to验证码登录 + switchTab: function(e) { + // this.landing = false + // this.codeLoginBtnStatus = false + // this.phone_codeStatus1 = false + // this.account = '' + // this.password = '' + // this.tabbar_isShow = 1 + this.setData({ + currentIndex: e.currentTarget.dataset.idx, + tabbar_isShow: e.currentTarget.dataset.item.status, + }); +}, + // 用户点击显示弹窗 setCloses:function(){ wx.showToast({ @@ -46,7 +61,6 @@ Page({ }) }, 500) - } else { _that.setData({ option: true @@ -54,41 +68,7 @@ Page({ } }, - getUserInfo: function (t) { - wx.showLoading({ - title: "正在登录", - mask: !0 - }) - }, - material: function (res) { - wx.getUserInfo({ - success: function (res) { - var userInfo = res.userInfo; - var nickName = userInfo.nickName; - var avatarUrl = userInfo.avatarUrl; - var gender = userInfo.gender; //性别 0:未知、1:男、2:女 - wx.request({ - url: app.d.ceshiUrl + '&action=user&m=material', - method: 'post', - data: { - openid: app.globalData.userInfo.openid, - nickName: nickName, - avatarUrl: avatarUrl, - gender: gender - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - wx.showToast({ - title: res.data.info, - success: 2000 - }); - } - }) - } - }) - }, + //获取用户信息新接口 agreeGetUser: function (e) { let that = this; @@ -99,8 +79,8 @@ Page({ console.log(e.detail.userInfo) if (e.detail.errMsg == 'getUserInfo:ok') { //获取成功设置状态 - app.globalData.userlogin = true; - wx.setStorageSync('userlogin', true); + app.globalData.isLogin = true; + wx.setStorageSync('isLogin', true); //设置用户信息本地存储 try { wx.setStorageSync('userInfo', e.detail.userInfo); @@ -113,7 +93,7 @@ Page({ } that.setData({ - userlogin: false + isLogin: false }) that.getOP(e.detail.userInfo) @@ -125,58 +105,94 @@ Page({ }) //没有授权需要弹框 that.setData({ - userlogin: true + isLogin: true }); } }, - login: function () { - var that = this; - //取出本地存储用户信息,解决需要每次进入小程序弹框获取用户信息 - var userInfo = wx.getStorageSync('userInfo'); - wx.login({ - success: res => { - app.globalData.code = res.code - wx.setStorageSync('code', res.code) - }, - fail: function () { - wx.showToast({ - title: '系统提示:网络错误!', - icon: 'warn', - duration: 1500, - }) - } + accountInput: function(e) { + this.setData({ + valueId: "nickname", + account: e.detail.value }) - - wx.getSetting({ - success: (res) => { - //没有授权需要弹框 - if (!res.authSetting['scope.userInfo']) { - that.setData({ - userlogin: true - }); - } else { - //判断用户已经授权。不需要弹框 - if (app.globalData.userlogin) { - that.setData({ - userlogin: false - }) - app.globalData.userlogin = true; - wx.setStorageSync('userlogin', true); - } else { - that.setData({ - userlogin: true - }); - } - } - }, - fail: function () { + }, + passwordInput: function(e) { + this.setData({ + valueId: "nickname", + password: e.detail.value + }) + }, + login: function () { + var that = this; + WXAPI.login({ + storeId: 239, + phone: that.data.account, + password: that.data.password, + }).then(res => { + if (res.code == 200) { + var data = res.data + app.globalData.accessId = data.access_id; + wx.setStorageSync('accessId', data.access_id) + wx.setStorageSync('isLogin', true); + wx.setStorageSync('userInfo', data.data); + wx.navigateBack() + // wx.showToast({ + // title: '登录成功!', + // success: 2000 + // }); + } else { wx.showToast({ - title: '系统提示:网络错误!', - icon: 'warn', + title: res.message, + icon: 'none', duration: 1500, }) } - }) + }); + + + // wx.login({ + // success: res => { + // app.globalData.code = res.code + // wx.setStorageSync('code', res.code) + // }, + // fail: function () { + // wx.showToast({ + // title: '系统提示:网络错误!', + // icon: 'warn', + // duration: 1500, + // }) + // } + // }) + + // wx.getSetting({ + // success: (res) => { + // //没有授权需要弹框 + // if (!res.authSetting['scope.userInfo']) { + // that.setData({ + // isLogin: true + // }); + // } else { + // //判断用户已经授权。不需要弹框 + // if (app.globalData.isLogin) { + // that.setData({ + // isLogin: false + // }) + // app.globalData.isLogin = true; + // wx.setStorageSync('isLogin', true); + // } else { + // that.setData({ + // isLogin: true + // }); + // } + // } + // }, + // fail: function () { + // wx.showToast({ + // title: '系统提示:网络错误!', + // icon: 'warn', + // duration: 1500, + // }) + // } + // }) }, getOP: function (res) { //提交用户信息 获取用户id diff --git a/pages/login/login.json b/pages/login/login.json index 4575d1b..a38ebaa 100644 --- a/pages/login/login.json +++ b/pages/login/login.json @@ -1,4 +1,4 @@ { "usingComponents": {}, - "component": true + "navigationBarTitleText": "登录" } \ No newline at end of file diff --git a/pages/login/login.wxml b/pages/login/login.wxml index 1537d3a..5935fcd 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -1,28 +1,37 @@ - + + - - - - - - 欢迎来到{{ loadtitle }} + + {{item.type}} + - - - 为提供更优质的服务,需要获取以下信息: - - - - · 你的公开信息(昵称、头像等) + + + + - - + + + + + \ No newline at end of file diff --git a/pages/login/login.wxss b/pages/login/login.wxss index 69135d0..fe44df8 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -1,160 +1,122 @@ -.pupContentBG { - width: 100vw !important; - height: 100vh !important; - position: fixed !important; - top: 0 !important; +page{ + background-color: #F4F5F6; +} +.top-tab{ + /* position: fixed; */ + padding-left: 20rpx; + padding-right: 20rpx; + width: 100%; + height: 100rpx; + background-color: #fff; + white-space: nowrap; +} +.top-tab-itemActive{ + color: #333333; + width: 50%; + height: 100rpx; + line-height: 100rpx; + text-align: center; + font-size: 32rpx; + font-weight: bold; + display: inline-block; +} +.top-tab-item { + color: #999999; + width: 50%; + height: 100rpx; + line-height: 100rpx; + text-align: center; + font-size: 30rpx; + display: inline-block; +} +.top-tab-lineActive{ + width: 150rpx; + height: 6rpx; + margin-top: -10rpx; + margin-left: 30%; + background-color: #F95B43; + z-index: 655; +} +.top-tab-line{ + width: 100%; + height: 2rpx; + margin-top: -8rpx; + background-color: #fff; +} +.login{ + display: flex; +} +/* 图片+输入框+下划线的父容器view */ +.userCs{ + margin-top: 50rpx; + margin-left: 25rpx; + position: absolute; + display: flex; + width:700rpx ; + height: 110rpx ; + background-color: white; + border-radius: 20rpx; +} +/* 用户名图标 */ +.userCs .user{ + margin-top: 25rpx; + margin-left: 30rpx; + width: 55rpx; + height: 55rpx; +} +/* 用户名输入框 */ +.userCs input{ + width: 500rpx; + font-size: 30rpx ; + margin-top: 35rpx; + margin-left: 30rpx; + line-height: 55rpx; +} +/* 密码图标+输入框+小眼睛图标+下划线父容器view */ +.passwordCs{ + margin-top: 190rpx; + margin-left: 25rpx; + position: absolute; + display: flex; + width:700rpx ; + height: 110rpx ; + background-color: white; + border-radius: 20rpx; +} +/* 密码图标 */ +.passwordCs .pass{ + margin-top: 25rpx; + margin-left: 30rpx; + width: 55rpx; + height: 55rpx; +} +/* 眼睛 图标*/ +.passwordCs .eye{ + margin-top: 5rpx; + margin-left: 65rpx; + width: 55rpx; + height: 55rpx; +} +/* 密码输入框 */ +.passwordCs input{ + width: 500rpx; + font-size: 30rpx ; + margin-top: 35rpx; + margin-left: 30rpx; + line-height: 55rpx; +} + +.loginView{ + /* margin: 300rpx 90rpx 25rpx; */ + margin-top: 380rpx; + margin-left: 25rpx; + width: 700rpx; + height: 85rpx; + background-color:#F95B43; + border-radius: 20rpx; + font-size: 32rpx; + color: white; + display: flex; + align-items: center; + justify-content: center; } - -.pupContent { - width: 100% !important; - background: #FFFFFF !important; - position: fixed !important; - bottom: 0 !important; - z-index: 999 !important; - border-radius: 16rpx 16rpx 0rpx 0rpx !important; -} - -.pupContent >image { - width: 28rpx !important; - height: 28rpx !important; - float: right !important; - margin-right: 30rpx !important; - margin-top: 30rpx !important; -} - -.pupContent-body { - margin: 60rpx 40rpx !important; -} - -/* 设置显示的背景 */ -.pupContent-head { - display: flex !important; - align-items: center !important; - color: #020202 !important; - font-weight:bold !important; - font-size:34rpx !important; - padding-bottom: 60rpx !important; -} -.pupContent-head view{ - padding-left: 20rpx !important; -} -.pupContent-head image{ - width: 80rpx !important; - height: 80rpx !important; -} -.showBG { - display: block !important; -} - -.pupContent-title { - color: #020202 !important; - font-size: 30rpx !important; - font-weight:500 !important; - padding-bottom: 40rpx !important; -} - -.pupContent-title { - color: #020202 !important; - font-size:30rpx !important; -} - -.pupContent-btn { - height: 90rpx !important; - background-color: #1AAD19 !important; - color: #FFFFFF !important; - font-size:30rpx !important; - font-weight:500 !important; - display: flex !important; - justify-content: center !important; - align-items: center !important; - border-radius:10rpx !important; -} - -.pupContent-con { - color: #666666 !important; - font-size:26rpx !important; - padding-bottom: 68rpx !important; -} - -.hideBG { - display: none; -} - -/* 弹出或关闭动画来动态设置内容高度 */ - -@keyframes slideBGtUp { - from { - background: transparent; - } - - to { - background: rgba(0, 0, 0, 0.1); - } -} - -@keyframes slideBGDown { - from { - background: rgba(0, 0, 0, 0.1); - } - - to { - background: transparent; - } -} - -/* 显示或关闭内容时动画 */ - -.openBG { - animation: slideBGtUp 0.5s ease-in both; - /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ -} - -.closeBG { - animation: slideBGDown 0.5s ease-in both; - /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ -} - -/* 设置显示内容 */ - -.showContent { - display: block; -} - -.hideContent { - display: none; -} - -/* 弹出或关闭动画来动态设置内容高度 */ - -@keyframes slideContentUp { - from { - height: 0; - } - - to { - height: 520rpx; - } -} - -@keyframes slideContentDown { - from { - height: 520rpx; - } - - to { - height: 0; - } -} - -/* 显示或关闭内容时动画 */ - -.open { - animation: slideContentUp 0.5s ease-in both; - /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ -} - -.closes { - animation: slideContentDown 0.5s ease-in both; - /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ -} - diff --git a/pages/new/new.js b/pages/new/new.js index 87106c0..10e0cdf 100644 --- a/pages/new/new.js +++ b/pages/new/new.js @@ -35,7 +35,7 @@ Page({ select: select, sort: sort, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; that.setData({ shopList: data.pro, @@ -183,7 +183,7 @@ Page({ sort: sort, page: page }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; that.setData({ shopList: data.pro, @@ -212,7 +212,7 @@ Page({ select: select, sort: sort, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; if (data.pro == '' || data.status == 0) { that.setData({ diff --git a/pages/order/detail.js b/pages/order/detail.js index 67fe934..d91a6e7 100644 --- a/pages/order/detail.js +++ b/pages/order/detail.js @@ -110,8 +110,8 @@ Page({ //离开界面时清除定时器 clearInterval(this.data.timeout); - util.getUesrBgplus(this, app, false) - util.getUesrBgplus(this, app, true) + // util.getUesrBgplus(this, app, false) + // util.getUesrBgplus(this, app, true) }, // 选择支付方式 switchChange: function (e) { diff --git a/pages/order/pay.js b/pages/order/pay.js index d422456..7c993d4 100644 --- a/pages/order/pay.js +++ b/pages/order/pay.js @@ -105,8 +105,8 @@ Page({ }, onUnload() { //onUnload监听页面卸载 var that = this; - util.getUesrBgplus(that, app, true) //刷新显示购物车数量 - util.getUesrBgplus(that, app, false) //刷新显示购物车数量 + // util.getUesrBgplus(that, app, true) //刷新显示购物车数量 + // util.getUesrBgplus(that, app, false) //刷新显示购物车数量 var cartid = that.data.cartId var type = that.data.type if (type == 1) { //直接结算离开页面清除购物车数量 @@ -150,7 +150,7 @@ Page({ that.setData({ dz_stu: false, }); - util.getUesrBgplus(that, app, false) + // util.getUesrBgplus(that, app, false) wx.navigateTo({ url: '../order/pay?cartId=' + that.data.cartId, }) @@ -218,7 +218,7 @@ Page({ }); if (status == 0) { setTimeout(function () { - util.getUesrBgplus(that, app, false) + // util.getUesrBgplus(that, app, false) wx.navigateBack({ delta: 1 }) @@ -226,7 +226,7 @@ Page({ } else { setTimeout(function () { - util.getUesrBgplus(that, app, false) + // util.getUesrBgplus(that, app, false) wx.navigateBack({ delta: 1 }) diff --git a/pages/product/detail.js b/pages/product/detail.js index 6b0e6e4..1827016 100644 --- a/pages/product/detail.js +++ b/pages/product/detail.js @@ -155,104 +155,83 @@ Page({ console.log(app.globalData.userInfo, 'openid') // if (openid) { var bgcolor = app.d.bgcolor; - wx.setNavigationBarColor({ - frontColor: app.d.frontColor, - backgroundColor: bgcolor, // 页面标题为路由参数 - animation: { - duration: 400, - timingFunc: 'easeIn' - } - }); - console.log(that.data.userid) - wx.request({ - url: app.d.ceshiUrl + '&action=product&m=index', - method: 'post', - data: { - pro_id: that.data.productId, - openid: openid, - type1: that.data.type1,//判断是抽奖还是其他活动 - choujiangid: that.data.choujiangid, - role: that.options.role ? that.options.role : '', - size: that.data.size, - userid: that.data.userid - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var status = res.data.status; - var is_shou = res.data.type; - if (status == 1) { - var pro = res.data.pro; - var content = pro.content; - WxParse.wxParse('content', 'html', content, that, 5); - that.setData({ - bgcolor: bgcolor, - itemData: pro, - kucun: pro.num, - bannerItem: pro.img_arr, - share: res.data.share, - title: pro.name, - is_zhekou: pro.is_zhekou, - comments: res.data.comments, - is_shou: res.data.type, - collection_id: res.data.collection_id, - choujiangid: that.data.choujiangid, - role: that.data.role ? that.data.role : '', - qj_price: res.data.qj_price, - qj_yprice: res.data.qj_yprice, - attrList: res.data.attrList, - skuBeanList: res.data.skuBeanList, - zhekou: res.data.zhekou != '' ? res.data.zhekou : false, - }); - util.getUesrBgplus(that, app, true) - that.setData({ - remind: false - }); - //默认选中 - that.one(); - - } else if (status == 3) { - wx.showToast({ - title: res.data.err, - duration: 2000, - }); - wx.redirectTo({ - url: '../../pages/draw/draw' - }); - } else { - util.getUesrBgplus(that, app, true) - util.getUesrBgplus(that, app, false) - wx.switchTab({ - url: '../index/index' - }) - wx.showToast({ - title: res.data.err, - duration: 2000, - }); - } - //判断是否收藏 - if (is_shou) { - that.setData({ - wsc: 'bxs', - sc: 'xs', - }) - } else { - that.setData({ - wsc: 'xs', - sc: 'bxs', - }) - } - }, - error: function (e) { + // wx.setNavigationBarColor({ + // frontColor: app.d.frontColor, + // backgroundColor: bgcolor, // 页面标题为路由参数 + // animation: { + // duration: 400, + // timingFunc: 'easeIn' + // } + // }); + + WXAPI.productIndex({ + accessId: app.globalData.accessId, + storeId: 239, + pro_id: that.data.productId, + vipSource: 0 + }).then(res => { + if (res.code == 200) { + var data = res.data; + var pro = data.pro; + var content = pro.content; + WxParse.wxParse('content', 'html', content, that, 5); + that.setData({ + bgcolor: bgcolor, + itemData: pro, + kucun: pro.num, + bannerItem: pro.img_arr, + share: data.share, + title: pro.name, + is_zhekou: pro.is_zhekou, + comments: data.comments, + is_shou: data.type, + collection_id: data.collection_id, + choujiangid: that.data.choujiangid, + role: that.data.role ? that.data.role : '', + qj_price: pro.price, + qj_yprice: pro.vip_yprice, + attrList: data.attrList, + skuBeanList: data.skuBeanList, + zhekou: data.zhekou != '' ? data.zhekou : false, + }); + // util.getUesrBgplus(that, app, true) + that.setData({ + remind: false + }); + //默认选中 + that.one(); + } else if (res.code == 3) { wx.showToast({ - title: '网络异常!', + title: res.message, duration: 2000, }); - }, + wx.redirectTo({ + url: '../../pages/draw/draw' + }); + } else { + // util.getUesrBgplus(that, app, true) + // util.getUesrBgplus(that, app, false) + wx.switchTab({ + url: '../index/index' + }) + wx.showToast({ + title: res.message, + duration: 2000, + }); + } + //判断是否收藏 + if (data.type) { + that.setData({ + wsc: 'bxs', + sc: 'xs', + }) + } else { + that.setData({ + wsc: 'xs', + sc: 'bxs', + }) + } }); - - }, // 弹窗 setModalStatus: function (e) { @@ -366,11 +345,13 @@ Page({ }, //跳转cart go_cart: function () { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } - util.getUesrBgplus(this, app, false) + // util.getUesrBgplus(this, app, false) wx.switchTab({ url: '../cart/cart' }) @@ -568,52 +549,38 @@ Page({ var pro_type = e.target.dataset.type; var ptype = e.currentTarget.dataset.type; // console.log(ptype, '--jnkmjkl') - wx.request({ - url: app.d.ceshiUrl + '&action=product&m=add_cart', - method: 'post', - data: { - uid: app.globalData.userInfo.openid, - pid: that.data.productId, - num: that.data.buynum, - sizeid: sizeid, - pro_type: pro_type, - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { + WXAPI.productAddCart({ + uid: app.globalData.userInfo.openid, + pid: that.data.productId, + num: that.data.buynum, + sizeid: sizeid, + pro_type: pro_type, + }).then(res => { + if (res.code == 200) { //设置购物车刷新 app.d.purchase = 1; var data = res.data; - if (data.status == 1) { - var ptype = e.currentTarget.dataset.type; - if (ptype == 'buynow') { - wx.redirectTo({ - url: '../order/pay?cartId=' + data.cart_id + '&pid=' + that.data.productId + '&num=' + that.data.buynum + '&type=1', - }); - return; - } else { - wx.showToast({ - title: '加入购物车成功', - icon: 'success', - duration: 2000 - }); - util.getUesrBgplus(that, app, true) - that.setData({ - showModalStatus: false - }); - } + var ptype = e.currentTarget.dataset.type; + if (ptype == 'buynow') { + wx.redirectTo({ + url: '../order/pay?cartId=' + data.cart_id + '&pid=' + that.data.productId + '&num=' + that.data.buynum + '&type=1', + }); + return; } else { wx.showToast({ - icon: 'loading', - title: res.err, + title: '加入购物车成功', + icon: 'success', duration: 2000 }); + // util.getUesrBgplus(that, app, true) + that.setData({ + showModalStatus: false + }); } - }, - fail: function () { + } else { wx.showToast({ - title: '网络异常!', + icon: 'loading', + title: res.message, duration: 2000 }); } @@ -693,99 +660,70 @@ Page({ }, // 添加到收藏 addFavorites: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var that = this; - wx.request({ - url: app.d.ceshiUrl + '&action=addFavorites&m=index', - method: 'post', - data: { - openid: app.globalData.userInfo.openid, - pid: that.data.productId, - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - + WXAPI.addFavoritesIndex({ + openid: app.globalData.userInfo.openid, + pid: that.data.productId, + }).then(res => { + if (res.code == 200) { var data = res.data; - if (data.status == 1) { - wx.showToast({ - title: data.succ, - duration: 2000 - }); - that.setData({ - wsc: 'bxs', - sc: 'xs', - collection_id: data.id - }) - //变成已收藏,但是目前小程序可能不能改变图片,只能改样式 - that.data.itemData.isCollect = false; - } else { - wx.showToast({ - title: res.err, - duration: 2000 - }); - that.setData({ - wsc: 'bxs', - sc: 'xs', - }) - } - }, - fail: function () { - // fail wx.showToast({ - title: '网络异常!', + title: res.message, duration: 2000 }); + that.setData({ + wsc: 'bxs', + sc: 'xs', + collection_id: data.id + }) + //变成已收藏,但是目前小程序可能不能改变图片,只能改样式 + that.data.itemData.isCollect = false; + } else { + wx.showToast({ + title: res.message, + duration: 2000 + }); + that.setData({ + wsc: 'bxs', + sc: 'xs', + }) } }); }, // 取消收藏 delFavorites: function (e) { var that = this; - wx.request({ - url: app.d.ceshiUrl + '&action=addFavorites&m=removeFavorites', - method: 'post', - data: { - id: that.data.collection_id, - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var data = res.data; - if (data.status == 1) { - wx.showToast({ - title: data.succ, - duration: 2000 - }); - //变成未收藏,但是目前小程序可能不能改变图片,只能改样式 - that.setData({ - wsc: 'xs', - sc: 'bxs', - }) - } else { - wx.showToast({ - title: res.err, - duration: 2000 - }); - that.setData({ - wsc: 'xs', - sc: 'bxs', - }) - } - }, - fail: function () { - // fail + WXAPI.removeFavorites({ + id: that.data.collection_id, + }).then(res => { + if (res.code == 200) { + var data = res; wx.showToast({ - title: '网络异常!', + title: res.message, duration: 2000 }); + //变成未收藏,但是目前小程序可能不能改变图片,只能改样式 + that.setData({ + wsc: 'xs', + sc: 'bxs', + }) + } else { + wx.showToast({ + title: res.message, + duration: 2000 + }); + that.setData({ + wsc: 'xs', + sc: 'bxs', + }) } - }); + }); }, //图片预览 previewImage: function (e) { @@ -802,9 +740,11 @@ Page({ }, add_fromid: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var that = this; @@ -864,9 +804,11 @@ Page({ }, // 弹窗 set_share: function (e) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) } var taht = this; var show_share = taht.data.show_share; diff --git a/pages/product/detail.json b/pages/product/detail.json index 25aca8e..ae4a221 100644 --- a/pages/product/detail.json +++ b/pages/product/detail.json @@ -1,6 +1,4 @@ { - "navigationBarTitleText": "商品详情", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "商品详情" } \ No newline at end of file diff --git a/pages/product/detail.wxml b/pages/product/detail.wxml index e80ab46..653e6c8 100644 --- a/pages/product/detail.wxml +++ b/pages/product/detail.wxml @@ -332,10 +332,10 @@ + + - - - + diff --git a/pages/search/search.json b/pages/search/search.json deleted file mode 100644 index af352a9..0000000 --- a/pages/search/search.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "navigationBarTitleText": "搜索" -} \ No newline at end of file diff --git a/pages/user/user.js b/pages/user/user.js index 794b7a9..c57da29 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -37,7 +37,8 @@ Page({ ], cont: 1, remind: '加载中', - tjr: false, + tjr: false, + user:'', }, //下拉刷新 onPullDownRefresh: function () { @@ -61,14 +62,14 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - wx.setNavigationBarColor({ - frontColor: app.d.frontColor, - backgroundColor: app.d.bgcolor, //页面标题为路由参数7a896c app.d.bgcolor - animation: { - duration: 400, - timingFunc: 'easeIn' - } - }); + // wx.setNavigationBarColor({ + // frontColor: app.d.frontColor, + // backgroundColor: app.d.bgcolor, //页面标题为路由参数7a896c app.d.bgcolor + // animation: { + // duration: 400, + // timingFunc: 'easeIn' + // } + // }); var plug_ins = app.globalData.userInfo.plug_ins; // 插件 this.setData({ bgcolor: app.d.bgcolor, // 背景颜色 @@ -98,36 +99,37 @@ Page({ requestMyData: function () { var that = this; + WXAPI.appIndex({ + + }) + WXAPI.userIndex({ - openid: app.globalData.userInfo.openid || '', - referee_openid: app.globalData.userInfo.referee_openid || '' + accessId: app.globalData.accessId, + storeId: 239, + storeType: 1, + mobile:'', }).then(res => { - if (res.status == 1) { - var data = res; - if (data.user.wx_name == 'undefined') { + if (res.code == 200) { + var data = res.data; + if (data.data) { that.setData({ - userlogin: true - }); - that.login(); - } else { - that.setData({ - user: data.user, - article: data.article, - logo: data.logo, - company: data.company, - th: data.th, - dfh_num: data.dfh_num, - dfk_num: data.dfk_num, - dpj_num: data.dpj_num, - dsh_num: data.dsh_num, - plug_ins: data.plug_ins, - tjr: data.tjr, - support: data.support + user: data.data.user, + // article: data.data.article, + logo: data.data.logo, + company: data.data.company, + th: data.data.th, + dfh_num: data.data.dfh_num, + dfk_num: data.data.dfk_num, + dpj_num: data.data.dpj_num, + dsh_num: data.data.dsh_num, + // plug_ins: data.data.plug_ins, + // tjr: data.data.tjr, + // support: data.data.support }); } } else { wx.showToast({ - title: '非法操作!', + title: '访问失败!', duration: 2000 }); } @@ -141,17 +143,20 @@ Page({ }) }, login: function () { - if (app.userlogin(1)) { - this.pop.clickPup(this) - this.requestMyData(); - return - } + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) + } }, jumpgo: function (event) { - if (app.userlogin(1)) { - this.pop.clickPup(this) - return - } + var isLogin = wx.getStorageSync('isLogin') + if (!isLogin) { + wx.navigateTo({ + url: '/pages/login/login' + }) + } let url = event.currentTarget.dataset.id wx.navigateTo({ url: url diff --git a/pages/user/user.json b/pages/user/user.json index 69a93a6..c7a4de6 100644 --- a/pages/user/user.json +++ b/pages/user/user.json @@ -1,6 +1,4 @@ { - "navigationBarTitleText": "个人中心", - "usingComponents": { - "pop": "../login/login" - } + "usingComponents": {}, + "navigationBarTitleText": "个人中心" } \ No newline at end of file diff --git a/pages/user/user.wxml b/pages/user/user.wxml index 9276d36..037e186 100644 --- a/pages/user/user.wxml +++ b/pages/user/user.wxml @@ -29,10 +29,10 @@ - - + + - {{user.wx_name}} + {{user.user_name}} 用户ID:{{user.user_id}} {{tjr}} diff --git a/pages/user/user.wxss b/pages/user/user.wxss index 606e7a1..ae97f6a 100644 --- a/pages/user/user.wxss +++ b/pages/user/user.wxss @@ -19,7 +19,7 @@ text{ /* margin-top:-35px; */ font-size:32px; margin-left:35px; - color: #fff; + color: #333333; } .user_top{ height:420rpx; diff --git a/project.private.config.json b/project.private.config.json index 634161e..1b6bfdf 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,7 +2,8 @@ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "%E4%BA%92%E5%88%A9%E5%95%86%E5%9F%8E", "setting": { - "compileHotReLoad": true + "compileHotReLoad": true, + "urlCheck": false }, "libVersion": "2.20.2" } \ No newline at end of file diff --git a/utils/server.js b/utils/server.js index 7932e4a..da1613a 100644 --- a/utils/server.js +++ b/utils/server.js @@ -1,12 +1,12 @@ //小程序开发api接口 -const API_BASE_URL = 'http://xiaochengxu.houjiemeishi.com/zhibo/LKT/index.php?module=api&software_name=3&edition=1.0' +const API_BASE_URL = 'https://mall.gylservice.com/gw?module=app' const requestServer = (url, method, data) => { let _url = API_BASE_URL + url return new Promise((resolve, reject) => { var userInfo = wx.getStorageSync('userInfo'); var token = userInfo.token; - var openid = wx.getStorageSync('openid'); + var accessId = wx.getStorageSync('accessId'); // console.log('token:' + token); wx.request({ url: _url, @@ -14,8 +14,9 @@ const requestServer = (url, method, data) => { data: data, header: { 'content-type': 'application/x-www-form-urlencoded', - token: token, - openid: openid, + // accessId: accessId, + language: '', + "Accept": "*/*", }, dataType: 'json', success(res) { @@ -57,42 +58,64 @@ module.exports = { appIndex: (data) => { //获取用户会话密钥 return requestServer('&action=app&m=index', 'post', data) }, - homeIndex: (data) => { //首页 - return requestServer('&action=Index&m=index', 'post', data) + /* 首页 */ + homeIndex: (data) => { //首页 + return requestServer('&action=index&app=index', 'post', data) }, - appCart: (data) => { + newArrivalIndex: (data) => { //新品上市 + return requestServer('&action=index&app=new_arrival', 'post', data) + }, + recommendIndex: (data) => { //好物优选 + return requestServer('&action=index&app=recommend', 'post', data) + }, + productIndex: (data) => { //商品详情 + return requestServer('&action=product&app=index', 'post', data) + }, + /* 分类 */ + searchIndex: (data) => { //分类页 + return requestServer('&action=search&app=index', 'post', data) + }, + /* 购物车 */ + appCart: (data) => { // return requestServer('&action=app&m=cart', 'post', data) }, + cartIndex: (data) => { //购物车 + return requestServer('&action=cart&app=index', 'post', data) + }, + /* 我的 */ + userIndex: (data) => { //个人中心 + return requestServer('&action=user&app=index', 'post', data) + }, + /* 登录 */ + login: (data) => { //登录 + return requestServer('&action=login&app=login', 'post', data) + }, productSaveFormid: (data) => { return requestServer('&action=product&m=save_formid', 'post', data) }, - userMaterial: (data) => { //用户信息 + userMaterial: (data) => { // return requestServer('&action=user&m=material', 'post', data) }, indexGetMore: (data) => { //更多 - return requestServer('&action=Index&m=get_more', 'post', data) + return requestServer('&action=index&app=get_more', 'post', data) }, newProduct: (data) => { //新品 return requestServer('&action=product&m=new_product', 'post', data) }, - searchIndex: (data) => { //搜索页 - return requestServer('&action=search&m=index', 'post', data) - }, + productToCollection: (data) => { return requestServer('&action=product&m=to_Collection', 'post', data) }, - userIndex: (data) => { //个人中心 - return requestServer('&action=user&m=index', 'post', data) - }, + productUpcart: (data) => { return requestServer('&action=product&m=up_cart', 'post', data) }, productDelAllCart: (data) => { //清空 return requestServer('&action=product&m=delAll_cart', 'post', data) }, - productShopping: (data) => { - return requestServer('&action=product&m=Shopping', 'post', data) - }, + // productShopping: (data) => { + // return requestServer('&action=product&m=Shopping', 'post', data) + // }, productDelcart: (data) => { //删除 return requestServer('&action=product&m=delcart', 'post', data) }, @@ -129,5 +152,36 @@ module.exports = { addressUpAdds: (data) => { //修改地址 return requestServer('&action=address&m=up_adds', 'post', data) }, + envelopeIndex: (data) => { // + return requestServer('&action=envelope&m=index', 'post', data) + }, + envelopeShare: (data) => { // + return requestServer('&action=envelope&m=share', 'post', data) + }, + appUser: (data) => { // + return requestServer('&action=app&m=user', 'post', data) + }, + getcodeProductShare: (data) => { // + return requestServer('&action=getcode&m=product_share', 'post', data) + }, + userPerfectIndex: (data) => { // + return requestServer('&action=user&m=perfect_index', 'post', data) + }, + userSecretKey: (data) => { // + return requestServer('&action=user&m=secret_key', 'post', data) + }, + userPerfect: (data) => { // + return requestServer('&action=user&m=perfect', 'post', data) + }, + + productAddCart: (data) => { // + return requestServer('&action=product&m=add_cart', 'post', data) + }, + addFavoritesIndex: (data) => { // + return requestServer('&action=addFavorites&m=index', 'post', data) + }, + removeFavorites: (data) => { // + return requestServer('&action=addFavorites&m=removeFavorites', 'post', data) + }, } \ No newline at end of file diff --git a/utils/util.js b/utils/util.js index 924b013..5a5d2b5 100644 --- a/utils/util.js +++ b/utils/util.js @@ -14,28 +14,11 @@ function formatNumber(n) { return n[1] ? n : '0' + n } -function getUesrBg(that) { - WXAPI.appCart({ - openid: app.globalData.userInfo.openid, - }).then(res => { - if (res.status == 1) { - var data = res; - var num = data.cart.toString() - if (num > 0) { - wx.setTabBarBadge({ - index: 3, - text: num, - }) - } - } - }); -} - function getUesrBgplus(that, app, is) { WXAPI.appCart({ openid: app.globalData.userInfo.openid, }).then(res => { - if (res.status == 1) { + if (res.code == 200) { var data = res; if (is) { that.setData({ @@ -64,13 +47,11 @@ function getUesrBgplus(that, app, is) { */ function getUrl() { //如果不想安装后台服务,请使用注释这一行做简单数据体验 - return 'http://xiaochengxu.houjiemeishi.com/zhibo/LKT/index.php?module=api&software_name=3&edition=1.0' - // return 'http://localhost/open/app/LKT/index.php?module=api&software_name=3&edition=1.0' + return 'http://192.168.0.73:18001' } module.exports = { formatTime: formatTime, - getUesrBg: getUesrBg, getUesrBgplus: getUesrBgplus, getUrl: getUrl }