|
|
@@ -23,47 +23,33 @@ export default {
|
|
|
// this.scrollUpdate();
|
|
|
// });
|
|
|
let that = this;
|
|
|
- // 默认登录
|
|
|
- encrypt().then(() => {
|
|
|
- // 登录成功之后要批量加载一下DMS的字典,后续全局可调用
|
|
|
- that.$store.state.DMSTypes.forEach((item) => {
|
|
|
- api
|
|
|
- .getDmsTypes({
|
|
|
- cName: item,
|
|
|
- type: 0,
|
|
|
- })
|
|
|
- .then((result2) => {
|
|
|
- if (result2.code == 200) {
|
|
|
- // 遍历result2.content,将每个元素的index作为key,name作为value,存储到DmsTypesMap中
|
|
|
- let dmsTypesMap = {};
|
|
|
- result2.content.forEach((element) => {
|
|
|
- dmsTypesMap[element.index] = element.name;
|
|
|
- });
|
|
|
- that.$store.commit("setDmsTypesMap", {
|
|
|
- name: item,
|
|
|
- list: dmsTypesMap,
|
|
|
- });
|
|
|
- } else {
|
|
|
- that.$message({
|
|
|
- type: "error",
|
|
|
- message: result2.content,
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- that.$message({
|
|
|
- type: "error",
|
|
|
- message: "服务器忙碌,请稍后重试!",
|
|
|
- });
|
|
|
- });
|
|
|
+ let sessionUserInfo = sessionStorage.getItem("sessionUserInfo");
|
|
|
+ // console.log(sessionUserInfo);
|
|
|
+ if (sessionUserInfo && sessionUserInfo !== "") {
|
|
|
+ let user = JSON.parse(sessionUserInfo);
|
|
|
+ // console.log(user);
|
|
|
+ // 刷新页面登录
|
|
|
+ encrypt(user).then(() => {
|
|
|
+ // 登录成功之后要批量加载一下DMS的字典,后续全局可调用
|
|
|
+ that.getDMSTypesData();
|
|
|
+ }).catch((err) => {
|
|
|
+ that.$message({
|
|
|
+ type: "error",
|
|
|
+ message: err,
|
|
|
+ });
|
|
|
});
|
|
|
- }).catch((err) => {
|
|
|
- that.$message({
|
|
|
- type: "error",
|
|
|
- message: err,
|
|
|
+ }else{
|
|
|
+ // 默认登录
|
|
|
+ encrypt().then(() => {
|
|
|
+ // 登录成功之后要批量加载一下DMS的字典,后续全局可调用
|
|
|
+ that.getDMSTypesData();
|
|
|
+ }).catch((err) => {
|
|
|
+ that.$message({
|
|
|
+ type: "error",
|
|
|
+ message: err,
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
// scrollUpdate() {
|
|
|
@@ -78,7 +64,42 @@ export default {
|
|
|
// return ww < wh ? ww : wh;
|
|
|
return ww;
|
|
|
},
|
|
|
-
|
|
|
+ // 登录成功之后要批量加载一下DMS的字典,后续全局可调用
|
|
|
+ getDMSTypesData() {
|
|
|
+ let that = this;
|
|
|
+ that.$store.state.DMSTypes.forEach((item) => {
|
|
|
+ api
|
|
|
+ .getDmsTypes({
|
|
|
+ cName: item,
|
|
|
+ type: 0,
|
|
|
+ })
|
|
|
+ .then((result) => {
|
|
|
+ if (result.code == 200) {
|
|
|
+ // 遍历result.content,将每个元素的index作为key,name作为value,存储到DmsTypesMap中
|
|
|
+ let dmsTypesMap = {};
|
|
|
+ result.content.forEach((element) => {
|
|
|
+ dmsTypesMap[element.index] = element.name;
|
|
|
+ });
|
|
|
+ that.$store.commit("setDmsTypesMap", {
|
|
|
+ name: item,
|
|
|
+ list: dmsTypesMap,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.$message({
|
|
|
+ type: "error",
|
|
|
+ message: result.content,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ that.$message({
|
|
|
+ type: "error",
|
|
|
+ message: "服务器忙碌,请稍后重试!",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
initScript() {
|
|
|
let that = this;
|
|
|
window.SkySceneryConfig = {
|