提交 023ee1b6 authored 作者: JaxBBLL's avatar JaxBBLL

fix: init 2

上级 7409b5f4
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
plus.screen.lockOrientation("landscape-primary"); //锁定横屏 plus.screen.lockOrientation("landscape-primary"); //锁定横屏
// #endif // #endif
// this.init(); this.init();
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.android.requestPermissions( plus.android.requestPermissions(
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
if (now_user.user) { if (now_user.user) {
this.$store.commit("SET_USER", now_user); this.$store.commit("SET_USER", now_user);
} }
this.init(); // this.init();
}, },
onLoad: function (query) { onLoad: function (query) {
console.log("即将开始初始化app"); console.log("即将开始初始化app");
......
<template> <template>
<!-- 首页 --> <!-- 首页 -->
<view class="container"> <view class="container">
<view class="flex">
<navigator
url="/pages/inspectionContent/inspectionContentList?uid=23"
hover-class="navigator-hover"
>
<button type="default" class="uni-btn">23</button>
</navigator>
<navigator
url="/pages/inspectionContent/inspectionContentList?uid=16"
hover-class="navigator-hover"
>
<button type="default" class="uni-btn">16</button>
</navigator>
</view>
<!-- 第一个模块 --> <!-- 第一个模块 -->
<view class="header"> <view class="header">
<view class="title">杭州内网监管在线-运维在线</view> <view class="title">杭州内网监管在线-运维在线</view>
......
<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 class="log-input" clearSize="0" v-model="person.account" prefixIcon="person" <uni-easyinput
placeholder="用户名"></uni-easyinput> class="log-input"
<uni-easyinput v-if="passwordVisible" class="log-input" prefixIcon="locked" clearSize="0" clearSize="0"
v-model="person.pwd" @iconClick="togglePasswordVisible" :placeholder="passwordPlaceholder" v-model="person.account"
:passwordIcon="false" :type="passwordVisible ? 'text' : 'password'"></uni-easyinput> prefixIcon="person"
<uni-easyinput v-else class="log-input" prefixIcon="locked-filled" clearSize="0" v-model="person.pd" placeholder="用户名"
@iconClick="togglePasswordVisible" :placeholder="passwordPlaceholder" :passwordIcon="false" ></uni-easyinput>
:type="passwordVisible ? 'text' : 'password'"></uni-easyinput> <uni-easyinput
</view> v-if="passwordVisible"
<view class="login_btn" @click="login"> class="log-input"
<view class="login_btn_text"> 登录 </view> prefixIcon="locked"
</view> clearSize="0"
</view> v-model="person.pwd"
</view> @iconClick="togglePasswordVisible"
</view> :placeholder="passwordPlaceholder"
: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 { import { getUserList } from "@/utils/systemCofig";
getUserList, import {
} from "@/utils/systemCofig"; LOG_TYPE_ENUM,
import { getLogContent,
LOG_TYPE_ENUM, addLog,
getLogContent, readLogData,
addLog, } from "@/utils/IoReadingAndWriting.js";
readLogData, export default {
} from "@/utils/IoReadingAndWriting.js"; components: {},
export default { data() {
components: {}, return {
data() { person: {
return { account: "姜安平", // 超管账号
person: { pwd: "Jap@123",
account: "姜安平", // 超管账号 },
pwd: "Jap@123", backButtonPress: 0,
}, personList: [],
backButtonPress: 0, passwordVisible: false, // 是否显示密码
personList: [], db: null,
passwordVisible: false, // 是否显示密码 };
db: null, },
}; computed: {
}, // 动态密码输入框 placeholder
computed: { passwordPlaceholder() {
// 动态密码输入框 placeholder return this.passwordVisible ? "密码" : "********";
passwordPlaceholder() { },
return this.passwordVisible ? "密码" : "********"; },
},
}, created() {},
onShow() {},
created() {}, async mounted() {},
onShow() {}, // 定义返回退出
async mounted() { onBackPress(options) {
this.backButtonPress++;
}, if (this.backButtonPress > 1) {
// 定义返回退出 uni.setStorageSync("oper_record", this.$store.state.oper_record);
onBackPress(options) { uni.setStorageSync("all_data", this.$store.state.all_data);
this.backButtonPress++; uni.setStorageSync("now_user", this.$store.state.now_user);
if (this.backButtonPress > 1) { uni.setStorageSync(
uni.setStorageSync("oper_record", this.$store.state.oper_record); "last_time",
uni.setStorageSync("all_data", this.$store.state.all_data); this.$store.state.now_user.LastSynchronizationTime
uni.setStorageSync("now_user", this.$store.state.now_user); );
uni.setStorageSync( plus.runtime.quit();
"last_time", } else {
this.$store.state.now_user.LastSynchronizationTime plus.nativeUI.toast("再划一次退出应用");
); }
plus.runtime.quit(); setTimeout(function () {
} else { this.backButtonPress = 0;
plus.nativeUI.toast("再划一次退出应用"); }, 1000);
} return true;
setTimeout(function() { },
this.backButtonPress = 0; methods: {
}, 1000); // 切换密码显示/隐藏
return true; togglePasswordVisible() {
}, this.passwordVisible = !this.passwordVisible;
methods: { },
// 切换密码显示/隐藏 // 点击登录
togglePasswordVisible() { async login() {
this.passwordVisible = !this.passwordVisible; userApi.login(this.person).then((res) => {
}, if (res.data) {
// 点击登录 this.personList = res.data;
async login() { this.$store.commit("SET_USER", this.personList);
userApi.login(this.person).then((res) => { uni.setStorageSync("now_user", this.personList);
if (res.data) { uni.setStorageSync(
this.personList = res.data; "last_time",
this.$store.commit("SET_USER", this.personList); this.personList.LastSynchronizationTime || ""
uni.navigateTo({ );
url: "/pages/home/home",
}); uni.navigateTo({
}else{ url: "/pages/home/home",
uni.showToast({ });
title: '账号密码错误,请重新输入', } else {
icon: "none", uni.showToast({
duration: 2000, 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 {
width: 350px; .log-input {
margin-bottom: 24px; width: 350px;
background: #fff; margin-bottom: 24px;
color: #4a4a4a; background: #fff;
} color: #4a4a4a;
}
/deep/.is-input-border {
border-radius: 2px !important; /deep/.is-input-border {
height: 40px !important; border-radius: 2px !important;
} height: 40px !important;
}
/deep/.uni-easyinput__content {
background-color: rgba(0, 0, 0, 0) !important; /deep/.uni-easyinput__content {
} background-color: rgba(0, 0, 0, 0) !important;
}
/deep/.uni-easyinput__placeholder-class {
color: #4a4a4a; /deep/.uni-easyinput__placeholder-class {
} color: #4a4a4a;
}
/deep/.is-focused {
border: 1px solid #4a4a4a !important; /deep/.is-focused {
border: 1px solid #4a4a4a !important;
.uniui-eye-filled {
color: #4a4a4a !important; .uniui-eye-filled {
} color: #4a4a4a !important;
}
.uniui-eye-slash-filled {
color: #4a4a4a !important; .uniui-eye-slash-filled {
} color: #4a4a4a !important;
} }
}
/deep/.uni-input-input {
color: #4a4a4a !important; /deep/.uni-input-input {
} color: #4a4a4a !important;
}
/deep/.uniui-clear {
color: #4a4a4a !important; /deep/.uniui-clear {
} color: #4a4a4a !important;
}
.login_btn {
background: #3774f6; .login_btn {
box-shadow: 0px 2px 14px 0px rgba(51, 104, 246, 0.24); background: #3774f6;
border-radius: 3px; box-shadow: 0px 2px 14px 0px rgba(51, 104, 246, 0.24);
border-radius: 3px;
.login_btn_text {
width: 350px; .login_btn_text {
height: 40px; width: 350px;
background-color: #3774f6; height: 40px;
box-shadow: 0px 1px 4px 0px rgba(84, 116, 232, 0.16); background-color: #3774f6;
border-radius: 2px; box-shadow: 0px 1px 4px 0px rgba(84, 116, 232, 0.16);
display: flex; border-radius: 2px;
align-items: center; display: flex;
justify-content: center; align-items: center;
color: #fff; justify-content: center;
} color: #fff;
} }
} }
</style> }
\ No newline at end of file </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论