Commit 21ed51e4 authored by “yiyousong”'s avatar “yiyousong”

feat:遂宁项目

parent aa9dd7d3
......@@ -16,6 +16,7 @@
"axios": "^0.27.2",
"babel-polyfill": "^6.26.0",
"core-js": "^3.8.3",
"crypto-js": "^4.1.1",
"echarts": "^5.3.3",
"element-ui": "^2.15.8",
"font-awesome": "^4.7.0",
......
......@@ -21,8 +21,8 @@ Object.keys(directives).forEach((name) =>
Vue.directive(name, directives[name])
);
// datav
import dataV from '@jiaminghi/data-view'
Vue.use(dataV)
import dataV from "@jiaminghi/data-view";
Vue.use(dataV);
// 引入lodash
import lodash from "lodash";
Vue.prototype.$_ = lodash;
......@@ -41,9 +41,9 @@ Vue.prototype.$codeMap = codeMap;
Vue.prototype.$bus = new Vue();
Vue.config.productionTip = false;
// 图片预
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
// 图片预
import Viewer from "v-viewer";
import "viewerjs/dist/viewer.css";
Vue.use(Viewer);
new Vue({
router,
......
......@@ -18,12 +18,12 @@ service.interceptors.request.use(
"Content-Type": "application/json;charset=utf-8",
};
const Authorization = JSON.parse(localStorage.getItem("Authorization"));
const siteid = JSON.parse(localStorage.getItem("siteId"))
const siteid = JSON.parse(localStorage.getItem("siteId"));
if (Authorization) {
config.headers.Authorization = Authorization;
config.headers.Authtoken = Authorization;
config.headers.siteid = siteid
config.headers.siteid = siteid;
}
return config;
},
......@@ -42,7 +42,13 @@ service.interceptors.response.use(
maxCount: 1,
duration: 1,
});
} else if (code === 401) {
} else if (
code === 401 ||
code === 9001 ||
code === 9002 ||
code === 101 ||
code === 102
) {
message.error({
message: msg,
maxCount: 1,
......@@ -98,8 +104,9 @@ service.interceptors.response.use(
} else {
if (JSON.stringify(error).includes("timeout")) {
Vue.prototype.$message.error("服务器响应超时,请刷新当前页");
} else {
error.message = "连接服务器失败";
}
error.message = "连接服务器失败";
}
message.error({
message: error.message,
......
......@@ -25,7 +25,7 @@ const routes = [
import(
/* webpackChunkName: "dataAdmin" */ "@/views/dataAdmin/dataAdmin.vue"
),
meta: { title: "数据管理" },
meta: { title: "数据管理", activeMenu: "/home/dataManagement" },
},
{
path: "serviceDataAnalyse",
......
import CryptoJS from "crypto-js";
// 加密数据
export let encrypt = (str, keyStr, ivStr) => {
keyStr = keyStr ? keyStr : "0000000671595991";
ivStr = ivStr ? ivStr : "tdrdadq59tbss5n7";
//密钥16位
let key = CryptoJS.enc.Utf8.parse(keyStr);
//加密向量16位
let iv = CryptoJS.enc.Utf8.parse(ivStr);
let encrypted = CryptoJS.AES.encrypt(str, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
});
return encrypted.toString();
};
/**
* 加密存储临时数据并解析对象
*/
const aseKey = "**_FXxx_1234_KEY";
const KEY = "KEY_EXTRA";
export class SessionCrypto {
// 加密
static setItem(key = KEY, value = "") {
if (typeof key === "string") {
const stringify = JSON.stringify(value);
const encrypt = CryptoJS.AES.encrypt(
stringify,
CryptoJS.enc.Utf8.parse(aseKey),
{
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
}
).toString();
window.sessionStorage.setItem(key, encrypt);
return encrypt;
}
}
// 解密
static getItem(key = KEY) {
const ssStr = window.sessionStorage.getItem(key) || "";
try {
if (ssStr) {
const decrypt = CryptoJS.AES.decrypt(
ssStr,
CryptoJS.enc.Utf8.parse(aseKey),
{
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
}
).toString(CryptoJS.enc.Utf8);
const parseStr = JSON.parse(decrypt);
return parseStr;
}
return "";
} catch (e) {
return "";
}
}
// 删除
static remove(key) {
window.sessionStorage.removeItem(key);
}
}
......@@ -59,7 +59,17 @@ export default {
methods: {
// 跳转
handleJump(url) {
this.$router.push(url);
if (url.includes("http")) {
let token = Storage.get(2, "Authorization");
let siteid = Storage.get(2, "siteId") ? Storage.get(2, "siteId") : 0;
let path = this.$route.path;
window.open(
`${url}?token=${token}&siteid=${siteid}&path=${path}`,
"_blank"
);
} else {
this.$router.push(url);
}
},
// 获取子菜单权限
getChildrenPermission() {
......
......@@ -5,7 +5,13 @@
autoplay
:autoplaySpeed="2400"
:dots="false"
style="width: 100%; overflow: hidden; position: absolute; left: 0"
style="
width: 100%;
height: calc(100% - 72px);
overflow: hidden;
position: absolute;
left: 0;
"
>
<div class="img_box img1"></div>
<!-- style="
......@@ -314,7 +320,7 @@ export default {
overflow: hidden;
.img_box {
width: 100%;
height: 92.1vh;
height: calc(100vh - 72px);
overflow: hidden;
background-size: cover;
}
......
......@@ -33,15 +33,19 @@
<div slot="footer">
<a-button style="margin-left: 10px" @click="resetForm">重置</a-button>
<a-button type="primary" class="addclass" @click="handleOk">确定</a-button>
<a-button type="primary" class="addclass" @click="handleOk"
>确定</a-button
>
</div>
</a-modal>
</template>
<script>
import { changeAccount, changePassWord } from "@/utils/js/validate";
import { changePassword } from "@/api/user";
import { changePassword, LogoutInterface } from "@/api/user";
import Storage from "@/utils/js/Storage";
import { mapMutations } from "vuex";
import { encrypt } from "@/utils";
export default {
props: {
visibleEditPwd: {
......@@ -93,24 +97,29 @@ export default {
},
},
methods: {
...mapMutations("user", ["SET_USERDATA"]),
handleOk() {
this.$refs.formData.validate(async (valid) => {
let _this = this;
if (valid) {
let obj = {
loginName: this.form.loginName,
oldPwd: this.form.oldPwd,
newPwd: this.form.newPwd,
loginName: encrypt(this.form.loginName),
oldPwd: encrypt(this.form.oldPwd),
newPwd: encrypt(this.form.newPwd),
};
let res = await changePassword(obj);
let { code } = res;
if (code === 1) {
this.$message.success("密码修改成功,请重新登录");
this.Visible = false;
setTimeout(() => {
Storage.remove(2, "userInfo");
Storage.remove(2, "Authorization");
this.$router.push("/");
}, 1000);
LogoutInterface({}).then(() => {
setTimeout(() => {
Storage.clear(2);
Storage.clear(1);
_this.SET_USERDATA({});
_this.$router.push("/");
}, 1000);
});
}
}
});
......
......@@ -21,7 +21,7 @@
<a-menu
mode="horizontal"
@click="handelClick"
:defaultSelectedKeys="[$route.path]"
:selectedKeys="curActive"
:style="{ lineHeight: '4.4rem' }"
>
<a-menu-item v-for="v of menuTree_X" :key="`${v.url}`">{{
......@@ -135,6 +135,14 @@ export default {
];
return arr.includes(this.$route.path);
},
curActive() {
let router = this.$route;
if (router.meta.activeMenu) {
return [router.meta.activeMenu];
} else {
return [router.path];
}
},
},
methods: {
...mapMutations("user", ["SET_USERDATA"]),
......@@ -169,12 +177,9 @@ export default {
title: "您是否确定退出登录?",
onOk() {
LogoutInterface({}).then((res) => {
// this.$message.success(res.msg);
_this.$Storage.remove(2, "Authorization");
_this.$Storage.remove(2, "siteId");
_this.$Storage.remove(2, "siteName");
_this.$Storage.remove(2, "userInfo");
sessionStorage.removeItem("routeInfo");
this.$message.success("退出成功");
_this.$Storage.clear(2);
_this.$Storage.clear(1);
_this.SET_USERDATA({});
setTimeout(() => {
_this.$router.replace({ path: "/" });
......
......@@ -62,6 +62,7 @@
// import { mapMutations, mapActions } from "vuex";
import { LoginInterface } from "@/api/user.js";
// import { changeAccount, changePassWord } from "@/utils/js/validate";
import { encrypt } from "@/utils";
export default {
data() {
return {
......@@ -71,6 +72,7 @@ export default {
loginName: "",
password: "",
securityCode: "",
type: 2,
mark: "",
},
rules: {
......@@ -103,7 +105,11 @@ export default {
handleSubmit() {
this.$refs.formData.validate(async (valid) => {
if (valid) {
let res = await LoginInterface(this.form);
let res = await LoginInterface({
...this.form,
loginName: encrypt(this.form.loginName),
password: encrypt(this.form.password),
});
if (res.code == 1) {
let { siteList, user } = res.data;
this.$Storage.set(2, "siteList", siteList);
......
......@@ -5,7 +5,13 @@
autoplay
:autoplaySpeed="2000"
:dots="false"
style="width: 100%; height: 100%; overflow: hidden"
style="
width: 100%;
height: calc(100% - 72px);
overflow: hidden;
position: absolute;
left: 0;
"
>
<div class="img_box img1"></div>
<!-- style="
......@@ -122,7 +128,7 @@ export default {
overflow: hidden;
.img_box {
width: 100%;
height: 92.1vh;
height: calc(100vh - 72px);
overflow: hidden;
background-size: cover;
}
......@@ -203,7 +209,7 @@ export default {
font-size: 16px;
color: #ffffff;
padding-top: 5px;
text-align: left;
text-align: center;
line-height: 20px;
display: -webkit-box;
-webkit-box-orient: vertical;
......
......@@ -36,7 +36,9 @@
<div slot="footer">
<a-button style="margin-left: 10px" @click="handleClose">取消</a-button>
<a-button type="primary" class="addclass" @click="handleOk">确定</a-button>
<a-button type="primary" class="addclass" @click="handleOk"
>确定</a-button
>
</div>
</a-modal>
</div>
......@@ -45,6 +47,7 @@
<script>
import { changeAccount, changePassWord } from "@/utils/js/validate";
import { editPassword } from "@/api/user";
import { encrypt } from "@/utils";
export default {
props: {
visibleEditPwd: {
......@@ -98,7 +101,11 @@ export default {
handleOk() {
this.$refs.formData.validate(async (valid) => {
if (valid) {
let res = await editPassword(this.form);
let res = await editPassword({
...this.form,
loginName: encrypt(this.form.loginName),
newPwd: encrypt(this.form.newPwd),
});
if (res.code === 1) {
this.$message.success("密码修改成功");
this.handleClose();
......
......@@ -56,7 +56,9 @@
</a-form-model>
<div slot="footer">
<a-button style="margin-left: 10px" @click="resetForm">重置</a-button>
<a-button type="primary" class="addclass" @click="onSubmit">确定</a-button>
<a-button type="primary" class="addclass" @click="onSubmit"
>确定</a-button
>
</div>
</a-modal>
</div>
......@@ -66,6 +68,7 @@
import { getListByParentId } from "@/api/area.js";
import { userSave } from "@/api/userManagement.js";
import { TreeSelect } from "ant-design-vue";
import { encrypt } from "@/utils";
const SHOW_PARENT = TreeSelect.SHOW_PARENT; //SHOW_ALL, SHOW_PARENT, SHOW_CHILD
export default {
data() {
......@@ -178,6 +181,8 @@ export default {
...this.form,
areaNames: JSON.stringify(this.form.areaNames),
areaCodes: this.form.areaNames.map((v) => v.areaCode).join(","),
loginName: encrypt(this.form.loginName),
loginPwd: encrypt(this.form.loginPwd),
});
let { code, msg } = res;
if (code === 1) {
......
......@@ -80,7 +80,9 @@
</a-form-model>
<div slot="footer">
<a-button style="margin-left: 10px" @click="resetForm">重置</a-button>
<a-button type="primary" class="addclass" @click="onSubmit">确定</a-button>
<a-button type="primary" class="addclass" @click="onSubmit"
>确定</a-button
>
</div>
</a-modal>
</div>
......@@ -91,6 +93,7 @@ import { changeAccount, changePassWord } from "@/utils/js/validate";
import { getListByParentId } from "@/api/area.js";
import { userSave } from "@/api/userManagement.js";
import { TreeSelect } from "ant-design-vue";
import { encrypt } from "@/utils";
const SHOW_PARENT = TreeSelect.SHOW_PARENT; //SHOW_ALL, SHOW_PARENT, SHOW_CHILD
export default {
data() {
......@@ -189,6 +192,8 @@ export default {
...this.form,
areaCodes: this.form.areaCodes.join(","),
areaNames: JSON.stringify(this.changeSelect),
loginName: encrypt(this.form.loginName),
loginPwd: encrypt(this.form.loginPwd),
});
let { code, msg } = res;
if (code === 1) {
......
......@@ -2639,6 +2639,11 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"
crypto-js@^4.1.1:
version "4.1.1"
resolved "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf"
integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==
css-declaration-sorter@^6.3.1:
version "6.4.0"
resolved "https://registry.npmmirror.com/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment