提交 e3089cd4 authored 作者: zs's avatar zs

日志新增登录/修改密码

上级 0b1cf98e
...@@ -131,8 +131,18 @@ ...@@ -131,8 +131,18 @@
if(res.data){ if(res.data){
uni.showToast({ uni.showToast({
title: "恭喜您,密码更新成功!", title: "恭喜您,密码更新成功!",
icon:"none",
duration: 3000, duration: 3000,
}); });
const logContent = getLogContent(
LOG_TYPE_ENUM.updatePassword,
"",
"其他"
);
const log_list = this.$store.state.log_list;
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list).then((res) => {});
this.logOut(); this.logOut();
}else{ }else{
uni.showToast({ uni.showToast({
......
<template> <template>
<!-- 登录页 --> <!-- 登录页 -->
<view class="content"> <view class="content">
<view class="login_wrap"> <view class="login_wrap">
<view class="top-module"> <view class="top-module">
<image src="@/static/logo.png" mode="aspectFit" alt="" /> <image src="@/static/logo.png" mode="aspectFit" alt="" />
<view class="title">杭州内网监管在线-运维在线</view> <view class="title">杭州内网监管在线-运维在线</view>
</view> </view>
<view class="form_wrap"> <view class="form_wrap">
<view class="input_wrap"> <view class="input_wrap">
<uni-easyinput <uni-easyinput class="log-input" clearSize="0" v-model="person.account" prefixIcon="person"
class="log-input" placeholder="用户名"></uni-easyinput>
clearSize="0" <uni-easyinput v-if="passwordVisible" class="log-input" prefixIcon="locked" clearSize="0"
v-model="person.account" v-model="person.pwd" @iconClick="togglePasswordVisible" :placeholder="passwordPlaceholder"
prefixIcon="person" :passwordIcon="false" :type="passwordVisible ? 'text' : 'password'"></uni-easyinput>
placeholder="用户名" <uni-easyinput v-else class="log-input" prefixIcon="locked-filled" clearSize="0" v-model="person.pd"
></uni-easyinput> @iconClick="togglePasswordVisible" :placeholder="passwordPlaceholder" :passwordIcon="false"
<uni-easyinput :type="passwordVisible ? 'text' : 'password'"></uni-easyinput>
v-if="passwordVisible" </view>
class="log-input" <view class="login_btn" @click="login">
prefixIcon="locked" <view class="login_btn_text"> 登录 </view>
clearSize="0" </view>
v-model="person.pwd" </view>
@iconClick="togglePasswordVisible" </view>
:placeholder="passwordPlaceholder" </view>
:passwordIcon="false"
:type="passwordVisible ? 'text' : 'password'"
></uni-easyinput>
<uni-easyinput
v-else
class="log-input"
prefixIcon="locked-filled"
clearSize="0"
v-model="person.pd"
@iconClick="togglePasswordVisible"
:placeholder="passwordPlaceholder"
:passwordIcon="false"
:type="passwordVisible ? 'text' : 'password'"
></uni-easyinput>
</view>
<view class="login_btn" @click="login">
<view class="login_btn_text"> 登录 </view>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
import userApi from "@/api/user.js"; import userApi from "@/api/user.js";
import SqlliteDbUtil from "@/utils/sqllitedb"; import SqlliteDbUtil from "@/utils/sqllitedb";
import table from "@/api/sqllite/table.js"; import table from "@/api/sqllite/table.js";
import { getUserList } from "@/utils/systemCofig"; import {
import { getUserList
LOG_TYPE_ENUM, } from "@/utils/systemCofig";
getLogContent, import {
addLog, LOG_TYPE_ENUM,
readLogData, getLogContent,
} from "@/utils/IoReadingAndWriting.js"; addLog,
export default { readLogData,
components: {}, } from "@/utils/IoReadingAndWriting.js";
data() { export default {
return { components: {},
person: { data() {
account: "姜安平", return {
pwd: "Jap@123", person: {
}, account: "管理员",
backButtonPress: 0, pwd: "Gly@124",
personList: [], },
passwordVisible: false, // 是否显示密码 backButtonPress: 0,
db: null, personList: [],
}; passwordVisible: false, // 是否显示密码
}, db: null,
computed: { };
// 动态密码输入框 placeholder },
passwordPlaceholder() { computed: {
return this.passwordVisible ? "密码" : "********"; // 动态密码输入框 placeholder
}, passwordPlaceholder() {
}, return this.passwordVisible ? "密码" : "********";
},
created() {}, },
onShow() {},
async mounted() {}, created() {},
// 定义返回退出 onShow() {},
onBackPress(options) { async mounted() {},
this.backButtonPress++; // 定义返回退出
if (this.backButtonPress > 1) { onBackPress(options) {
uni.setStorageSync("oper_record", this.$store.state.oper_record); this.backButtonPress++;
uni.setStorageSync("all_data", this.$store.state.all_data); if (this.backButtonPress > 1) {
uni.setStorageSync("now_user", this.$store.state.now_user); uni.setStorageSync("oper_record", this.$store.state.oper_record);
uni.setStorageSync( uni.setStorageSync("all_data", this.$store.state.all_data);
"last_time", uni.setStorageSync("now_user", this.$store.state.now_user);
this.$store.state.now_user.LastSynchronizationTime uni.setStorageSync(
); "last_time",
plus.runtime.quit(); this.$store.state.now_user.LastSynchronizationTime
} else { );
plus.nativeUI.toast("再划一次退出应用"); plus.runtime.quit();
} } else {
setTimeout(function () { plus.nativeUI.toast("再划一次退出应用");
this.backButtonPress = 0; }
}, 1000); setTimeout(function() {
return true; this.backButtonPress = 0;
}, }, 1000);
methods: { return true;
// 切换密码显示/隐藏 },
togglePasswordVisible() { methods: {
this.passwordVisible = !this.passwordVisible; // 切换密码显示/隐藏
}, togglePasswordVisible() {
// 点击登录 this.passwordVisible = !this.passwordVisible;
async login() { },
userApi.login(this.person).then((res) => { // 点击登录
if (res.data) { async login() {
this.personList = res.data; userApi.login(this.person).then((res) => {
this.$store.commit("SET_USER", this.personList); if (res.data) {
uni.setStorageSync("now_user", this.personList); this.personList = res.data;
uni.setStorageSync( this.$store.commit("SET_USER", this.personList);
"last_time", uni.setStorageSync("now_user", this.personList);
this.personList.LastSynchronizationTime || "" uni.setStorageSync(
); "last_time",
this.personList.LastSynchronizationTime || ""
uni.navigateTo({ );
url: "/pages/home/home", const logContent = getLogContent(
}); LOG_TYPE_ENUM.login,
} else { "",
uni.showToast({ "其他"
title: "账号密码错误,请重新输入", );
icon: "none", const log_list = this.$store.state.log_list;
duration: 2000, log_list.push(logContent);
}); this.$store.commit("SET_LOG_LIST", log_list);
} addLog(log_list).then((res) => {});
}); uni.navigateTo({
}, url: "/pages/home/home",
}, });
}; } else {
uni.showToast({
title: "账号密码错误,请重新输入",
icon: "none",
duration: 2000,
});
}
});
},
},
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.content { .content {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
// background-color: red; // background-color: red;
background-image: url("../../static/img/logbg.png"); background-image: url("../../static/img/logbg.png");
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.top-module { .top-module {
width: 350px; width: 350px;
margin-bottom: 48px; margin-bottom: 48px;
text-align: center; text-align: center;
image { image {
width: 88px; width: 88px;
height: 88px; height: 88px;
} }
.title { .title {
font-size: 26px; font-size: 26px;
color: #000000; color: #000000;
line-height: 34px; line-height: 34px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.16); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
} }
} }
.login_wrap { .login_wrap {}
}
.log-input {
.log-input { width: 350px;
width: 350px; margin-bottom: 24px;
margin-bottom: 24px; background: #fff;
background: #fff; color: #4a4a4a;
color: #4a4a4a; }
}
/deep/.is-input-border {
/deep/.is-input-border { border-radius: 2px !important;
border-radius: 2px !important; height: 40px !important;
height: 40px !important; }
}
/deep/.uni-easyinput__content {
/deep/.uni-easyinput__content { background-color: rgba(0, 0, 0, 0) !important;
background-color: rgba(0, 0, 0, 0) !important; }
}
/deep/.uni-easyinput__placeholder-class {
/deep/.uni-easyinput__placeholder-class { color: #4a4a4a;
color: #4a4a4a; }
}
/deep/.is-focused {
/deep/.is-focused { border: 1px solid #4a4a4a !important;
border: 1px solid #4a4a4a !important;
.uniui-eye-filled {
.uniui-eye-filled { color: #4a4a4a !important;
color: #4a4a4a !important; }
}
.uniui-eye-slash-filled {
.uniui-eye-slash-filled { color: #4a4a4a !important;
color: #4a4a4a !important; }
} }
}
/deep/.uni-input-input {
/deep/.uni-input-input { color: #4a4a4a !important;
color: #4a4a4a !important; }
}
/deep/.uniui-clear {
/deep/.uniui-clear { color: #4a4a4a !important;
color: #4a4a4a !important; }
}
.login_btn {
.login_btn { background: #3774f6;
background: #3774f6; box-shadow: 0px 2px 14px 0px rgba(51, 104, 246, 0.24);
box-shadow: 0px 2px 14px 0px rgba(51, 104, 246, 0.24); border-radius: 3px;
border-radius: 3px;
.login_btn_text {
.login_btn_text { width: 350px;
width: 350px; height: 40px;
height: 40px; background-color: #3774f6;
background-color: #3774f6; box-shadow: 0px 1px 4px 0px rgba(84, 116, 232, 0.16);
box-shadow: 0px 1px 4px 0px rgba(84, 116, 232, 0.16); border-radius: 2px;
border-radius: 2px; display: flex;
display: flex; align-items: center;
align-items: center; justify-content: center;
justify-content: center; color: #fff;
color: #fff; }
} }
} }
} </style>
</style> \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论