123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- <template>
- <view class="section">
- <!-- <view class="bg"><image src="static/login-bg.png.png" style="width:64rpx;height:64rpx"></image></view> -->
-
- <view class="text-area content">
- <text class="title">智慧消防</text>
- </view>
- <form class="padding-lg flex flex-direction">
- <view class="login-box shadow ">
- <view class="phone-box">
- <input type="text" placeholder="请输入手机号码" onfocus="this.placeholder=''" v-model="phone">
- <span class="icon iconfont left-icon"></span>
- <span class="icon iconfont right-icon"></span>
- </view>
- <view class="password-box">
- <input type="text" placeholder="请输入验证码" v-model="verify">
- <text class="icon iconfont left-icon"></text>
- <view @click="getVerifyCode">
- <text class="right-icon verify">{{!codeTime?'获取验证码':codeTime+'s'}}</text>
- </view>
- </view>
- <view class="btn-area">
- <button class="submit" @click="submitRes">提 交 </button>
- </view>
- </view>
- </form>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- codeTime: 0,
- phone: '',
- verify: '',
- // VerificationCodeOne: ''
- }
- },
-
- onLoad(option) {
- // if(option.flag){
-
-
- // }else{
- // //this.init()
-
- // }
- uni.setNavigationBarColor({
- frontColor: "#ffffff", //文字颜色
- backgroundColor: "#4866DF", //底部背景色
- })
-
- },
- methods: {
-
-
-
- // async init(){
- // window.location.href=this.$BASE_URL+"Login/getFirst1"
- // },
-
-
- //点击获取验证码
- getVerifyCode() {
- if (!this.phone) {
- uni.showToast({
- title: "请输入手机号码...",
- icon: "none"
- });
- return
- }
- if (!/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(this.phone)) {
- uni.showToast({
- title: "请输入正确的手机号码...",
- icon: "none"
- });
- return
- }
- this.getVerifyData({
- "phone": this.phone
- })
-
- //
- if (this.codeTime > 0) {
- uni.showToast({
- title: '不能重复获取',
- icon: "none"
- });
- return;
- } else {
- this.codeTime = 60
- let timer = setInterval(() => {
- this.codeTime--;
- if (this.codeTime < 1) {
- clearInterval(timer);
- this.codeTime = 0
- }
- }, 1000)
- }
- },
-
- //点击提交按钮
- submitRes() {
- if (!this.phone) {
- uni.showToast({
- title: "请输入手机号码...",
- icon: "none"
- });
- return
- }
- if (!/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(this.phone)) {
- uni.showToast({
- title: "请输入正确的手机号码...",
- icon: "none"
- });
- return
- }
- if (!this.verify) {
- uni.showToast({
- title: "请输入验证码...",
- icon: "none"
- });
- return
- }
- this.getData({
- "phone": this.phone,
- "VerificationCode": this.verify,
- // "VerificationCodeOne": this.VerificationCodeOne
- })
- },
-
- async getVerifyData(params = {}) {
- // alert(1)
- const res = await this.$myRequest2({
- url: 'Login/getVerificationCode',
- data: params
- })
- // this.VerificationCodeOne = eval('(' + res.data + ')').data[0].VerificationCode
- },
-
- async getData(params = {}) {
- const res = await this.$myRequest2({
- url: 'Login/setSignUp',
- data: params
- })
- uni.setStorageSync("token", res.data.data);
- if (res.data.flag == true) {
- uni.reLaunch({
- url: '/pages/index/index'
- });
- } else {
- }
-
- },
- }
- }
- </script>
- <style>
- .section {
- height: 400rpx;
- background-image: url(../../static/login-bg.png);
- background-size: cover;
- background-repeat: no-repeat;
- }
- .bg{
- width:100%;
- height:400rpx;
- position: absolute;
- z-index: 0;
- }
- .content {
- height: 434rpx;
- text-align: center;
- position: relative;
- }
- .login-box {
- height: 600rpx;
- position: relative;
- top: -150rpx;
- background: #fff;
- border-radius: 30rpx;
- padding: 100rpx 20rpx;
- }
- .shadow {
- box-shadow: 0px 2px 4px rgb(26 26 26 / 10%);
- }
- .title {
- position: absolute;
- color: #fff;
- font-size: 60rpx;
- bottom: 180rpx;
- display: block;
- width: 100%;
- }
- input,
- button {
- width: 100%;
- height: 100rpx;
- line-height: 100rpx;
- opacity: 1;
- border: 1px solid #dbdbdb;
- border-radius: 100rpx;
- background: #fff;
- coloe: #333;
- margin: 40rpx 0;
- font-size: 34rpx;
- }
- input {
- text-indent: 100rpx;
- }
- .submit {
- background: #4074E7;
- color: #fff
- }
- .phone-box,
- .password-box {
- position: relative;
- }
- .password-box .verify {
- font-size: 30rpx;
- color: #999999
- }
- .left-icon {
- position: absolute;
- left: 48rpx;
- top: 50%;
- margin-top: -20rpx;
- line-height: 100%;
- font-size: 40rpx;
- color: #7A7A7A
- }
- .right-icon {
- position: absolute;
- right: 48rpx;
- top: 50%;
- margin-top: -20rpx;
- line-height: 100%;
- font-size: 40rpx;
- }
- .right-icon.verify {
- margin-top: -10rpx;
- color: #4074E7
- }
- .iconfont {
- color: #999
- }
- </style>
|