| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- Component({
- properties: {
- language: {
- type: Object,
- value: {}
- }
- },
- options: {
- addGlobalClass: true
- },
- data: {
- accountno: "",
- password: "",
- inputType: "password", //密码输入框类型
- memory: true, //记忆
- focus: false,
- },
- lifetimes: {
- attached: function () {
- /* 恢复缓存中保存的账号密码 */
- this.setData({
- ...wx.getStorageSync('loginMsg')
- });
- setTimeout(() => {
- this.allowOrNot();
- }, 100)
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- methods: {
- /* input输入 */
- inputChange(e) {
- this.setData({
- [e.target.dataset.name]: e.detail.value.trim()
- })
- this.allowOrNot()
- },
- /* 验证是否允许登录 */
- allowOrNot() {
- getCurrentPages()[0].setData({
- disabled: (this.data.accountno.length && this.data.password.length) ? false : true
- })
- },
- /* 改变密码输入框类型 */
- changePasswordType() {
- this.setData({
- inputType: this.data.inputType == "text" ? 'password' : 'text'
- })
- },
- /* 是否记忆密码 */
- isMemory() {
- this.setData({
- memory: !this.data.memory
- })
- },
- /* 处理登录 */
- handleLogin() {
- getApp().globalData.http.login({
- "accountno": this.data.accountno,
- "password": require("../../../utils/md5").hexMD5(this.data.password),
- "systemclient": "wechatsaletool"
- }).then(res => {
- getCurrentPages()[0].setData({
- loading: false
- })
- if (res.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- wx.setStorageSync('loginMsg', {
- accountno: this.data.accountno,
- password: (this.data.memory) ? this.data.password : ''
- })
- require("./login").loginMsg(res);
- getApp().globalData.remindchangepassword = res.remindchangepassword == 1;
- })
- }
- }
- })
|