| | |
| | | <switch :checked='remberPassword' color="#FFCC33" style="zoom:.5" @change="remberChange"/> |
| | | </view> |
| | | </view> |
| | | <view class="button" @click="login"> |
| | | 登录 |
| | | </view> |
| | | <!-- <view class="button" @click="login" :loading="load.loading"> |
| | | {{load.btnText}} |
| | | </view> --> |
| | | <button class="button" @click="onLogin()" :loading="load.loading">{{load.btnText}}</button> |
| | | </view> |
| | | <!-- 设置弹窗区域 --> |
| | | <uni-popup ref="settings" type="dialog"> |
| | |
| | | </view> |
| | | </uni-popup> |
| | | |
| | | |
| | | |
| | | <!-- 版本号 --> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <view class="version"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | // import { data } from 'jquery' |
| | | import { mapState } from 'vuex'//引入mapState |
| | | 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: '登录' |
| | | }, |
| | | } |
| | | }, |
| | | computed: mapState({ |
| | | project: state => state.project |
| | | }) , |
| | | mounted() { |
| | | uni.getSystemInfo({ |
| | | success(res) { |
| | |
| | | uni.setStorageSync('Network', this.network); |
| | | this.$refs.settings.close() |
| | | }, |
| | | login() { |
| | | let _this = this |
| | | let path = 'demo' |
| | | if(uni.getStorageSync('Network')) { |
| | | path = uni.getStorageSync('Network')[0].address |
| | | path = path.substring(0, path.length - 3); |
| | | onLogin() { |
| | | let _this = this,path = 'demo',network = uni.getStorageSync('Network'); |
| | | if(!network) { |
| | | uni.showToast({ |
| | | icon: 'error', |
| | | title: '请配置网络信息' |
| | | }) |
| | | } |
| | | uni.navigateTo({ |
| | | url: `/pages/project/${path}/home/home`, |
| | | fail(res) { |
| | | console.log(`没有${path}项目,请联系管理元`); |
| | | // path = network[0].address |
| | | // path = path.substring(0, path.length - 3); |
| | | path = _this.project.name |
| | | 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) { |
| | | _this.load.loading = true; |
| | | _this.load.btnText = '登录中'; |
| | | uni.setStorageSync('token', res.data.token); |
| | | _this.load.btnText = '登录中'; |
| | | setTimeout(() => { |
| | | uni.showToast({ |
| | | title: '登录成功' |
| | | }) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: `/pages/home/home`, |
| | | }); |
| | | }, 300) |
| | | }, 700) |
| | | } |
| | | // uni.navigateTo({ |
| | | // url: `/pages/project/${path}/home/home`, |
| | | // fail(res) { |
| | | // console.log(`没有${path}项目,请联系管理元`); |
| | | // } |
| | | |
| | | // }) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | } |
| | |
| | | inset -4px -4px 4px rgba(255,255,255,.4), |
| | | -4px -4px 5px rgba(0,0,0,.4); |
| | | } |
| | | .button:active { |
| | | transform: translateY(5px) scale(0.99, 0.99); |
| | | box-shadow: inset 4px 4px 4px rgba(0, 0, 0, .3), |
| | | inset -4px -4px 8px rgba(255, 255, 255, .7), |
| | | -5px -5px 5px rgba(0, 0, 0, .3); |
| | | } |
| | | @media screen and (orientation: portrait) { |
| | | /* 竖屏 */ |
| | | .main { |