Browse Source

init

undefined
lancer 3 years ago
parent
commit
0d9c13a852
4 changed files with 155 additions and 19 deletions
  1. +79
    -9
      pages/login/Setthepassword.vue
  2. +63
    -3
      pages/login/Verification.vue
  3. +4
    -1
      pages/login/index.vue
  4. +9
    -6
      utils/domain.js

+ 79
- 9
pages/login/Setthepassword.vue View File

@@ -1,17 +1,38 @@
<template>
<view>
<view style="width: 100%;height: 180rpx;"></view>
<!-- <view style="width: 100%;height: 180rpx;"></view> -->
<view class="input">
<view class="zcasfdasf">设置密码</view>
<view class="tejHdgasd">设置密码后,就可以使用手机号码与密码登录了~</view>
<view style="margin-top:60rpx" class="cwjs-cells item-flex">
<view class="cwjs-item center">
<!-- <view class="zcasfdasf">设置密码</view>
<view class="tejHdgasd">设置密码后,就可以使用手机号码与密码登录了~</view> -->
<view class="cwjs-cells item-flex" style="margin-top: 80rpx;">
<view class="cwjs-item center" style="margin-left:30rpx;">
<input type="text" v-model="phone" placeholder="请输入手机号码" maxlength="11"
placeholder-style='color:#AAAAAA;' />
</view>
</view>
<view class="cwjs-cells item-flex" style="margin-top:30rpx;">
<view class="cwjs-item center" style="margin-left:30rpx;display: flex;">
<input type="text" v-model="msg" placeholder="请输入验证码" maxlength="4"
placeholder-style='color:#AAAAAA;' />
<view class="mamay">
<view class="sada" v-if="sendAuthCode" style="font-size: 30rpx;" @click="getAuthCode">获取验证码
</view>
<text class="sada" v-if="!sendAuthCode">
重新发送({{ auth_time }})
<!-- <text></text> -->
</text>
</view>
</view>
</view>
<view style="margin-top:30rpx" class="cwjs-cells item-flex">
<view class="cwjs-item center" style="margin-left:30rpx;">
<input class="cwjs-item cwjs-input" v-model="username" password="true" placeholder="请设置6~12位的登录密码"
placeholder-style='color:#AAAAAA' maxlength="12" />
</view>
</view>

</view>
<!-- <view class="button" @click="denglu"><text class="">登录</text></view> -->
<view class="button" @tap="bindWxBLogin">确认</view>
</view>
</template>
@@ -24,14 +45,22 @@
data() {
return {
username: '', //获取到的密码
phone: ''
phone: '',
auth_time: 0,
sendAuthCode: true,
msg: '',
code:''
}
},
onLoad: function(options) {
this.phone = options.username
// this.phone = options.username
},
methods: {
bindWxBLogin() {
if(this.code!=this.msg){
util.showNone("验证码错误");
return false;
}
if (this.username.length < 6) {
util.showNone("密码小于6位,请重试");
return false;
@@ -40,6 +69,7 @@
username: this.phone, //手机号
newpassword: this.username, //密码
}
uni.request({
url: config.service.forgotPassword,
header: {
@@ -61,7 +91,45 @@
}
}
},
//获取验证码
getAuthCode() {
if (this.phone == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'none'
});
return
}
this.code=''
uni.request({
url: config.service.sendCode + "/" + this.phone,
method: "GET",
header: {
'content-type': 'application/json',
},
success: (data) => {
console.log(data)
// 成功地响应会话信息
if (data.data.code == 0) {
util.showSuccess('发送成功');
this.code=data.data.data
this.sendAuthCode = false;
this.auth_time = 60;
var auth_timetimer = setInterval(() => {
this.auth_time--;
if (this.auth_time <= 0) {
this.sendAuthCode = true;
clearInterval(auth_timetimer);
}
}, 1000);
} else {
util.showNone(data.data.msg);
return false;
}
},
})
},
}
};
</script>
@@ -116,8 +184,10 @@
margin: 0 auto;
height: 88rpx;
overflow: hidden;
border-bottom: 1rpx solid #BFC7D3;
border: 1rpx solid #BFC7D3;
position: relative;
border-radius: 12rpx;
padding-left: 20rpx;
}

