提交 eb4a4e3e authored 作者: 邓文彬's avatar 邓文彬

fix(功能走查): 上次登陆时间的存储时间节点。存在疑问

上级 4b9c8a9d
......@@ -66,7 +66,7 @@ export default {
onHide: function () {
// app关闭时将数据存储到本地缓存
uni.setStorageSync("now_user", this.$store.state.now_user);
uni.setStorageSync("last_time", this.$store.state.last_time);
// uni.setStorageSync("last_time", this.$store.state.last_time);
},
onUnload() {},
......
......@@ -7,7 +7,7 @@
>HI,欢迎回来{{ userInfo.name }}{{ userInfo.user }}</view
>
<view class="unit">所属单位:{{ userInfo.unitName || "--" }}</view>
<view class="time">上次登录时间:{{ lastTime || "--" }}</view>
<view class="time">上次登录时间:{{ userInfo.last_time || "--" }}</view>
<image
class="bg-img"
......@@ -15,7 +15,7 @@
src="@/static/img/add-img/home1.png"
></image>
</view>
<view class="card-item">
<view class="card-item" @click="toSyncPage">
<view class="title2x">巡检、报修记录</view>
<view class="count">
<text class="num">{{ syncCount }}</text
......@@ -86,24 +86,6 @@ export default {
},
data() {
return {
activeTabIndex: 0,
tabList: [
{
defaultIcon: "iconfont icon-yingyongyewuguanli1",
isActive: true,
text: "首页",
},
{
defaultIcon: "iconfont icon-Inspection",
isActive: false,
text: "巡检管理",
},
{
defaultIcon: "iconfont icon-a-ActivityConfiguration",
isActive: false,
text: "同步管理",
},
],
isDialog: false, //
list: [], // 展示数据
......@@ -114,19 +96,29 @@ export default {
countNum: 0, // 统计查询总数
syncCount: 0, // 待同步条数
lastTime: "", // 上次登陆时间
// lastTime: "", // 上次登陆时间
};
},
created() {
this.lastTime = uni.getStorageSync("last_time") || "";
// this.lastTime = uni.getStorageSync("last_time") || "";
},
mounted() {
this.init();
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
methods: {
init() {
uni.showLoading();
getAllInspections()
.then((res) => {
this.all_data = res;
this.init();
this.getList();
uni.hideLoading();
})
.catch((error) => {
......@@ -142,13 +134,10 @@ export default {
uni.hideLoading();
});
},
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
toSyncPage() {
this.$emit("changeTab", {}, 2)
},
methods: {
// 待同步数据
initSyncCount() {
this.syncCount = (this.all_data || []).filter(
......@@ -157,7 +146,7 @@ export default {
},
// 初始化
init() {
getList() {
const all_data = this.all_data || [];
const tempAllData = {};
......@@ -223,16 +212,12 @@ export default {
});
},
change(e) {
console.log("----", e);
this.searchForm = e;
this.init();
},
tabClick(item, index) {
console.log("----");
this.activeTabIndex = index;
},
toIndex() {
uni.navigateTo({
......
......@@ -34,7 +34,7 @@
<!-- 内容区 -->
<view class="right-container">
<!-- 首页 -->
<Content v-if="activeTabIndex == 0" />
<Content v-if="activeTabIndex == 0" @changeTab="tabClick" />
<!-- 巡检管理 -->
<InspectionManagement v-if="activeTabIndex == 1" />
......@@ -127,7 +127,7 @@ export default {
success() {
_this.$store.commit("SET_USER", {});
uni.setStorageSync("now_user", this.$store.state.now_user);
uni.setStorageSync("last_time", this.$store.state.last_time);
// uni.setStorageSync("last_time", this.$store.state.last_time);
uni.clearStorage(); //测试将所有缓存清除
},
......
......@@ -142,20 +142,8 @@ export default {
this.$refs.form
.validate()
.then((res) => {
// console.log(this.formData.oldPd,this.user.pd)
// 输入密码与该账号密码一致
if (this.formData.oldPd == this.user.passWord) {
// this.user.passWord = this.formData.newPd;
// let key = null;
// this.personList.some((item, index) => {
// if (item.id == this.user.id) {
// key = index;
// }
// });
// console.log("---- this.user", this.user)
// 将数组中与当前登录账号ID相同项替换
// this.personList.splice(key, 1, this.user);
const id = this.user.id;
const tempPersonList = this.personList.map((item) => {
if (item.id == id) {
......@@ -164,68 +152,6 @@ export default {
return item;
});
// let timeStr = getDateTime.dateTimeStr("y-m-d h:i");
// let operData = {
// name: this.$store.state.now_user.name,
// level: "秘密",
// user: this.$store.state.now_user.user,
// module: "其他",
// detail: "无",
// type: "修改密码",
// time: timeStr,
// };
// this.$store.state.oper_record.unshift(operData);
// 重新存储本地用户信息
// let _this = this;
// plus.io.resolveLocalFileSystemURL(
// "/storage/emulated/0/Android/data/asmzx/pd/", //指定的目录
// function(entry) {
// // 创建或打开文件, fs.root是根目录操作对象,直接fs表示当前操作对象
// entry.getFile(
// 'u.txt', {
// create: true // 文件不存在则创建
// },
// fileEntry => {
// // 文件在手机中的路径
// console.log(fileEntry.fullPath)
// fileEntry.createWriter(writer => {
// let data = _this.$Base64.encode(JSON.stringify(_this
// .personList))
// console.log(data, 123);
// // 写入文件成功完成的回调函数
// writer.onwrite = e => {
// // console.log('写入成功');
// };
// // 向文件中写入数据
// writer.write(
// JSON.stringify(data)
// );
// });
// },
// e => {
// console.log('getFile failed: ' + e.message);
// }
// );
// },
// e => {
// console.log(e.message);
// },
// function(err) {
// console.log("访问指定目录失败:" + err.message);
// });
// uni.setStorageSync('user_data', this.personList)
// uni.showToast({
// title: '恭喜您,密码更新成功!',
// icon: 'none',
// duration: 2000
// })
// this.logOut()
const temp = JSON.stringify(tempPersonList);
const fileContent = JSON.stringify(Base64.encode(temp));
......@@ -242,7 +168,6 @@ export default {
duration: 2000,
});
// 生成日志
const logContent = getLogContent(LOG_TYPE_ENUM.updatePassword);
const log_list = this.$store.state.log_list;
......
......@@ -32,6 +32,8 @@ import {
createFileWithPlusIO,
TEST,
TEST_2X,
USER_FILE_NAME,
} from "@/utils/systemCofig";
import {
......@@ -42,6 +44,8 @@ import {
readLogData,
} from "@/utils/IoReadingAndWriting.js";
import moment from "moment";
import { Base64 } from "js-base64";
export default {
components: {
......@@ -50,11 +54,11 @@ export default {
data() {
return {
person: {
user: "bjqxj",
pd: "JF85250920",
// user: "bjqxj",
// pd: "JF85250920",
// user: "hzsgjy", // 超管账号
// pd: "JFXJ85250920",
user: "hzsgjy", // 超管账号
pd: "JFXJ85250920",
},
backButtonPress: 0,
personList: [],
......@@ -72,7 +76,7 @@ export default {
uni.setStorageSync("oper_record", this.$store.state.oper_record);
uni.setStorageSync("all_data", this.$store.state.all_data);
uni.setStorageSync("now_user", this.$store.state.now_user);
uni.setStorageSync("last_time", this.$store.state.last_time);
// uni.setStorageSync("last_time", this.$store.state.last_time);
plus.runtime.quit();
} else {
plus.nativeUI.toast("再划一次退出应用");
......@@ -142,10 +146,18 @@ export default {
this.person.pd == this.personList[key].passWord
) {
const last_time = moment().format("yyyy-MM-DD HH:mm:ss");
this.$store.commit("SET_USER", this.personList[key]);
uni.setStorageSync("now_user", this.personList[key]);
this.$store.commit("SET_TIME", last_time);
uni.setStorageSync("last_time", last_time);
this.personList[key].last_time = last_time;
const userInfo = this.personList[key];
this.$store.commit("SET_USER", userInfo);
uni.setStorageSync("now_user", userInfo);
const fileContent = JSON.stringify(Base64.encode(this.personList));
createFileWithPlusIO(
SYNCHRONIZE_DATA_PAD,
USER_FILE_NAME,
fileContent
);
uni.navigateTo({
url: "/pages/home/home",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论