|
- <template>
- <view>
- <view class="head">
- <image class="head-immg" src="https://qufang.oss-cn-beijing.aliyuncs.com/zkgj/xcx/login.png" mode=""></image>
- </view>
- <view class="input">
- <view class="cwjs-cells item-flex">
- <view class="cwjs-item center">
- <image src="https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/user.png" class="logo_input">
- </image>
- <input class="cwjs-item cwjs-input" style="font-size: 36rpx;" v-model="username" placeholder="请输入账号名" type="number" maxlength="11" placeholder-style="color:#AAAAAA"/>
- </view>
- </view>
- <view class="cwjs-cells item-flex" style="margin-top:13rpx;">
- <view class="cwjs-item center">
- <image src="https://qufang.oss-cn-beijing.aliyuncs.com/channelHelper/lock.png" class="logo_input">
- </image>
- <input class="cwjs-item cwjs-input" style="font-size: 36rpx;" placeholder="请输入密码" placeholder-style="color:#AAAAAA" type="password" v-model="password" maxlength="16" v-if="passwordType"/>
- <input class="cwjs-item cwjs-input" style="font-size: 36rpx;" placeholder="请输入密码" placeholder-style="color:#AAAAAA" maxlength="16" v-model="password" v-else/>
- </view>
- <view class="imagesBox" @tap="changeBindPassword">
- <image v-if="passwordType==false" src="../../static/images/zhengkai.png" class="images" mode="scaleToFill"></image>
- <image v-if="passwordType==true" src="../../static/images/bishang.png" class="images" mode="scaleToFill"></image>
- </view>
- </view>
- <view class="textbox">
- <view class="textbox-1" @tap="bindVerification">验证码登录</view>
- <view class="textbox-2"></view>
- <view class="textbox-11" @tap="bindpassword">忘记密码</view>
- </view>
- </view>
- <view class="button" @tap="bindWxBLogin">立即登录</view>
- </view>
- </template>
-
- <script>
- var util = require("../../utils/util.js");
- var config = require("../../config");
- var app = getApp();
- var WXB_SESSION_LOGIN_DATA = 'weapp_session_login_data';
- export default {
- data() {
- return {
- username: '',//18831048327 ,18888888800
- password: '',//123456
- passwordType: true,
- agreeChecked: true
- };
- },
- onLoad: function(options) {
- uni.hideToast();
- },
- methods: {
- //验证码登录
- bindVerification() {
- uni.navigateTo({
- url: '/pages/login/Verification?role=1',
- })
- },
- //忘记密码
- bindpassword() {
- uni.navigateTo({
- url: '/pages/login/Verification?role=2',
- })
- },
- //密码选择
- changeBindPassword: function(e) {
- this.passwordType=!this.passwordType;
- },
- //登录
- bindWxBLogin: function(e) {
- util.showBusy('正在登录...');
- var that = this;
- if (this.username == '') {
- util.showNone("请输入账号名");
- return false;
- }
- if (this.password == '') {
- util.showNone("请输入密码");
- return false;
- }
- var loginParams = {
- loginName: this.username,
- password: this.password
- };
- // 请求服务器登录地址,获得会话信息
- uni.request({
- url: config.service.login,
- header: {
- 'content-type': 'application/json'
- },
- method: "POST",
- data: loginParams,
- success: function(result) {
- var data = result.data;
- //console.log("登陆信息", data);
- if (data && data.code == 10000) {
- var res = data.data;
- if (res) {
- var data = {
- 'token': res
- };
- uni.setStorageSync(WXB_SESSION_LOGIN_DATA, data); //写入缓存
- that.getMenu()
- that.getUser();
- util.showSuccess('登录成功');
- } else {
- util.showNone("账号名或密码错误,请重试");
- return false;
- }
- // 没有正确响应会话信息
- } else {
- util.showNone(data.message);
- return false;
- }
- },
- // 响应错误
- fail: function(loginResponseError) {
- util.showNone("网络异常,请重试");
- return false;
- }
- });
- },
- getUser(){
- util.getRequestPromise(config.service.getUser, {}, false, "GET").then(data => {
- if (data.zkProperties) {
-
- } else {
- data.zkProperties = [{
- id: "",
- propertyName: ''
- }]
- }
- let lopan = {
- id: data.zkProperties[0].id,
- name: data.zkProperties[0].propertyName
- }
- uni.setStorageSync("fendianindex", 0); //写入缓存
- uni.setStorageSync("weapp_session_userInfo_data", data); //写入缓存
- uni.setStorageSync("buildingID", lopan); //项目id写入缓存
- uni.switchTab({
- url: '/pages/index/index'
- });
- });
- },
- getMenu(){
- this.$u.get("/user/getMenu").then(data => {
- uni.setStorageSync("weapp_session_Menu_data", data)
- })
- }
- }
- };
- </script>
- <style lang="scss">
- .cwjs-logo {
- display: block;
- width: 219rpx;
- height: 158rpx;
- margin: 54rpx auto 66rpx;
- }
-
- .cwjs-tips {
- font-size: 24rpx;
- padding: 80rpx 0;
- color: #8a8a8a;
- }
-
- .cwjs-form {
- position: relative;
- margin: 0;
- background-color: #fff;
- border-radius: 10px;
- padding: 20rpx 40rpx 113rpx;
- }
-
- .cwjs-cells {
- width: 569rpx;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- margin: 0 auto;
- height: 88rpx;
- overflow: hidden;
- border-bottom: 1rpx solid #BFC7D3;
- position: relative;
- }
-
- .center {
- flex: 1;
- }
-
- .cwjs-input {
- height: 48rpx;
- line-height: 48rpx;
- padding: 23rpx 23rpx 23rpx 78rpx;
- font-size: 28rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- color: #000;
- }
-
- .images {
- display: block;
- width: 40rpx;
- height: 21rpx;
- margin-right: 30rpx;
- margin-top: 33.5rpx;
- }
-
- .mod-btn {
- position: absolute;
- bottom: -80rpx;
- left: 50%;
- margin-left: -80rpx;
- }
-
-
-
-
- /* 头部 */
-
- .head {
- width: 750rpx;
- height: 500rpx;
- position: relative;
- .head-immg{
- width: 118rpx;
- height: 61rpx;
- position: absolute;
- top: 300rpx;
- left: 100rpx;
- }
- }
-
-
- .logo {
- width: 248upx;
- height: 248upx;
- display: block;
- position: absolute;
- top: 134rpx;
- left: 240.5rpx;
- }
-
- /* 输入框 */
- .input {
- width: 100%;
- height: auto;
- padding: 0 105rpx;
- box-sizing: border-box;
- }
-
- .logo_input {
- width: 34rpx;
- height: 38rpx;
- position: absolute;
- top: 25rpx;
- left: 0;
- }
-
- /* 登录 */
- .button {
- width: 630rpx;
- height: 86rpx;
- background: #2671E2;
- box-shadow: 0px 2rpx 20rpx 0px rgba(38, 113, 226, 0.5);
- border-radius: 49rpx;
- text-align: center;
- line-height: 89rpx;
- color: #fff;
- margin: 0 auto;
- margin-top: 239rpx;
- font-size: 34rpx;
- }
-
- .footer {
- width: 100%;
- height: 157rpx;
- position: absolute;
- bottom: 0;
- left: 0;
- }
-
- .imagesBox {
- width: 80rpx;
- height: 88rpx;
- }
-
-
-
- .login {
- text-decoration: underline;
- text-align: center;
- margin-top: 40px;
- color: #88909E;
- font-size: 28rpx;
- }
-
- .textbox {
- width: 569rpx;
- display: flex;
- margin-top: 40rpx;
- }
-
- .textbox-1 {
- width: 30%;
- font-size: 30rpx;
- color: #999999;
- }
-
- .textbox-11 {
- width: 30%;
- text-align: right;
- font-size: 30rpx;
- color: #999999;
- }
-
- .textbox-2 {
- width: 40%;
- }
- </style>
|