.center {


+ 63
- 3
pages/login/Verification.vue View File

@@ -46,6 +46,7 @@
<script>
var util = require("../../utils/util.js");
var config = require("../../config");
var WXB_SESSION_LOGIN_DATA = 'weapp_session_login_data';
var app = getApp();
export default {
data() {
@@ -80,14 +81,14 @@
}
if (this.msg.length == 4) {
uni.request({
url: config.service.plogin + '?mobile=SMS@' + this.phonecet + '&code=' + this.msg +
url: config.service.plogin + '?mobile=SMS@' + this.username + '&code=' + this.msg +
'&grant_type=mobile',
method: "POST",
header: {
'Authorization': 'Basic cGlnOnBpZw=='
},
data: {
mobile: 'SMS@' + this.phonecet,
mobile: 'SMS@' + this.username,
code: this.msg,
grant_type: 'mobile'
},
@@ -108,7 +109,7 @@
return false;
}
} else {
util.showNone(data.message);
util.showNone(data.msg);
return false;
}
},
@@ -120,9 +121,68 @@
});
}
},
getUser(){
util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
if (data.user.total==0) {
uni.showToast({
title: '暂无绑定楼盘',
duration: 2000,
icon:"none"
});
return
} else {
let lopan = {
id: data.houseList[0].id,
name: data.houseList[0].propertyName
}
let users=data.user
users.zkProperties=data.houseList
uni.setStorageSync("fendianindex", 0); //写入缓存
uni.setStorageSync("weapp_session_userInfo_data",users); //写入缓存
uni.setStorageSync("buildingID", lopan); //楼盘id写入缓存
uni.switchTab({
url: '/pages/index/index'
});
}
});
},
//获取权限
getMenu(){
uni.request({
url: config.service.getMenu,
method: "POST",
header: {
'content-type': 'application/json',
'Authorization': 'Bearer '+uni.getStorageSync('weapp_session_login_data').token
},
success: (data) => {
let rescor=data.data;
if (rescor.code == 0) {
uni.setStorageSync("weapp_session_Menu_data", rescor.data)
}else{
uni.showToast({
title: rescor.msg,
duration: 2000,
icon:"none"
});
return
}
}
})
},

//获取验证码
getAuthCode() {
if (this.phone == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'none'
});
return
}
uni.request({
url: config.service.sendCode + "/" + this.username,
method: "GET",


+ 4
- 1
pages/login/index.vue View File

@@ -76,8 +76,11 @@
},
//忘记密码
bindpassword() {
// uni.navigateTo({
// url: '/pages/login/Verification?role=2',
// })
uni.navigateTo({
url: '/pages/login/Verification?role=2',
url: '/pages/login/Setthepassword',
})
},
//密码选择


+ 9
- 6
utils/domain.js View File

@@ -1,12 +1,13 @@
// http.js使用

const baseUrl = 'http://39.97.167.65/autoSR/api';// 测试站
// const baseUrl = 'http://39.97.167.65/autoSR/api';// 测试站

// const baseUrl = 'http://8kdmng.natappfree.cc/autoSR/api'; // 佳豪

// const baseUrl = 'http://192.168.31.134:9999/autoSR/api'; // 佳豪
// const baseUrl = 'http://192.168.31.167:9999/autoSR/api'; // 长龙

// const baseUrl = 'https://zanyong.hfju.com/autoSR/api';// 正式
const baseUrl = 'https://zanyong.hfju.com/autoSR/api';// 正式



@@ -16,8 +17,8 @@ const baseUrl = 'http://39.97.167.65/autoSR/api';// 测试站
* 小程序配置文件
*/
// 此处主机域名修改成腾讯云解决方案分配的域名
const host = 'http://39.97.167.65/autoSR/api'; // 测试站
const hosts = 'http://39.97.167.65/'; // 测试站
// const host = 'http://39.97.167.65/autoSR/api'; // 测试站
// const hosts = 'http://39.97.167.65/'; // 测试站

// const host = 'http://192.168.31.134:9999/autoSR/api'; // 佳豪
// const hosts = 'http://192.168.31.134:9999/'; // 佳豪
@@ -25,9 +26,11 @@ const hosts = 'http://39.97.167.65/'; // 测试站
// const host = 'http://8kdmng.natappfree.cc/autoSR/api';
// const hosts = 'http://8kdmng.natappfree.cc/';

// const host = 'http://192.168.31.167:9999/autoSR/api'; // 长龙
// const hosts = 'http://192.168.31.167:9999/'; // 长龙

// const host = 'https://zanyong.hfju.com/autoSR/api';//正式
// const hosts = 'https://zanyong.hfju.com/';//正式
const host = 'https://zanyong.hfju.com/autoSR/api';//正式
const hosts = 'https://zanyong.hfju.com/';//正式





Loading…
Cancel
Save