diff --git a/common/http.api.js b/common/http.api.js
index 1f734be..7485bf8 100644
--- a/common/http.api.js
+++ b/common/http.api.js
@@ -47,6 +47,7 @@ const install = (Vue, vm) => {
let checkUserName = (params={})=>vm.$u.get(`/index.php/api/login/check_username`, params);//注册时检查用户名是否
let getCodeRepass = (id,params)=>vm.$u.get(`/index.php/api/login/getpwdnum/type/mobphone/to/${id}`,params);//获取验证码
let changepwd = ( params)=>vm.$u.post(`/index.php/api/login/changepwd`, params);//修改密码
+ let wxReg = ( params)=>vm.$u.post(`/index.php/api/login/one_key_reg`, params);//微信一键注册
vm.$u.api = {
getSearch,
@@ -84,7 +85,8 @@ const install = (Vue, vm) => {
getCodeRepass,
changepwd,
checkUserName,
- register};
+ register,
+ wxReg};
}
export default {
diff --git a/pages/login/register.vue b/pages/login/register.vue
index c2dbc28..b909859 100644
--- a/pages/login/register.vue
+++ b/pages/login/register.vue
@@ -24,8 +24,14 @@
已有账号立即登录
+
+
+
+ 微信一键注册
+
-
@@ -42,6 +48,8 @@
getCodeBtnColor:"#ffffff",
getCodeisWaiting:false,
unique:true,
+ nickname:'',
+ code:''
}
},
onLoad() {
@@ -106,6 +114,96 @@
}else{}
})
},
+ //微信一键注册
+ weChartReg(){
+ let that = this;
+ uni.showModal({
+ title: '温馨提示',
+ content: '亲,授权微信登录后才能正常使用小程序功能',
+ success(modelRes) {
+ //如果用户点击了确定按钮
+ if (modelRes.confirm) {
+ uni.getUserProfile({
+ desc: '获取你的昵称',
+ success: profileRes => {
+ that.nickName = profileRes.userInfo.nickName;
+ uni.login({
+ provider: 'weixin',
+ success: function (wxLoginRes) {
+ debugger;
+ console.log(wxLoginRes.code)
+ that.code = wxLoginRes.code;
+ let params = {nickname:that.nickName,code:wxLoginRes.code};
+ that.$u.api.wxReg(params).then(wxRegRes=>{
+ uni.hideLoading();
+ if(wxRegRes.code==0){
+ uni.showToast({
+ title: '注册成功',
+ icon: "success"
+ });
+ uni.login({
+ provider: 'weixin',
+ success: function (ress) {
+ that.$u.api.login({
+ code: ress.code
+ }).then(
+ res => {
+ that.$u.vuex('vuex_token', res.data.token)
+ that.$u.api.getInfo().then(res => {
+ that.$u.vuex('vuex_user', res.data)
+ if(res.data.icon===""){
+ that.$u.vuex('vuex_user.icon', '/static/img/face.jpg')
+ }else{
+ that.$u.vuex('vuex_user.icon', that.vuex_host + 'public/' + res.data.icon)
+ }
+ uni.reLaunch({
+ url:'/pages/tabBar/home/home'
+ })
+ })
+ uni.hideLoading()
+ }
+ ).catch(res=>{
+ uni.redirectTo({
+ url:'/pages/login/login'
+ })
+ })
+ },
+ })
+ }else{
+ uni.showToast({
+ title: infoRes.data.msg,
+ icon:'none'
+ });
+ }
+ })
+ },
+ })
+ },
+ fail: res => {
+ console.log(2);
+ console.log(res)
+ //拒绝授权
+ uni.showToast({
+ title: '您拒绝了请求,不能正常使用小程序',
+ icon: 'error',
+ duration: 2000
+ });
+ return;
+ }
+ });
+ } else if (res.cancel) {
+ //如果用户点击了取消按钮
+ console.log(3);
+ uni.showToast({
+ title: '您拒绝了请求,不能正常使用小程序',
+ icon: 'error',
+ duration: 2000
+ });
+ return;
+ }
+ }
+ });
+ },
//注册
doReg(){
let that = this;
@@ -177,6 +275,9 @@
// });
// },1000)
//
+ },
+ weChartRegister(){
+
},
toLogin(){
uni.hideKeyboard()
@@ -195,4 +296,26 @@
color: #ff0000;
text-decoration: underline;
}
+ .wechartRegister{
+ text-align: center;
+ }
+ .wechartRegisterImg{
+ width: 100upx;
+ height: 100upx;
+ margin-top: 30upx;
+ }
+ .wechartRegisterText{
+ font-size: 22upx;
+ color: #ffffff;
+ }
+ #wxRegister{
+ background-color: #f06c7a ;
+ height: max-content;
+ padding: 0;
+ border: none;
+ // line-height: 0;
+ }
+ #wxRegister::after{
+ border: none;
+ }
diff --git a/pages/order/confirmation.vue b/pages/order/confirmation.vue
index 7ee93f5..833c824 100644
--- a/pages/order/confirmation.vue
+++ b/pages/order/confirmation.vue
@@ -152,7 +152,7 @@
int: 1200, //抵扣积分
deduction: 0, //抵扣价格
recinfo:{
- id:0,
+ // id:0,
},
if_invoice:2,
freights:{},
diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue
index eeb90c6..0207f25 100644
--- a/pages/tabBar/home/home.vue
+++ b/pages/tabBar/home/home.vue
@@ -307,7 +307,7 @@ export default {
res.data[i].img = this.vuex_host + '/' + res.data[i].img+"?timer="+timestamp
console.log(i)
console.log(res.data[i].img)
- debugger;
+ // debugger;
}
this.swiperList = res.data;
console.log(this.swiperList)
@@ -452,7 +452,7 @@ export default {
},
//轮播图跳转
toSwiper(e) {
- debugger;
+ // debugger;
console.log(e)
// uni.showToast({ title: e.src, icon: 'none' });
},
diff --git a/pages/user/setting/setting.vue b/pages/user/setting/setting.vue
index 7d4ebe9..fc13f53 100644
--- a/pages/user/setting/setting.vue
+++ b/pages/user/setting/setting.vue
@@ -99,7 +99,7 @@
},
logout(){
var that = this
- that.$u.api.logout().then(res=>{
+ /* that.$u.api.logout().then(res=>{
if(res.code==0){
that.$u.vuex('vuex_user', {nickname: '游客', icon:'/static/img/face.jpg'})
that.$u.vuex('vuex_token', '')
@@ -107,6 +107,11 @@
url:'/pages/login/login'
})
}
+ }) */
+ that.$u.vuex('vuex_user', {nickname: '游客', icon:'/static/img/face.jpg'})
+ that.$u.vuex('vuex_token', '')
+ uni.reLaunch({
+ url:'/pages/login/login'
})
}
}
diff --git a/static/img/share/wechart.png b/static/img/share/wechart.png
new file mode 100644
index 0000000..3a33cc4
Binary files /dev/null and b/static/img/share/wechart.png differ