Commit 2c4b1ef1 by LJM

深圳华云数智工业科技有限公司

parent 2e8db2c7
Showing with 95 additions and 92 deletions
<template> <template>
<view class="page-login column rowCenter verCenter"> <view class="page-login column rowCenter verCenter">
<view class="logo"><image src="/static/WMS@2x.png" mode="aspectFill"></image></view> <view class="logo">
<image src="/static/WMS@2x.png" mode="aspectFill"></image>
</view>
<view class="company row rowCenter verCenter"> <view class="company row rowCenter verCenter">
<picker @change="bindPickerChange" :value="index" :range="array"> <picker @change="bindPickerChange" :value="index" :range="array">
<view class="row verCenter"> <view class="row verCenter">
...@@ -23,109 +25,109 @@ ...@@ -23,109 +25,109 @@
</template> </template>
<script> <script>
import { API } from '@/util/api.js'; import { API } from '@/util/api.js';
import md5 from '@/util/md5.js'; import md5 from '@/util/md5.js';
export default { export default {
data() { data() {
return { return {
index: 0, index: 0,
array: ['深圳市猎芯科技有限公司', '深贸电子有限公司'], array: ['深圳市猎芯科技有限公司', '深贸电子有限公司', '深圳华云数智工业科技有限公司'],
name: '', name: '',
passwd: '', passwd: '',
disabled: false disabled: false
}; };
}, },
onLoad() { onLoad() {
uni.removeStorageSync('oa_skey'); uni.removeStorageSync('oa_skey');
uni.removeStorageSync('oa_user_id'); uni.removeStorageSync('oa_user_id');
uni.removeStorageSync('company_id'); uni.removeStorageSync('company_id');
uni.removeStorageSync('oa_user_email'); uni.removeStorageSync('oa_user_email');
//记住密码 //记住密码
const name = uni.getStorageSync('name') || ''; const name = uni.getStorageSync('name') || '';
const passwd = uni.getStorageSync('passwd') || ''; const passwd = uni.getStorageSync('passwd') || '';
if (name && passwd) { if (name && passwd) {
this.name = name; this.name = name;
this.passwd = passwd; this.passwd = passwd;
} }
},
methods: {
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
this.disabled = false;
}, },
/** methods: {
* 组织切换 bindPickerChange: function(e) {
*/ console.log('picker发送选择改变,携带值为', e.detail.value);
changeOrgId() { this.index = e.detail.value;
this.request(API.changeOrgId, 'POST', { org_id: Number(this.index) + 1 }, false).then(res => { this.disabled = false;
if (res.code === 0) { },
this.disabled = false; /**
* 组织切换
*/
changeOrgId() {
this.request(API.changeOrgId, 'POST', { org_id: Number(this.index) + 1 }, false).then(res => {
if (res.code === 0) {
this.disabled = false;
uni.showToast({
title: '登录成功',
icon: 'success'
});
setTimeout(() => {
uni.redirectTo({
url: '/pages/index/index'
});
}, 2000);
} else {
this.disabled = true;
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
});
}
});
},
/**
* 提交
*/
submit() {
if (!this.name) {
uni.showToast({ uni.showToast({
title: '登录成功', title: '请输入登录账号',
icon: 'success' icon: 'error'
}); });
setTimeout(() => { return false;
uni.redirectTo({ }
url: '/pages/index/index'
}); if (!this.passwd) {
}, 2000); uni.showToast({
} else { title: '请输入登录密码',
this.disabled = true; icon: 'error'
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false
}); });
return false;
} }
});
},
/**
* 提交
*/
submit() {
if (!this.name) {
uni.showToast({
title: '请输入登录账号',
icon: 'error'
});
return false;
}
if (!this.passwd) { uni.setStorageSync('name', this.name);
uni.showToast({ uni.setStorageSync('passwd', this.passwd);
title: '请输入登录密码',
icon: 'error' this.request(API.login, 'POST', { name: this.name, passwd: md5.hex_md5_32(this.passwd) }, true).then(res => {
if (res.retcode === 0) {
uni.setStorageSync('oa_skey', res.data.skey);
uni.setStorageSync('oa_user_id', res.data.userId);
uni.setStorageSync('company_id', Number(this.index) + 1);
//调用选用组织
this.changeOrgId();
} else {
uni.showModal({
title: '提示',
content: res.errMsg,
showCancel: false
});
}
}); });
return false;
} }
uni.setStorageSync('name', this.name);
uni.setStorageSync('passwd', this.passwd);
this.request(API.login, 'POST', { name: this.name, passwd: md5.hex_md5_32(this.passwd) }, true).then(res => {
if (res.retcode === 0) {
uni.setStorageSync('oa_skey', res.data.skey);
uni.setStorageSync('oa_user_id', res.data.userId);
uni.setStorageSync('company_id', Number(this.index) + 1);
//调用选用组织
this.changeOrgId();
} else {
uni.showModal({
title: '提示',
content: res.errMsg,
showCancel: false
});
}
});
} }
} };
};
</script> </script>
<style lang="scss"> <style lang="scss">
@import '@/assets/css/mine/login.scss'; @import '@/assets/css/mine/login.scss';
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment