|
@@ -9,9 +9,10 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="loginForm">
|
|
|
+ <!-- #ifdef H5 -->
|
|
|
<u--form labelPosition="left" :model="model" :rules="rules" ref='model'>
|
|
|
<u-form-item label="" prop="mobile">
|
|
|
- <u--input clearable shape='circle' placeholder="请输入手机号" v-model="model.mobile">
|
|
|
+ <u--input clearable shape='circle' placeholder="请输入手机号" v-model="model.mobile">
|
|
|
<view class="" style="" slot='prefix'>
|
|
|
<image class="icon" src="@/static/login/icon_login_account.png" mode=""></image>
|
|
|
</view>
|
|
@@ -29,19 +30,19 @@
|
|
|
</u-form-item>
|
|
|
</u--form>
|
|
|
<u-button @click='loginFn' class='loginBtn' type="primary" shape="circle" size="" text="登录"></u-button>
|
|
|
+ <!-- #endif -->
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
+ <u-button type="primary" size="large" shape="circle" text="手机号快捷登录" open-type="getPhoneNumber"
|
|
|
+ @getphonenumber="getPhoneNumber">
|
|
|
+ </u-button>
|
|
|
+ <!-- #endif -->
|
|
|
</view>
|
|
|
- <zjDialogVerification
|
|
|
- ref="verification"
|
|
|
- :isShow="isShowCodeDialog"
|
|
|
- :top="codeObj.yHeight"
|
|
|
- :bgImg="codeObj.bigImage"
|
|
|
- :maskImg="codeObj.smallImage"
|
|
|
- :isSuccess="codeObj.isSuccess"
|
|
|
- :isFail="codeObj.isFail"
|
|
|
- @close="isShowCodeDialog = false"
|
|
|
- @refresh="refresh"
|
|
|
- @finish="finish">
|
|
|
- </zjDialogVerification>
|
|
|
+ <!-- #ifdef H5 -->
|
|
|
+ <zjDialogVerification ref="verification" :isShow="isShowCodeDialog" :top="codeObj.yHeight" :bgImg="codeObj.bigImage"
|
|
|
+ :maskImg="codeObj.smallImage" :isSuccess="codeObj.isSuccess" :isFail="codeObj.isFail"
|
|
|
+ @close="isShowCodeDialog = false" @refresh="refresh" @finish="finish">
|
|
|
+ </zjDialogVerification>
|
|
|
+ <!-- #endif -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -49,20 +50,20 @@
|
|
|
import zjDialogVerification from "@/components/zj-dialog-verification.vue";
|
|
|
import api from '@/common/http/'
|
|
|
export default {
|
|
|
- components:{
|
|
|
+ components: {
|
|
|
zjDialogVerification
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isShowCodeDialog:false,
|
|
|
+ isShowCodeDialog: false,
|
|
|
codeObj: {
|
|
|
- bigImage: '',
|
|
|
- smallImage: '',
|
|
|
- key: '',
|
|
|
- yHeight: '',
|
|
|
- isSuccess: false,
|
|
|
- isFail: false,
|
|
|
- },
|
|
|
+ bigImage: '',
|
|
|
+ smallImage: '',
|
|
|
+ key: '',
|
|
|
+ yHeight: '',
|
|
|
+ isSuccess: false,
|
|
|
+ isFail: false,
|
|
|
+ },
|
|
|
model: {
|
|
|
mobile: '',
|
|
|
code: '',
|
|
@@ -84,22 +85,43 @@
|
|
|
countDown: 0,
|
|
|
}
|
|
|
},
|
|
|
- watch:{
|
|
|
- countDown(){
|
|
|
- if(this.countDown>0){
|
|
|
- setTimeout(()=>{
|
|
|
+ watch: {
|
|
|
+ countDown() {
|
|
|
+ if (this.countDown > 0) {
|
|
|
+ setTimeout(() => {
|
|
|
this.countDown--
|
|
|
- },1000)
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- async getImgV(){
|
|
|
+ // 获取手机号
|
|
|
+ getPhoneNumber(e) {
|
|
|
+ if (!e.detail.iv) {
|
|
|
+ return this.$toast('获取手机号失败');
|
|
|
+ }
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: (loginRes) => {
|
|
|
+ api.get('/wechat/user/auth', {
|
|
|
+ code: loginRes.code,
|
|
|
+ phoneCode: e.detail.code,
|
|
|
+ }).then(res => {
|
|
|
+ this.$store.commit("set_token", res.data.token)
|
|
|
+ this.$store.commit("set_openId", res.data.openId)
|
|
|
+ this.$store.commit("set_name", res.data.name)
|
|
|
+ this.$store.commit("set_avatar", res.data.avatar)
|
|
|
+ this.$navToPage("/pages/index/index")
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async getImgV() {
|
|
|
try {
|
|
|
- if(this.countDown==0){
|
|
|
- this.$refs.model.validateField("mobile",(res)=>{
|
|
|
- if(!res.length){
|
|
|
- api.get('/admin/user/getVerifi').then(res=>{
|
|
|
+ if (this.countDown == 0) {
|
|
|
+ this.$refs.model.validateField("mobile", (res) => {
|
|
|
+ if (!res.length) {
|
|
|
+ api.get('/admin/user/getVerifi').then(res => {
|
|
|
this.codeObj = res.data;
|
|
|
this.isShowCodeDialog = true
|
|
|
})
|
|
@@ -108,15 +130,15 @@
|
|
|
}
|
|
|
} catch (e) {}
|
|
|
},
|
|
|
- refresh(){
|
|
|
+ refresh() {
|
|
|
this.getImgV()
|
|
|
},
|
|
|
- finish(val){
|
|
|
- api.postJson('/admin/user/smsCode',{
|
|
|
- mobile:this.model.mobile,
|
|
|
- code:this.codeObj.key,
|
|
|
- codeValue:parseInt(val),
|
|
|
- }).then(res=>{
|
|
|
+ finish(val) {
|
|
|
+ api.postJson('/admin/user/smsCode', {
|
|
|
+ mobile: this.model.mobile,
|
|
|
+ code: this.codeObj.key,
|
|
|
+ codeValue: parseInt(val),
|
|
|
+ }).then(res => {
|
|
|
this.isShowCodeDialog = false
|
|
|
this.codeObj = {
|
|
|
bigImage: '',
|
|
@@ -193,4 +215,4 @@
|
|
|
background: linear-gradient(135deg, #7fdaff 0%, #6da7ff 100%);
|
|
|
border-radius: 50rpx;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|