杜叶春
2 years ago
81 changed files with 1265 additions and 1837 deletions
@ -0,0 +1,284 @@ |
|||||
|
var app = getApp(); |
||||
|
var WXAPI = require('../../utils/server.js'); |
||||
|
var t = 0; |
||||
|
var show = false; |
||||
|
var moveY = 200; |
||||
|
var index = [0, 0, 0]; |
||||
|
var sheng = [];//省
|
||||
|
var shi = [];//城市
|
||||
|
var xian = [];//区县
|
||||
|
|
||||
|
|
||||
|
Page({ |
||||
|
|
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
sheng: sheng, |
||||
|
shi: shi, |
||||
|
xian: xian, |
||||
|
value: [0, 0, 0], |
||||
|
}, |
||||
|
// 下拉刷新
|
||||
|
onPullDownRefresh: function () { |
||||
|
wx.showNavigationBarLoading() //在标题栏中显示加载
|
||||
|
|
||||
|
this.AddressManagement(); |
||||
|
wx.hideNavigationBarLoading() //完成停止加载
|
||||
|
wx.stopPullDownRefresh() //停止下拉刷新
|
||||
|
}, |
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
wx.setNavigationBarColor({ |
||||
|
frontColor: app.d.frontColor, |
||||
|
backgroundColor: app.d.bgcolor, //页面标题为路由参数
|
||||
|
animation: { |
||||
|
duration: 400, |
||||
|
timingFunc: 'easeIn' |
||||
|
} |
||||
|
}) |
||||
|
this.setData({ |
||||
|
bgcolor: app.d.bgcolor, |
||||
|
id_arr: options.addr_id |
||||
|
}); |
||||
|
|
||||
|
this.AddressManagement(); |
||||
|
}, |
||||
|
/** |
||||
|
* 修改地址 |
||||
|
*/ |
||||
|
AddressManagement: function () { |
||||
|
var that = this; |
||||
|
WXAPI.addressUpAddsIndex({ |
||||
|
openid: app.globalData.userInfo.openid, |
||||
|
id_arr: that.data.id_arr, |
||||
|
}).then(res => { |
||||
|
if (res.status == 1) { |
||||
|
var data = res; |
||||
|
var address = data.adds; |
||||
|
var province = data.province; |
||||
|
var city = data.city; |
||||
|
var county = data.county; |
||||
|
if (address == '') { |
||||
|
var address = [] |
||||
|
} |
||||
|
that.setData({ |
||||
|
address: address, |
||||
|
province: province, |
||||
|
city: city, |
||||
|
county: county |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
AddressManagement1: function () { |
||||
|
var that = this; |
||||
|
WXAPI.addressManagement({ |
||||
|
openid: app.globalData.userInfo.openid, |
||||
|
}).then(res => { |
||||
|
if (res.status == 1) { |
||||
|
var data = res; |
||||
|
var sheng = data.sheng; |
||||
|
var shi = data.shi; |
||||
|
var xian = data.xian; |
||||
|
that.setData({ |
||||
|
sheng: sheng, |
||||
|
shi: shi, |
||||
|
xian: xian |
||||
|
}); |
||||
|
} else { |
||||
|
wx.showToast({ |
||||
|
title: '非法操作!', |
||||
|
duration: 2000 |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
// 点击选择城市
|
||||
|
translate: function (e) { |
||||
|
if (t == 0) { |
||||
|
moveY = 0; |
||||
|
show = false; |
||||
|
t = 1; |
||||
|
} else { |
||||
|
moveY = 200; |
||||
|
show = true; |
||||
|
t = 0; |
||||
|
} |
||||
|
|
||||
|
animationEvents(this, moveY, show); |
||||
|
this.AddressManagement1(); |
||||
|
}, |
||||
|
//隐藏弹窗浮层
|
||||
|
hiddenFloatView(e) { |
||||
|
moveY = 200; |
||||
|
this.setData({ |
||||
|
show: false |
||||
|
}); |
||||
|
t = 1; |
||||
|
}, |
||||
|
//滑动事件
|
||||
|
bindChange: function (e) { |
||||
|
var val = e.detail.value |
||||
|
//判断滑动的是第几个column
|
||||
|
//若省份column做了滑动则定位到地级市和区县第一位
|
||||
|
if (index[0] != val[0]) { |
||||
|
this.getCityArr(val[0]);//获取地级市数据
|
||||
|
this.getCountyInfo(val[0], val[1]);//获取区县数据
|
||||
|
} else { //若省份column未做滑动,地级市做了滑动则定位区县第一位
|
||||
|
if (index[1] != val[1]) { |
||||
|
this.getCountyInfo(val[0], val[1]);//获取区县数据
|
||||
|
} |
||||
|
} |
||||
|
index = val; |
||||
|
this.Preservation(index); |
||||
|
}, |
||||
|
// 根据省获取市
|
||||
|
getCityArr: function (count) { |
||||
|
var that = this; |
||||
|
WXAPI.getCityArr({ |
||||
|
count: count, |
||||
|
}).then(res => { |
||||
|
if (res.status == 1) { |
||||
|
var data = res; |
||||
|
that.setData({ |
||||
|
shi: data.shi |
||||
|
}); |
||||
|
} else { |
||||
|
wx.showToast({ |
||||
|
title: '非法操作!', |
||||
|
duration: 2000 |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
// 根据省市获取县
|
||||
|
getCountyInfo: function (count, column) { |
||||
|
var that = this; |
||||
|
WXAPI.getCountyInfo({ |
||||
|
count: count, |
||||
|
column: column, |
||||
|
}).then(res => { |
||||
|
if (res.status == 1) { |
||||
|
var data = res; |
||||
|
that.setData({ |
||||
|
xian: data.xian |
||||
|
}); |
||||
|
} else { |
||||
|
wx.showToast({ |
||||
|
title: '非法操作!', |
||||
|
duration: 2000 |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
// 滑动事件结束
|
||||
|
Preservation: function (rew) { |
||||
|
var that = this; |
||||
|
WXAPI.preservation({ |
||||
|
sheng: rew[0], |
||||
|
shi: rew[1], |
||||
|
xuan: rew[2] |
||||
|
}).then(res => { |
||||
|
if (res.status == 1) { |
||||
|
var data = res; |
||||
|
var province = data.province; |
||||
|
var city = data.city; |
||||
|
var county = data.county; |
||||
|
that.setData({ |
||||
|
province: province, |
||||
|
city: city, |
||||
|
county: county, |
||||
|
}); |
||||
|
} else { |
||||
|
wx.showToast({ |
||||
|
title: '非法操作!', |
||||
|
duration: 2000 |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
// 点击保存
|
||||
|
SaveAddress: function (e) { |
||||
|
var that = this; |
||||
|
if (e.detail.value.user_name.length == 0) { |
||||
|
wx.showToast({ |
||||
|
title: '联系人不得为空!', |
||||
|
icon: 'loading', |
||||
|
duration: 1500 |
||||
|
}) |
||||
|
wx.hideToast() |
||||
|
} else if (e.detail.value.mobile.length == 0) { |
||||
|
wx.showToast({ |
||||
|
title: '电话不得为空!', |
||||
|
icon: 'loading', |
||||
|
duration: 1500 |
||||
|
}) |
||||
|
wx.hideToast() |
||||
|
} else if (e.detail.value.province.length == 0) { |
||||
|
wx.showToast({ |
||||
|
title: '城市不得为空!', |
||||
|
icon: 'loading', |
||||
|
duration: 1500 |
||||
|
}) |
||||
|
wx.hideToast() |
||||
|
} else { |
||||
|
WXAPI.saveAddress({ |
||||
|
openid: app.globalData.userInfo.openid, |
||||
|
user_name: e.detail.value.user_name, |
||||
|
id_arr: that.data.id_arr, |
||||
|
mobile: e.detail.value.mobile, |
||||
|
province: e.detail.value.province, |
||||
|
city: e.detail.value.city, |
||||
|
county: e.detail.value.county, |
||||
|
address: e.detail.value.address |
||||
|
}).then(res => { |
||||
|
if (res.status == 1) { |
||||
|
var data = res; |
||||
|
wx.showModal({ |
||||
|
title: '提示', |
||||
|
content: data.info, |
||||
|
success: function (res) { |
||||
|
wx.navigateBack({ |
||||
|
delta: 1 |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
wx.showToast({ |
||||
|
title: res.err, |
||||
|
icon: 'loading', |
||||
|
duration: 1500 |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
// WXAPI.addressUpAdds({
|
||||
|
// from_id: formId,
|
||||
|
// userid: app.globalData.userInfo.openid
|
||||
|
// }).then(res => {
|
||||
|
// if (res.status == 1) {
|
||||
|
// var data = res;
|
||||
|
|
||||
|
// }
|
||||
|
// });
|
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
//动画事件
|
||||
|
function animationEvents(that, moveY, show) { |
||||
|
that.animation = wx.createAnimation({ |
||||
|
transformOrigin: "50% 50%", |
||||
|
duration: 400, |
||||
|
timingFunction: "ease", |
||||
|
delay: 0 |
||||
|
}) |
||||
|
that.animation.translateY(moveY + 'vh').step() |
||||
|
that.setData({ |
||||
|
animation: that.animation.export(), |
||||
|
show: show |
||||
|
}) |
||||
|
} |
@ -1,328 +0,0 @@ |
|||||
var app = getApp(); |
|
||||
var t = 0; |
|
||||
var show = false; |
|
||||
var moveY = 200; |
|
||||
var index = [0, 0, 0]; |
|
||||
var sheng = [];//省
|
|
||||
var shi = [];//城市
|
|
||||
var xian = [];//区县
|
|
||||
|
|
||||
|
|
||||
Page({ |
|
||||
|
|
||||
/** |
|
||||
* 页面的初始数据 |
|
||||
*/ |
|
||||
data: { |
|
||||
sheng: sheng, |
|
||||
shi: shi, |
|
||||
xian: xian, |
|
||||
value: [0, 0, 0], |
|
||||
}, |
|
||||
// 下拉刷新
|
|
||||
onPullDownRefresh: function () { |
|
||||
wx.showNavigationBarLoading() //在标题栏中显示加载
|
|
||||
|
|
||||
this.AddressManagement(); |
|
||||
wx.hideNavigationBarLoading() //完成停止加载
|
|
||||
wx.stopPullDownRefresh() //停止下拉刷新
|
|
||||
}, |
|
||||
/** |
|
||||
* 生命周期函数--监听页面加载 |
|
||||
*/ |
|
||||
onLoad: function (options) { |
|
||||
wx.setNavigationBarColor({ |
|
||||
frontColor: app.d.frontColor, |
|
||||
backgroundColor: app.d.bgcolor, //页面标题为路由参数
|
|
||||
animation: { |
|
||||
duration: 400, |
|
||||
timingFunc: 'easeIn' |
|
||||
} |
|
||||
}) |
|
||||
this.setData({ |
|
||||
bgcolor: app.d.bgcolor, |
|
||||
id_arr: options.addr_id |
|
||||
}); |
|
||||
|
|
||||
this.AddressManagement(); |
|
||||
}, |
|
||||
/** |
|
||||
* 修改地址 |
|
||||
*/ |
|
||||
AddressManagement: function () { |
|
||||
var that = this; |
|
||||
wx.request({ |
|
||||
url: app.d.ceshiUrl + '&action=address&m=up_addsindex', |
|
||||
data: { |
|
||||
openid: app.globalData.userInfo.openid, |
|
||||
id_arr: that.data.id_arr, |
|
||||
}, |
|
||||
method: "POST", |
|
||||
header: { |
|
||||
'content-type': 'application/x-www-form-urlencoded' // 默认值
|
|
||||
}, |
|
||||
success: function (res) { |
|
||||
// success
|
|
||||
var address = res.data.adds; |
|
||||
var province = res.data.province; |
|
||||
var city = res.data.city; |
|
||||
var county = res.data.county; |
|
||||
if (address == '') { |
|
||||
var address = [] |
|
||||
} |
|
||||
|
|
||||
that.setData({ |
|
||||
address: address, |
|
||||
province: province, |
|
||||
city: city, |
|
||||
county: county |
|
||||
|
|
||||
}) |
|
||||
|
|
||||
}, |
|
||||
}) |
|
||||
}, |
|
||||
AddressManagement1: function () { |
|
||||
var that = this; |
|
||||
wx.request({ |
|
||||
url: app.d.ceshiUrl + '&action=user&m=AddressManagement', |
|
||||
data: { |
|
||||
openid: app.globalData.userInfo.openid, |
|
||||
}, |
|
||||
method: "POST", |
|
||||
header: { |
|
||||
'content-type': 'application/x-www-form-urlencoded' // 默认值
|
|
||||
}, |
|
||||
success: function (res) { |
|
||||
if (res.data.status == 1) { |
|
||||
var sheng = res.data.sheng; |
|
||||
var shi = res.data.shi; |
|
||||
var xian = res.data.xian; |
|
||||
that.setData({ |
|
||||
sheng: sheng, |
|
||||
shi: shi, |
|
||||
xian: xian |
|
||||
}); |
|
||||
} else { |
|
||||
wx.showToast({ |
|
||||
title: '非法操作!', |
|
||||
duration: 2000 |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
|
|
||||
// 点击选择城市
|
|
||||
translate: function (e) { |
|
||||
if (t == 0) { |
|
||||
moveY = 0; |
|
||||
show = false; |
|
||||
t = 1; |
|
||||
} else { |
|
||||
moveY = 200; |
|
||||
show = true; |
|
||||
t = 0; |
|
||||
} |
|
||||
|
|
||||
animationEvents(this, moveY, show); |
|
||||
this.AddressManagement1(); |
|
||||
}, |
|
||||
//隐藏弹窗浮层
|
|
||||
hiddenFloatView(e) { |
|
||||
moveY = 200; |
|
||||
this.setData({ |
|
||||
show: false |
|
||||
}); |
|
||||
t = 1; |
|
||||
}, |
|
||||
//滑动事件
|
|
||||
bindChange: function (e) { |
|
||||
var val = e.detail.value |
|
||||
//判断滑动的是第几个column
|
|
||||
//若省份column做了滑动则定位到地级市和区县第一位
|
|
||||
if (index[0] != val[0]) { |
|
||||
this.getCityArr(val[0]);//获取地级市数据
|
|
||||
this.getCountyInfo(val[0], val[1]);//获取区县数据
|
|
||||
} else { //若省份column未做滑动,地级市做了滑动则定位区县第一位
|
|
||||
if (index[1] != val[1]) { |
|
||||
this.getCountyInfo(val[0], val[1]);//获取区县数据
|
|
||||
} |
|
||||
} |
|
||||
index = val; |
|
||||
this.Preservation(index); |
|
||||
}, |
|
||||
// 根据省获取市
|
|
||||
getCityArr: function (count) { |
|
||||
var that = this; |
|
||||
wx.request({ |
|
||||
url: app.d.ceshiUrl + '&action=user&m=getCityArr', |
|
||||
data: { |
|
||||
count: count, |
|
||||
}, |
|
||||
method: "POST", |
|
||||
header: { |
|
||||
'content-type': 'application/x-www-form-urlencoded' // 默认值
|
|
||||
}, |
|
||||
success: function (res) { |
|
||||
if (res.data.status == 1) { |
|
||||
var shi = res.data.shi; |
|
||||
that.setData({ |
|
||||
shi: shi |
|
||||
}); |
|
||||
} else { |
|
||||
wx.showToast({ |
|
||||
title: '非法操作!', |
|
||||
duration: 2000 |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
// 根据省市获取县
|
|
||||
getCountyInfo: function (count, column) { |
|
||||
var that = this; |
|
||||
wx.request({ |
|
||||
url: app.d.ceshiUrl + '&action=user&m=getCountyInfo', |
|
||||
data: { |
|
||||
count: count, |
|
||||
column: column, |
|
||||
}, |
|
||||
method: "POST", |
|
||||
header: { |
|
||||
'content-type': 'application/x-www-form-urlencoded' // 默认值
|
|
||||
}, |
|
||||
success: function (res) { |
|
||||
if (res.data.status == 1) { |
|
||||
var xian = res.data.xian; |
|
||||
that.setData({ |
|
||||
xian: xian |
|
||||
}); |
|
||||
|
|
||||
} else { |
|
||||
wx.showToast({ |
|
||||
title: '非法操作!', |
|
||||
duration: 2000 |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
// 滑动事件结束
|
|
||||
Preservation: function (rew) { |
|
||||
var that = this; |
|
||||
wx.request({ |
|
||||
url: app.d.ceshiUrl + '&action=user&m=Preservation', |
|
||||
data: { |
|
||||
sheng: rew[0], |
|
||||
shi: rew[1], |
|
||||
xuan: rew[2] |
|
||||
}, |
|
||||
method: "POST", |
|
||||
header: { |
|
||||
'content-type': 'application/x-www-form-urlencoded' // 默认值
|
|
||||
}, |
|
||||
success: function (res) { |
|
||||
if (res.data.status == 1) { |
|
||||
var province = res.data.province; |
|
||||
var city = res.data.city; |
|
||||
var county = res.data.county; |
|
||||
that.setData({ |
|
||||
province: province, |
|
||||
city: city, |
|
||||
county: county, |
|
||||
}); |
|
||||
} else { |
|
||||
wx.showToast({ |
|
||||
title: '非法操作!', |
|
||||
duration: 2000 |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
// 点击保存
|
|
||||
SaveAddress: function (e) { |
|
||||
var that = this; |
|
||||
if (e.detail.value.user_name.length == 0) { |
|
||||
wx.showToast({ |
|
||||
title: '联系人不得为空!', |
|
||||
icon: 'loading', |
|
||||
duration: 1500 |
|
||||
}) |
|
||||
wx.hideToast() |
|
||||
} else if (e.detail.value.mobile.length == 0) { |
|
||||
wx.showToast({ |
|
||||
title: '电话不得为空!', |
|
||||
icon: 'loading', |
|
||||
duration: 1500 |
|
||||
}) |
|
||||
wx.hideToast() |
|
||||
} else if (e.detail.value.province.length == 0) { |
|
||||
wx.showToast({ |
|
||||
title: '城市不得为空!', |
|
||||
icon: 'loading', |
|
||||
duration: 1500 |
|
||||
}) |
|
||||
wx.hideToast() |
|
||||
} else { |
|
||||
wx.request({ |
|
||||
url: app.d.ceshiUrl + '&action=address&m=up_adds', |
|
||||
data: { |
|
||||
openid: app.globalData.userInfo.openid, |
|
||||
user_name: e.detail.value.user_name, |
|
||||
id_arr: that.data.id_arr, |
|
||||
mobile: e.detail.value.mobile, |
|
||||
province: e.detail.value.province, |
|
||||
city: e.detail.value.city, |
|
||||
county: e.detail.value.county, |
|
||||
address: e.detail.value.address |
|
||||
}, |
|
||||
method: "POST", |
|
||||
header: { |
|
||||
'content-type': 'application/x-www-form-urlencoded' // 默认值
|
|
||||
}, |
|
||||
success: function (res) { |
|
||||
if (res.data.status == 0) { |
|
||||
wx.showToast({ |
|
||||
title: res.data.info, |
|
||||
icon: 'loading', |
|
||||
duration: 1500 |
|
||||
}) |
|
||||
} else { |
|
||||
wx.showModal({ |
|
||||
title: '提示', |
|
||||
content: res.data.info, |
|
||||
success: function (res) { |
|
||||
wx.navigateBack({ |
|
||||
delta: 1 |
|
||||
}) |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
}, |
|
||||
fail: function () { |
|
||||
// fail
|
|
||||
wx.showToast({ |
|
||||
title: '网络异常!', |
|
||||
duration: 2000 |
|
||||
}); |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
} |
|
||||
}) |
|
||||
//动画事件
|
|
||||
function animationEvents(that, moveY, show) { |
|
||||
that.animation = wx.createAnimation({ |
|
||||
transformOrigin: "50% 50%", |
|
||||
duration: 400, |
|
||||
timingFunction: "ease", |
|
||||
delay: 0 |
|
||||
}) |
|
||||
that.animation.translateY(moveY + 'vh').step() |
|
||||
that.setData({ |
|
||||
animation: that.animation.export(), |
|
||||
show: show |
|
||||
}) |
|
||||
} |
|
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "优惠券", |
"navigationBarTitleText": "优惠券", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "商品详情", |
"navigationBarTitleText": "商品详情", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "我的团", |
"navigationBarTitleText": "我的团", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "商品详情", |
"navigationBarTitleText": "商品详情", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "爱拼才会赢", |
"navigationBarTitleText": "爱拼才会赢", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,5 +1,6 @@ |
|||||
{ |
{ |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
}, |
||||
|
"navigationBarTitleText": "互利商城" |
||||
} |
} |
@ -1 +1,4 @@ |
|||||
{"navigationBarTitleText":"授权登录"} |
{ |
||||
|
"usingComponents": {}, |
||||
|
"component": true |
||||
|
} |
@ -1,13 +1,28 @@ |
|||||
<include src="/commons/extension/extension" /> |
<!-- 底部弹窗动画的内容 --> |
||||
<include src="/commons/navbar/navbar" /> |
|
||||
|
<view class='pupContent {{click? "showContent": "hideContent"}} {{option? "open": "closes"}}' hover-stop-propagation='true'> |
||||
<view class="after-navber"> |
<image src="../../images/logonsgb.png" catchtap="setCloses"></image> |
||||
<view style="padding: 0 60rpx"> |
<view class="pupContent-body"> |
||||
<view style="padding:80rpx 0 48rpx;border-bottom: 1rpx solid #e3e3e3;margin-bottom: 72rpx;text-align: center"> |
<view class="pupContent-head"> |
||||
<image src="/images/icon-wechatapp.png" style="width: 200rpx;height: 200rpx;"></image> |
<image src="{{ logoimg }}"></image> |
||||
</view> |
<view>欢迎来到{{ loadtitle }}</view> |
||||
<view style="font-size: 13pt;margin-bottom: 40rpx">申请获取以下权限</view> |
</view> |
||||
<view style="color: #888;margin-bottom: 88rpx">获得你的公开信息(昵称、头像等)</view> |
|
||||
|
<view class="pupContent-title"> |
||||
<button bindgetuserinfo="" class="login-btn" openType="getUserInfo">授权登录</button></view> |
为提供更优质的服务,需要获取以下信息: |
||||
|
</view> |
||||
|
|
||||
|
<view class="pupContent-con"> |
||||
|
<view>· 你的公开信息(昵称、头像等)</view> |
||||
|
</view> |
||||
|
|
||||
|
<view> |
||||
|
<button class="pupContent-btn" bindgetuserinfo="agreeGetUser" class="login-btn" openType="getUserInfo" style="background-color: #1AAD19; border-radius:10rpx;height:46px;display:flex;justify-content:center;align-items: center;" >确定</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
|
||||
|
</view> |
||||
|
<!-- 固定的背景 --> |
||||
|
<view class='pupContentBG {{click?"showBG":"hideBG"}} {{option?"openBG":"closeBG"}}' catchtap='clickPup' catchtouchmove="myCatchTouch"> |
||||
</view> |
</view> |
@ -1,4 +1,160 @@ |
|||||
body{ background: #fff; } |
.pupContentBG { |
||||
.login-btn{ border: none; height: 88rpx; line-height: 88rpx; background: #04be01; color: #fff; font-size: 11pt; border-radius: 999rpx; } |
width: 100vw !important; |
||||
.login-btn::after{ display: none; } |
height: 100vh !important; |
||||
.login-btn.button-hover { box-shadow: inset 0 5rpx 30rpx rgba(0,0,0,.15); } |
position: fixed !important; |
||||
|
top: 0 !important; |
||||
|
} |
||||
|
|
||||
|
.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 执行的动作。 */ |
||||
|
} |
||||
|
|
||||
|
@ -1,229 +0,0 @@ |
|||||
var app = getApp(); |
|
||||
Page({ |
|
||||
|
|
||||
data: { |
|
||||
click: false, //是否显示弹窗内容
|
|
||||
option: false, //显示弹窗或关闭弹窗的操作动画
|
|
||||
logoimg: '', |
|
||||
loadtitle:'', |
|
||||
thvm:{} |
|
||||
}, |
|
||||
myCatchTouch: function () { |
|
||||
return; |
|
||||
}, |
|
||||
// 用户点击显示弹窗
|
|
||||
setCloses:function(){ |
|
||||
wx.showToast({ |
|
||||
title: '没有授权,不能进入小程序个人中心!', |
|
||||
icon: 'none', |
|
||||
duration: 2000 |
|
||||
}) |
|
||||
this.clickPup() |
|
||||
}, |
|
||||
clickPup: function (vm) { |
|
||||
this.setData({ |
|
||||
logoimg: app.globalData.logoimg, |
|
||||
loadtitle: app.globalData.title, |
|
||||
thvm: vm ? vm:'' |
|
||||
}) |
|
||||
let _that = this; |
|
||||
if (!_that.data.click) { |
|
||||
_that.setData({ |
|
||||
click: true, |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
if (_that.data.option) { |
|
||||
_that.setData({ |
|
||||
option: false, |
|
||||
}) |
|
||||
|
|
||||
// 关闭显示弹窗动画的内容,不设置的话会出现:点击任何地方都会出现弹窗,就不是指定位置点击出现弹窗了
|
|
||||
setTimeout(() => { |
|
||||
_that.setData({ |
|
||||
click: false, |
|
||||
}) |
|
||||
}, 500) |
|
||||
|
|
||||
|
|
||||
} else { |
|
||||
_that.setData({ |
|
||||
option: true |
|
||||
}) |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
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; |
|
||||
wx.showLoading({ |
|
||||
title: '正在登入', |
|
||||
success: 2000 |
|
||||
}); |
|
||||
console.log(e.detail.userInfo) |
|
||||
if (e.detail.errMsg == 'getUserInfo:ok') { |
|
||||
//获取成功设置状态
|
|
||||
app.globalData.userlogin = true; |
|
||||
wx.setStorageSync('userlogin', true); |
|
||||
//设置用户信息本地存储
|
|
||||
try { |
|
||||
wx.setStorageSync('userInfo', e.detail.userInfo); |
|
||||
} catch (e) { |
|
||||
wx.showToast({ |
|
||||
title: '系统提示:网络错误!', |
|
||||
icon: 'warn', |
|
||||
duration: 1500, |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
that.setData({ |
|
||||
userlogin: false |
|
||||
}) |
|
||||
|
|
||||
that.getOP(e.detail.userInfo) |
|
||||
} else { |
|
||||
wx.showToast({ |
|
||||
title: '没有授权,不能执行该操作!', |
|
||||
icon: 'none', |
|
||||
duration: 2000 |
|
||||
}) |
|
||||
//没有授权需要弹框
|
|
||||
that.setData({ |
|
||||
userlogin: 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, |
|
||||
}) |
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
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 () { |
|
||||
wx.showToast({ |
|
||||
title: '系统提示:网络错误!', |
|
||||
icon: 'warn', |
|
||||
duration: 1500, |
|
||||
}) |
|
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
getOP: function (res) { |
|
||||
//提交用户信息 获取用户id
|
|
||||
let that = this |
|
||||
let thatplus = this.data.thvm |
|
||||
app.getUserInfo('', '', res, function (){ |
|
||||
let userInfo = res; |
|
||||
var user = app.globalData.userInfo; |
|
||||
|
|
||||
app.globalData.userInfo['avatarUrl'] = userInfo.avatarUrl; // 头像
|
|
||||
app.globalData.userInfo['nickName'] = userInfo.nickName; // 昵称
|
|
||||
app.globalData.userInfo['gender'] = userInfo.gender; // 性别
|
|
||||
wx.setStorageSync('userInfo', app.globalData.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: '授权成功!', |
|
||||
success: 2000 |
|
||||
}); |
|
||||
|
|
||||
setTimeout(function () { |
|
||||
that.clickPup() |
|
||||
thatplus.onLoad() |
|
||||
}, 1800); |
|
||||
|
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
}) |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
}) |
|
@ -1,4 +0,0 @@ |
|||||
{ |
|
||||
"usingComponents": {}, |
|
||||
"component": true |
|
||||
} |
|
@ -1,66 +0,0 @@ |
|||||
// pages/logins/logins.wx.js
|
|
||||
Page({ |
|
||||
|
|
||||
/** |
|
||||
* 页面的初始数据 |
|
||||
*/ |
|
||||
data: { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面加载 |
|
||||
*/ |
|
||||
onLoad: function (options) { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面初次渲染完成 |
|
||||
*/ |
|
||||
onReady: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面显示 |
|
||||
*/ |
|
||||
onShow: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面隐藏 |
|
||||
*/ |
|
||||
onHide: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面卸载 |
|
||||
*/ |
|
||||
onUnload: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 页面相关事件处理函数--监听用户下拉动作 |
|
||||
*/ |
|
||||
onPullDownRefresh: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 页面上拉触底事件的处理函数 |
|
||||
*/ |
|
||||
onReachBottom: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 用户点击右上角分享 |
|
||||
*/ |
|
||||
onShareAppMessage: function () { |
|
||||
|
|
||||
} |
|
||||
}) |
|
@ -1,29 +0,0 @@ |
|||||
<!-- 底部弹窗动画的内容 --> |
|
||||
<!-- <include src="/commons/extension/extension" /> |
|
||||
<include src="/commons/navbar/navbar" /> --> |
|
||||
<view class='pupContent {{click? "showContent": "hideContent"}} {{option? "open": "closes"}}' hover-stop-propagation='true'> |
|
||||
<image src="../../images/logonsgb.png" catchtap="setCloses"></image> |
|
||||
<view class="pupContent-body"> |
|
||||
<view class="pupContent-head"> |
|
||||
<image src="{{ logoimg }}"></image> |
|
||||
<view>欢迎来到{{ loadtitle }}</view> |
|
||||
</view> |
|
||||
|
|
||||
<view class="pupContent-title"> |
|
||||
为提供更优质的服务,需要获取以下信息: |
|
||||
</view> |
|
||||
|
|
||||
<view class="pupContent-con"> |
|
||||
<view>· 你的公开信息(昵称、头像等)</view> |
|
||||
</view> |
|
||||
|
|
||||
<view> |
|
||||
<button class="pupContent-btn" bindgetuserinfo="agreeGetUser" class="login-btn" openType="getUserInfo" style="background-color: #1AAD19; border-radius:10rpx;height:46px;display:flex;justify-content:center;align-items: center;" >确定</button> |
|
||||
</view> |
|
||||
</view> |
|
||||
|
|
||||
|
|
||||
</view> |
|
||||
<!-- 固定的背景 --> |
|
||||
<view class='pupContentBG {{click?"showBG":"hideBG"}} {{option?"openBG":"closeBG"}}' catchtap='clickPup' catchtouchmove="myCatchTouch"> |
|
||||
</view> |
|
@ -1,160 +0,0 @@ |
|||||
.pupContentBG { |
|
||||
width: 100vw !important; |
|
||||
height: 100vh !important; |
|
||||
position: fixed !important; |
|
||||
top: 0 !important; |
|
||||
} |
|
||||
|
|
||||
.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 执行的动作。 */ |
|
||||
} |
|
||||
|
|
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "商品详情", |
"navigationBarTitleText": "商品详情", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,7 +1,7 @@ |
|||||
{ |
{ |
||||
"navigationBarBackgroundColor": "#999999", |
"navigationBarBackgroundColor": "#999999", |
||||
"navigationBarTextStyle": "black", |
"navigationBarTextStyle": "black", |
||||
"navigationBarTitleText": "来客推", |
"navigationBarTitleText": "互利商城", |
||||
"backgroundColor": "#eeeeee", |
"backgroundColor": "#eeeeee", |
||||
"backgroundTextStyle": "light" |
"backgroundTextStyle": "light" |
||||
} |
} |
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "个人中心", |
"navigationBarTitleText": "个人中心", |
||||
"usingComponents": { |
"usingComponents": { |
||||
"pop": "../logins/logins" |
"pop": "../login/login" |
||||
} |
} |
||||
} |
} |
@ -1,7 +1,8 @@ |
|||||
{ |
{ |
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", |
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", |
||||
"projectname": "%E6%9D%A5%E5%AE%A2%E7%94%B5%E5%95%86", |
"projectname": "%E4%BA%92%E5%88%A9%E5%95%86%E5%9F%8E", |
||||
"setting": { |
"setting": { |
||||
"compileHotReLoad": true |
"compileHotReLoad": true |
||||
} |
}, |
||||
|
"libVersion": "2.20.2" |
||||
} |
} |
@ -1,16 +0,0 @@ |
|||||
var util = require('./utils/util.js') |
|
||||
var request = new Object(); |
|
||||
|
|
||||
request.wxRequest = function (obj) { |
|
||||
|
|
||||
wx.request({ |
|
||||
url: util.getUri() + obj.url, |
|
||||
data: obj.data, |
|
||||
method: obj.method, |
|
||||
header: { "Content-Type": "application/x-www-form-urlencoded" }, |
|
||||
success: function (res) { |
|
||||
typeof (obj.success) == 'function' && obj.success(res.data); |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
module.exports = request |
|
@ -0,0 +1,133 @@ |
|||||
|
//小程序开发api接口
|
||||
|
const API_BASE_URL = 'http://xiaochengxu.houjiemeishi.com/zhibo/LKT/index.php?module=api&software_name=3&edition=1.0' |
||||
|
|
||||
|
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'); |
||||
|
// console.log('token:' + token);
|
||||
|
wx.request({ |
||||
|
url: _url, |
||||
|
method: method, |
||||
|
data: data, |
||||
|
header: { |
||||
|
'content-type': 'application/x-www-form-urlencoded', |
||||
|
token: token, |
||||
|
openid: openid, |
||||
|
}, |
||||
|
dataType: 'json', |
||||
|
success(res) { |
||||
|
resolve(res.data) |
||||
|
}, |
||||
|
fail(error) { |
||||
|
reject(error) |
||||
|
}, |
||||
|
complete(aaa) { |
||||
|
//加载完成
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
//promise
|
||||
|
Promise.prototype.finally = function(callback) { |
||||
|
var Promise = this.constructor |
||||
|
return this.then( |
||||
|
function(value) { |
||||
|
Promise.resolve(callback()).then( |
||||
|
function() { |
||||
|
return value; |
||||
|
} |
||||
|
); |
||||
|
}, |
||||
|
function(reason) { |
||||
|
Promise.resolve(callback()).then( |
||||
|
function() { |
||||
|
throw reason; |
||||
|
} |
||||
|
); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
module.exports = { |
||||
|
requestServer, |
||||
|
appIndex: (data) => { //获取用户会话密钥
|
||||
|
return requestServer('&action=app&m=index', 'post', data) |
||||
|
}, |
||||
|
homeIndex: (data) => { //首页
|
||||
|
return requestServer('&action=Index&m=index', 'post', data) |
||||
|
}, |
||||
|
appCart: (data) => { |
||||
|
return requestServer('&action=app&m=cart', 'post', data) |
||||
|
}, |
||||
|
productSaveFormid: (data) => { |
||||
|
return requestServer('&action=product&m=save_formid', 'post', data) |
||||
|
}, |
||||
|
userMaterial: (data) => { //用户信息
|
||||
|
return requestServer('&action=user&m=material', 'post', data) |
||||
|
}, |
||||
|
indexGetMore: (data) => { //更多
|
||||
|
return requestServer('&action=Index&m=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) |
||||
|
}, |
||||
|
productDelcart: (data) => { //删除
|
||||
|
return requestServer('&action=product&m=delcart', 'post', data) |
||||
|
}, |
||||
|
addressManagement: (data) => { //添加地址
|
||||
|
return requestServer('&action=user&m=AddressManagement', 'post', data) |
||||
|
}, |
||||
|
getCityArr: (data) => { //根据省获取市
|
||||
|
return requestServer('&action=user&m=getCityArr', 'post', data) |
||||
|
}, |
||||
|
getCountyInfo: (data) => { //根据省市获取县
|
||||
|
return requestServer('&action=user&m=getCountyInfo', 'post', data) |
||||
|
}, |
||||
|
preservation: (data) => { |
||||
|
return requestServer('&action=user&m=Preservation', 'post', data) |
||||
|
}, |
||||
|
saveAddress: (data) => { |
||||
|
return requestServer('&action=user&m=SaveAddress', 'post', data) |
||||
|
}, |
||||
|
addressDelselect: (data) => { |
||||
|
return requestServer('&action=address&m=del_select', 'post', data) |
||||
|
}, |
||||
|
addressIndex: (data) => { |
||||
|
return requestServer('&action=address&m=index', 'post', data) |
||||
|
}, |
||||
|
addressSetDefault: (data) => { //设置默认地址
|
||||
|
return requestServer('&action=address&m=set_default', 'post', data) |
||||
|
}, |
||||
|
addressDelAdds: (data) => { //删除地址
|
||||
|
return requestServer('&action=address&m=del_adds', 'post', data) |
||||
|
}, |
||||
|
addressUpAddsIndex: (data) => { //修改地址
|
||||
|
return requestServer('&action=address&m=up_addsindex', 'post', data) |
||||
|
}, |
||||
|
addressUpAdds: (data) => { //修改地址
|
||||
|
return requestServer('&action=address&m=up_adds', 'post', data) |
||||
|
}, |
||||
|
|
||||
|
} |
Loading…
Reference in new issue