This commit is contained in:
parent
6290e963e4
commit
ecb94ba348
|
|
@ -76,6 +76,11 @@
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "隐私协议"
|
"navigationBarTitleText": "隐私协议"
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"path": "pages/me/agreement",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "服务协议"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/search/index",
|
"path": "pages/index/search/index",
|
||||||
|
|
|
||||||
|
|
@ -19,137 +19,134 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import listCell from '@/components/com-input';
|
import { reactive } from 'vue';
|
||||||
export default {
|
import { onLoad} from '@dcloudio/uni-app'
|
||||||
components: {
|
import {setSendMsg,forgetPwd} from '@/api/login/login.js';
|
||||||
listCell
|
let data = reactive({
|
||||||
},
|
mobile: '',
|
||||||
data() {
|
code: '',
|
||||||
return {
|
loginIng: false,
|
||||||
mobile: '',
|
sendIng: false,
|
||||||
code: '',
|
sendTime: '获取验证码',
|
||||||
loginIng: false,
|
count: 60,
|
||||||
sendIng: false,
|
type: '',
|
||||||
sendTime: '获取验证码',
|
})
|
||||||
count: 60,
|
|
||||||
type: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(option) {
|
|
||||||
if (option.type) {
|
|
||||||
this.type = option.type
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
inputChange(e) {
|
|
||||||
const key = e.currentTarget.dataset.key;
|
|
||||||
this[key] = e.detail.value;
|
|
||||||
},
|
|
||||||
|
|
||||||
countDown() {
|
onLoad((option) => {
|
||||||
const {
|
if (option.type) {
|
||||||
count
|
data.type = option.type
|
||||||
} = this;
|
}
|
||||||
if (count === 1) {
|
})
|
||||||
this.count = 60;
|
|
||||||
this.sendIng = false;
|
function inputChange(e) {
|
||||||
this.sendTime = '获取验证码'
|
const key = e.currentTarget.dataset.key;
|
||||||
|
data[key] = e.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function countDown() {
|
||||||
|
const {
|
||||||
|
count
|
||||||
|
} = data;
|
||||||
|
if (count === 1) {
|
||||||
|
data.count = 60;
|
||||||
|
data.sendIng = false;
|
||||||
|
data.sendTime = '获取验证码'
|
||||||
|
} else {
|
||||||
|
data.count = count - 1;
|
||||||
|
data.sendIng = true;
|
||||||
|
data.sendTime = count - 1 + '秒后重新获取';
|
||||||
|
setTimeout(data.countDown.bind(data), 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendMsg() {
|
||||||
|
const {
|
||||||
|
mobile
|
||||||
|
} = data;
|
||||||
|
if (!mobile) {
|
||||||
|
data.$queue.showToast("请输入手机号");
|
||||||
|
} else if (mobile.length !== 11) {
|
||||||
|
data.$queue.showToast("请输入正确的手机号");
|
||||||
|
} else {
|
||||||
|
data.$queue.showLoading("正在发送验证码...");
|
||||||
|
http.request({
|
||||||
|
url: 'app/Login/sendMsg/' + mobile + '/gzg',
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
data.sendIng = true;
|
||||||
|
uni.showToast({ title: '验证码发送成功请注意查收', icon: 'none', })
|
||||||
|
data.countDown();
|
||||||
} else {
|
} else {
|
||||||
this.count = count - 1;
|
uni.showModal({
|
||||||
this.sendIng = true;
|
showCancel: false,
|
||||||
this.sendTime = count - 1 + '秒后重新获取';
|
title: '短信发送失败',
|
||||||
setTimeout(this.countDown.bind(this), 1000);
|
content: res.msg ? res.msg : '请一分钟后再获取验证码'
|
||||||
}
|
|
||||||
},
|
|
||||||
sendMsg() {
|
|
||||||
const {
|
|
||||||
mobile
|
|
||||||
} = this;
|
|
||||||
if (!mobile) {
|
|
||||||
this.$queue.showToast("请输入手机号");
|
|
||||||
} else if (mobile.length !== 11) {
|
|
||||||
this.$queue.showToast("请输入正确的手机号");
|
|
||||||
} else {
|
|
||||||
this.$queue.showLoading("正在发送验证码...");
|
|
||||||
http.request({
|
|
||||||
url: 'app/Login/sendMsg/' + mobile + '/gzg',
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.sendIng = true;
|
|
||||||
this.$queue.showToast('验证码发送成功请注意查收');
|
|
||||||
this.countDown();
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
showCancel: false,
|
|
||||||
title: '短信发送失败',
|
|
||||||
content: res.msg ? res.msg : '请一分钟后再获取验证码'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.hideLoading();
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
toLogin() {
|
|
||||||
const {
|
|
||||||
mobile,
|
|
||||||
code
|
|
||||||
} = this;
|
|
||||||
let userId = this.$queue.getData("userId");
|
|
||||||
if (!mobile) {
|
|
||||||
this.$queue.showToast("请输入手机号");
|
|
||||||
} else if (mobile.length !== 11) {
|
|
||||||
this.$queue.showToast("请输入正确的手机号");
|
|
||||||
} else if (!code) {
|
|
||||||
this.$queue.showToast("请输入验证码");
|
|
||||||
} else {
|
|
||||||
this.$queue.showLoading("正在绑定中...");
|
|
||||||
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
|
|
||||||
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
|
|
||||||
'';
|
|
||||||
let openidheadimgurl = this.$queue.getData('openidheadimgurl') ? this.$queue.getData(
|
|
||||||
'openidheadimgurl') : '';
|
|
||||||
let invitation = this.$queue.getData('inviterCode') ? this.$queue.getData('inviterCode') : '';
|
|
||||||
let userId = this.$queue.getData('userId') ? this.$queue.getData('userId') : '';
|
|
||||||
|
|
||||||
http.request({
|
|
||||||
url: `app/Login/registerCode`,
|
|
||||||
method: 'post',
|
|
||||||
data: {
|
|
||||||
phone: mobile,
|
|
||||||
wxId: openId,
|
|
||||||
userId: userId,
|
|
||||||
inviterCode: invitation,
|
|
||||||
avatar: openidheadimgurl,
|
|
||||||
userName: openidnickname,
|
|
||||||
msg: code
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.$queue.setData("token", res.token);
|
|
||||||
this.$queue.setData('userId', res.user.userId);
|
|
||||||
this.$queue.setData('userName', res.user.userName);
|
|
||||||
this.$queue.setData('phone', res.user.phone);
|
|
||||||
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
|
|
||||||
'../../static/logo.png');
|
|
||||||
this.$queue.showToast('绑定成功');
|
|
||||||
setTimeout(function() {
|
|
||||||
uni.navigateBack()
|
|
||||||
}, 1000)
|
|
||||||
} else {
|
|
||||||
uni.showModal({
|
|
||||||
showCancel: false,
|
|
||||||
title: '绑定失败',
|
|
||||||
content: res.msg,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
uni.hideLoading();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toLogin() {
|
||||||
|
const {
|
||||||
|
mobile,
|
||||||
|
code
|
||||||
|
} = data;
|
||||||
|
let userId = this.$queue.getData("userId");
|
||||||
|
if (!mobile) {
|
||||||
|
uni.showToast({ title: '请输入手机号', icon: 'none', })
|
||||||
|
} else if (mobile.length !== 11) {
|
||||||
|
uni.showToast({ title: '请输入正确的手机号', icon: 'none', })
|
||||||
|
} else if (!code) {
|
||||||
|
uni.showToast({ title: '请输入验证码', icon: 'none', })
|
||||||
|
} else {
|
||||||
|
uni.showLoading({ title: '正在绑定中...' })
|
||||||
|
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
|
||||||
|
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
|
||||||
|
'';
|
||||||
|
let openidheadimgurl = this.$queue.getData('openidheadimgurl') ? this.$queue.getData(
|
||||||
|
'openidheadimgurl') : '';
|
||||||
|
let invitation = this.$queue.getData('inviterCode') ? this.$queue.getData('inviterCode') : '';
|
||||||
|
let userId = this.$queue.getData('userId') ? this.$queue.getData('userId') : '';
|
||||||
|
|
||||||
|
http.request({
|
||||||
|
url: `app/Login/registerCode`,
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
phone: mobile,
|
||||||
|
wxId: openId,
|
||||||
|
userId: userId,
|
||||||
|
inviterCode: invitation,
|
||||||
|
avatar: openidheadimgurl,
|
||||||
|
userName: openidnickname,
|
||||||
|
msg: code
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$queue.setData("token", res.token);
|
||||||
|
this.$queue.setData('userId', res.user.userId);
|
||||||
|
this.$queue.setData('userName', res.user.userName);
|
||||||
|
this.$queue.setData('phone', res.user.phone);
|
||||||
|
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
|
||||||
|
'../../static/logo.png');
|
||||||
|
this.$queue.showToast('绑定成功');
|
||||||
|
uni.showToast({ title: '绑定成功', icon: 'none', })
|
||||||
|
setTimeout(function() {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
uni.showModal({
|
||||||
|
showCancel: false,
|
||||||
|
title: '绑定失败',
|
||||||
|
content: res.msg,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,34 +128,27 @@
|
||||||
password: password,
|
password: password,
|
||||||
phone: mobile
|
phone: mobile
|
||||||
})
|
})
|
||||||
|
uni.setStorageSync('token', res.token)
|
||||||
if (res.code === 0) {
|
uni.setStorageSync('userId', res.user.userId)
|
||||||
uni.setStorageSync('token', res.token)
|
uni.setStorageSync('userName', res.user.userName)
|
||||||
uni.setStorageSync('userId', res.user.userId)
|
uni.setStorageSync('avatar', res.user.avatar ? res.user.avatar : '../../static/default/avatar.png')
|
||||||
uni.setStorageSync('userName', res.user.userName)
|
uni.setStorageSync('phone', res.user.phone)
|
||||||
uni.setStorageSync('avatar', res.user.avatar ? res.user.avatar : '../../static/default/avatar.png')
|
uni.setStorageSync('invitationCode', res.user.invitationCode)
|
||||||
uni.setStorageSync('phone', res.user.phone)
|
uni.setStorageSync('sex', res.user.sex)
|
||||||
uni.setStorageSync('invitationCode', res.user.invitationCode)
|
uni.setStorageSync('userId', res.user.userId)
|
||||||
uni.setStorageSync('sex', res.user.sex)
|
//设置渠道码
|
||||||
uni.setStorageSync('userId', res.user.userId)
|
if (res.user.qdCode) {
|
||||||
//设置渠道码
|
uni.setStorageSync('qdCode', res.user.qdCode)
|
||||||
if (res.user.qdCode) {
|
|
||||||
uni.setStorageSync('qdCode', res.user.qdCode)
|
|
||||||
}
|
|
||||||
uni.showToast({
|
|
||||||
title: '登录成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
uni.reLaunch({
|
|
||||||
url:'/pages/index/index'
|
|
||||||
})
|
|
||||||
} else{
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: res.msg,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: '登录成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
uni.reLaunch({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,7 @@
|
||||||
if (options.invitation ) { data.invitation = options.invitation }
|
if (options.invitation ) { data.invitation = options.invitation }
|
||||||
|
|
||||||
let res = await commonType(3)
|
let res = await commonType(3)
|
||||||
if (res.code == 0) {
|
data.registerCode = res.value
|
||||||
data.registerCode = res.data.value
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -96,8 +94,9 @@
|
||||||
title: '正在发送验证码...'
|
title: '正在发送验证码...'
|
||||||
})
|
})
|
||||||
let res = await setSendMsg(data.mobile,'login')
|
let res = await setSendMsg(data.mobile,'login')
|
||||||
console.log(res)
|
uni.hideLoading();
|
||||||
if ( res.code == 0 ) {
|
uni.hideToast();
|
||||||
|
if( res ){
|
||||||
data.sending = true;
|
data.sending = true;
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '验证码发送成功请注意查收',
|
title: '验证码发送成功请注意查收',
|
||||||
|
|
@ -109,11 +108,10 @@
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
title: '短信发送失败',
|
title: '短信发送失败',
|
||||||
content: res.msg ? res.msg : '请一分钟后再获取验证码'
|
content: '请一分钟后再获取验证码'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.hideLoading();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
async function getGuize() {
|
async function getGuize() {
|
||||||
let res = await commonType(155)
|
let res = await commonType(155)
|
||||||
this.content = res.data.value
|
this.content = res.value
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel(){
|
function cancel(){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue