Browse Source

no message

feature/v1.1.0
xpz2018 7 years ago
parent
commit
61766ded95
9 changed files with 59 additions and 61 deletions
  1. 4
      app.js
  2. 18
      pages/activity_detail/activity_detail.js
  3. 4
      pages/activity_detail/activity_detail.wxss
  4. 13
      pages/activity_list/activity_list.js
  5. 2
      pages/login/login.wxml
  6. 5
      pages/login/login.wxss
  7. 49
      pages/mcenter/mcenter.js
  8. 23
      pages/pay_result/pay_result.js
  9. 2
      wxParse/html2json.js

4
app.js

@ -59,13 +59,9 @@ App({
success: res => { success: res => {
// 可以将 res 发送给后台解码出 unionId // 可以将 res 发送给后台解码出 unionId
that.globalData.userInfo = res.userInfo; that.globalData.userInfo = res.userInfo;
// this.onLoginUser(); // this.onLoginUser();
// 发送 res.code 到后台换取 openId, sessionKey, unionId // 发送 res.code 到后台换取 openId, sessionKey, unionId
that.commitUserInfo(that.globalData.openid, res.encryptedData, res.iv); that.commitUserInfo(that.globalData.openid, res.encryptedData, res.iv);
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况 // 所以此处加入 callback 以防止这种情况
if (that.userInfoReadyCallback) { if (that.userInfoReadyCallback) {

18
pages/activity_detail/activity_detail.js

@ -55,12 +55,6 @@ Page({
activityNo: options.activityNo == undefined ? "" : options.activityNo, activityNo: options.activityNo == undefined ? "" : options.activityNo,
groupNo: options.groupNo == undefined ? "" : options.groupNo, groupNo: options.groupNo == undefined ? "" : options.groupNo,
}); });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
}, },
/** /**
@ -81,7 +75,7 @@ Page({
} else { } else {
url = "/mall/wxa/activity/detail"; url = "/mall/wxa/activity/detail";
} }
console.log('msg>>>' + that.data.activityNo + ',' + that.data.groupNo);
wx.request({ wx.request({
url: app.gw.hostUrl + url, url: app.gw.hostUrl + url,
method: 'get', method: 'get',
@ -94,11 +88,11 @@ Page({
'sessionId': wx.getStorageSync('sessionId') 'sessionId': wx.getStorageSync('sessionId')
}, },
success: function (res) { success: function (res) {
console.log(res);
var data = res.data; var data = res.data;
var status = data.code; var status = data.code;
console.log(res); console.log(res);
if (status == 0) { if (status == 0) {
that.setData({ that.setData({
activityDetail: data.response, activityDetail: data.response,
activityNo: data.response.activityNo, activityNo: data.response.activityNo,
@ -110,7 +104,6 @@ Page({
}); });
let activityContent = data.response.activityContent; let activityContent = data.response.activityContent;
WxParse.wxParse('activityContent', 'html', activityContent, that); WxParse.wxParse('activityContent', 'html', activityContent, that);
console.log("currentMemberType:" + data.response.currentMemberType + "&&status:" + that.data.groupStatus + "&&groupNo" + that.data.groupNo);
//根据状态切换样式 //根据状态切换样式
if (that.data.groupNo !=""){ if (that.data.groupNo !=""){
//开团后页面变化 //开团后页面变化
@ -292,7 +285,6 @@ Page({
groupTap: function (e) { groupTap: function (e) {
let that = this; let that = this;
var url = ""; var url = "";
console.log("groupNo:" + that.data.groupNo + "&currentMemberType:" + that.data.currentMemberType + "&groupStatus:" + that.data.groupStatus);
if (that.data.groupNo == ""){ if (that.data.groupNo == ""){
url = '/mall/wxa/activity/group/open'; url = '/mall/wxa/activity/group/open';
//首次开团 //首次开团
@ -387,9 +379,9 @@ Page({
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
var json = JSON.stringify(that.data.activityDetail);
console.log(that.data.activityDetail)
wx.navigateTo({ wx.navigateTo({
url: '../pay_result/pay_result?json=' + json
url: '../pay_result/pay_result?activityNo=' + that.data.activityNo + '&groupNo=' + that.data.groupNo + '&shareTitle=' + that.data.activityDetail.shareTitle + '&sharePhoto=' + that.data.activityDetail.sharePhoto
}) })
}, },
"fail": function (res) { "fail": function (res) {
@ -412,7 +404,7 @@ Page({
}, },
fail: function (e) { fail: function (e) {
wx.showToast({ wx.showToast({
title: '网络异常!err:authlogin',
title: '网络异常!',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })

4
pages/activity_detail/activity_detail.wxss

@ -122,7 +122,7 @@ image{
} }
.grounp_info .status .tag{ .grounp_info .status .tag{
padding: 5rpx 20rpx;
padding: 5rpx 12rpx;
font-size: 24rpx; font-size: 24rpx;
width:110px; width:110px;
height:36px; height:36px;
@ -156,7 +156,7 @@ image{
.grounp_info .status .countDownTimeView{ .grounp_info .status .countDownTimeView{
width: 300rpx; width: 300rpx;
height: 24rpx; height: 24rpx;
margin: -6rpx 150rpx auto;
margin: -6rpx 162rpx auto;
} }
.grounp_info .status .countDownTimeView .countDownTimeText{ .grounp_info .status .countDownTimeView .countDownTimeText{

13
pages/activity_list/activity_list.js

@ -65,13 +65,14 @@ Page({
pageNum: that.data.pageNum + 1 pageNum: that.data.pageNum + 1
}); });
} }
console.log(that.data.repos);
} else { } else {
wx.showToast({
title: res.data.msg,
icon: 'none',
duration: 1000
});
if (res.data.code != 0){
wx.showToast({
title: res.data.msg,
icon: 'none',
duration: 1000
});
}
that.setData({ that.setData({
loading: false, loading: false,
}); });

2
pages/login/login.wxml

@ -19,5 +19,5 @@
</view> </view>
</view> </view>
</view> </view>
<button class='subBtn' form-type="submit"> 登录 </button>
<button class='subBtn' form-type="submit" open-type='getUserInfo'> 登录 </button>
</form> </form>

5
pages/login/login.wxss

@ -28,7 +28,7 @@ button::after{
z-index:3; z-index:3;
} }
.detailBox{ .detailBox{
margin-top: 58rpx;
margin-top: 60rpx;
background:#fff; background:#fff;
} }
.box{ .box{
@ -82,7 +82,8 @@ button::after{
} }
.subBtn{ .subBtn{
width: 90%; width: 90%;
margin: 40rpx auto;
height: 90rpx;
margin: 60rpx auto;
text-align: center; text-align: center;
color: #fff; color: #fff;
background: #1eba84; background: #1eba84;

49
pages/mcenter/mcenter.js

@ -4,45 +4,46 @@ const app = getApp()
Page({ Page({
data: { data: {
items:[
{ top: 20, title: '我的订单', img:'../../images/order.png',page:'Order'},
{ top: 1, title: '我的活动', img: '../../images/addr.png', page:'Activity'},
{ top: 1, title: '联系客服', img: '../../images/service.png', page:'Transition'}
items: [
{ top: 20, title: '我的订单', img: '../../images/order.png', page: 'Order' },
{ top: 1, title: '我的活动', img: '../../images/addr.png', page: 'Activity' },
{ top: 1, title: '联系客服', img: '../../images/service.png', page: 'Transition' }
], ],
sessionId: '' sessionId: ''
}, },
//事件处理函数
bindViewTap: function () {
wx.navigateTo({
url: '../logs/logs'
})
},
bindFocus: function () {
wx.navigateTo({
title: "goback",
url: '../jz/jz'
})
},
goActivity: function (e) { goActivity: function (e) {
wx.navigateTo({
url: '../activity_list/activity_list'
})
if (this.data.sessionId == undefined || this.data.sessionId.length == 0) {
this.goLogin(e);
} else {
wx.navigateTo({
url: '../activity_list/activity_list'
})
}
}, },
goLogin: function (e) { goLogin: function (e) {
wx.navigateTo({ wx.navigateTo({
url: '../login/login'
url: '../login/login'
}) })
}, },
goOrder: function (e) { goOrder: function (e) {
wx.navigateTo({
url: '../order/order'
})
if (this.data.sessionId == undefined || this.data.sessionId.length == 0) {
this.goLogin(e);
} else {
wx.navigateTo({
url: '../order/order'
})
}
}, },
goTransition: function (e) { goTransition: function (e) {
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: '400-6080100'
phoneNumber: '400-6080100'
}) })
}, },
onLoad: function () { onLoad: function () {
this.setData({ this.setData({
sessionId: wx.getStorageSync('sessionId') sessionId: wx.getStorageSync('sessionId')

23
pages/pay_result/pay_result.js

@ -1,6 +1,9 @@
Page({ Page({
data: { data: {
activityDetail: {},
activityNo: '',
groupNo: "",
shareTitle: '',
sharePhoto: '',
windowWidth: 0, windowWidth: 0,
windowHeight: 0, windowHeight: 0,
scaleW: 0.85, scaleW: 0.85,
@ -23,7 +26,13 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
this.data.activityDetail = JSON.parse(options.json);
this.setData({
activityNo: options.activityNo == undefined ? "" : options.activityNo,
groupNo: options.groupNo == undefined ? "" : options.groupNo,
shareTitle: options.shareTitle == undefined ? "" : options.shareTitle,
sharePhoto: options.sharePhoto == undefined ? "" : options.sharePhoto,
});
console.log("options>>" + this.data.activityNo + "," + this.data.groupNo + "," + this.data.shareTitle + "," + this.data.sharePhoto);
wx.getSystemInfo({ wx.getSystemInfo({
success: (res) => { success: (res) => {
this.setData({ this.setData({
@ -37,7 +46,7 @@ Page({
url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code', url: getApp().gw.hostUrl + '/mall/wxa/activity/group/wxa_code',
method: 'get', method: 'get',
data: { data: {
groupNo: that.data.activityDetail.groupNo,
groupNo: that.data.groupNo,
width: 80, width: 80,
page: 'index/index' page: 'index/index'
}, },
@ -70,9 +79,9 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
return { return {
title: this.data.activityDetail.shareTitle,
imageUrl: this.data.activityDetail.sharePhoto,
path: '/pages/activity_detail/activity_detail?activityNo=' + this.data.activityDetail.activityNo + '&groupNo=' + this.data.activityDetail.groupNo,
title: this.data.shareTitle,
imageUrl: this.data.sharePhoto,
path: '/pages/activity_detail/activity_detail?activityNo=' + this.data.activityNo + '&groupNo=' + this.data.groupNo,
}; };
}, },
@ -96,7 +105,7 @@ Page({
}, },
goActivityInfo: function () { goActivityInfo: function () {
wx.navigateBack()
}, },
togglePopup: function () { togglePopup: function () {

2
wxParse/html2json.js

@ -109,14 +109,12 @@ function html2json(html, bindName) {
var name = attr.name; var name = attr.name;
var value = attr.value; var value = attr.value;
if (name == 'class') { if (name == 'class') {
console.dir(value);
// value = value.join("") // value = value.join("")
node.classStr = value; node.classStr = value;
} }
// has multi attibutes // has multi attibutes
// make it array of attribute // make it array of attribute
if (name == 'style') { if (name == 'style') {
console.dir(value);
// value = value.join("") // value = value.join("")
node.styleStr = value; node.styleStr = value;
} }

Loading…
Cancel
Save