This commit is contained in:
GaoHao 2025-01-07 10:54:46 +08:00
parent 6290e963e4
commit ecb94ba348
6 changed files with 156 additions and 163 deletions

View File

@ -76,6 +76,11 @@
"style": { "style": {
"navigationBarTitleText": "隐私协议" "navigationBarTitleText": "隐私协议"
} }
}, {
"path": "pages/me/agreement",
"style": {
"navigationBarTitleText": "服务协议"
}
}, },
{ {
"path": "pages/index/search/index", "path": "pages/index/search/index",

View File

@ -19,13 +19,10 @@
</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({
},
data() {
return {
mobile: '', mobile: '',
code: '', code: '',
loginIng: false, loginIng: false,
@ -33,51 +30,52 @@
sendTime: '获取验证码', sendTime: '获取验证码',
count: 60, count: 60,
type: '', 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) => {
if (option.type) {
data.type = option.type
}
})
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
function countDown() {
const { const {
count count
} = this; } = data;
if (count === 1) { if (count === 1) {
this.count = 60; data.count = 60;
this.sendIng = false; data.sendIng = false;
this.sendTime = '获取验证码' data.sendTime = '获取验证码'
} else { } else {
this.count = count - 1; data.count = count - 1;
this.sendIng = true; data.sendIng = true;
this.sendTime = count - 1 + '秒后重新获取'; data.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000); setTimeout(data.countDown.bind(data), 1000);
} }
}, }
sendMsg() {
function sendMsg() {
const { const {
mobile mobile
} = this; } = data;
if (!mobile) { if (!mobile) {
this.$queue.showToast("请输入手机号"); data.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) { } else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号"); data.$queue.showToast("请输入正确的手机号");
} else { } else {
this.$queue.showLoading("正在发送验证码..."); data.$queue.showLoading("正在发送验证码...");
http.request({ http.request({
url: 'app/Login/sendMsg/' + mobile + '/gzg', url: 'app/Login/sendMsg/' + mobile + '/gzg',
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.sendIng = true; data.sendIng = true;
this.$queue.showToast('验证码发送成功请注意查收'); uni.showToast({ title: '验证码发送成功请注意查收', icon: 'none', })
this.countDown(); data.countDown();
} else { } else {
uni.showModal({ uni.showModal({
showCancel: false, showCancel: false,
@ -90,21 +88,22 @@
}) })
} }
}, }
toLogin() {
function toLogin() {
const { const {
mobile, mobile,
code code
} = this; } = data;
let userId = this.$queue.getData("userId"); let userId = this.$queue.getData("userId");
if (!mobile) { if (!mobile) {
this.$queue.showToast("请输入手机号"); uni.showToast({ title: '请输入手机号', icon: 'none', })
} else if (mobile.length !== 11) { } else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号"); uni.showToast({ title: '请输入正确的手机号', icon: 'none', })
} else if (!code) { } else if (!code) {
this.$queue.showToast("请输入验证码"); uni.showToast({ title: '请输入验证码', icon: 'none', })
} else { } else {
this.$queue.showLoading("正在绑定中..."); uni.showLoading({ title: '正在绑定中...' })
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : ''; let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') : let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
''; '';
@ -134,6 +133,7 @@
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar : this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
'../../static/logo.png'); '../../static/logo.png');
this.$queue.showToast('绑定成功'); this.$queue.showToast('绑定成功');
uni.showToast({ title: '绑定成功', icon: 'none', })
setTimeout(function() { setTimeout(function() {
uni.navigateBack() uni.navigateBack()
}, 1000) }, 1000)
@ -147,9 +147,6 @@
uni.hideLoading(); uni.hideLoading();
}); });
} }
},
},
} }
</script> </script>

View File

@ -128,8 +128,6 @@
password: password, password: password,
phone: mobile phone: mobile
}) })
if (res.code === 0) {
uni.setStorageSync('token', res.token) uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId) uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('userName', res.user.userName) uni.setStorageSync('userName', res.user.userName)
@ -142,6 +140,7 @@
if (res.user.qdCode) { if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode) uni.setStorageSync('qdCode', res.user.qdCode)
} }
uni.hideLoading();
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',
icon: 'none' icon: 'none'
@ -149,13 +148,7 @@
uni.reLaunch({ uni.reLaunch({
url:'/pages/index/index' url:'/pages/index/index'
}) })
} else{
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} }
} }

View File

@ -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();
} }
} }

View File

@ -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(){