|
@@ -2,7 +2,7 @@
|
|
<template>
|
|
<template>
|
|
<view />
|
|
<view />
|
|
<!-- 积分确权 -->
|
|
<!-- 积分确权 -->
|
|
- <su-popup :show="selectSocialUsers" type="center" round="10" :isMaskClick="false" showClose @close="close">
|
|
|
|
|
|
+ <su-popup :show="selectSocialUsers" type="center" round="10" :isMaskClick="false">
|
|
<view class="head-nav">
|
|
<view class="head-nav">
|
|
<view class="head-box">
|
|
<view class="head-box">
|
|
<view class="ss-flex ss-m-b-20">
|
|
<view class="ss-flex ss-m-b-20">
|
|
@@ -13,7 +13,8 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<view>
|
|
- <view v-for="user in state.socialUsers" :key="user.username" class="ss-flex" style="padding: 20rpx;margin: 0 auto;width: 520rpx;" @click="selectUser(user.username)">
|
|
|
|
|
|
+ <view v-for="user in state.socialUsers" :key="user.username" class="ss-flex"
|
|
|
|
+ style="padding: 20rpx;margin: 0 auto;width: 520rpx;" @click="selectUser(user.username)">
|
|
<image :src="user.avatar" style="width:100rpx;height:100rpx;border-radius: 50%;margin-right:20rpx" />
|
|
<image :src="user.avatar" style="width:100rpx;height:100rpx;border-radius: 50%;margin-right:20rpx" />
|
|
<view>{{user.username}}</view>
|
|
<view>{{user.username}}</view>
|
|
</view>
|
|
</view>
|
|
@@ -32,19 +33,25 @@
|
|
<uni-forms ref="smsLoginRef" v-model="state.model" :rules="state.rules" validateTrigger="bind"
|
|
<uni-forms ref="smsLoginRef" v-model="state.model" :rules="state.rules" validateTrigger="bind"
|
|
labelWidth="140" labelAlign="center" class="loginUniForm">
|
|
labelWidth="140" labelAlign="center" class="loginUniForm">
|
|
<uni-forms-item name="username" label="用户名" class="loginUniFormItem">
|
|
<uni-forms-item name="username" label="用户名" class="loginUniFormItem">
|
|
- <uni-easyinput placeholder="请输入用户名" v-model="state.username" :inputBorder="false" :clearable="false" @blur="verifyUsername">
|
|
|
|
- <template v-slot:right>
|
|
|
|
- <view v-if="!state.verifyUsername" class="icon"><image style :src="sheep.$url.static('/static/images/shibai.png')" /></view>
|
|
|
|
- <view v-else class="icon"> <image :src="sheep.$url.static('/static/images/chenggong.png')" /></view>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <uni-easyinput placeholder="请输入用户名" v-model="state.username" :inputBorder="false" :clearable="false"
|
|
|
|
+ @blur="verifyUsername">
|
|
|
|
+ <template v-slot:right>
|
|
|
|
+ <view v-if="!state.verifyUsername" class="icon">
|
|
|
|
+ <image style :src="sheep.$url.static('/static/images/shibai.png')" />
|
|
|
|
+ </view>
|
|
|
|
+ <view v-else class="icon">
|
|
|
|
+ <image :src="sheep.$url.static('/static/images/chenggong.png')" />
|
|
|
|
+ </view>
|
|
|
|
+ </template>
|
|
</uni-easyinput>
|
|
</uni-easyinput>
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
<uni-forms-item name="mobile" label="手机号" class="loginUniFormItem ss-p-t-10">
|
|
<uni-forms-item name="mobile" label="手机号" class="loginUniFormItem ss-p-t-10">
|
|
<uni-easyinput placeholder="请输入手机号" v-model="state.model.mobile" :inputBorder="false" type="number">
|
|
<uni-easyinput placeholder="请输入手机号" v-model="state.model.mobile" :inputBorder="false" type="number">
|
|
<template v-slot:right>
|
|
<template v-slot:right>
|
|
-
|
|
|
|
|
|
+
|
|
<button class="ss-reset-button code-btn code-btn-start" :disabled="!state.verifyUsername"
|
|
<button class="ss-reset-button code-btn code-btn-start" :disabled="!state.verifyUsername"
|
|
- :class="{ 'disabled': !state.verifyUsername }" @tap="getSmsCode('smsLogin', state.model.mobile)">
|
|
|
|
|
|
+ :class="{ 'disabled': !state.verifyUsername }"
|
|
|
|
+ @tap="getSmsCode('smsLogin', state.model.mobile)">
|
|
{{ getSmsTimer('smsLogin') }}
|
|
{{ getSmsTimer('smsLogin') }}
|
|
</button>
|
|
</button>
|
|
</template>
|
|
</template>
|
|
@@ -57,7 +64,8 @@
|
|
</uni-easyinput>
|
|
</uni-easyinput>
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
</uni-forms>
|
|
</uni-forms>
|
|
- <view style="display: flex;justify-content: space-between;padding: 40rpx;padding-bottom: 0rpx;padding-bottom: 40rpx">
|
|
|
|
|
|
+ <view
|
|
|
|
+ style="display: flex;justify-content: space-between;padding: 40rpx;padding-bottom: 0rpx;padding-bottom: 40rpx">
|
|
<button class="ss-reset-button login-btn-start" @tap="officialRegister"> 注册 </button>
|
|
<button class="ss-reset-button login-btn-start" @tap="officialRegister"> 注册 </button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -90,10 +98,10 @@
|
|
const smsLoginRef = ref(null);
|
|
const smsLoginRef = ref(null);
|
|
// 数据
|
|
// 数据
|
|
const state = reactive({
|
|
const state = reactive({
|
|
- verifyUsername: false ,
|
|
|
|
- username:'',
|
|
|
|
- openid:'',
|
|
|
|
- socialUsers:[],
|
|
|
|
|
|
+ verifyUsername: false,
|
|
|
|
+ username: '',
|
|
|
|
+ openid: '',
|
|
|
|
+ socialUsers: [],
|
|
loginReqVO: {
|
|
loginReqVO: {
|
|
type: 31,
|
|
type: 31,
|
|
code: "",
|
|
code: "",
|
|
@@ -117,17 +125,23 @@
|
|
function updateIsPopup() {
|
|
function updateIsPopup() {
|
|
isPopup.value = true;
|
|
isPopup.value = true;
|
|
}
|
|
}
|
|
- function updateSocialUsers(openid,socialUsers){
|
|
|
|
|
|
+
|
|
|
|
+ function updateSocialUsers(openid, socialUsers) {
|
|
selectSocialUsers.value = true;
|
|
selectSocialUsers.value = true;
|
|
state.openid = openid;
|
|
state.openid = openid;
|
|
state.socialUsers = socialUsers;
|
|
state.socialUsers = socialUsers;
|
|
- console.log("updateSocialUsers条用了,这时state.socialUsers是",state.socialUsers)
|
|
|
|
|
|
+ console.log("updateSocialUsers条用了,这时state.socialUsers是", state.socialUsers)
|
|
}
|
|
}
|
|
// 选了登录的用户
|
|
// 选了登录的用户
|
|
- async function selectUser(username){
|
|
|
|
|
|
+ async function selectUser(username) {
|
|
console.log(username)
|
|
console.log(username)
|
|
// 提交数据
|
|
// 提交数据
|
|
- const { code } = await AuthUtil.selectUsernameLogin({openId:state.openid ,username});
|
|
|
|
|
|
+ const {
|
|
|
|
+ code
|
|
|
|
+ } = await AuthUtil.selectUsernameLogin({
|
|
|
|
+ openId: state.openid,
|
|
|
|
+ username
|
|
|
|
+ });
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
// closeAuthModal();
|
|
// closeAuthModal();
|
|
// 检测 H5 登录回调
|
|
// 检测 H5 登录回调
|
|
@@ -143,30 +157,35 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
let lastUsername = ref('')
|
|
let lastUsername = ref('')
|
|
- async function verifyUsername(e){
|
|
|
|
|
|
+ async function verifyUsername(e) {
|
|
const username = e.detail.value;
|
|
const username = e.detail.value;
|
|
- if(username == '' || username == lastUsername.value){
|
|
|
|
|
|
+ if (username == '' || username == lastUsername.value) {
|
|
// 为空或者没改东西,不调校验
|
|
// 为空或者没改东西,不调校验
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
lastUsername.value = username
|
|
lastUsername.value = username
|
|
// 提交数据
|
|
// 提交数据
|
|
- const { data } = await AuthUtil.verifyUsername(username);
|
|
|
|
|
|
+ const {
|
|
|
|
+ data
|
|
|
|
+ } = await AuthUtil.verifyUsername(username);
|
|
// false就是已经有这个用户名,不可以用。true是没有,可以改
|
|
// false就是已经有这个用户名,不可以用。true是没有,可以改
|
|
console.log(data)
|
|
console.log(data)
|
|
- if(data){
|
|
|
|
|
|
+ if (data) {
|
|
state.verifyUsername = data
|
|
state.verifyUsername = data
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
state.verifyUsername = data
|
|
state.verifyUsername = data
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- async function officialRegister(){
|
|
|
|
- uni.setStorageSync("linkId",1)
|
|
|
|
|
|
+ async function officialRegister() {
|
|
|
|
+ uni.setStorageSync("linkId", 1)
|
|
const linkId = uni.getStorageSync("linkId");
|
|
const linkId = uni.getStorageSync("linkId");
|
|
- if(!linkId){
|
|
|
|
|
|
+ if (!linkId) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- const { code } = await sheep.$platform.useProvider().register(code,state.loginReqVO.state,linkId,state.username)
|
|
|
|
|
|
+
|
|
|
|
+ const {
|
|
|
|
+ code
|
|
|
|
+ } = await sheep.$platform.useProvider().register(code, state.loginReqVO.state, linkId, state.username)
|
|
// 提交数据
|
|
// 提交数据
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
closeAuthModal();
|
|
closeAuthModal();
|
|
@@ -182,7 +201,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
onBeforeMount(async () => {
|
|
onBeforeMount(async () => {
|
|
const options = {}
|
|
const options = {}
|
|
new URLSearchParams(location.search).forEach((value, key) => {
|
|
new URLSearchParams(location.search).forEach((value, key) => {
|
|
@@ -204,13 +223,13 @@
|
|
|
|
|
|
if (event === 'login') { // 场景一:登录
|
|
if (event === 'login') { // 场景一:登录
|
|
const res = await sheep.$platform.useProvider().login(code, state)
|
|
const res = await sheep.$platform.useProvider().login(code, state)
|
|
- console.log("login.vue的res",res)
|
|
|
|
|
|
+ console.log("login.vue的res", res)
|
|
|
|
|
|
- if (res.data.socialUsers != null){
|
|
|
|
- updateSocialUsers(res.data.openid,res.data.socialUsers)
|
|
|
|
|
|
+ if (res.data.socialUsers != null) {
|
|
|
|
+ updateSocialUsers(res.data.openid, res.data.socialUsers)
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- } else if (event === 'register') {
|
|
|
|
|
|
+ } else if (event === 'register') {
|
|
updateIsPopup()
|
|
updateIsPopup()
|
|
return false
|
|
return false
|
|
} else if (event === 'bind') { // 场景二:绑定
|
|
} else if (event === 'bind') { // 场景二:绑定
|
|
@@ -233,15 +252,17 @@
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
- .icon{
|
|
|
|
- display:flex;
|
|
|
|
|
|
+ .icon {
|
|
|
|
+ display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
- margin-right:7rpx
|
|
|
|
|
|
+ margin-right: 7rpx
|
|
}
|
|
}
|
|
- .icon image{
|
|
|
|
- width:35rpx;
|
|
|
|
- height:35rpx;
|
|
|
|
|
|
+
|
|
|
|
+ .icon image {
|
|
|
|
+ width: 35rpx;
|
|
|
|
+ height: 35rpx;
|
|
}
|
|
}
|
|
|
|
+
|
|
@keyframes title-animation {
|
|
@keyframes title-animation {
|
|
0% {
|
|
0% {
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|