From 2ea874c6923d3c9ea9037b832573a12130bba883 Mon Sep 17 00:00:00 2001
From: duan <1004387497@qq.com>
Date: Wed, 17 Jul 2024 14:57:48 +0800
Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=92=8C=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E4=B8=AD=E5=BF=83=E4=BF=AE=E6=94=B9=E6=89=8B=E6=9C=BA=E5=8F=B7?=
=?UTF-8?q?=EF=BC=8C=E9=87=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2=E7=BB=91=E5=AE=9A?=
=?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/js/api.js | 5 +-
pages.json | 7 +
pages/login/login.vue | 591 ++++------------------------
pages/member/activatedmemberone.vue | 71 ++++
pages/member/index.vue | 8 +
pages/user/information.vue | 37 +-
6 files changed, 191 insertions(+), 528 deletions(-)
create mode 100644 pages/member/activatedmemberone.vue
diff --git a/common/js/api.js b/common/js/api.js
index 9a327c3..7438067 100644
--- a/common/js/api.js
+++ b/common/js/api.js
@@ -2,6 +2,9 @@ export default {
userwxlogin(data) { //登录
return uni.api.post("/login/wx/custom/login", data);
},
+ userwxlogins(data) { // 获取手机号
+ return uni.api.post("/login/getPhoneNumber", data);
+ },
loginapplogin(data) { //APP登录(登录即注册)
return uni.api.post("/login/app/login", data);
},
@@ -170,7 +173,7 @@ export default {
return uni.api.get("/login/mpdifyPwd", data);
},
cashierServicesong(data) { // 获取所有歌曲,支持搜索及分页
- return uni.api.get("/song", data,false);
+ return uni.api.get("/song", data, false);
},
cashierServicerecord(data) { // 点歌记录
return uni.api.get("/song/record", data);
diff --git a/pages.json b/pages.json
index 9bedad0..34a854a 100644
--- a/pages.json
+++ b/pages.json
@@ -281,6 +281,13 @@
"style": {
"navigationBarTitleText": "账单明细"
}
+ },
+ {
+ "path" : "pages/member/activatedmemberone",
+ "style" :
+ {
+ "navigationBarTitleText" : "会员卡"
+ }
}
],
"globalStyle": {
diff --git a/pages/login/login.vue b/pages/login/login.vue
index ad42771..fe0b9ec 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -1,95 +1,11 @@
-
-
- 手机号码
-
-
-
-
- 验证码
-
-
-
- {{ Recapture }}
-
-
- {{ second }}s重新发送
-
-
-
-
-
-
- 登录
- 其他手机号登录/注册
-
-
-
- 登录
- 其他手机号登录/注册
-
-
+
-
- {{ baseUrl || '切换' }}
-
-
-
-
-
-
- 用户须知
-
- 感谢您使用《银收客》,我们非常重视您的个 人信息和隐私保护,在您使用服务前。请仔 细阅读
- 《用户协议》
- 和
- 《隐私协议》
-
- 如您同意此条款,请点击“同意”并开始使 用我们的产品和服务,我们将尽全力保护您 的个人信息安全
-
- 拒绝
- 同意
-
-
-
-
-
-
-
-
-
-
-
@@ -97,156 +13,86 @@
export default {
data() {
return {
- showpicker: false,
- showpopup: false,
- valueinput: '',
- showbox: false,
-
- columns: [
- ['http://admintestapi.sxczgkj.cn/', 'https://ky.sxczgkj.cn', 'http://192.168.2.22:7004',
- 'http://admintestapi.sxczgkj.cn/', '自定义输入'
- ]
- ],
- radioChangeItem: false, //单选框
- agreeShow: false,
h: null, //动态高度
- showPassword: false, //是否显示密码
- debug: uni.conf.debug,
- baseUrl: uni.conf.baseUrl,
- // 注册定时器 初始值
- second: 60,
- showText: true,
- Recapture: '发送验证码',
types: '', //判断是否是微信扫码点餐进来
- form: {
- //密码
- loginName: '',
- password: '',
- code: '',
- inviteCode: ''
- }
};
},
mounted() {
this.computed_h();
- },
- onLoad(e) {
-
-
- // console.log(e, '调试1')
- // try {
- // this.types = e.types
- // } catch (e) {
- // //TODO handle the exception
- // }
- // #ifdef APP-PLUS || H5
- this.showbox = true
- // #endif
+ this.userlogin() // 静默登录
},
methods: {
- // 同意隐私政策
- agree() {
- uni.setStorageSync('agree', 1);
- this.agreeShow = false;
- },
- blurinput(e) {
- uni.conf.baseUrl = e;
- this.baseUrl = e;
- this.showpopup = false;
- },
- confirmpicker(e) {
- this.showpicker = false;
- if (e.value == '自定义输入') {
- this.showpopup = true;
- } else {
- this.baseUrl = e.value[0];
- uni.conf.baseUrl = e.value;
- }
- },
- // 拒绝隐私政策-退出应用
- refuse() {
- // #ifdef APP-PLUS || H5
- //android 退出方法
- plus.runtime.quit();
- // ios 退出方法
- plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
- // #endif
- },
-
- radioChange(n) {
- //是否同意
- this.radioChangeItem = n;
- },
- display() {
- // 切换图片显示隐藏
- this.showPassword = !this.showPassword;
- },
- async CodeRegister() {
- //发起验证码
- if (this.form.loginName == null || this.form.loginName == '') {
- uni.showToast({
- title: '请输入电话号码',
- icon: 'none'
- });
- return false;
- }
- const res = await this.api.phoneValidateCode({
- // post 手机验证码
- phone: this.form.loginName
- });
- if (res) {
- uni.showToast({
- title: '验证码获取成功',
- icon: 'none'
- });
- // 定时器
- this.showText = false;
- this.Recapture = '重新获取';
- var interval = setInterval(() => {
- let times = --this.second;
- this.second = times < 10 ? '0' + times : times; //小于10秒补 0
- }, 1000);
- setTimeout(() => {
- clearInterval(interval);
- this.second = 60;
- this.showText = true;
- }, 60000);
- }
- },
- async Privacy(e) {
- if (e == 1) {
- //用户协议
- let res = await this.api.agreementgetAgreementOne({
- discern: 0
- });
- uni.pro.navigateTo('my/about/agreement', {
- discern: 0,
- list: res.data.content
- });
- } else {
- let res3 = await this.api.agreementgetAgreementOne({
- discern: 3
- });
- uni.pro.navigateTo('my/about/agreement', {
- discern: 3,
- list: res3.data.content
- });
- }
- },
- rightClick() {
- uni.switchTab({
- url: '/pages/device_shop/index'
- });
- },
- register() {
- uni.navigateTo({
- url: '../login/register'
- });
- },
- passwords() {
- uni.navigateTo({
- url: '../login/password'
+ // 静默登录
+ // userlogin(reslange) {
+ // uni.login({
+ // provider: 'weixin',
+ // success: async (data) => {
+ // if (data.errMsg == "login:ok") {
+ // console.log(data.code, '调试-code')
+ // let res = await this.api.userwxlogins({
+ // code: data.code,
+ // // rawData: infoRes.rawData,
+ // // signature: infoRes.signature,
+ // // iv: reslange.detail.iv,
+ // // encryptedData: resdataa.detail.encryptedData
+ // })
+ // if (res.code == 0) {}
+ // // if (uni.cache.get('types') == 'types') {
+ // // uni.reLaunch({
+ // // url: '/pages/order_food/order_food'
+ // // });
+ // // } else {
+ // // uni.pro.switchTab('index/index')
+ // // }
+ // }
+ // }
+ // })
+ // },
+ // 正常登录
+ async userlogin(reslange) {
+ var resdataa = reslange
+ // if (resdataa.detail.iv) {
+ uni.login({
+ provider: 'weixin',
+ success: async (data) => {
+ try {
+ uni.getUserInfo({
+ provider: 'weixin',
+ success: async (infoRes) => {
+ uni.cache.set('weixincode', data.code);
+ let res = await this.api.userwxlogin({
+ code: uni.cache.get('weixincode'), //临时登录凭证
+ rawData: infoRes.rawData,
+ // signature: infoRes.signature,
+ // iv: infoRes.detail.iv,
+ // encryptedData: infoRes.detail
+ // .encryptedData
+ })
+ if (res.code == 0) {
+ uni.cache.set('token', res.data.token);
+ uni.cache.set('miniAppOpenId', res.data.userInfo
+ .miniAppOpenId)
+ uni.cache.set('userInfo', res.data.userInfo);
+ if (uni.cache.get('types') == 'types') {
+ uni.reLaunch({
+ url: '/pages/order_food/order_food'
+ });
+ } else {
+ uni.pro.switchTab('index/index')
+ }
+ }
+ },
+ fail: (err) => {}
+ });
+ } catch (e) {}
+ }
});
+ // } else {
+ // uni.showToast({
+ // title: '获取手机号失败!请重新获取',
+ // icon: 'none'
+ // });
+ // }
},
async computed_h() {
//获取div宽度
@@ -258,122 +104,6 @@
height: h
};
},
- async toLoginconfirm() {
- //登录
- if (this.form.loginName == null || this.form.loginName == '') {
- uni.showToast({
- title: '请输入电话号码',
- icon: 'none'
- });
- return false;
- }
- // if (this.radioChangeItem == false) {
- // uni.showToast({
- // icon: 'none',
- // title: '请先阅读《用户协议》和《隐私政策》'
- // });
- // return;
- // }
- // #ifdef MP-WEIXIN
- uni.login({
- provider: 'weixin',
- success: async (data) => {
- let res = await this.api.loginapplogin({
- username: this.form.loginName,
- password: this.form.password,
- code: this.form.code,
- opencode: data.code
- });
- console.log(res);
- if (res.code == 0) {
- uni.cache.set('token', res.data.token);
- uni.cache.set('miniAppOpenId', res.data.userInfo
- .miniAppOpenId)
- uni.cache.set('userInfo', res.data.userInfo);
- if (uni.cache.get('types') == 'types') {
- uni.reLaunch({
- url: '/pages/order_food/order_food'
- });
- } else {
- uni.pro.switchTab('index/index')
- }
-
- }
- }
- });
- // #endif
-
-
- },
- // async getPhoneNumber(res) { // 获取手机号
- // var resdataa = res
- // console.log(res)
- // // #ifdef MP-WEIXIN
- // uni.login({
- // provider: 'weixin',
- // success: async (data) => {
- // let resdata = await this.api.logingetPhoneNumber({
- // code: data.code,
- // iv: resdataa.detail.iv,
- // encryptedData: resdataa.detail.encryptedData
- // })
- // console.log(resdata)
- // if (resdata.data) {
- // this.phone = resdata.data
- // this.userlogin()
- // }
- // }
- // });
- // // #endif
- // },
- async userlogin(reslange) {
- var resdataa = reslange
- if (resdataa.detail.iv) {
- // #ifdef MP-WEIXIN
- uni.login({
- provider: 'weixin',
- success: async (data) => {
- try {
- uni.getUserInfo({
- provider: 'weixin',
- success: async (infoRes) => {
- uni.cache.set('weixincode', data.code);
- let res = await this.api.userwxlogin({
- code: uni.cache.get('weixincode'), //临时登录凭证
- rawData: infoRes.rawData,
- signature: infoRes.signature,
- iv: resdataa.detail.iv,
- encryptedData: resdataa.detail
- .encryptedData
- })
- if (res.code == 0) {
- uni.cache.set('token', res.data.token);
- uni.cache.set('miniAppOpenId', res.data.userInfo
- .miniAppOpenId)
- uni.cache.set('userInfo', res.data.userInfo);
- if (uni.cache.get('types') == 'types') {
- uni.reLaunch({
- url: '/pages/order_food/order_food'
- });
- } else {
- uni.pro.switchTab('index/index')
- }
- }
- },
- fail: (err) => {}
- });
- } catch (e) {}
- }
- });
- // #endif
- } else {
- uni.showToast({
- title: '获取手机号失败!请重新获取',
- icon: 'none'
- });
- }
-
- },
}
};
@@ -394,15 +124,6 @@
height: 100vh;
overflow: hidden;
- .top {
- position: absolute;
- left: 64rpx;
-
- .u-navbar--fixed {
- top: 88rpx;
- }
- }
-
.box {
// padding-top: 110rpx;
position: fixed;
@@ -417,93 +138,6 @@
}
}
- .warp {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
-
- .rect {
- width: 606rpx;
- background-color: #fff;
- border-radius: 12rpx;
-
- .rect_img {
- // background: url(@/static/login/uoverlay.png) no-repeat;
- background-size: 100% 100%;
- width: 100%;
- height: 120px;
- }
-
- .rect_text {
- padding: 0 40rpx;
-
- .rect_text_one {
- margin-top: 32rpx;
- font-size: 32rpx;
- font-family: Source Han Sans CN-Medium, Source Han Sans CN;
- font-weight: 500;
- color: #333333;
- }
-
- .rect_text_tow {
- margin-top: 32rpx;
- font-size: 28rpx;
- font-family: Source Han Sans CN-Regular, Source Han Sans CN;
- font-weight: 400;
-
- text {
- color: #2f87fd;
- }
-
- color: #333333;
- }
-
- .rect_text_there {
- margin-top: 16rpx;
- font-size: 28rpx;
- font-family: Source Han Sans CN-Regular, Source Han Sans CN;
- font-weight: 400;
- color: #999999;
- }
-
- .rect_text_four {
- width: 100%;
- padding: 48rpx 40rpx 30rpx 40rpx;
-
- .rect_text_four_o {
- padding: 16rpx 64rpx;
- background: #ffffff;
- border-radius: 36rpx;
- font-size: 28rpx;
- font-family: Source Han Sans CN-Medium, Source Han Sans CN;
- font-weight: 500;
- color: #333333;
- border: 2rpx solid #333333;
- }
-
- .rect_text_four_t {
- background: #2f87fd;
- padding: 16rpx 64rpx;
- border-radius: 36rpx;
- font-size: 28rpx;
- font-family: Source Han Sans CN-Medium, Source Han Sans CN;
- font-weight: 500;
- color: #ffffff;
- }
- }
- }
- }
- }
-
- .box_conf {
- position: fixed;
- top: 0;
- color: #000;
- padding: 20rpx;
- right: 2%;
- }
-
.top_box::after {
position: absolute;
// content: url(@/static/icon.png);
@@ -527,57 +161,6 @@
border-radius: 40rpx 40rpx 0px 0px;
top: 220rpx;
- .top_box_one {
- position: relative;
- width: 100%;
- margin-top: 64rpx;
- border-bottom: 6rpx solid #e5e5e5;
-
- .top_box_one_text {
- font-size: 36rpx;
- font-family: Source Han Sans CN-Medium, Source Han Sans CN;
- font-weight: 500;
- color: #333333;
- }
-
- input {
- height: auto;
- padding: 18rpx 0 20rpx 0;
- }
-
- .repeat {
- position: absolute;
- bottom: 26rpx;
- right: 0;
- width: 25rpx;
- height: 17rpx;
- }
-
- .repeats {
- position: absolute;
- bottom: 26rpx;
- right: 0;
- font-size: 24rpx;
- z-index: 9;
- font-family: $uni_family;
- font-weight: 400;
- color: #ffffff;
- border-radius: 12rpx;
- }
- }
-
- .top_box_tow {
- width: 100%;
-
- text {
- margin-top: 34rpx;
- font-size: 24rpx;
- font-family: $uni_family;
- font-weight: 400;
- color: #666666;
- }
- }
-
.toLogin {
margin-top: 212rpx;
width: 100%;
@@ -593,38 +176,8 @@
border: none;
}
- .toLogin::after {
- background: none;
- border: none;
- }
- .toLogins {
- margin-top: 32rpx;
- width: 100%;
- line-height: 84rpx;
- height: 84rpx;
- border-radius: 12rpx 12rpx 12rpx 12rpx;
- border: 2rpx solid #333333;
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 400;
- font-size: 32rpx;
- color: #333333;
- text-align: center;
- }
- .agreement {
- width: 100%;
- margin-top: 40rpx;
- font-family: Source Han Sans CN, Source Han Sans CN;
- font-weight: 500;
- font-size: 20rpx;
- color: #999999;
- text-align: left;
-
- .agreement-Item {
- color: #333333;
- }
- }
}
}
\ No newline at end of file
diff --git a/pages/member/activatedmemberone.vue b/pages/member/activatedmemberone.vue
new file mode 100644
index 0000000..da0adbb
--- /dev/null
+++ b/pages/member/activatedmemberone.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/member/index.vue b/pages/member/index.vue
index 1efafc2..7ebdac0 100644
--- a/pages/member/index.vue
+++ b/pages/member/index.vue
@@ -42,6 +42,14 @@
this.paygetShopByMember(e.shopId)
}
this.paygetActive(e.shopId) //列表
+ // 判断是否绑定手机,只有下单时候有,会员列表肯定有
+ console.log(uni.cache.get('userInfo').telephone, '调试1')
+ if (!uni.cache.get('userInfo').telephone) {
+ // 跳转到开通页面
+ uni.navigateTo({
+ url: '/pages/member/activatedmemberone?shopId=' + e.shopId
+ })
+ }
},
methods: {
async paygetShopByMember(w) {
diff --git a/pages/user/information.vue b/pages/user/information.vue
index 7f03b0a..925b7d4 100644
--- a/pages/user/information.vue
+++ b/pages/user/information.vue
@@ -19,16 +19,18 @@
昵称
-
+
手机号
-
+
+
@@ -61,13 +63,15 @@
},
userInfo: uni.cache.get('userInfo'),
userHeadImg: "",
- nickName: ''
+ nickName: '',
+ phonetitle: ""
};
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.nickName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
+ this.phonetitle = this.userInfo.telephone ? this.userInfo.telephone : '请授权手机号'
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
@@ -77,12 +81,28 @@
}
},
methods: {
+ async getPhone(d) {
+ if (d.detail.iv) {
+ uni.login({
+ provider: 'weixin',
+ success: async (data) => {
+ console.log(data)
+ let res = await this.api.userwxlogins({
+ code: data.code,
+ encryptedData: d.detail.encryptedData,
+ iv: d.detail.iv,
+ })
+ this.phonetitle = res.data
+ }
+ })
+ }
+ },
bindblur(e) {
- console.log(e,11)
+ console.log(e, 11)
this.nickName = e.detail.value; // 获取微信昵称
},
bindinput(e) {
- console.log(e,22)
+ console.log(e, 22)
this.nickName = e.detail.value; // 获取微信昵称
},
// uploadImg() {
@@ -148,7 +168,8 @@
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
- nickName: this.nickName
+ nickName: this.nickName,
+ telephone: this.phonetitle
})
if (res.code == 0) {
uni.navigateBack()