Browse Source

继续优化

master
dai 3 years ago
parent
commit
d6ea1c75ef
  1. 2
      src/js/dai/request.js
  2. 2
      src/js/dai/request2.js
  3. 186
      src/router/index.js
  4. 1
      src/utils/index.js
  5. 65
      src/views/pages/index.vue
  6. 2
      src/views/pages/login.vue

2
src/js/dai/request.js

@ -4,6 +4,7 @@
import axios from "axios"; import axios from "axios";
import curry from "dai-js/tools/curry"; import curry from "dai-js/tools/curry";
import { Message } from "element-ui"; import { Message } from "element-ui";
import { clearLoginInfo } from "@/utils";
const request = curry( const request = curry(
(method, url, data = {}, headers = {}, progress = () => {}) => { (method, url, data = {}, headers = {}, progress = () => {}) => {
@ -42,6 +43,7 @@ const request = curry(
// 10005 token为空 10006登陆超时 10007别处登录 // 10005 token为空 10006登陆超时 10007别处登录
console.log("登录失效"); console.log("登录失效");
Message.error(res.data.msg); Message.error(res.data.msg);
clearLoginInfo();
return next({ return next({
name: "login", name: "login",
}); });

2
src/js/dai/request2.js

@ -4,6 +4,7 @@
import axios from "axios"; import axios from "axios";
import curry from "dai-js/tools/curry"; import curry from "dai-js/tools/curry";
import { Message } from "element-ui"; import { Message } from "element-ui";
import { clearLoginInfo } from "@/utils";
const request = curry( const request = curry(
(method, url, data = {}, headers = {}, progress = () => {}) => { (method, url, data = {}, headers = {}, progress = () => {}) => {
@ -42,6 +43,7 @@ const request = curry(
// 10005 token为空 10006登陆超时 10007别处登录 // 10005 token为空 10006登陆超时 10007别处登录
console.log("登录失效"); console.log("登录失效");
Message.error(res.data.msg); Message.error(res.data.msg);
clearLoginInfo();
return next({ return next({
name: "login", name: "login",
}); });

186
src/router/index.js

@ -213,192 +213,6 @@ router.beforeEach((to, from, next) => {
const customerId = localStorage.getItem("customerId"); const customerId = localStorage.getItem("customerId");
console.log("customerId:", customerId); console.log("customerId:", customerId);
window.SITE_CONFIG["menuShujuList"] = [
// {
// url: "/visual/plugin/power/organization",
// name: "动力主轴",
// id: "5feawfwaefwa577",
// },
{
id: "22213213",
name: "基础信息",
// url: "visual/basicinfo/basicInfoMain",
children: [
{
url: "/visual/basicinfo/basicInfoMain",
name: "人房信息统计",
id: "5feawfwaefwa5",
},
{
url: "/visual/basicinfo/personCategory/index",
name: "人员类别分析",
id: "5fwaefwaefawef5",
},
{
url: "/visual/basicinfo/houseStatic/houseStatic",
name: "人房概览统计",
id: "5fwaefwaefawef6",
},
],
},
{
icon: "icon-setting",
id: "2",
name: "人员图谱",
url: "visual/basicinfo/peopleSearch",
},
{
icon: "icon-setting",
id: "3",
name: "人员预警",
url: "visual/warning/index",
},
{
icon: "icon-setting",
id: "2221321001",
name: "社区党建",
// url: "visual/basicinfo/basicInfoMain",
children: [
{
url: "/visual/communityParty/gridParty",
name: "网格党建平面图",
id: "5feawfwaefwa579",
},
{
url: "/visual/communityParty/party",
name: "党员信息统计",
id: "5feawfwaefwa578",
},
{
url: "/visual/communityParty/community",
name: "联建单位分析",
id: "5fwaefwaefawef588",
},
{
url: "/visual/communityParty/elegant",
name: "党员风采榜",
id: "5fwaefwaefawef589",
},
],
},
{
icon: "icon-setting",
id: "2221321123",
name: "社区服务",
// url: "visual/basicinfo/basicInfoMain",
children: [
{
url: "/visual/measure/service",
name: "需求服务分析",
id: "5feawfwaefwa57",
},
{
url: "/visual/measure/volunteer",
name: "志愿服务分析",
id: "5fwaefwaefawef58",
},
],
},
{
icon: "icon-setting",
id: "6",
name: "社区治理",
children: [
{
url: "visual/communityGovern/shijianchuli/shijianchulifenxi",
name: "事件处理分析",
id: "shijianchulifenxi",
},
// {
// url: "visual/communityGovern/processAnalyze",
// name: "事件处置分析",
// id: "processAnalyze",
// },
{
url: "/visual/communityGovern/shijianfenlei/shijianfenleifenxi",
name: "事件分类分析",
id: "shijianfenleifenxi",
},
{
url: "/visual/communityGovern/duoyuanfuwu/duoyuanfuwufenxi",
name: "多元服务分析",
id: "duoyuanfuwufenxi",
},
// {
// url: "/visual/communityGovern/typeAnalyze",
// name: "事件分类分析",
// id: "typeAnalyze",
// },
// {
// url: "/visual/communityGovern/resibuzz",
// name: "居民热议分析",
// id: "resibuzz",
// },
// {
// url: "/visual/communityGovern/distributionAnalyze",
// name: "事件分布分析",
// id: "distributionAnalyze",
// },
],
},
{
icon: "icon-setting",
id: "2221321fefefaewfa123",
name: "初心互助",
url: "visual/heart/index",
children: [],
},
{
icon: "icon-setting",
id: "2221321fefefaewfa122223",
name: "疫情防控",
url: "",
children: [],
},
{
icon: "icon-setting",
id: "44rq22222q2222",
name: "智慧安防",
// url: "visual/basicinfo/basicInfoMain",
children: [
{
url: "https://test-rxs-job.elinkservice.cn/haiqin-ai/aisecurity.html#/monitor-panel",
// url: "/visual/ai/index",
name: "视频监控",
id: "5feawfwa111111efwa57",
},
/*{
url: "/visual/ai/renliu",
name: "人流数据",
id: "5fwaefwae222112fawef58",
},
{
url: "/visual/ai/cheliu",
name: "车流数据",
id: "erawerwecsxefwaw",
},
{
url: "/visual/ai/shebei",
name: "设备数据",
id: "zfzffewaf",
},
{
url: "/visual/ai/gongdan",
name: "工单数据",
id: "fewafwafewaefddd",
},*/
{
// url: "/visual/ai/yujing",
url: "https://test-rxs-job.elinkservice.cn/haiqin-ai/aisecurity.html#/data-analysis",
name: "预警分析",
id: "545345fdsfs",
},
],
},
];
// fnAddDynamicMenuRoutes2(window.SITE_CONFIG["menuShujuList"]);
http http
.get("gov/access/menu/navDigitalCommunity?tableName=data_menu") .get("gov/access/menu/navDigitalCommunity?tableName=data_menu")
.then(({ data: res }) => { .then(({ data: res }) => {

1
src/utils/index.js

@ -45,6 +45,7 @@ export function getDictLabel(dictType, dictValue) {
export function clearLoginInfo() { export function clearLoginInfo() {
store.commit('resetStore') store.commit('resetStore')
Cookies.remove('token') Cookies.remove('token')
localStorage.setItem("token", '');
window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false
} }

65
src/views/pages/index.vue

@ -5,14 +5,14 @@
<div class="list"> <div class="list">
<div class="item" @click="handleClickItem(1)"> <div class="item" @click="handleClickItem(1)">
<img class="logo" src="@/assets/img/index/logo-1.png" alt="" /> <img class="logo" src="@/assets/img/index/logo-1.png" alt="" />
<!-- 党建引领基层治理互联管理平台 --> <!-- 党建引领基层治理互联管理平台 -->
<div class="name">数字社区管理平台</div> <div class="name">数字社区管理平台</div>
<img src="@/assets/img/index/zhuangshi.png" class="tip" /> <img src="@/assets/img/index/zhuangshi.png" class="tip" />
</div> </div>
<div class="item z-on" @click="handleClickItem(2)"> <div class="item z-on" @click="handleClickItem(2)">
<img class="logo" src="@/assets/img/index/logo-2.png" alt="" /> <img class="logo" src="@/assets/img/index/logo-2.png" alt="" />
<!-- 数据分析可视化平台 --> <!-- 数据分析可视化平台 -->
<div class="name">数字社区可视化平台</div> <div class="name">数字社区可视化平台</div>
<img src="@/assets/img/index/zhuangshi.png" class="tip" /> <img src="@/assets/img/index/zhuangshi.png" class="tip" />
</div> </div>
@ -21,7 +21,9 @@
<div class="m-footer"> <div class="m-footer">
<div class="login-footer"> <div class="login-footer">
<p> <p>
<a href="http://www.elinkchina.com.cn/" target="_blank">{{ $t('login.copyright') }}</a> <a href="http://www.elinkchina.com.cn/" target="_blank">{{
$t("login.copyright")
}}</a>
</p> </p>
</div> </div>
</div> </div>
@ -29,60 +31,69 @@
</div> </div>
</template> </template>
<script> <script>
import Cookies from 'js-cookie' import Cookies from "js-cookie";
import debounce from 'lodash/debounce' import debounce from "lodash/debounce";
import { messages } from '@/i18n' import { messages } from "@/i18n";
import { getUUID } from '@/utils' import { getUUID } from "@/utils";
import { Loading } from 'element-ui' // Loading import { Loading } from "element-ui"; // Loading
import JSEncrypt from 'jsencrypt' // import JSEncrypt from "jsencrypt"; //
let loading // let loading; //
export default { export default {
data() { data() {
return { return {
pubKey: null, // pubKey: null, //
isShowLogin: true, isShowLogin: true,
i18nMessages: messages i18nMessages: messages,
} };
}, },
components: {}, components: {},
computed: {}, computed: {},
created() {}, created() {},
mounted() {}, mounted() {},
beforeRouteEnter(to, from, next) {
console.log(from);
if (from.name == "login") {
next();
location.reload();
}
next();
},
methods: { methods: {
handleClickItem(k) { handleClickItem(k) {
if (k == 1) { if (k == 1) {
this.$router.replace({ name: 'main' }) this.$router.replace({ name: "main" });
} else if (k == 2) { } else if (k == 2) {
this.$router.replace({ name: 'main-shuju' }) this.$router.replace({ name: "main-shuju" });
} }
}, },
// //
getAutoLogin(platformToken) { getAutoLogin(platformToken) {
this.dataForm.thirdToken = platformToken this.dataForm.thirdToken = platformToken;
this.dataForm.platform = 'pyld' this.dataForm.platform = "pyld";
this.$http this.$http
.post(`/auth/sso/oper/third/login`, this.dataForm) .post(`/auth/sso/oper/third/login`, this.dataForm)
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
if (res.code == 8302) { if (res.code == 8302) {
return this.$message.error(res.msg) return this.$message.error(res.msg);
} }
return this.$message.error(res.msg) return this.$message.error(res.msg);
} }
localStorage.setItem('customerId', res.data.customerId) localStorage.setItem("customerId", res.data.customerId);
localStorage.setItem('userType', 'work') localStorage.setItem("userType", "work");
localStorage.setItem('showHeader', '0') localStorage.setItem("showHeader", "0");
localStorage.setItem('token', res.data.token) localStorage.setItem("token", res.data.token);
this.$router.replace({ name: 'home' }) this.$router.replace({ name: "home" });
}) })
.catch(() => {}) .catch(() => {});
// epmet-ext9.elinkservice.cn/platform-admin // epmet-ext9.elinkservice.cn/platform-admin
} },
} },
} };
</script> </script>
<style lang="scss" src="@/assets/scss/pages/indexWork.scss" scoped></style> <style lang="scss" src="@/assets/scss/pages/indexWork.scss" scoped></style>

2
src/views/pages/login.vue

@ -247,7 +247,7 @@ export default {
localStorage.setItem("userType", "work"); localStorage.setItem("userType", "work");
localStorage.setItem("showHeader", "0"); localStorage.setItem("showHeader", "0");
localStorage.setItem("token", res.data.token); localStorage.setItem("token", res.data.token);
this.$router.replace({ name: "home" }); this.$router.replace({ name: "index" });
}) })
.catch(() => {}); .catch(() => {});
// epmet-ext9.elinkservice.cn/platform-admin // epmet-ext9.elinkservice.cn/platform-admin

Loading…
Cancel
Save