修改密码

zhangtao
laozt 1 year ago
parent e522ad8f3d
commit 2cb5932a7b

@ -8,6 +8,7 @@
<script> <script>
import ThemePicker from "@/components/ThemePicker"; import ThemePicker from "@/components/ThemePicker";
import { xzTree } from "@/api/yingji/keyEnterprise.js"; import { xzTree } from "@/api/yingji/keyEnterprise.js";
import { mapState } from "vuex";
export default { export default {
name: "App", name: "App",
@ -33,6 +34,28 @@ export default {
localStorage.setItem("TREE_DATA", JSON.stringify(res.data)); 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> </script>
<style scoped> <style scoped>

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

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

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

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

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

@ -16,9 +16,12 @@ const user = {
old1: [], old1: [],
new1: [], new1: [],
district: [], district: [],
isorgpwd: false,
}, },
mutations: { mutations: {
SET_IS_ORG_PWD(state, isorgpwd) {
state.isorgpwd = isorgpwd;
},
setOld: (state, route) => { setOld: (state, route) => {
state.old1 = route; state.old1 = route;
}, },
@ -53,7 +56,6 @@ const user = {
state.permissions = permissions; state.permissions = permissions;
}, },
}, },
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({ commit }, userInfo) {
@ -66,6 +68,11 @@ const user = {
.then((res) => { .then((res) => {
setToken(res.token); setToken(res.token);
commit("SET_TOKEN", res.token); commit("SET_TOKEN", res.token);
// 判断是否是初始密码
if (password == "Yingji@123") {
console.log("SET_IS_ORG_PWD");
commit("SET_IS_ORG_PWD", true);
}
resolve(); resolve();
}) })
.catch((error) => { .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) { login2({ commit }, userInfo) {
const username = userInfo.username.trim(); const username = userInfo.username.trim();

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

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