| | |
| | | data: { |
| | | phone: '', |
| | | password: '', |
| | | checked: false, |
| | | imageWidth: 100, |
| | | imageHeight: 100, |
| | | inputViewWidth: 100, |
| | | inputViewHeight: 100, |
| | | inputWidth: 100, |
| | | inputHeight: 100, |
| | | |
| | | userInfo: {}, |
| | | |
| | | jsCode: null, |
| | | canIUse: wx.canIUse('button.open-type.getUserInfo'), |
| | | |
| | | LogoUrl: Constant.Assets.Login.LogoUrl, |
| | | BackgroupImageUrl: Constant.Assets.Login.BackgroupImageUrl, |
| | | |
| | | isShowPwd:false,//是否显示密码 |
| | | isShowPwd: false, //是否显示密码 |
| | | m_SoftWareVersion: Constant.SoftWareVersion |
| | | }, |
| | | |
| | | // 打电话 |
| | |
| | | password: e.detail.value |
| | | }) |
| | | }, |
| | | // 记住密码框 |
| | | rememberPwd(e) { |
| | | this.data.checked = !this.data.checked |
| | | this.setData({ |
| | | checked: this.data.checked |
| | | }) |
| | | }, |
| | | // 获取输入电话号码 |
| | | phoneInput: function (e) { |
| | | this.setData({ |
| | |
| | | }) |
| | | }, |
| | | //清除账号 |
| | | clearnAccount(){ |
| | | clearnAccount() { |
| | | this.setData({ |
| | | phone: "" |
| | | }) |
| | | }, |
| | | //显示密码 |
| | | changePwdView(){ |
| | | if(this.data.password == ""){ |
| | | changePwdView() { |
| | | if (this.data.password == "") { |
| | | return |
| | | } |
| | | this.data.isShowPwd = !this.data.isShowPwd |
| | | this.setData({ |
| | | isShowPwd:this.data.isShowPwd |
| | | isShowPwd: this.data.isShowPwd |
| | | }) |
| | | }, |
| | | //获取用户登录信息 |
| | |
| | | let promise = new Promise((resolve, reject) => { |
| | | wx.login({ |
| | | success: function (res) { |
| | | // console.log(res,48) |
| | | // console.log(res,48) |
| | | if (res.code) { |
| | | resolve(res); |
| | | } else { |
| | |
| | | //演示账户 |
| | | loginByDemo: function (jsCode) { |
| | | let that = this; |
| | | |
| | | var userInfo = this.data.userInfo; |
| | | userInfo.EmployeeID = Constant.Assets.Login.DemoEmployeeID; //演示账户 |
| | | userInfo.CorpID = Constant.CorpID; |
| | |
| | | //真实用户 |
| | | loginByReal: function (jsCode) { |
| | | let that = this; |
| | | |
| | | var userInfo = this.data.userInfo; |
| | | var sysInfo = app.globalData.sysInfo; |
| | | // console.log('打印userInfo', userInfo) |
| | | wx.showToast({ |
| | | title: '登陆中', |
| | | title: '登录中', |
| | | icon: "loading", |
| | | duration: 3000 |
| | | }); |
| | | // let data={ |
| | | // SoftType:Constant.SoftType, |
| | | // SoftTag:Constant.SoftTag, |
| | | // LoginName: this.data.phone, |
| | | // LoginPwd: this.data.password, |
| | | // CorpID: Constant.CorpID, |
| | | // WxCode: jsCode, |
| | | // UJsCode: jsCode, //是否就是jsCode有待确认 |
| | | // UAvatarUrl: userInfo == null ? "" : userInfo.avatarUrl, |
| | | // UCity: userInfo == null ? "" : userInfo.city, |
| | | // UProvince: userInfo == null ? "" : userInfo.province, |
| | | // UNickName: userInfo == null ? "" : userInfo.nickName, |
| | | // UGender: userInfo == null ? "" : userInfo.gender + "", |
| | | // SBrand: sysInfo.brand, |
| | | // SModel: sysInfo.model, |
| | | // SPlatform: sysInfo.platform, |
| | | // SVersion: sysInfo.version |
| | | // } |
| | | let data={ |
| | | LoginName: this.data.phone, |
| | | LoginPwd: this.data.password, |
| | | Software:Constant.Software |
| | | let data = { |
| | | LoginName: that.data.phone, |
| | | LoginPwd: that.data.password, |
| | | Software: Constant.Software |
| | | } |
| | | // console.log(JSON.stringify(data),110) |
| | | var post_url = Constant.BASE_AUTH_URL + "Auth/User/Login/LoginSoftwareStandardBySystemAccount@V1.0"; |
| | | wx.request({ |
| | | url: post_url, |
| | |
| | | fail: function (err) { //请求失败 |
| | | wx.hideToast(); |
| | | wx.showModal({ |
| | | content: '网络信号不好', |
| | | content: err, |
| | | showCancel: false, |
| | | confirmColor: "#39b5de" |
| | | }); |
| | | }, |
| | | success: function (res) { |
| | | // console.log(res,123) |
| | | wx.hideToast(); |
| | | |
| | | var result = res.data; |
| | | // console.log(result); |
| | | if (result.Code != 0) { |
| | | wx.showModal({ |
| | | content: "账号密码不正确", |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | var return_data = result.Data; |
| | | if (return_data.Status != 0) { |
| | | wx.showModal({ |
| | |
| | | }); |
| | | return; |
| | | } |
| | | let Token = return_data.Token |
| | | let Token = return_data.AccessToken |
| | | let RefreshToken = return_data.RefreshToken |
| | | let isNeedToken = false //是否需要Token 当Token失效的时候 判断是否跳转登录 |
| | | if(Token){ |
| | | if (Token) { |
| | | isNeedToken = true |
| | | } |
| | | |
| | | let Checked = {} |
| | | if (that.data.checked) { |
| | | Checked = { |
| | | phone: that.data.phone, |
| | | password: that.data.password, |
| | | checked: that.data.checked |
| | | } |
| | | } |
| | | let ExpreTime = new Date().getTime() //获取当前时间戳 |
| | | |
| | | wx.setStorageSync('AccountInfo', Checked) |
| | | wx.setStorageSync('AccessToken', { |
| | | Token:Token, |
| | | ExpreTime:ExpreTime, |
| | | isNeedToken:isNeedToken |
| | | Token: Token, |
| | | RefreshToken: RefreshToken, |
| | | ExpreTime: ExpreTime, |
| | | isNeedToken: isNeedToken, |
| | | }) |
| | | |
| | | var return_user = return_data.User; |
| | | //console.log(return_user); |
| | | |
| | | userInfo.ID = return_user.ID |
| | | userInfo.WxUserCode = return_user.LastLoginWxUserCode; |
| | | userInfo.EmployeeID = return_user.EmployeeID; //使用员工ID |
| | | userInfo.CorpID = return_user.CorpID; |
| | | userInfo.RealName = return_user.RealName; |
| | | userInfo.Telphone = return_user.Telphone; |
| | | //console.log(userInfo); |
| | | |
| | | userInfo.CorpID = return_user.LoginAccount.ID; |
| | | userInfo.RealName = return_user.Name; |
| | | userInfo.phone = that.data.phone |
| | | userInfo.password = that.data.password |
| | | that.loginSuccessCb(userInfo); |
| | | } |
| | | }); |
| | |
| | | //登录成功 |
| | | loginSuccessCb: function (userInfo) { |
| | | var that = this; |
| | | //console.log(userInfo,184) |
| | | that.setData({ |
| | | userInfo: userInfo |
| | | }); |
| | | // |
| | | //if (wx.getStorageSync("LoginUserInfo")) { |
| | | // app.globalData.userInfo = userInfo; |
| | | //} |
| | | wx.setStorageSync("LoginUserInfo", userInfo); |
| | | app.globalData.userInfo = userInfo; |
| | | wx.showToast({ |
| | |
| | | wx.switchTab({ |
| | | url: '../../workDesktop/index/index', |
| | | }) |
| | | |
| | | // var pages = getCurrentPages(); |
| | | // if (pages.length >= 2) { |
| | | // //var currPage = pages[pages.length - 1]; //当前页面 |
| | | // var prevPage = pages[pages.length - 2]; //返回上一个页面 |
| | | // //console.log(prevPage.route) |
| | | // if (prevPage) { |
| | | // var fn = prevPage.refreshUserInfo; |
| | | // if (typeof fn == "function") |
| | | // fn(); |
| | | // wx.navigateBack(); |
| | | // } else { |
| | | // wx.navigateTo({ |
| | | // url: "/workDestop/index/index" |
| | | // }); |
| | | // } |
| | | // } else { |
| | | // wx.navigateBack(); |
| | | // } |
| | | app.onStartAlarm() |
| | | }, |
| | | //点击真实用户登录按钮 |
| | | tapBindUserReal: function (e) { |
| | | // console.log(e) |
| | | |
| | | let that = this; |
| | | |
| | | if (this.data.phone.length < 0 || this.data.password.length < 0) { |
| | | wx.showToast({ |
| | | title: '用户名或密码不能为空够!', |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (this.data.phone.length < 2 || this.data.password.length < 5) { |
| | | wx.showToast({ |
| | | title: '用户名密码长度不够!', |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | wx.getUserProfile({ |
| | | desc: '用于登录验证', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 |
| | | success: (res) => { |
| | |
| | | that.setData({ |
| | | userInfo: res.userInfo, |
| | | }) |
| | | |
| | | that.getWxUserLoginCodeCb().then((loginParas) => { |
| | | // console.log(loginParas.code) |
| | | var jsCode = loginParas.code; |
| | | if (e.detail.userInfo == undefined || e.detail.userInfo == null) { |
| | | wx.showToast({ |
| | | title: '授权失败请重新授权', |
| | | |
| | | }) |
| | | } |
| | | that.loginByReal(jsCode); |
| | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 加载 |
| | | onLoad: function () { |
| | | var that = this; |
| | | var screenSize = app.globalData.screenSize; |
| | | |
| | | var screenWidth = screenSize.width; |
| | | var screenHight = screenSize.height; |
| | | var screenWidthScale = screenSize.width / 750; |
| | | var screenHightScale = screenSize.height / 1334; |
| | | |
| | | if (wx.getStorageSync('AccountInfo') && wx.getStorageSync('AccountInfo').checked) { |
| | | let getPhone = wx.getStorageSync('AccountInfo').phone |
| | | let getPassword = wx.getStorageSync('AccountInfo').password |
| | | that.setData({ |
| | | phone: getPhone, |
| | | password: getPassword, |
| | | checked: wx.getStorageSync('AccountInfo').checked |
| | | }) |
| | | } |
| | | that.setData({ |
| | | imageWidth: screenWidth, |
| | | imageHeight: screenHightScale * 520 + 10, |
| | |
| | | inputViewWidth: screenWidth, |
| | | inputViewHeight: screenHightScale * 88, |
| | | inputWidth: screenWidth, |
| | | inputHeight: screenHightScale * 177 |
| | | inputHeight: screenHightScale * 177, |
| | | }); |
| | | |
| | | console.log(111) |
| | | // app.onReset() |
| | | }, |
| | | |
| | | onShareAppMessage: function () { |