|
|
@@ -1,17 +1,13 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<uni-icons class="setting" type="gear" @click="handleServerSettings" size="50" color="#fff"></uni-icons>
|
|
|
- <view class="login_logo">
|
|
|
-
|
|
|
- <image :src="logo || 'https://img.picgo.net/2024/04/18/login_logo45cb6a5eb95c8c1c.png'"></image>
|
|
|
- </view>
|
|
|
+ <view class="login_logo">
|
|
|
+ <image :src="logo || 'https://img.picgo.net/2024/04/18/login_logo45cb6a5eb95c8c1c.png'"></image>
|
|
|
+ </view>
|
|
|
<view class="login-title">
|
|
|
-
|
|
|
<label>智慧工厂信息化系统</label>
|
|
|
|
|
|
- <text>{{ companyName}}</text>
|
|
|
-
|
|
|
-
|
|
|
+ <text>{{ companyName }}</text>
|
|
|
</view>
|
|
|
<view>
|
|
|
<view class="login-content">
|
|
|
@@ -43,25 +39,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {
|
|
|
- postJ
|
|
|
- } from "@/utils/api.js";
|
|
|
- import {
|
|
|
- login,
|
|
|
- usName
|
|
|
- } from "@/api/common.js";
|
|
|
- import {
|
|
|
- getResourcesTree
|
|
|
- } from '@/api/pda/common.js'
|
|
|
+ import { postJ } from '@/utils/api.js'
|
|
|
+ import { login, usName } from '@/api/common.js'
|
|
|
+ import { getResourcesTree } from '@/api/pda/common.js'
|
|
|
|
|
|
- import {
|
|
|
- setMemo,
|
|
|
- isMemo,
|
|
|
- removeMemo,
|
|
|
- setPassword,
|
|
|
- getPassword,
|
|
|
- } from "@/utils/passwordMemo.js";
|
|
|
- import ServerSetting from "@/components/ServerSetting/index";
|
|
|
+ import { setMemo, isMemo, removeMemo, setPassword, getPassword } from '@/utils/passwordMemo.js'
|
|
|
+ import ServerSetting from '@/components/ServerSetting/index'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -70,20 +53,20 @@
|
|
|
data() {
|
|
|
return {
|
|
|
userInfo: {
|
|
|
- username: "",
|
|
|
- passwd: "",
|
|
|
+ username: '',
|
|
|
+ passwd: ''
|
|
|
},
|
|
|
isMemo: isMemo(),
|
|
|
loginDisabled: false,
|
|
|
-
|
|
|
+
|
|
|
companyName: null,
|
|
|
- logo: null,
|
|
|
- };
|
|
|
+ logo: null
|
|
|
+ }
|
|
|
},
|
|
|
onLoad() {
|
|
|
if (this.isMemo) {
|
|
|
- const userInfo = getPassword();
|
|
|
- if (userInfo?.username) this.userInfo = userInfo;
|
|
|
+ const userInfo = getPassword()
|
|
|
+ if (userInfo?.username) this.userInfo = userInfo
|
|
|
}
|
|
|
|
|
|
this.getUsName()
|
|
|
@@ -91,16 +74,14 @@
|
|
|
mounted() {
|
|
|
// #ifdef APP-PLUS
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.serverSettingRef && this.$refs.serverSettingRef.serverCheck();
|
|
|
- });
|
|
|
+ this.$refs.serverSettingRef && this.$refs.serverSettingRef.serverCheck()
|
|
|
+ })
|
|
|
// #endif
|
|
|
// uni.reLaunch({
|
|
|
// url: "/pages/home/home",
|
|
|
// });
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
getUsName() {
|
|
|
usName().then(res => {
|
|
|
this.companyName = res.companyName
|
|
|
@@ -108,7 +89,7 @@
|
|
|
})
|
|
|
},
|
|
|
setServerStatus(val) {
|
|
|
- this.loginDisabled = !val;
|
|
|
+ this.loginDisabled = !val
|
|
|
},
|
|
|
//登录
|
|
|
// submit() {
|
|
|
@@ -156,8 +137,8 @@
|
|
|
submit() {
|
|
|
// #ifdef APP-PLUS
|
|
|
if (!this.apiUrl) {
|
|
|
- this.$refs.serverSettingRef.open();
|
|
|
- return;
|
|
|
+ this.$refs.serverSettingRef.open()
|
|
|
+ return
|
|
|
}
|
|
|
// #endif
|
|
|
|
|
|
@@ -166,47 +147,45 @@
|
|
|
loginPwd: this.userInfo.passwd
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- postJ(this.apiUrl + "/main/user/login", param)
|
|
|
- .then((res) => {
|
|
|
-
|
|
|
+ postJ(this.apiUrl + '/main/user/login', param)
|
|
|
+ .then(res => {
|
|
|
if (this.isMemo) {
|
|
|
- setPassword(this.userInfo);
|
|
|
+ setPassword(this.userInfo)
|
|
|
}
|
|
|
|
|
|
- console.log(res);
|
|
|
- let data = res.data;
|
|
|
- uni.setStorageSync("token", data.token);
|
|
|
- uni.setStorageSync("userInfo", data);
|
|
|
+ console.log(res)
|
|
|
+ let data = res.data
|
|
|
+ uni.setStorageSync('token', data.token)
|
|
|
+
|
|
|
uni.showToast({
|
|
|
- title: "登录成功",
|
|
|
- icon: "success",
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
+ title: '登录成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
this.getTree()
|
|
|
setTimeout(() => {
|
|
|
uni.reLaunch({
|
|
|
- url: "/pages/home/home",
|
|
|
- });
|
|
|
- }, 2000);
|
|
|
+ url: '/pages/home/home'
|
|
|
+ })
|
|
|
+ }, 2000)
|
|
|
})
|
|
|
- .catch((err) => {
|
|
|
+ .catch(err => {
|
|
|
uni.showToast({
|
|
|
title: err.message,
|
|
|
- icon: "none",
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
- });
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
handleServerSettings() {
|
|
|
- this.$refs.serverSettingRef.open();
|
|
|
+ this.$refs.serverSettingRef.open()
|
|
|
},
|
|
|
checkboxChange(e) {
|
|
|
- this.isMemo = e.detail.value[0] === "1";
|
|
|
+ this.isMemo = e.detail.value[0] === '1'
|
|
|
if (this.isMemo) {
|
|
|
- setMemo();
|
|
|
+ setMemo()
|
|
|
} else {
|
|
|
- removeMemo();
|
|
|
+ removeMemo()
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -220,17 +199,13 @@
|
|
|
})
|
|
|
}
|
|
|
let List = JSON.stringify(res || [])
|
|
|
- uni.setStorageSync("treeList", List);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ uni.setStorageSync('treeList', List)
|
|
|
})
|
|
|
- },
|
|
|
- },
|
|
|
- };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- @import "login.scss";
|
|
|
-</style>
|
|
|
+ @import 'login.scss';
|
|
|
+</style>
|