|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<view class="status-bar-height"></view>
|
|
<view class="status-bar-height"></view>
|
|
<uni-nav-bar fixed="true" title="登录" backgroundColor="#f8f8f8" :border="false" rightIcon="gear"
|
|
<uni-nav-bar fixed="true" title="登录" backgroundColor="#f8f8f8" :border="false" rightIcon="gear"
|
|
- @clickRight="openSetting()"></uni-nav-bar>
|
|
|
|
|
|
+ @clickRight="openSetting" @clickLeft="back"></uni-nav-bar>
|
|
<view class="title padding-top-20">
|
|
<view class="title padding-top-20">
|
|
<view class="title-name">欧曼 MES 客户端</view>
|
|
<view class="title-name">欧曼 MES 客户端</view>
|
|
</view>
|
|
</view>
|
|
@@ -10,7 +10,7 @@
|
|
<uni-easyinput class="padding-top-20" placeholder="密码" v-model="password" type="password"
|
|
<uni-easyinput class="padding-top-20" placeholder="密码" v-model="password" type="password"
|
|
@confirm="login"></uni-easyinput>
|
|
@confirm="login"></uni-easyinput>
|
|
<view class="flex padding-top-20">
|
|
<view class="flex padding-top-20">
|
|
- <button type="primary" class="grow-1" size="mini" @tap="login()">登录</button>
|
|
|
|
|
|
+ <button type="primary" class="grow-1" size="mini" @tap="login">登录</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -27,10 +27,26 @@
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
username: '',
|
|
username: '',
|
|
- password: ''
|
|
|
|
|
|
+ password: '',
|
|
|
|
+ backType: '',
|
|
|
|
+ prevPage: ''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onLoad() {
|
|
|
|
+ if (extend.isObject(opts)) {
|
|
|
|
+ switch (opts.type) {
|
|
|
|
+ case 'switchTab':
|
|
|
|
+ this.backType = opts.type;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ this.backType = 'navigateBack';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (extend.isNonEmptyString(opts.page)) {
|
|
|
|
+ this.prevPage = opts.page;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onLoad() {},
|
|
|
|
methods: {
|
|
methods: {
|
|
openSetting() {
|
|
openSetting() {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
@@ -54,8 +70,13 @@
|
|
if (res.success) {
|
|
if (res.success) {
|
|
let ures = await user.getByServer();
|
|
let ures = await user.getByServer();
|
|
if (ures.success) {
|
|
if (ures.success) {
|
|
|
|
+ let url = extend.isNonEmptyString(this.prevPage) ? this.prevPage : '/pages/home/index';
|
|
|
|
+ // 登录成功
|
|
|
|
+ uni.switchTab({
|
|
|
|
+ url: url
|
|
|
|
+ });
|
|
uni.reLaunch({
|
|
uni.reLaunch({
|
|
- url: '/pages/home/index'
|
|
|
|
|
|
+ url: url
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -66,6 +87,20 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ back() {
|
|
|
|
+ let url = extend.isNonEmptyString(this.prevPage) ? this.prevPage : '/pages/home/index';
|
|
|
|
+ switch (this.backType) {
|
|
|
|
+ case 'switchTab':
|
|
|
|
+ uni.switchTab({
|
|
|
|
+ url: url
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ uni.navigateBack();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|