|
@@ -2,20 +2,60 @@
|
|
<div class="phone-wrap">
|
|
<div class="phone-wrap">
|
|
<div class="input-content">
|
|
<div class="input-content">
|
|
<div class="input-item">
|
|
<div class="input-item">
|
|
- <input class="input-text" type="tel" placeholder="请输入手机号" value="{{mobile}}" style="placeholder-color: #CCC" onchange="updateMobile"></input>
|
|
|
|
|
|
+ <input
|
|
|
|
+ class="input-text"
|
|
|
|
+ type="tel"
|
|
|
|
+ placeholder="请输入手机号"
|
|
|
|
+ value="{{mobile}}"
|
|
|
|
+ style="placeholder-color: #CCC"
|
|
|
|
+ onchange="updateMobile"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<div class="input-item">
|
|
<div class="input-item">
|
|
- <input class="input-text" type="number" maxlength="6" placeholder="请输入验证码" value="{{code}}" style="placeholder-color: #CCC" onchange="updateMessage"></input>
|
|
|
|
- <text class="send-msg" if="{{!hasSend}}" @click="sendMsg">获取验证码</text>
|
|
|
|
- <text class="send-msg disabled" else>重新获取{{duration}}</text>
|
|
|
|
|
|
+ <input
|
|
|
|
+ class="input-text"
|
|
|
|
+ type="number"
|
|
|
|
+ maxlength="6"
|
|
|
|
+ placeholder="请输入验证码"
|
|
|
|
+ value="{{code}}"
|
|
|
|
+ style="placeholder-color: #CCC"
|
|
|
|
+ onchange="updateMessage"
|
|
|
|
+ />
|
|
|
|
+ <text class="send-msg" if="{{!hasSend}}" @click="sendMsg"
|
|
|
|
+ >获取验证码</text
|
|
|
|
+ >
|
|
|
|
+ <text class="send-msg disabled" else>重新获取{{ duration }}</text>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <input type="button" value="登录绑定手机号" class="bind-button" @click="bindUser"> </input>
|
|
|
|
|
|
+
|
|
|
|
+ <div class="agreement">
|
|
|
|
+ <image
|
|
|
|
+ src="../../assets/imgs/un_checked.png"
|
|
|
|
+ if="{{!checked}}"
|
|
|
|
+ @click="changeStatus()"
|
|
|
|
+ ></image>
|
|
|
|
+ <image
|
|
|
|
+ src="../../assets/imgs/is_checked.png"
|
|
|
|
+ if="{{checked}}"
|
|
|
|
+ @click="changeStatus()"
|
|
|
|
+ ></image>
|
|
|
|
+ <div class="agreement-text">
|
|
|
|
+ <text @click="changeStatus()">我已阅读并同意</text
|
|
|
|
+ ><text class="red" @click="pageChange('Agreement')">用户服务协议</text
|
|
|
|
+ ><text class="red" @click="pageChange('Privacy')">用户隐私政策</text>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <input
|
|
|
|
+ type="button"
|
|
|
|
+ value="登录绑定手机号"
|
|
|
|
+ class="bind-button"
|
|
|
|
+ @click="bindUser"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import it from '../../helper/interface.js';
|
|
import it from '../../helper/interface.js';
|
|
-import { sendCode, userBind} from '../../api/index';
|
|
|
|
|
|
+import { sendCode, userBind } from '../../api/index';
|
|
import router from '@system.router';
|
|
import router from '@system.router';
|
|
import prompt from '@system.prompt';
|
|
import prompt from '@system.prompt';
|
|
import storage from '@system.storage';
|
|
import storage from '@system.storage';
|
|
@@ -26,24 +66,24 @@ export default {
|
|
duration: 120,
|
|
duration: 120,
|
|
mobile: null,
|
|
mobile: null,
|
|
code: null,
|
|
code: null,
|
|
- isOnBind:false,
|
|
|
|
- isOnsend:false,
|
|
|
|
-
|
|
|
|
|
|
+ isOnBind: false,
|
|
|
|
+ isOnsend: false,
|
|
|
|
+ checked: false,
|
|
},
|
|
},
|
|
onInit() {
|
|
onInit() {
|
|
|
|
|
|
},
|
|
},
|
|
async sendMsg() {
|
|
async sendMsg() {
|
|
- if(this.isOnsend){
|
|
|
|
|
|
+ if (this.isOnsend) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
this.isOnsend = true;
|
|
this.isOnsend = true;
|
|
let result = it.validatePhone(this.mobile);
|
|
let result = it.validatePhone(this.mobile);
|
|
if (result) {
|
|
if (result) {
|
|
- let res = await sendCode({ phone: this.mobile }).catch((err)=>{this.isOnsend = false});
|
|
|
|
- if(res){
|
|
|
|
- this.isOnsend = false;
|
|
|
|
- this.countDown();
|
|
|
|
|
|
+ let res = await sendCode({ phone: this.mobile }).catch((err) => { this.isOnsend = false });
|
|
|
|
+ if (res) {
|
|
|
|
+ this.isOnsend = false;
|
|
|
|
+ this.countDown();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
prompt.showToast({
|
|
prompt.showToast({
|
|
@@ -57,6 +97,9 @@ export default {
|
|
updateMessage(e) {
|
|
updateMessage(e) {
|
|
this.code = e.value;
|
|
this.code = e.value;
|
|
},
|
|
},
|
|
|
|
+ changeStatus() {
|
|
|
|
+ this.checked = !this.checked;
|
|
|
|
+ },
|
|
//倒计时
|
|
//倒计时
|
|
countDown() {
|
|
countDown() {
|
|
this.hasSend = true;
|
|
this.hasSend = true;
|
|
@@ -69,8 +112,18 @@ export default {
|
|
}
|
|
}
|
|
}, 1000);
|
|
}, 1000);
|
|
},
|
|
},
|
|
|
|
+ pageChange(page) {
|
|
|
|
+ router.push({
|
|
|
|
+ uri: `/views/${page}`
|
|
|
|
+ })
|
|
|
|
+ },
|
|
//绑定用户
|
|
//绑定用户
|
|
async bindUser() {
|
|
async bindUser() {
|
|
|
|
+ if (!this.checked) {
|
|
|
|
+ return prompt.showToast({
|
|
|
|
+ message: '请先阅读并同意用户服务协议和用户隐私协议'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
if (!this.mobile || !this.code) {
|
|
if (!this.mobile || !this.code) {
|
|
prompt.showToast({
|
|
prompt.showToast({
|
|
message: '请输入手机号和验证码'
|
|
message: '请输入手机号和验证码'
|
|
@@ -83,29 +136,29 @@ export default {
|
|
})
|
|
})
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if(this.isOnBind){
|
|
|
|
|
|
+ if (this.isOnBind) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
this.isOnBind = true;
|
|
this.isOnBind = true;
|
|
let params = {
|
|
let params = {
|
|
phone: this.mobile,
|
|
phone: this.mobile,
|
|
code: this.code,
|
|
code: this.code,
|
|
- version:'2.0'
|
|
|
|
|
|
+ version: '2.0'
|
|
}
|
|
}
|
|
-
|
|
|
|
- let res = await userBind(params).catch((err)=>{this.isOnBind = false;});
|
|
|
|
- if(res){
|
|
|
|
|
|
+
|
|
|
|
+ let res = await userBind(params).catch((err) => { this.isOnBind = false; });
|
|
|
|
+ if (res) {
|
|
this.isOnBind = false;
|
|
this.isOnBind = false;
|
|
await storage.set({ key: "hasLogin", value: 'hasLogin' });
|
|
await storage.set({ key: "hasLogin", value: 'hasLogin' });
|
|
await storage.set({ key: "loginPhone", value: this.mobile });
|
|
await storage.set({ key: "loginPhone", value: this.mobile });
|
|
|
|
|
|
- this.$app.setAppData('backfrom','phone');
|
|
|
|
|
|
+ this.$app.setAppData('backfrom', 'phone');
|
|
prompt.showToast({
|
|
prompt.showToast({
|
|
message: '登录成功!'
|
|
message: '登录成功!'
|
|
})
|
|
})
|
|
- setTimeout(()=>{
|
|
|
|
|
|
+ setTimeout(() => {
|
|
router.back();
|
|
router.back();
|
|
- },1500)
|
|
|
|
|
|
+ }, 1500)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|