|
|
@@ -1,22 +1,10 @@
|
|
|
<template>
|
|
|
<view class="app-content">
|
|
|
<view>
|
|
|
- <form @submit="formSubmit">
|
|
|
+ <form>
|
|
|
<view class="module-com input-line-wrap">
|
|
|
- <view class="prompt-text" style="padding-top:20upx;margin-bottom:20upx;font-size:30upx;" >按以下操作进行登录:</view>
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title" style="width:120upx;">昵称</view>
|
|
|
- <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入昵称" maxlength="50" type="text" />
|
|
|
- </tui-list-cell>
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
- <view class="tui-title" style="width:120upx;">手机号</view>
|
|
|
- <view style="width:400upx;verticle-align:middle">
|
|
|
- <button class="admin-button-com blue middle" style="border:none;" open-type="getPhoneNumber" @getphonenumber="getWxMobile" >点击自动填写</button>
|
|
|
- <text style="margin-left:5upx;">{{form.mobile}}</text>
|
|
|
- </view>
|
|
|
- </tui-list-cell>
|
|
|
- <view class="btn-wrap">
|
|
|
- <button class="admin-button-com blue big" style="border:none;" formType="submit">登录</button>
|
|
|
+ <view class="btn-wrap" style="margin-top:100upx;">
|
|
|
+ <button class="admin-button-com blue big" style="border:none;" open-type="getPhoneNumber" @getphonenumber="getWxMobile" >手机号一键登录</button>
|
|
|
</view>
|
|
|
<view style="float:right;font-size:30upx;margin-right:40upx;color:#333333;" @click="accountLogin()"><text>使用账号密码登录</text></view>
|
|
|
</view>
|
|
|
@@ -38,8 +26,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
form: {
|
|
|
- mobile: "",
|
|
|
- name: ""
|
|
|
+ mobile: ""
|
|
|
},
|
|
|
needBack:0
|
|
|
};
|
|
|
@@ -73,47 +60,25 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- formSubmit(e) {
|
|
|
- let rules = [
|
|
|
- {
|
|
|
- name: "mobile",
|
|
|
- rule: ["required"],
|
|
|
- msg: ["请填写手机号"]
|
|
|
- },
|
|
|
- {
|
|
|
- name: "name",
|
|
|
- rule: ["required"],
|
|
|
- msg: ["请填写昵称"]
|
|
|
- }
|
|
|
- ]
|
|
|
- let formData = this.form;
|
|
|
- let checkRes = form.validation(formData, rules);
|
|
|
- if (!checkRes) {
|
|
|
- this.confirmFn();
|
|
|
- } else {
|
|
|
- this.$msg(checkRes);
|
|
|
- }
|
|
|
- },
|
|
|
getWxMobile(e) {
|
|
|
+ let that = this
|
|
|
if (e.detail.errMsg === "getPhoneNumber:ok") {
|
|
|
- let currentMiniOpenId = uni.getStorageSync('miniOpenId')
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('miniOpenId')
|
|
|
getWxPhone({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
|
|
|
-
|
|
|
- if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId == 1){
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '网络异常,请重试一次',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- this.form.mobile = subRes.data.mobile
|
|
|
- uni.showToast({ title:'获取成功',icon: "success" })
|
|
|
+ if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId == 1){
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '网络异常,请重试一次',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.form.mobile = subRes.data.mobile
|
|
|
+ that.confirmFn()
|
|
|
})
|
|
|
} else {
|
|
|
this.$msg("获取手机失败");
|