|
@@ -2,7 +2,8 @@
|
|
|
<router-view />
|
|
<router-view />
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
-import api from "@/api/common";
|
|
|
|
|
|
|
+// import api from "@/api/common";
|
|
|
|
|
+import encrypt from "@/utils/encrypt";
|
|
|
export default {
|
|
export default {
|
|
|
name: "App",
|
|
name: "App",
|
|
|
data() {
|
|
data() {
|
|
@@ -23,57 +24,51 @@ export default {
|
|
|
// });
|
|
// });
|
|
|
let that = this;
|
|
let that = this;
|
|
|
// 默认登录
|
|
// 默认登录
|
|
|
- api
|
|
|
|
|
- .login({
|
|
|
|
|
- userName: systemConfig.defaultAccount.userName,
|
|
|
|
|
- password: AesEncryptUtil.getPassword(),
|
|
|
|
|
- clientId: "1",
|
|
|
|
|
- })
|
|
|
|
|
- .then((result) => {
|
|
|
|
|
- if (result.code == 200) {
|
|
|
|
|
- that.$store.commit("setUserInfo", result.content);
|
|
|
|
|
- that.$store.commit("setToken", result.message);
|
|
|
|
|
- that.$store.commit("setUserState", true);
|
|
|
|
|
- // 登录成功之后要批量加载一下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);
|
|
|
|
|
|
|
+ encrypt().then((result) => {
|
|
|
|
|
+ if (result.code == 200) {
|
|
|
|
|
+ that.$store.commit("setUserInfo", result.content);
|
|
|
|
|
+ that.$store.commit("setToken", result.message);
|
|
|
|
|
+ that.$store.commit("setUserState", true);
|
|
|
|
|
+ // 登录成功之后要批量加载一下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({
|
|
that.$message({
|
|
|
type: "error",
|
|
type: "error",
|
|
|
- message: "服务器忙碌,请稍后重试!",
|
|
|
|
|
|
|
+ message: result2.content,
|
|
|
});
|
|
});
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ console.log(err);
|
|
|
|
|
+ that.$message({
|
|
|
|
|
+ type: "error",
|
|
|
|
|
+ message: "服务器忙碌,请稍后重试!",
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- that.$message({
|
|
|
|
|
- type: "error",
|
|
|
|
|
- message: result.content,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message({
|
|
|
|
|
+ type: "error",
|
|
|
|
|
+ message: result.content,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
that.$message({
|
|
that.$message({
|
|
|
type: "error",
|
|
type: "error",
|