finish account

This commit is contained in:
RainSun 2020-03-29 22:44:00 +08:00
parent 4291f9a79a
commit 7894e98661
10 changed files with 390 additions and 1499 deletions

@ -24,8 +24,8 @@
<md-bottom-bar-item
id="bottom-bar-item-favorites"
md-label="管理"
md-icon="account_circle"
to="/admin"
md-icon="person"
to="/account"
></md-bottom-bar-item>
</md-bottom-bar>
</div>

@ -27,6 +27,14 @@ const routes = [
meta: {
keepAlive: true
},
},
{
path: '/account',
name: 'Account',
component: () => import(/* webpackChunkName: "account" */ '../views/Account/Account.vue'),
meta: {
keepAlive: true
},
},
{
path: '*', // 页面不存在的情况下会跳到home

@ -8,7 +8,10 @@ export default new Vuex.Store({
// 用户信息
user_info: {},
// 配置信息
settings: {},
settings: {
open_vconsole: false,
is_dark_mode: false,
},
},
mutations: {
// 设置用户信息

@ -1,514 +1,354 @@
<template>
<div class="account">
<md-app md-waterfall md-mode="fixed">
<md-app-toolbar class="md-primary toolbar">
<div class="md-toolbar-section-start">
<md-button class="md-icon-button" @click="back()"><md-icon>arrow_back</md-icon></md-button>
<h3 class="md-title" style="flex: 1">{{ lang.title }}</h3>
</div>
</md-app-toolbar>
<div class="account" ref="account">
<md-app md-waterfall md-mode="fixed">
<md-app-toolbar class="md-primary">
<div class="md-toolbar-section-start">
<span class="md-title page-title">曳光 控制台</span>
</div>
<div class="md-toolbar-section-end">
<div class="sroll-top-area"></div>
</div>
</md-app-toolbar>
<md-app-content>
<div ref="list_placeholder" :style="`height:40px`"></div>
<md-progress-bar
v-if="loading_switch"
md-mode="indeterminate"
style="position: absolute; top: 56px; left: 0; width: 100%;"
></md-progress-bar>
<template v-if="Object.keys(this.user_info).length == 0">
<md-field style="margin-top: 30px;">
<label>管理员token</label>
<md-input v-model="openid" placeholder="请输入您的身份码" type="number" maxlength="17"></md-input>
</md-field>
<md-button class="md-dense md-raised md-primary expand" @click="login">提交</md-button>
</template>
<template v-else>
<md-list>
<md-subheader class="md-primary">管理员信息</md-subheader>
<md-list-item>
<span class="md-list-item-text">学号{{user_info.id}}</span>
</md-list-item>
<md-list-item>
<span class="md-list-item-text">姓名{{user_info.name}}</span>
</md-list-item>
<md-list-item>
<span class="md-list-item-text">邮件{{user_info.mail}}</span>
</md-list-item>
<md-list-item>
<span class="md-list-item-text">身份码{{user_info.openid}}</span>
</md-list-item>
<md-subheader class="md-primary">管理员信息</md-subheader>
<md-list-item>
<md-icon>brightness_6</md-icon>
<span class="md-list-item-text">黑暗模式</span>
<md-switch v-model="is_dark_mode" class="md-primary"></md-switch>
</md-list-item>
<md-list-item>
<md-icon>code</md-icon>
<span class="md-list-item-text">VConsole</span>
<md-switch v-model="open_vconsole" class="md-primary"></md-switch>
</md-list-item>
<md-button class="md-dense md-raised md-primary expand" @click="logout_confirm_switch = true">退出登录</md-button>
</md-list>
</template>
<md-dialog-confirm
:md-active.sync="logout_confirm_switch"
md-title="警告"
md-content="您将退出登录,该操作将清空本地信息"
md-confirm-text="继续"
md-cancel-text="取消"
@md-confirm="logout"
:md-click-outside-to-close="false"
/>
<md-snackbar
md-position="center"
:md-active.sync="show_snackbar"
md-persistent
:md-duration="1500"
>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
<md-app-content>
<v-touch @swiperight="back()" :swipe-options="{ direction: 'horizontal' }">
<div ref="list_placeholder" style="height: 54px;"></div>
<icon class="logo" name="canary"></icon>
<template v-if="page_type == 'login'">
<md-field :class="mail_addr_verify ? '' : 'md-invalid'">
<label>{{ lang.login.input_placeholder[0] }}</label>
<md-input v-model="mail_addr" required></md-input>
<span class="md-error">{{ mail_addr_errmsg }}</span>
</md-field>
<md-field :class="password_verify ? '' : 'md-invalid'">
<label>{{ lang.login.input_placeholder[1] }}</label>
<md-input v-model="password" required></md-input>
<span class="md-error">{{ lang.login.password_errmsg }}</span>
</md-field>
<md-button class="md-raised md-primary expand" @click="judgeLogin()" :disabled="login_loading">
{{ lang.login.submit }}
<div class="loading-box"><md-progress-spinner v-if="login_loading" :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner></div>
</md-button>
</template>
<template v-if="page_type == 'activation'">
<p class="md-caption">{{ lang.activation.title }}</p>
<md-field :class="activation_code_verify ? '' : 'md-invalid'">
<label>{{ lang.activation.subheader }}</label>
<md-input v-model="activation_code" required></md-input>
<span class="md-error">{{ lang.activation.input_errmsg }}</span>
</md-field>
<md-button class="md-raised md-primary expand" :disabled="activation_loading" @click="judgeActivation()">
{{ lang.activation.submit }}
<div class="loading-box"><md-progress-spinner v-if="activation_loading" :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner></div>
</md-button>
</template>
<template v-if="page_type == 'account'">
<md-list>
<md-list-item>
<span class="md-list-item-text">{{ user_infos.mail_addr }}</span>
</md-list-item>
<md-divider></md-divider>
<md-list-item>
<span class="md-list-item-text">{{ lang.account.label[0] }}</span>
<span class="time-content">{{ update_time }}</span>
</md-list-item>
<md-list-item>
<span class="md-list-item-text">{{ lang.account.label[1] }}</span>
<md-button @click="syncCloudStart()" v-if="!sync_cloud_loading" class="md-icon-button md-list-action"><md-icon>cloud_upload</md-icon></md-button>
<md-progress-spinner v-else :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner>
</md-list-item>
<md-list-item>
<span class="md-list-item-text">{{ lang.account.label[2] }}</span>
<md-button @click="syncLocalStart()" v-if="!sync_local_loading" class="md-icon-button md-list-action"><md-icon>cloud_download</md-icon></md-button>
<md-progress-spinner v-else :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner>
</md-list-item>
<md-button @click="startLogout()" class="md-raised md-primary expand" :disabled="sync_local_loading || sync_cloud_loading">{{ lang.account.logout }}</md-button>
</md-list>
</template>
<md-snackbar md-position="center" :md-active.sync="show_snackbar" md-persistent>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
</v-touch>
</md-app-content>
</md-app>
</div>
<div :style="`height:40px`"></div>
</md-app-content>
</md-app>
</div>
</template>
<script>
// @ is an alias to /src
import { mapState, mapActions } from 'vuex';
import { encrypt, decrypt, encryptMainCode, decryptMainCode } from '@/utils/aes.js';
import { login, activation, syncLocal, syncCloud } from '@/axios/api.js';
import { lang } from '@/utils/language.js';
import { setHtmlFontSize } from '@/utils/px2rem.js';
import { mapState, mapActions } from "vuex";
import { setHtmlFontSize } from "@/utils/px2rem.js";
import { api } from "@/axios/fetch.js";
export default {
name: 'Add',
data() {
return {
page_type: 'login', // login activation account
mail_addr: '',
mail_addr_verify: true,
mail_addr_errmsg: '',
password: '',
password_verify: true,
activation_code: '',
activation_code_verify: true,
sync_local_loading: false,
sync_cloud_loading: false,
login_loading: false,
activation_loading: false,
show_snackbar: false,
snakebar_msg: '',
lang: '',
clientHeight: ''
};
},
computed: {
...mapState(['user_infos', 'row_data', 'row_pwd', 'settings']),
update_time: function() {
return this.formatDateTime(new Date(parseInt(this.user_infos.update_time)));
}
},
methods: {
...mapActions(['setUserInfo', 'setRowData', 'setRowPwd']),
// md-app
changeFixed(clientHeight) {
//
// console.log(clientHeight);
// window.document.getElementsByClassName('md-content')[0].style.minHeight = clientHeight + 'px';
this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight = clientHeight + 'px';
this.$refs.list_placeholder.parentNode.style.minHeight = clientHeight - 32 + 'px';
window.document.documentElement.setAttribute('data-theme', this.settings.is_dark_mode ? 'dark' : 'light');
name: "Account",
data() {
return {
// md-app
clientHeight: "",
// snackbar
show_snackbar: false,
snakebar_msg: "",
// openid
openid: "",
//
loading_switch: false,
//
is_dark_mode: false,
// vconsole
open_vconsole: false,
//
has_init: false,
// 退confirm
logout_confirm_switch: false
};
},
computed: {
...mapState(["user_info", "settings"])
},
methods: {
...mapActions(["setUserInfo", "setSettings"]),
// md-app
changeFixed(clientHeight) {
//
this.$refs.account.children[0].style.minHeight = clientHeight + "px";
this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight =
clientHeight + "px";
this.$refs.list_placeholder.parentNode.style.minHeight =
clientHeight - 32 + "px";
window.document.documentElement.setAttribute(
"data-theme",
this.settings.is_dark_mode ? "dark" : "light"
);
},
//
init() {
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("storeState"))
)
);
//
this.open_vconsole = this.settings.open_vconsole;
this.is_dark_mode = this.settings.is_dark_mode;
// flag
setTimeout(
function() {
this.has_init = true;
console.log("本页信息覆写完成");
}.bind(this),
10
);
},
//
login() {
this.openid = this.openid.trim();
//
if (!/\d+/.test(this.openid)) {
console.log("数据格式校验失败");
this.message("请输入正确的身份码");
return;
}
this.loading_switch = true;
let data = {
openid: this.openid
};
console.log(`上传信息准备完成`);
console.log(data);
api
.post("/login", data)
.then(res => {
let user_info = res.data.admin;
this.setUserInfo([user_info, this]);
console.log("登录成功,用户信息覆写完成");
this.message("登录成功");
this.loading_switch = false;
this.openid = "";
})
.catch(err => {
console.log(err);
this.loading_switch = false;
if (err.response && err.response.status != 500) {
this.message(`${err.response.status}: ${err.response.data}`);
} else {
this.message("网络错误,请稍候重试");
}
});
},
//
resetSettings() {
let settings = {
open_vconsole: this.open_vconsole,
is_dark_mode: this.is_dark_mode
};
this.setSettings([settings, this]);
console.log("个性化设置覆写完成");
//
window.document.documentElement.setAttribute(
"data-theme",
this.settings.is_dark_mode ? "dark" : "light"
);
// vconsole
this.toggleVcon()
this.message("设置成功");
},
// snackBar
message(msg) {
this.snakebar_msg = msg;
this.show_snackbar = true;
},
// class
hasClass(obj, cls) {
return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
},
//
init() {
// vuex
this.$store.replaceState(Object.assign(this.$store.state, JSON.parse(localStorage.getItem('storeState'))));
this.initLanguage();
//
if (this.user_infos.has_login) {
//
if (this.user_infos.activation) {
//
this.page_type = 'account';
} else {
//
this.page_type = 'activation';
}
// class
addClass(obj, cls) {
if (!this.hasClass(obj, cls)) obj.className += ' ' + cls;
},
// class
removeClass(obj, cls) {
if (this.hasClass(obj, cls)) {
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
obj.className = obj.className.replace(reg, ' ');
}
},
// class
toggleVcon() {
let vcon_dom = document.getElementById('__vconsole');
let class_name = 'vconsole-show'
if (this.hasClass(vcon_dom, class_name)) {
//
if(!this.settings.open_vconsole) {
//
this.removeClass(vcon_dom, class_name);
}
} else {
//
this.page_type = 'login';
//
if(this.settings.open_vconsole) {
//
this.addClass(vcon_dom, class_name);
}
}
console.log('当前用户状态为' + this.page_type);
},
//
initLanguage() {
if (this.settings.is_chinese) {
this.lang = lang().account.CHS;
} else {
this.lang = lang().account.EN;
}
console.log('语言配置完成');
},
//
back() {
this.$router.go(-1);
},
// Home
turnToHome(msg) {
console.log(msg);
this.$router.replace('/');
},
//
judgeLogin() {
// flag
let can_continue = true;
// mail_addr
if (!(this.mail_addr = this.mail_addr.trim())) {
can_continue = false;
this.mail_addr_verify = false;
this.mail_addr_errmsg = this.lang.mail_addr_errmsg[0];
}
let reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if (!reg.test(this.mail_addr)) {
can_continue = false;
this.mail_addr_verify = false;
this.mail_addr_errmsg = this.lang.mail_addr_errmsg[1];
}
// password
if (!(this.password = this.password.trim())) {
can_continue = false;
this.password_verify = false;
}
// flag
if (can_continue) this.startLogin();
},
//
startLogin() {
this.login_loading = true;
let data = {
mail_addr: this.mail_addr,
password: encryptMainCode(this.password),
update_time: new Date().getTime()
};
login(data)
.then(res => {
// console.log(res.data)
this.manageLoginRes(res.data);
})
.catch(err => {
console.log(err);
this.login_loading = false;
this.snakebar_msg = this.lang.snakebar_msg[0];
this.show_snackbar = true;
});
},
//
manageLoginRes(data) {
if (data.errcode == 200) {
//
let user_infos = {
mail_addr: this.mail_addr,
has_login: true,
activation: true,
row_login_pwd: encryptMainCode(this.password),
update_time: data.update_time
};
this.setUserInfo([user_infos, this]);
console.log('正常用户登录,用户信息覆写完成');
this.snakebar_msg = this.lang.snakebar_msg[1];
this.show_snackbar = true;
this.page_type = 'account';
} else if (data.errcode == 107 || data.errcode == 108 || data.errcode == 105) {
//
let user_infos = {
mail_addr: this.mail_addr,
has_login: true,
activation: false,
row_login_pwd: encryptMainCode(this.password),
update_time: this.user_infos.update_time
};
this.setUserInfo([user_infos, this]);
console.log('用户注册成功,验证码已下发,用户信息覆写完成');
this.snakebar_msg = this.lang.snakebar_msg[2];
this.show_snackbar = true;
this.page_type = 'activation';
} else if (data.errcode == 106) {
this.password = '';
console.log('用户密码错误');
this.snakebar_msg = this.lang.snakebar_msg[3];
this.show_snackbar = true;
} else {
console.log('请求出错');
console.log(data);
this.snakebar_msg = this.lang.snakebar_msg[4] + data.errcode;
this.show_snackbar = true;
}
this.login_loading = false;
},
//
judgeActivation() {
// flag
let can_continue = true;
// password
if (!(this.activation_code = this.activation_code.trim())) {
can_continue = false;
this.activation_code_verify = false;
}
// flag
if (can_continue) this.startActivation();
},
//
startActivation() {
this.activation_loading = true;
let data = {
mail_addr: this.user_infos.mail_addr,
uuid: this.activation_code
};
activation(data)
.then(res => {
// console.log(res.data)
this.manageActivation(res.data);
})
.catch(err => {
console.log(err);
this.activation_loading = false;
this.snakebar_msg = this.lang.snakebar_msg[0];
this.show_snackbar = true;
});
},
//
manageActivation(data) {
if (data.errcode == 200) {
//
let user_infos = {
mail_addr: this.user_infos.mail_addr,
has_login: true,
activation: true,
row_login_pwd: this.user_infos.row_login_pwd,
update_time: data.update_time
};
this.setUserInfo([user_infos, this]);
console.log('验证成功,用户信息覆写完成');
this.snakebar_msg = this.lang.snakebar_msg[5];
this.show_snackbar = true;
this.page_type = 'account';
} else if (data.errcode == 401 || data.errcode == 404 || data.errcode == 407) {
//
this.activation_code = '';
console.log('验证码错误');
console.log(data);
this.snakebar_msg = this.lang.snakebar_msg[6];
this.show_snackbar = true;
} else {
console.log('请求出错');
console.log(data);
this.snakebar_msg = this.lang.snakebar_msg[4] + data.errcode;
this.show_snackbar = true;
}
this.activation_loading = false;
},
//
formatDateTime(inputTime) {
var date = new Date(inputTime);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? '0' + m : m;
var d = date.getDate();
d = d < 10 ? '0' + d : d;
var h = date.getHours();
h = h < 10 ? '0' + h : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? '0' + minute : minute;
second = second < 10 ? '0' + second : second;
return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
// return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + second;
// return y + "-" + m + "-" + d;
},
//
syncLocalStart() {
this.sync_local_loading = true;
let data = {
mail_addr: this.user_infos.mail_addr,
password: this.user_infos.row_login_pwd
};
syncLocal(data)
.then(res => {
console.log(res.data)
if (res.data.errcode == 200) {
//
this.setRowData([res.data.codebook, this]);
console.log('数据获取成功,密码本覆写成功');
let user_infos = this.user_infos;
user_infos.update_time = res.data.update_time;
this.setUserInfo([user_infos, this]);
console.log('数据获取成功,用户信息覆写成功');
this.snakebar_msg = this.lang.snakebar_msg[7];
this.show_snackbar = true;
} else {
//
console.log('数据获取失败');
console.log(res.data);
this.snakebar_msg = this.lang.snakebar_msg[4] + res.data.errcode;
this.show_snackbar = true;
}
setTimeout(
function() {
this.sync_local_loading = false;
}.bind(this),
1000
);
})
.catch(err => {
console.log(err);
this.sync_local_loading = false;
this.snakebar_msg = this.lang.snakebar_msg[0];
this.show_snackbar = true;
});
},
//
syncCloudStart() {
this.sync_cloud_loading = true;
let data = {
mail_addr: this.user_infos.mail_addr,
password: this.user_infos.row_login_pwd,
codebook: this.row_data,
update_time: new Date().getTime()
};
syncCloud(data)
.then(res => {
// console.log(res.data)
if (res.data.errcode == 200) {
//
let user_infos = this.user_infos;
user_infos.update_time = res.data.update_time;
this.setUserInfo([user_infos, this]);
console.log('数据获取成功,用户信息覆写成功');
this.snakebar_msg = this.lang.snakebar_msg[8];
this.show_snackbar = true;
} else {
//
console.log('数据获取失败');
console.log(res.data);
this.snakebar_msg = this.lang.snakebar_msg[4] + res.data.errcode;
this.show_snackbar = true;
}
setTimeout(
function() {
this.sync_cloud_loading = false;
}.bind(this),
1000
);
})
.catch(err => {
console.log(err);
this.sync_cloud_loading = false;
this.snakebar_msg = this.lang.snakebar_msg[0];
this.show_snackbar = true;
});
},
// 退
startLogout() {
//
let user_infos = {
mail_addr: 'A Little Canary',
has_login: false,
activation: false,
update_time: '1582282494434'
};
this.setUserInfo([user_infos, this]);
console.log('用户信息覆写完成');
this.back();
}
},
created() {
this.lang = lang().account.CHS;
console.log('临时语言系统加载完成');
this.init();
},
mounted() {
//
this.clientHeight = `${document.documentElement.clientHeight}`;
//document.body.clientWidth;
window.onresize = function temp() {
this.clientHeight = `${document.documentElement.clientHeight}`;
setHtmlFontSize();
}.bind(this);
},
watch: {
// `clientHeight`
clientHeight: function() {
this.changeFixed(this.clientHeight);
},
// `mail_addr`
mail_addr: function() {
this.mail_addr_verify = true;
},
// `password`
password: function() {
this.password_verify = true;
},
// `activation_code`
activation_code: function() {
this.activation_code_verify = true;
}
},
beforeDestroy() {},
components: {}
},
// 退
logout() {
this.setUserInfo([{}, this])
console.log('用户信息覆写完成')
this.message('本地信息清空完成')
}
},
created() {
this.init();
},
mounted() {
//
this.clientHeight = `${document.documentElement.clientHeight}`;
//document.body.clientWidth;
window.onresize = function temp() {
this.clientHeight = `${document.documentElement.clientHeight}`;
setHtmlFontSize();
}.bind(this);
this.$refs.list_placeholder.parentNode.parentNode.addEventListener(
"scroll",
this.scroll
);
},
watch: {
// `clientHeight`
clientHeight: function() {
this.changeFixed(this.clientHeight);
},
// `is_dark_mode`
is_dark_mode: function() {
if (this.has_init) this.resetSettings();
},
// `open_vconsole`
open_vconsole: function() {
if (this.has_init) this.resetSettings();
}
},
beforeDestroy() {},
components: {}
};
</script>
<style scoped lang="scss" type="text/scss">
@import '../../style/main';
@import "../../style/main";
.account {
width: 100%;
min-height: 100%;
background: #fff;
.expand {
width: 100%;
margin: 0 !important;
min-height: 1.2rem !important;
margin-top: 0.5rem !important;
}
.logo {
margin: 0 auto;
display: block;
height: 5rem;
width: 5rem;
}
.time-content {
text-align: right !important;
}
.loading-box {
position: absolute;
right: 50%;
top: 50%;
margin-right: -11px;
margin-top: -11px;
}
.toolbar {
position: fixed !important;
}
width: 100%;
// max-width: 500px;
min-height: 100%;
background: #fff;
// margin: 0 auto;
.expand {
width: 100%;
margin: 0 !important;
min-height: 0.8rem !important;
margin-top: 0.5rem !important;
}
.drawer-banner {
padding: 1rem 0.3rem 0.3rem 0.3rem;
box-sizing: border-box;
background: $main-color;
color: #fff;
position: relative;
.default-avatar {
color: #fff;
margin-bottom: 0.3rem;
}
.md-caption {
color: #fbfbfb;
}
}
.md-toolbar {
position: fixed;
top: 0;
}
.md-toolbar-row {
order: 12;
// margin-bottom: .3rem !important;
}
.md-toolbar-section-start,
.md-toolbar-section-end,
.md-toolbar-row {
min-height: 56px;
}
.md-toolbar-row {
margin-top: -10px;
}
.md-speed-dial.md-bottom-right {
position: fixed !important;
}
}
// Demo purposes only
.md-drawer {
width: 240px;
max-width: calc(100vw - 125px);
}
.md-app-scroller > div {
overflow-y: scroll !important;
}
.face {
color: #fff !important;
}
.page-title {
flex: 1;
min-height: 56px;
line-height: 56px;
}
.sroll-top-area {
flex: 1;
min-height: 56px;
}
.md-bottom-bar.md-type-fixed .md-bottom-bar-item {
max-width: 1000px !important;
}
</style>

@ -1,5 +1,5 @@
<template>
<div class="home" ref="home">
<div class="clear" ref="clear">
<md-app md-waterfall md-mode="fixed">
<md-app-toolbar class="md-primary">
<div class="md-toolbar-section-start">
@ -8,11 +8,14 @@
<div class="md-toolbar-section-end">
<div class="sroll-top-area"></div>
</div>
</md-app-toolbar>
<md-app-content>
<div ref="list_placeholder" :style="`height:40px`"></div>
<md-progress-bar v-if="loading_switch" md-mode="indeterminate" style="position: absolute; top: 56px; left: 0; width: 100%;"></md-progress-bar>
<md-progress-bar
v-if="loading_switch"
md-mode="indeterminate"
style="position: absolute; top: 56px; left: 0; width: 100%;"
></md-progress-bar>
<md-field style="margin-top: 30px;">
<label>失物招领id</label>
<md-input v-model="id" placeholder="输入在地址栏找到的失物招领id" type="number" maxlength="17"></md-input>
@ -22,7 +25,12 @@
<md-icon>delete</md-icon>
</md-speed-dial-target>
</md-speed-dial>
<md-snackbar md-position="center" :md-active.sync="show_snackbar" md-persistent>
<md-snackbar
md-position="center"
:md-active.sync="show_snackbar"
md-persistent
:md-duration="1500"
>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
<div :style="`height:40px`"></div>
@ -42,8 +50,6 @@ export default {
return {
// md-app
clientHeight: "",
//
show_list: [],
// snackbar
show_snackbar: false,
snakebar_msg: "",
@ -62,7 +68,7 @@ export default {
// md-app
changeFixed(clientHeight) {
//
this.$refs.home.children[0].style.minHeight = clientHeight + "px";
this.$refs.clear.children[0].style.minHeight = clientHeight + "px";
this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight =
clientHeight + "px";
this.$refs.list_placeholder.parentNode.style.minHeight =
@ -82,28 +88,13 @@ export default {
JSON.parse(localStorage.getItem("storeState"))
)
);
this.initUserInfo();
},
//
initUserInfo() {
if (Object.keys(this.user_info).length == 0) {
//
let user_info = {
mail_addr: "zhaoyingbo@live.cn",
openid: "123456"
};
this.setUserInfo([user_info, this]);
console.log("用户信息覆写完成");
}
console.log("用户信息初始化完成");
},
//
clear() {
//
if (Object.keys(this.user_info).length == 0) {
console.log("管理员信息校验失败");
this.message("请先登录");
return;
}
this.id = this.id.trim();
@ -171,7 +162,7 @@ export default {
<style scoped lang="scss" type="text/scss">
@import "../../style/main";
.home {
.clear {
width: 100%;
// max-width: 500px;
min-height: 100%;

@ -39,7 +39,12 @@
<md-button @click="item_cache = item; del_confirm_switch = true" class="md-primary">删除</md-button>
</md-card-actions>
</md-card>
<md-snackbar md-position="center" :md-active.sync="show_snackbar" md-persistent :md-duration="1500">
<md-snackbar
md-position="center"
:md-active.sync="show_snackbar"
md-persistent
:md-duration="1500"
>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
<md-dialog-confirm
@ -71,7 +76,7 @@ export default {
return {
// md-app
clientHeight: "",
//
//
show_list: [],
// snackbar
show_snackbar: false,
@ -114,24 +119,9 @@ export default {
JSON.parse(localStorage.getItem("storeState"))
)
);
this.initUserInfo();
this.getList();
},
//
initUserInfo() {
if (Object.keys(this.user_info).length == 0) {
//
let user_info = {
mail_addr: "zhaoyingbo@live.cn",
openid: "123456"
};
this.setUserInfo([user_info, this]);
console.log("用户信息覆写完成");
}
console.log("用户信息初始化完成");
},
//
scrollTop() {
this.$refs.list_placeholder.parentNode.parentNode.scrollTo({
@ -150,7 +140,6 @@ export default {
getList() {
if (Object.keys(this.user_info).length == 0) {
console.log("管理员信息校验失败");
this.message("请先登录");
return;
}
this.loading_switch = true;
@ -158,7 +147,7 @@ export default {
openid: this.user_info.openid
};
console.log(`上传信息准备完成`);
console.log(data)
console.log(data);
api
.post("/comment/get", data)
.then(res => {
@ -185,17 +174,17 @@ export default {
lafid: this.item_cache.position.lafid,
is_comment: this.item_cache.position.is_comment,
commentid: this.item_cache.position.commentid,
replyid: this.item_cache.content.id ? this.item_cache.content.id : ''
replyid: this.item_cache.content.id ? this.item_cache.content.id : ""
};
console.log(`删除信息准备完成`);
console.log(data)
console.log(data);
api
.delete("/comment/del", { data })
.then(res => {
this.loading_switch = false;
this.item_cache = null;
this.message("删除成功");
this.getList()
this.getList();
})
.catch(err => {
console.log(err);
@ -232,7 +221,13 @@ export default {
}
},
beforeDestroy() {},
components: {}
components: {},
activated() {
if (Object.keys(this.user_info).length == 0) {
this.show_list = []
console.log('无用户信息,空内容覆写完成')
}
}
};
</script>

@ -1,267 +0,0 @@
<template>
<div class="home" ref="home">
<md-app md-waterfall md-mode="fixed">
<md-app-toolbar class="md-primary">
<div class="md-toolbar-section-start">
<md-button class="md-icon-button" @click="drawer_switch = !drawer_switch">
<md-icon>menu</md-icon>
</md-button>
<span class="md-title page-title" @click="scrollTop()">曳光 控制台</span>
</div>
<div class="md-toolbar-section-end">
<div class="sroll-top-area" @click="scrollTop()"></div>
<md-button class="md-icon-button" @click="refresh" v-if="refresh_switch">
<md-icon>refresh</md-icon>
</md-button>
</div>
</md-app-toolbar>
<md-app-content>
<v-touch @swiperight="drawer_switch = true" :swipe-options="{ direction: 'horizontal' }">
<div ref="list_placeholder" :style="`height:40px`"></div>
<md-snackbar md-position="center" :md-active.sync="show_snackbar" md-persistent>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
<div :style="`height:40px`"></div>
</v-touch>
</md-app-content>
</md-app>
</div>
</template>
<script>
// @ is an alias to /src
import { mapState, mapActions } from "vuex";
import { setHtmlFontSize } from "@/utils/px2rem.js";
export default {
name: "Home",
data() {
return {
//
drawer_switch: false,
// md-app
clientHeight: "",
//
content_height: "",
//
show_list: [],
// snackbar
show_snackbar: false,
snakebar_msg: "",
// vcnsole
lastClickTime: 0,
count: 0,
//
scrollHeight: 0,
//
refresh_switch: false,
};
},
computed: {
...mapState(["user_info", "settings",])
},
methods: {
...mapActions([
"setUserInfo",
"setSettings",
]),
// md-app
changeFixed(clientHeight) {
//
this.$refs.home.children[0].style.minHeight = clientHeight + "px";
this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight =
clientHeight + "px";
this.$refs.list_placeholder.parentNode.style.minHeight =
clientHeight - 32 + "px";
this.content_height = clientHeight - 32 - 80 + "px";
window.document.documentElement.setAttribute(
"data-theme",
this.settings.is_dark_mode ? "dark" : "light"
);
},
//
init() {
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("storeState"))
)
);
this.initUserInfo()
},
//
initUserInfo() {
if (Object.keys(this.user_info).length == 0) {
//
let user_info = {
mail_addr: 'zhaoyingbo@live.cn',
openid: '123456'
};
this.setUserInfo([user_info, this]);
console.log('用户信息覆写完成');
}
console.log('用户信息初始化完成');
},
//
scrollTop() {
this.$refs.list_placeholder.parentNode.parentNode.scrollTo({
top: 0,
behavior: "smooth"
});
console.log("一键回顶成功");
},
//
refresh() {
this.$refs.router_view.refresh()
},
// snackBar
message(msg) {
this.snakebar_msg = msg
this.show_snackbar = true
},
// class
hasClass(obj, cls) {
return obj.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
},
// class
addClass(obj, cls) {
if (!this.hasClass(obj, cls)) obj.className += " " + cls;
},
// class
toggleClass(obj, cls) {
if (this.hasClass(obj, cls)) {
this.removeClass(obj, cls);
} else {
this.addClass(obj, cls);
}
},
// class
removeClass(obj, cls) {
if (this.hasClass(obj, cls)) {
var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
obj.className = obj.className.replace(reg, " ");
}
},
// vconsole
toggleVc() {
const nowTime = new Date().getTime();
if (nowTime - this.lastClickTime < 3000) {
this.count++;
} else {
this.count = 0;
}
this.lastClickTime = nowTime;
if (this.count >= 10) {
let vconDom = document.getElementById("__vconsole");
this.toggleClass(vconDom, "vconsole-show");
this.count = 0;
}
}
},
created() {
this.init();
},
mounted() {
//
this.clientHeight = `${document.documentElement.clientHeight}`;
//document.body.clientWidth;
window.onresize = function temp() {
this.clientHeight = `${document.documentElement.clientHeight}`;
setHtmlFontSize();
}.bind(this);
this.$refs.list_placeholder.parentNode.parentNode.addEventListener(
"scroll",
this.scroll
);
},
watch: {
// `clientHeight`
clientHeight: function() {
this.changeFixed(this.clientHeight);
},
$route: function() {
let path = this.$router.history.current.path
this.refresh_switch = path == '/home/clear' ? false : true
console.log(`当前路由:${path}, 刷新按钮状态:${this.refresh_switch}`)
}
},
beforeDestroy() {},
components: {}
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../../style/main";
.home {
width: 100%;
// max-width: 500px;
min-height: 100%;
background: #fff;
// margin: 0 auto;
.drawer-banner {
padding: 1rem 0.3rem 0.3rem 0.3rem;
box-sizing: border-box;
background: $main-color;
color: #fff;
position: relative;
.default-avatar {
color: #fff;
margin-bottom: 0.3rem;
}
.md-caption {
color: #fbfbfb;
}
}
.md-toolbar {
position: fixed;
top: 0;
}
.md-toolbar-row {
order: 12;
// margin-bottom: .3rem !important;
}
.md-toolbar-section-start,
.md-toolbar-section-end,
.md-toolbar-row {
min-height: 56px;
}
.md-toolbar-row {
margin-top: -10px;
}
.md-speed-dial.md-bottom-right {
position: fixed !important;
}
}
// Demo purposes only
.md-drawer {
width: 240px;
max-width: calc(100vw - 125px);
}
.md-app-scroller > div {
overflow-y: scroll !important;
}
.face {
color: #fff !important;
}
.page-title {
flex: 1;
min-height: 56px;
line-height: 56px;
}
.sroll-top-area {
flex: 1;
min-height: 56px;
}
.md-bottom-bar.md-type-fixed .md-bottom-bar-item {
max-width: 1000px !important;
}
</style>

@ -1,237 +0,0 @@
<template>
<div class="home" ref="home">
<md-app md-waterfall md-mode="fixed">
<md-app-toolbar class="md-primary">
<div class="md-toolbar-section-start">
<span class="md-title page-title" @click="scrollTop()">曳光 控制台</span>
</div>
<div class="md-toolbar-section-end">
<div class="sroll-top-area" @click="scrollTop()"></div>
</div>
</md-app-toolbar>
<md-app-content>
<div ref="list_placeholder" :style="`height:40px`"></div>
<md-progress-bar v-if="loading_switch" md-mode="indeterminate" style="position: absolute; top: 56px; left: 0; width: 100%;"></md-progress-bar>
<md-field style="margin-top: 30px;">
<label>失物招领id</label>
<md-input v-model="id" placeholder="输入在地址栏找到的失物招领id" type="number" maxlength="17"></md-input>
</md-field>
<md-speed-dial class="md-bottom-right" style="margin-bottom: 60px;">
<md-speed-dial-target class="md-primary" @click="clear" v-if="!loading_switch">
<md-icon>delete</md-icon>
</md-speed-dial-target>
</md-speed-dial>
<md-snackbar md-position="center" :md-active.sync="show_snackbar" md-persistent>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
<div :style="`height:40px`"></div>
</md-app-content>
</md-app>
</div>
</template>
<script>
// @ is an alias to /src
import { mapState, mapActions } from "vuex";
import { setHtmlFontSize } from "@/utils/px2rem.js";
import { api } from "@/axios/fetch.js";
export default {
name: "Clear",
data() {
return {
// md-app
clientHeight: "",
//
show_list: [],
// snackbar
show_snackbar: false,
snakebar_msg: "",
// id
id: "",
//
loading_switch: false
};
},
computed: {
...mapState(["user_info", "settings"])
},
methods: {
...mapActions(["setUserInfo", "setSettings"]),
// md-app
changeFixed(clientHeight) {
//
this.$refs.home.children[0].style.minHeight = clientHeight + "px";
this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight =
clientHeight + "px";
this.$refs.list_placeholder.parentNode.style.minHeight =
clientHeight - 32 + "px";
window.document.documentElement.setAttribute(
"data-theme",
this.settings.is_dark_mode ? "dark" : "light"
);
},
//
init() {
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("storeState"))
)
);
this.initUserInfo();
},
//
initUserInfo() {
if (Object.keys(this.user_info).length == 0) {
//
let user_info = {
mail_addr: "zhaoyingbo@live.cn",
openid: "123456"
};
this.setUserInfo([user_info, this]);
console.log("用户信息覆写完成");
}
console.log("用户信息初始化完成");
},
//
clear() {
//
if (Object.keys(this.user_info).length == 0) {
console.log("管理员信息校验失败");
this.message("请先登录");
return;
}
this.id = this.id.trim();
//
if (!/\d{17}/.test(this.id)) {
console.log("数据格式校验失败");
this.message("请输入正确的id");
return;
}
this.loading_switch = true;
let data = {
openid: this.user_info.openid,
id: this.id
};
console.log(data);
api
.delete("/laf/close", { data })
.then(res => {
this.message("清除成功");
this.loading_switch = false;
this.id = "";
})
.catch(err => {
console.log(err);
this.loading_switch = false;
if (err.response && err.response.status != 500) {
this.message(`${err.response.status}: ${err.response.data}`);
} else {
this.message("网络错误,请稍候重试");
}
});
},
// snackBar
message(msg) {
this.snakebar_msg = msg;
this.show_snackbar = true;
}
},
created() {
this.init();
},
mounted() {
//
this.clientHeight = `${document.documentElement.clientHeight}`;
//document.body.clientWidth;
window.onresize = function temp() {
this.clientHeight = `${document.documentElement.clientHeight}`;
setHtmlFontSize();
}.bind(this);
this.$refs.list_placeholder.parentNode.parentNode.addEventListener(
"scroll",
this.scroll
);
},
watch: {
// `clientHeight`
clientHeight: function() {
this.changeFixed(this.clientHeight);
}
},
beforeDestroy() {},
components: {}
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../../style/main";
.home {
width: 100%;
// max-width: 500px;
min-height: 100%;
background: #fff;
// margin: 0 auto;
.drawer-banner {
padding: 1rem 0.3rem 0.3rem 0.3rem;
box-sizing: border-box;
background: $main-color;
color: #fff;
position: relative;
.default-avatar {
color: #fff;
margin-bottom: 0.3rem;
}
.md-caption {
color: #fbfbfb;
}
}
.md-toolbar {
position: fixed;
top: 0;
}
.md-toolbar-row {
order: 12;
// margin-bottom: .3rem !important;
}
.md-toolbar-section-start,
.md-toolbar-section-end,
.md-toolbar-row {
min-height: 56px;
}
.md-toolbar-row {
margin-top: -10px;
}
.md-speed-dial.md-bottom-right {
position: fixed !important;
}
}
// Demo purposes only
.md-drawer {
width: 240px;
max-width: calc(100vw - 125px);
}
.md-app-scroller > div {
overflow-y: scroll !important;
}
.face {
color: #fff !important;
}
.page-title {
flex: 1;
min-height: 56px;
line-height: 56px;
}
.sroll-top-area {
flex: 1;
min-height: 56px;
}
.md-bottom-bar.md-type-fixed .md-bottom-bar-item {
max-width: 1000px !important;
}
</style>

@ -1,431 +0,0 @@
<template>
<div class="account">
<md-app md-waterfall md-mode="fixed">
<md-app-toolbar class="md-primary toolbar">
<div class="md-toolbar-section-start">
<md-button class="md-icon-button" @click="back()"><md-icon>arrow_back</md-icon></md-button>
<h3 class="md-title" style="flex: 1">{{ lang.title }}</h3>
</div>
</md-app-toolbar>
<md-app-content>
<v-touch @swiperight="back()" :swipe-options="{ direction: 'horizontal' }">
<div ref="list_placeholder" style="height: 54px;"></div>
<md-list>
<md-subheader class="md-primary">{{ lang.subheader[0] }}</md-subheader>
<md-list-item @click="openResetDialog('account')">
<md-icon>person</md-icon>
<span class="md-list-item-text">{{ lang.reset_list[0] }}</span>
<md-progress-spinner v-if="account_loading" :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner>
</md-list-item>
<md-list-item @click="openResetDialog('codebook')">
<md-icon>format_align_left</md-icon>
<span class="md-list-item-text">{{ lang.reset_list[1] }}</span>
<md-progress-spinner v-if="codebook_loading" :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner>
</md-list-item>
<md-list-item @click="openResetDialog('application')">
<md-icon>layers</md-icon>
<span class="md-list-item-text">{{ lang.reset_list[2] }}</span>
<md-progress-spinner v-if="application_loading" :md-diameter="22" :md-stroke="3" md-mode="indeterminate"></md-progress-spinner>
</md-list-item>
<md-list-item @click="open_dialog">
<md-icon>vpn_key</md-icon>
<span class="md-list-item-text">{{ lang.reset_list[3] }}</span>
</md-list-item>
<md-divider></md-divider>
<md-subheader class="md-primary">{{ lang.subheader[1] }}</md-subheader>
<md-list-item>
<md-icon>format_color_text</md-icon>
<span class="md-list-item-text">{{ lang.option_list[0] }}</span>
<md-switch v-model="is_chinese" class="md-primary"></md-switch>
</md-list-item>
<md-list-item>
<md-icon>brightness_6</md-icon>
<span class="md-list-item-text">{{ lang.option_list[1] }}</span>
<md-switch v-model="is_dark_mode" class="md-primary"></md-switch>
</md-list-item>
<md-list-item>
<md-icon>update</md-icon>
<md-field>
<label for="expired_time">{{ lang.option_list[2] }}</label>
<md-select v-model="expired_time" name="expired_time" id="expired_time">
<md-option value="300000">5 min</md-option>
<md-option value="600000">10 min</md-option>
<md-option value="900000">15 min</md-option>
<md-option :value="Number.MAX_SAFE_INTEGER">{{ lang.expired_time }}</md-option>
</md-select>
</md-field>
</md-list-item>
</md-list>
<md-dialog-prompt
:md-active.sync="reset_main_pwd_active"
v-model="new_main_pwd"
:md-title="lang.dialog.title"
md-input-maxlength="30"
:md-input-placeholder="lang.dialog.placeholder"
:md-confirm-text="lang.dialog.confirm"
:md-cancel-text="lang.dialog.cancel"
@md-confirm="resetPwd"
/>
<md-dialog-confirm
:md-active.sync="reset_confirm"
:md-title="lang.reset_dialog.title"
:md-content="lang.reset_dialog.content"
:md-confirm-text="lang.reset_dialog.confirm"
:md-cancel-text="lang.reset_dialog.cancel"
@md-cancel="reset_confirm = false"
@md-confirm="resetStart"
/>
<md-snackbar md-position="center" :md-active.sync="show_snackbar" md-persistent>
<span>{{ snakebar_msg }}</span>
</md-snackbar>
</v-touch>
</md-app-content>
</md-app>
</div>
</template>
<script>
// @ is an alias to /src
import { mapState, mapActions } from 'vuex';
import { encrypt, decrypt, encryptMainCode, decryptMainCode } from '@/utils/aes.js';
import { login, activation, syncLocal, syncCloud } from '@/axios/api.js';
import { lang } from '@/utils/language.js';
import { setHtmlFontSize } from '@/utils/px2rem.js';
export default {
name: 'Add',
data() {
return {
// loading
account_loading: false,
codebook_loading: false,
application_loading: false,
reset_main_pwd_active: false,
new_main_pwd: '',
reset_active: false,
//
is_chinese: false,
is_dark_mode: false,
// 300000 5
expired_time: 300000,
// snackbar
show_snackbar: false,
snakebar_msg: '',
//
has_init: false,
lang: '',
clientHeight: '',
//
reset_confirm: false,
reset_type: ''
};
},
computed: {
...mapState(['user_infos', 'row_data', 'row_pwd', 'settings'])
},
methods: {
...mapActions(['setUserInfo', 'setRowData', 'setRowPwd', 'setSettings']),
// md-app
changeFixed(clientHeight) {
//
// console.log(clientHeight);
// window.document.getElementsByClassName('md-content')[0].style.minHeight = clientHeight + 'px';
this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight = clientHeight + 'px';
this.$refs.list_placeholder.parentNode.style.minHeight = clientHeight - 32 + 'px';
window.document.documentElement.setAttribute('data-theme', this.settings.is_dark_mode ? 'dark' : 'light');
},
//
init() {
// vuex
this.$store.replaceState(Object.assign(this.$store.state, JSON.parse(localStorage.getItem('storeState'))));
//
if (Object.keys(this.row_pwd).length != 0) {
//
let now = new Date().getTime();
if (now - this.row_pwd.create_time < this.settings.expired_time) {
//
//
this.is_chinese = this.settings.is_chinese;
this.is_dark_mode = this.settings.is_dark_mode;
this.expired_time = this.settings.expired_time;
this.initLanguage();
// flag
setTimeout(
function() {
this.has_init = true;
console.log('本页信息覆写完成');
}.bind(this),
10
);
} else {
//
this.turnToHome('密码超时');
}
} else {
//
this.turnToHome('无密码');
}
},
//
initLanguage() {
if (this.settings.is_chinese) {
this.lang = lang().settings.CHS;
} else {
this.lang = lang().settings.EN;
}
console.log('语言配置完成');
},
//
back() {
//
if (this.reset_active) {
return;
}
this.$router.go(-1);
},
// Home
turnToHome(msg) {
console.log(msg);
this.$router.replace('/');
},
//
resetAccount(need_loading = true) {
this.reset_active = true;
if (need_loading) {
this.account_loading = true;
setTimeout(
function() {
this.account_loading = false;
this.snakebar_msg = this.lang.snakebar_msg.reset_account;
this.show_snackbar = true;
}.bind(this),
1000
);
}
//
let user_infos = {
mail_addr: 'A Little Canary',
has_login: false,
activation: false,
update_time: '1582282494434'
};
this.setUserInfo([user_infos, this]);
console.log('用户信息覆写完成');
this.reset_active = false;
},
//
resetCodebook(need_loading = true) {
this.reset_active = true;
if (need_loading) {
this.codebook_loading = true;
setTimeout(
function() {
this.codebook_loading = false;
this.snakebar_msg = this.lang.snakebar_msg.reset_codebook;
this.show_snackbar = true;
}.bind(this),
1000
);
}
this.setRowData(['', this]);
console.log('密码本覆写完成');
this.reset_active = false;
},
//
resetApplication() {
this.application_loading = true;
this.reset_active = true;
this.resetAccount(false);
this.resetCodebook(false);
this.setRowPwd(['', this]);
console.log('主密码覆写完成');
let settings = {
is_chinese: true,
is_dark_mode: false,
expired_time: 300000
};
this.setSettings([settings, this]);
console.log('个性化设置覆写完成');
this.reset_active = false;
this.application_loading = false;
this.turnToHome('项目重置完成');
},
//
resetSettings() {
let settings = {
is_chinese: this.is_chinese,
is_dark_mode: this.is_dark_mode,
expired_time: this.expired_time
};
this.setSettings([settings, this]);
console.log('个性化设置覆写完成');
if (this.settings.is_chinese) {
this.lang = lang().settings.CHS;
} else {
this.lang = lang().settings.EN;
}
window.document.documentElement.setAttribute('data-theme', this.settings.is_dark_mode ? 'dark' : 'light');
console.log('语言配置完成');
this.snakebar_msg = this.lang.snakebar_msg.reset_settings;
this.show_snackbar = true;
},
open_dialog() {
this.reset_main_pwd_active = true;
},
resetPwd(new_main_pwd) {
//
if (!new_main_pwd.trim()) {
this.snakebar_msg = this.lang.snakebar_msg.reset_pwd_failed;
this.show_snackbar = true;
}
//
if (this.row_data) {
//
let main_code_decrpt = decryptMainCode(this.row_pwd.main_code);
let data_decrypt;
//
try {
data_decrypt = decrypt(main_code_decrpt, this.row_data);
} catch (e) {
//
//
console.log(e);
this.turnToHome('密码错误');
return;
}
let data_list = JSON.parse(data_decrypt);
let data_list_aes = encrypt(new_main_pwd, data_list);
this.setRowData([data_list_aes, this]);
console.log('密码本密码修改成功,覆写完成')
}
let main_code_aes = encryptMainCode(new_main_pwd);
let row_pwd = {
main_code: main_code_aes,
create_time: new Date().getTime()
};
this.setRowPwd([row_pwd, this]);
this.snakebar_msg = this.lang.snakebar_msg.reset_pwd_successful;
this.show_snackbar = true;
},
//
openResetDialog(type) {
this.reset_confirm = true;
this.reset_type = type
},
//
resetStart() {
console.log('用户点击继续,重置开始')
switch(this.reset_type) {
case 'account':
this.resetAccount();
break
case 'codebook':
this.resetCodebook();
break
case 'application':
this.resetApplication();
break
default:
return
}
this.reset_type = ''
}
},
created() {
this.lang = lang().settings.CHS;
console.log('临时语言系统加载完成');
this.init();
},
mounted() {
//
this.clientHeight = `${document.documentElement.clientHeight}`;
//document.body.clientWidth;
window.onresize = function temp() {
this.clientHeight = `${document.documentElement.clientHeight}`;
setHtmlFontSize();
}.bind(this);
},
watch: {
// `clientHeight`
clientHeight: function() {
this.changeFixed(this.clientHeight);
},
// `is_chinese`
is_chinese: function() {
if (this.has_init) this.resetSettings();
},
// `is_dark_mode`
is_dark_mode: function() {
if (this.has_init) this.resetSettings();
},
// `expired_time`
expired_time: function() {
if (this.has_init) this.resetSettings();
}
},
beforeDestroy() {},
components: {}
};
</script>
<style scoped lang="scss" type="text/scss">
@import '../../style/main';
.account {
width: 100%;
min-height: 100%;
background: #fff;
.expand {
width: 100%;
margin: 0 !important;
min-height: 1.2rem !important;
margin-top: 0.5rem !important;
}
.time-content {
text-align: right !important;
}
.loading-box {
position: absolute;
right: 50%;
top: 50%;
margin-right: -11px;
margin-top: -11px;
}
.toolbar {
position: fixed !important;
}
}
</style>
<!--
本页计划内容
重置账户
重置密码本
重置应用
修改密码本解密密码
-----------
设置语言
设置过期时间
黑暗模式再议
-->

@ -142,30 +142,14 @@ export default {
JSON.parse(localStorage.getItem("storeState"))
)
);
this.initUserInfo();
//
this.getVerify();
},
//
initUserInfo() {
if (Object.keys(this.user_info).length == 0) {
//
let user_info = {
mail_addr: "zhaoyingbo@live.cn",
openid: "123456"
};
this.setUserInfo([user_info, this]);
console.log("用户信息覆写完成");
}
console.log("用户信息初始化完成");
},
//
getVerify() {
if (Object.keys(this.user_info).length == 0) {
console.log("管理员信息校验失败");
this.message("请先登录");
return;
}
this.loading_switch = true;
@ -198,7 +182,6 @@ export default {
confirmRes(verify_type) {
if (Object.keys(this.user_info).length == 0) {
console.log("管理员信息校验失败");
this.message("请先登录");
return;
}
if(!verify_type) {
@ -266,7 +249,13 @@ export default {
}
},
beforeDestroy() {},
components: {}
components: {},
activated() {
if (Object.keys(this.user_info).length == 0) {
this.verify_content = null
console.log('无用户信息,空内容覆写完成')
}
}
};
</script>