| | |
| | | <switch :checked='remberPassword' color="#FFCC33" style="zoom:.5" @change="remberChange"/> |
| | | </view> |
| | | </view> |
| | | <view class="button" @click="login"> |
| | | 登录 |
| | | <view class="button" @click="login" :loading="load.loading"> |
| | | {{load.btnText}} |
| | | </view> |
| | | </view> |
| | | <!-- 设置弹窗区域 --> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | // import { data } from 'jquery' |
| | | import md5 from '../../static/js/md5.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | {name: 'wms',ip:'192.168.1.1',port: '8080',address: 'pswms'}, |
| | | {name: 'wcs',ip:'192.168.1.1',port: '9090',address: 'pswcs'} |
| | | ], |
| | | url: { |
| | | ip: '', |
| | | port: '', |
| | | project: '' |
| | | load: { |
| | | loading: false, |
| | | btnText: '登录' |
| | | }, |
| | | } |
| | | }, |
| | |
| | | this.$refs.settings.close() |
| | | }, |
| | | login() { |
| | | let _this = this |
| | | let path = 'demo' |
| | | if(uni.getStorageSync('Network')) { |
| | | path = uni.getStorageSync('Network')[0].address |
| | | let _this = this,path = 'demo',network = uni.getStorageSync('Network'); |
| | | if(network) { |
| | | path = network[0].address |
| | | path = path.substring(0, path.length - 3); |
| | | } |
| | | uni.navigateTo({ |
| | | url: `/pages/project/${path}/home/home`, |
| | | fail(res) { |
| | | console.log(`没有${path}项目,请联系管理元`); |
| | | let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}` |
| | | uni.request({ |
| | | url: `${baseUrl}/login.action`, |
| | | data: { |
| | | username: 'super', |
| | | password: md5.hex_md5('xltys1995') |
| | | }, |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | uni.setStorageSync('token', res.data.token); |
| | | _this.load.btnText = '登录中'; |
| | | setTimeout(() => { |
| | | uni.showToast({ |
| | | title: '登录成功' |
| | | }) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: `/pages/project/${path}/home/home`, |
| | | }); |
| | | }, 300) |
| | | }, 700) |
| | | } |
| | | // uni.navigateTo({ |
| | | // url: `/pages/project/${path}/home/home`, |
| | | // fail(res) { |
| | | // console.log(`没有${path}项目,请联系管理元`); |
| | | // } |
| | | |
| | | // }) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | // 开发环境才提示,生产环境不会提示 |
| | | if (process.env.NODE_ENV === 'development') { |
| | | console.log(`\n %c uView V${version} %c https://uviewui.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0; border-radius: 5px;'); |
| | | // console.log(`\n %c uView V${version} %c https://uviewui.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0; border-radius: 5px;'); |
| | | } |
| | | |
| | | export default { |