修改密码

zhangtao
laozt 1 year ago
parent e522ad8f3d
commit 2cb5932a7b

@ -8,6 +8,7 @@
<script>
import ThemePicker from "@/components/ThemePicker";
import { xzTree } from "@/api/yingji/keyEnterprise.js";
import { mapState } from "vuex";
export default {
name: "App",
@ -33,6 +34,28 @@ export default {
localStorage.setItem("TREE_DATA", JSON.stringify(res.data));
});
},
computed: {
...mapState({
isorgpwd: (state) => state.user.isorgpwd,
}),
},
watch: {
isorgpwd(newVal, oldVal) {
// console.log("");
// console.log(newVal, oldVal);
//
let _this = this
if (newVal) {
this.$alert("您的密码为原始密码,需要修改!", "警告信息", {
confirmButtonText: "确定",
showClose: false,
callback: (action) => {
_this.$router.push("/user/profile");
},
});
}
},
},
};
</script>
<style scoped>

@ -146,6 +146,8 @@ export default {
localStorage.removeItem("isGovernmentAffairsNetwork");
location.href = "/login?redirect=%2Findex";
}
localStorage.removeItem("IS_ORG_PWD");
});
})
.catch(() => {});

@ -98,6 +98,7 @@ DictData.install();
moment.locale("zh-cn");
Vue.prototype.$moment = moment;
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
@ -119,3 +120,6 @@ new Vue({
store,
render: (h) => h(App),
});

@ -20,7 +20,6 @@ router.beforeEach((to, from, next) => {
next({ path: "/" });
NProgress.done();
} else {
// store.dispatch("Getdistrict");
if (store.getters.roles.length === 0) {
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息

@ -47,12 +47,6 @@ export const constantRoutes = [
component: () => import("@/views/login"),
hidden: true,
},
// {
// path: "/login2",
// component: (resolve) => require(["@/views/login2"], resolve),
// hidden: true,
// },
{
path: "/register",
component: () => import("@/views/register"),
@ -78,33 +72,32 @@ export const constantRoutes = [
path: "/home",
component: () => import("@/views/yingji/home.vue"),
name: "home",
meta:{index:0}
meta: { index: 0 },
},
{
path: "/planManage",
component: () => import("@/views/yingji/planManage.vue"),
name: "planManage",
meta:{index:1}
meta: { index: 1 },
},
{
path: "/enforcing",
component: () => import("@/views/yingji/enforcing.vue"),
name: "enforcing",
meta:{index:2}
meta: { index: 2 },
},
{
path: "/enterprise",
component: () => import("@/views/yingji/enterprise.vue"),
name: "enterprise",
meta:{index:3}
meta: { index: 3 },
},
{
path: "/focusEnter",
component: () => import("@/views/yingji/focusEnter.vue"),
name: "focusEnter",
meta:{index:4}
meta: { index: 4 },
},
],
},
{

@ -1,19 +1,20 @@
const getters = {
sidebar: state => state.app.sidebar,
size: state => state.app.size,
device: state => state.app.device,
dict: state => state.dict.dict,
visitedViews: state => state.tagsView.visitedViews,
cachedViews: state => state.tagsView.cachedViews,
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes,
topbarRouters:state => state.permission.topbarRouters,
defaultRoutes:state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters,
}
export default getters
sidebar: (state) => state.app.sidebar,
size: (state) => state.app.size,
device: (state) => state.app.device,
dict: (state) => state.dict.dict,
visitedViews: (state) => state.tagsView.visitedViews,
cachedViews: (state) => state.tagsView.cachedViews,
token: (state) => state.user.token,
avatar: (state) => state.user.avatar,
name: (state) => state.user.name,
introduction: (state) => state.user.introduction,
roles: (state) => state.user.roles,
permissions: (state) => state.user.permissions,
permission_routes: (state) => state.permission.routes,
topbarRouters: (state) => state.permission.topbarRouters,
defaultRoutes: (state) => state.permission.defaultRoutes,
sidebarRouters: (state) => state.permission.sidebarRouters,
isorgpwd: (state) => state.user.isorgpwd,
};
export default getters;

@ -16,9 +16,12 @@ const user = {
old1: [],
new1: [],
district: [],
isorgpwd: false,
},
mutations: {
SET_IS_ORG_PWD(state, isorgpwd) {
state.isorgpwd = isorgpwd;
},
setOld: (state, route) => {
state.old1 = route;
},
@ -53,7 +56,6 @@ const user = {
state.permissions = permissions;
},
},
actions: {
// 登录
Login({ commit }, userInfo) {
@ -66,6 +68,11 @@ const user = {
.then((res) => {
setToken(res.token);
commit("SET_TOKEN", res.token);
// 判断是否是初始密码
if (password == "Yingji@123") {
console.log("SET_IS_ORG_PWD");
commit("SET_IS_ORG_PWD", true);
}
resolve();
})
.catch((error) => {
@ -88,19 +95,6 @@ const user = {
});
});
},
// 获取行政区划
Getdistrict({ commit }) {
return new Promise((resolve, reject) => {
xzTree()
.then((res) => {
commit("SET_DISTRICT", res.data);
resolve();
})
.catch((error) => {
reject(error);
});
});
},
// 匿名
login2({ commit }, userInfo) {
const username = userInfo.username.trim();

@ -44,14 +44,20 @@
:clearable="false"
:disabled="readonly"
value-format="yyyy-MM"
placeholder="请选择年月">
placeholder="请选择年月"
>
</el-date-picker>
</el-form-item>
<el-form-item label="计划标题:">
<el-input v-model="form.planName" :readonly="readonly" show-word-limit :maxlength="64"></el-input>
<el-input
v-model="form.planName"
:readonly="readonly"
show-word-limit
:maxlength="64"
></el-input>
</el-form-item>
<el-form-item label="计划内容:" class="form-textarea">
<el-input
<el-input
v-model="form.planContent"
type="textarea"
resize="none"
@ -73,19 +79,21 @@
></el-input>
</el-form-item>
<el-form-item class="btns">
<el-button type="primary" @click="onSubmit" v-if="!readonly"></el-button>
<el-button type="primary" @click="onSubmit" v-if="!readonly"
>确认修改</el-button
>
<el-button @click="Close"></el-button>
</el-form-item>
</el-form>
<el-descriptions :column="2" border v-else>
<el-descriptions-item
:label="item.label"
v-for="(item, index) in listDes"
:key="index"
:span="item.span ? item.span : 1"
>
{{ item.value}}
</el-descriptions-item>
:label="item.label"
v-for="(item, index) in listDes"
:key="index"
:span="item.span ? item.span : 1"
>
{{ item.value }}
</el-descriptions-item>
</el-descriptions>
</div>
</div>
@ -96,86 +104,108 @@ import { Loading } from "element-ui";
export default {
data() {
return {
dialogVisible:false,
mydistrict:'',
form:{
entprName:'',
district:'',
createTime:'',
plannedYear:'',
planName:'',
planContent:'',
remark:''
dialogVisible: false,
mydistrict: "",
form: {
entprName: "",
district: "",
createTime: "",
plannedYear: "",
planName: "",
planContent: "",
remark: "",
},
id:'',
idTwo:'',
readonly:false,
loading:true,
title:'查看详情',
listDes:[
id: "",
idTwo: "",
readonly: false,
loading: true,
title: "查看详情",
listDes: [
{
tag: "entprName",
label: "企业名称",
value: "",
},
{
tag: "district",
label: "行政区划",
value: "",
},
{
tag: "createTime",
label: "发布时间",
value: "",
},
{
tag: "plannedYear",
label: "计划年月",
value: "",
},
{
tag: "planName",
label: "计划标题",
value: "",
span: 2,
},
{
tag: "planContent",
label: "计划内容",
value: "",
span: 2,
},
{
tag:'entprName',
label:'企业名称',
value:'',
},{
tag:'district',
label:'行政区划',
value:'',
},{
tag:'createTime',
label:'发布时间',
value:'',
},{
tag:'plannedYear',
label:'计划年月',
value:'',
},{
tag:'planName',
label:'计划标题',
value:'',
span:2,
},{
tag:'planContent',
label:'计划内容',
value:'',
span:2,
},{
tag:'remark',
label:'备注',
value:'',
span:2,
tag: "remark",
label: "备注",
value: "",
span: 2,
},
],
district:[]
}
district: [],
};
},
methods:{
open(item,id) {
this.idTwo = id
this.id = item.id
this.getDistrict()
this.getMyData(item.id,id)
if(id == 2) {
methods: {
open(item, id) {
this.idTwo = id;
this.id = item.id;
this.getDistrict();
this.getMyData(item.id, id);
if (id == 2) {
this.readonly = true;
this.title = '查看详情'
this.title = "查看详情";
} else {
this.readonly = false;
this.title = '修改详情'
this.title = "修改详情";
}
this.dialogVisible = true;
},
async getMyData(id,idTwo){
async getMyData(id, idTwo) {
this.loading = true;
let data = await this.$api.yingji.bPlanManageTwo(id)
if(data.code == 200){
let { entprName,district,createTime,plannedYear,planName,planContent,remark } = data.data
let data = await this.$api.yingji.bPlanManageTwo(id);
if (data.code == 200) {
let {
entprName,
district,
createTime,
plannedYear,
planName,
planContent,
remark,
} = data.data;
// let listData = data.data
this.mydistrict = district
let myDistrict = this.componendDistrict(district)
let mycreateTime = createTime.split(' ')[0]
if(idTwo == 2) {
let obj = { entprName,myDistrict,mycreateTime,plannedYear,planName,planContent,remark }
this.changeDescriptions(this.listDes,...Object.values(obj))
this.mydistrict = district;
let myDistrict = this.componendDistrict(district);
let mycreateTime = createTime.split(" ")[0];
if (idTwo == 2) {
let obj = {
entprName,
myDistrict,
mycreateTime,
plannedYear,
planName,
planContent,
remark,
};
this.changeDescriptions(this.listDes, ...Object.values(obj));
// for(let key in listData){
// this.listDes.forEach((value1, index1) => {
// if (key == value1.tag) {
@ -195,15 +225,23 @@ export default {
// }
// })
} else {
this.form = { entprName,district:myDistrict,createTime:mycreateTime,plannedYear,planName,planContent,remark }
this.form = {
entprName,
district: myDistrict,
createTime: mycreateTime,
plannedYear,
planName,
planContent,
remark,
};
}
this.loading = false;
}
},
changeDescriptions(arr,...items){
items.map((item,index)=>{
arr[index].value = item || '/'
})
changeDescriptions(arr, ...items) {
items.map((item, index) => {
arr[index].value = item || "/";
});
},
Close(item) {
this.dialogVisible = false;
@ -216,73 +254,101 @@ export default {
getData() {
var myDate = new Date();
var year = myDate.getFullYear(); //var mon = myDate.getMonth() + 1; //
var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1 == 0 ? "00" : myDate.getMonth() + 1;
var date = myDate.getDate() < 10 ? "0" + myDate.getDate() : myDate.getDate(); //
var hours = myDate.getHours() < 10 ? "0" + myDate.getHours() : myDate.getHours(); //
var minutes = myDate.getMinutes() < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //
var seconds = myDate.getSeconds() < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //var now = year + "_" + mon + "_" + date + " "+ hours + ":" + minutes + ":" + seconds;
var now = year + "-" + mon + "-" + date + " " + hours + ":" + minutes + ":" + seconds;
var mon =
myDate.getMonth() + 1 < 10
? "0" + (myDate.getMonth() + 1)
: myDate.getMonth() + 1 == 0
? "00"
: myDate.getMonth() + 1;
var date =
myDate.getDate() < 10 ? "0" + myDate.getDate() : myDate.getDate(); //
var hours =
myDate.getHours() < 10 ? "0" + myDate.getHours() : myDate.getHours(); //
var minutes =
myDate.getMinutes() < 10
? "0" + myDate.getMinutes()
: myDate.getMinutes(); //
var seconds =
myDate.getSeconds() < 10
? "0" + myDate.getSeconds()
: myDate.getSeconds(); //var now = year + "_" + mon + "_" + date + " "+ hours + ":" + minutes + ":" + seconds;
var now =
year +
"-" +
mon +
"-" +
date +
" " +
hours +
":" +
minutes +
":" +
seconds;
return now;
},
onSubmit(){
if(this.form.planContent && this.form.planName){
this.$modal.confirm("你确认修改吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async() => {
try {
let downloadLoadingInstance = Loading.service({
text: "正在修改计划,请稍候",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
// console.log(this.form)
const { planName,remark,planContent,plannedYear } = this.form;
let obj = {updateTime:this.getData(),planContent:planContent,planName:planName,remark:remark,id:this.id,plannedYear:plannedYear}
// console.log(obj)
let data = await this.$api.yingji.bPlanEnterprise('put',obj)
console.log(data)
if(data.code == 200){
downloadLoadingInstance.close();
this.$message({
showClose: true,
message: '修改成功',
type: 'success'
onSubmit() {
if (this.form.planContent && this.form.planName) {
this.$modal
.confirm("你确认修改吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
try {
let downloadLoadingInstance = Loading.service({
text: "正在修改计划,请稍候",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
this.Close("newsuccess")
}
} catch (error) {
}
})
// console.log(this.form)
const { planName, remark, planContent, plannedYear } = this.form;
let obj = {
updateTime: this.getData(),
planContent: planContent,
planName: planName,
remark: remark,
id: this.id,
plannedYear: plannedYear,
};
// console.log(obj)
let data = await this.$api.yingji.bPlanEnterprise("put", obj);
console.log(data);
if (data.code == 200) {
downloadLoadingInstance.close();
this.$message({
showClose: true,
message: "修改成功",
type: "success",
});
this.Close("newsuccess");
}
} catch (error) {}
});
}
},
async getDistrict(){
// let data = await this.$api.yingji.tree();
// this.district = data.data;
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"))
this.district = treeData
async getDistrict() {
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"));
this.district = treeData;
},
//
componendDistrict(district){
let name
this.district.map((item)=>{
if(item.subdistrict == district) {
name = item.institutionName
componendDistrict(district) {
let name;
this.district.map((item) => {
if (item.subdistrict == district) {
name = item.institutionName;
} else {
item.children.map((itemTwo)=>{
if(itemTwo.subdistrict == district) {
name = item.institutionName + '-' + itemTwo.institutionName
item.children.map((itemTwo) => {
if (itemTwo.subdistrict == district) {
name = item.institutionName + "-" + itemTwo.institutionName;
}
})
});
}
})
return name
});
return name;
},
},
}
};
</script>
<style lang="scss" scoped>
::v-deep .el-descriptions-row th {
@ -341,7 +407,7 @@ export default {
::v-deep .el-input {
.el-input__inner {
font-size: 15px;
font-family: 'Alibaba PuHuiTi';
font-family: "Alibaba PuHuiTi";
font-weight: 400;
color: #525966;
}
@ -352,7 +418,7 @@ export default {
.el-textarea__inner {
height: 100%;
font-size: 15px;
font-family: 'Alibaba PuHuiTi';
font-family: "Alibaba PuHuiTi";
font-weight: 400;
color: #525966;
}

@ -70,11 +70,11 @@
</el-button>
</div>
<div style="float: right" v-if="register">
<!-- <div style="float: right" v-if="register">
<router-link class="link-type" :to="'/register'"
>立即注册</router-link
>
</div>
</div> -->
</el-form-item>
</el-form>
</div>
@ -159,7 +159,6 @@ export default {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
// this.$router.push({ path: "/home" }).catch(() => {});
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
@ -185,7 +184,6 @@ export default {
this.getCode();
}
});
}
});
},

@ -1,135 +0,0 @@
<template>
<div></div>
</template>
<script>
import { getCodeImg, getlists } from "@/api/login";
import { getInfo } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from "@/utils/jsencrypt";
export default {
name: "Login",
data() {
return {
codeUrl: "",
cookiePassword: "",
loginForm: {
username: "admin",
password: "admin@123Jichuang",
rememberMe: false,
code: "",
uuid: "",
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" },
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" },
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
},
loading: false,
//
captchaOnOff: false,
//
register: true,
redirect: undefined,
form: "",
queryParams: {
pageNum: 1,
pageSize: 10,
landUseRights: null,
type: null,
unifiedSocialCreditCode: null,
actualBusinessAddress: null,
industry: null,
belongRegion: null,
fireRating: null,
acompEvalGrade: null,
businessLicenseImg: null,
certificateImg: null,
ownershipImg: null,
fireImg: null,
},
};
},
watch: {
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true,
},
},
created() {
// this.getCode();
this.getCookie();
this.handleLogin();
},
methods: {
getCode() {
getCodeImg().then((res) => {
this.captchaOnOff =
res.captchaOnOff === undefined ? true : res.captchaOnOff;
if (this.captchaOnOff) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
});
},
getCookie() {
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get("rememberMe");
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password:
password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
};
},
handleLogin() {
const loading = this.$loading({
lock: true,
text: "Loading",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
this.$store.dispatch("login2", this.loginForm).then((res) => {
getInfo().then((res) => {
this.$router
.replace({
path: "/profile",
query: { routerPath: this.redirect },
})
.catch(() => {});
loading.close();
});
});
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss">
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.login-code-img {
height: 38px;
width: 100%;
}
.registration {
text-align: right;
}
</style>
Loading…
Cancel
Save