|
|
@ -1,38 +1,17 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<view
|
|
|
|
<view class="page-login" :style="{ backgroundImage: `url(${image.login.bg3})` }">
|
|
|
|
class="page-login"
|
|
|
|
<view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }">
|
|
|
|
:style="{ backgroundImage: `url(${image.login.bg3})` }"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
class="header"
|
|
|
|
|
|
|
|
:style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<view class="left"></view>
|
|
|
|
<view class="left"></view>
|
|
|
|
<view class="title"></view>
|
|
|
|
<view class="title"></view>
|
|
|
|
<view class="right">
|
|
|
|
<view class="right">
|
|
|
|
<u-icon
|
|
|
|
<u-icon class="setting" @click="uni.navigateTo({ url: page.login.server })" size="30" name="/static/icons/icon-47.png"></u-icon>
|
|
|
|
class="setting"
|
|
|
|
|
|
|
|
@click="uni.navigateTo({ url: page.login.server })"
|
|
|
|
|
|
|
|
size="30"
|
|
|
|
|
|
|
|
name="/static/icons/icon-47.png"
|
|
|
|
|
|
|
|
></u-icon>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="logo">
|
|
|
|
<view class="logo">
|
|
|
|
<u-image
|
|
|
|
<u-image width="288rpx" height="85rpx" :src="image.global.logo1"></u-image>
|
|
|
|
width="288rpx"
|
|
|
|
|
|
|
|
height="85rpx"
|
|
|
|
|
|
|
|
:src="image.global.logo1"
|
|
|
|
|
|
|
|
></u-image>
|
|
|
|
|
|
|
|
<span>V1.6</span>
|
|
|
|
<span>V1.6</span>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-form
|
|
|
|
<u-form class="form" :model="form" ref="form" :border-bottom="false" :error-type="['toast']">
|
|
|
|
class="form"
|
|
|
|
|
|
|
|
:model="form"
|
|
|
|
|
|
|
|
ref="form"
|
|
|
|
|
|
|
|
:border-bottom="false"
|
|
|
|
|
|
|
|
:error-type="['toast']"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<u-form-item
|
|
|
|
<u-form-item
|
|
|
|
class="form-item"
|
|
|
|
class="form-item"
|
|
|
|
prop="username"
|
|
|
|
prop="username"
|
|
|
@ -76,19 +55,9 @@
|
|
|
|
/></u-form-item>
|
|
|
|
/></u-form-item>
|
|
|
|
</u-form>
|
|
|
|
</u-form>
|
|
|
|
<view class="i18n" @click="i18nOptionsShow = true">
|
|
|
|
<view class="i18n" @click="i18nOptionsShow = true">
|
|
|
|
<view class="dropdown-text">{{
|
|
|
|
<view class="dropdown-text">{{ $i18n.locale === 'en' ? 'English' : '简体中文' }}</view>
|
|
|
|
$i18n.locale === "en" ? "English" : "简体中文"
|
|
|
|
<u-icon :class="i18nOptionsShow ? 'dropdown-icon-active' : 'dropdown-icon'" size="16" name="/static/icons/icon-50.png"></u-icon>
|
|
|
|
}}</view>
|
|
|
|
<u-action-sheet :list="i18nList" v-model="i18nOptionsShow" @click="onLanguageSelect"></u-action-sheet>
|
|
|
|
<u-icon
|
|
|
|
|
|
|
|
:class="i18nOptionsShow ? 'dropdown-icon-active' : 'dropdown-icon'"
|
|
|
|
|
|
|
|
size="16"
|
|
|
|
|
|
|
|
name="/static/icons/icon-50.png"
|
|
|
|
|
|
|
|
></u-icon>
|
|
|
|
|
|
|
|
<u-action-sheet
|
|
|
|
|
|
|
|
:list="i18nList"
|
|
|
|
|
|
|
|
v-model="i18nOptionsShow"
|
|
|
|
|
|
|
|
@click="onLanguageSelect"
|
|
|
|
|
|
|
|
></u-action-sheet>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<u-button
|
|
|
|
<u-button
|
|
|
|
shape="circle"
|
|
|
|
shape="circle"
|
|
|
@ -101,21 +70,21 @@
|
|
|
|
hover-class="button-hover"
|
|
|
|
hover-class="button-hover"
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
@click="login"
|
|
|
|
@click="login"
|
|
|
|
>{{ $t("message.Login") }}</u-button
|
|
|
|
>{{ $t('message.Login') }}</u-button
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<alerts />
|
|
|
|
<alerts />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Ref } from "vue-property-decorator";
|
|
|
|
import { Component, Ref } from 'vue-property-decorator';
|
|
|
|
import { server } from "@/pages/login/server/model";
|
|
|
|
import { server } from '@/pages/login/server/model';
|
|
|
|
import Alerts from "@/components/alert/alerts.vue";
|
|
|
|
import Alerts from '@/components/alert/alerts.vue';
|
|
|
|
import { page } from "@/utils/page";
|
|
|
|
import { page } from '@/utils/page';
|
|
|
|
import { session } from "@/store/modules/session";
|
|
|
|
import { session } from '@/store/modules/session';
|
|
|
|
import { BasePage } from "@/components/base/page";
|
|
|
|
import { BasePage } from '@/components/base/page';
|
|
|
|
import { VForm } from "vue/types/form";
|
|
|
|
import { VForm } from 'vue/types/form';
|
|
|
|
import { Lang } from "@/i18n";
|
|
|
|
import { Lang } from '@/i18n';
|
|
|
|
// import { any } from 'lodash/fp';
|
|
|
|
// import { any } from 'lodash/fp';
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
@ -131,57 +100,53 @@ export default class LoginPage extends BasePage {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 表单引用
|
|
|
|
* 表单引用
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Ref("form") readonly $form!: VForm;
|
|
|
|
@Ref('form') readonly $form!: VForm;
|
|
|
|
|
|
|
|
|
|
|
|
get serverAddress(): string | null {
|
|
|
|
get serverAddress(): string | null {
|
|
|
|
return server.serverAddress;
|
|
|
|
return server.serverAddress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
form = {
|
|
|
|
form = {
|
|
|
|
username: "",
|
|
|
|
username: '',
|
|
|
|
password: "",
|
|
|
|
password: '',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
rules = {
|
|
|
|
rules = {
|
|
|
|
username: [
|
|
|
|
username: [{ required: true, message: this.$t('message.PleaseInputUserName') }],
|
|
|
|
{ required: true, message: this.$t("message.PleaseInputUserName") },
|
|
|
|
password: [{ required: true, message: this.$t('message.PleaseInputPassword') }],
|
|
|
|
],
|
|
|
|
|
|
|
|
password: [
|
|
|
|
|
|
|
|
{ required: true, message: this.$t("message.PleaseInputPassword") },
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
i18nOptionsShow = false;
|
|
|
|
i18nOptionsShow = false;
|
|
|
|
|
|
|
|
|
|
|
|
i18nList = [
|
|
|
|
i18nList = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
text: "简体中文",
|
|
|
|
text: '简体中文',
|
|
|
|
color: "black",
|
|
|
|
color: 'black',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
text: "English",
|
|
|
|
text: 'English',
|
|
|
|
color: "black",
|
|
|
|
color: 'black',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
onLanguageSelect(index: number) {
|
|
|
|
onLanguageSelect(index: number) {
|
|
|
|
const languages = ["cn", "en"];
|
|
|
|
const languages = ['cn', 'en'];
|
|
|
|
this.$i18n.locale = languages[index];
|
|
|
|
this.$i18n.locale = languages[index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onReady(): void {
|
|
|
|
onReady(): void {
|
|
|
|
this.$form.setRules(this.rules);
|
|
|
|
this.$form.setRules(this.rules);
|
|
|
|
console.log("image", this.image);
|
|
|
|
console.log('image', this.image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Version: string = "1.0.0";
|
|
|
|
Version: string = '1.0.0';
|
|
|
|
async update() {
|
|
|
|
async update() {
|
|
|
|
await session.QueryVersion();
|
|
|
|
await session.QueryVersion();
|
|
|
|
if (this.Version != session.Version) {
|
|
|
|
if (this.Version != session.Version) {
|
|
|
|
await uni.downloadFile({
|
|
|
|
await uni.downloadFile({
|
|
|
|
url: "http://106.13.174.133:5210/HaierWMS.apk",
|
|
|
|
url: 'http://106.13.174.133:5210/HaierWMS.apk',
|
|
|
|
success: (res) => {
|
|
|
|
success: (res) => {
|
|
|
|
console.log("res.statusCode", res.statusCode);
|
|
|
|
console.log('res.statusCode', res.statusCode);
|
|
|
|
console.log("res.tempFilePath", res.tempFilePath);
|
|
|
|
console.log('res.tempFilePath', res.tempFilePath);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -192,8 +157,8 @@ export default class LoginPage extends BasePage {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
if (!server.isServerAddressSet) {
|
|
|
|
if (!server.isServerAddressSet) {
|
|
|
|
await uni.showToast({
|
|
|
|
await uni.showToast({
|
|
|
|
icon: "none",
|
|
|
|
icon: 'none',
|
|
|
|
title: this.$t("message.Tip") as string,
|
|
|
|
title: this.$t('message.Tip') as string,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
uni.navigateTo({ url: page.login.server });
|
|
|
|
uni.navigateTo({ url: page.login.server });
|
|
|
@ -205,15 +170,7 @@ export default class LoginPage extends BasePage {
|
|
|
|
password,
|
|
|
|
password,
|
|
|
|
lang: this.$i18n.locale as Lang,
|
|
|
|
lang: this.$i18n.locale as Lang,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const {
|
|
|
|
const { code, factoryCode, list, loginName, msg, userId, userName } = loginResult;
|
|
|
|
code,
|
|
|
|
|
|
|
|
factoryCode,
|
|
|
|
|
|
|
|
list,
|
|
|
|
|
|
|
|
loginName,
|
|
|
|
|
|
|
|
msg,
|
|
|
|
|
|
|
|
userId,
|
|
|
|
|
|
|
|
userName,
|
|
|
|
|
|
|
|
} = loginResult;
|
|
|
|
|
|
|
|
session.setUser({
|
|
|
|
session.setUser({
|
|
|
|
code,
|
|
|
|
code,
|
|
|
|
factoryCode,
|
|
|
|
factoryCode,
|
|
|
@ -225,8 +182,8 @@ export default class LoginPage extends BasePage {
|
|
|
|
lang: this.$i18n.locale as Lang,
|
|
|
|
lang: this.$i18n.locale as Lang,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
uni.showToast({
|
|
|
|
uni.showToast({
|
|
|
|
icon: "success",
|
|
|
|
icon: 'success',
|
|
|
|
title: this.$t("message.LoginSuccessful") as string,
|
|
|
|
title: this.$t('message.LoginSuccessful') as string,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
uni.navigateTo({
|
|
|
|
uni.navigateTo({
|
|
|
|
url: page.login.area,
|
|
|
|
url: page.login.area,
|
|
|
|