vue2-client 1.2.85 → 1.2.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
- **1.2.81 - 1.2.85 -2022-07-21 @朱子峰**
4
+ **1.2.81 - 1.2.86 -2022-07-21 @朱子峰**
5
5
  - 功能新增:
6
6
  - 兼容V4登陆
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.85",
3
+ "version": "1.2.86",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -24,6 +24,7 @@ export default {
24
24
  },
25
25
  mounted () {
26
26
  this.setWeekModeTheme(this.weekMode)
27
+ localStorage.setItem('compatible', this.compatible)
27
28
  },
28
29
  watch: {
29
30
  weekMode (val) {
@@ -55,7 +56,7 @@ export default {
55
56
  }
56
57
  },
57
58
  computed: {
58
- ...mapState('setting', ['layout', 'theme', 'weekMode', 'lang'])
59
+ ...mapState('setting', ['layout', 'theme', 'weekMode', 'lang', 'compatible'])
59
60
  },
60
61
  methods: {
61
62
  ...mapMutations('setting', ['setDevice']),
@@ -118,9 +118,16 @@ export default {
118
118
  const loginRes = res
119
119
  const V4Token = { token: res.access_token, expire: res.expires_in }
120
120
  this.setV4AccessToken(V4Token)
121
+ // 如果这是用户首次打开本系统,localStorage无法初始化,改用code判断
122
+ let pass = false
123
+ if (res.code) {
124
+ if (res.code === 200) {
125
+ pass = true
126
+ }
127
+ }
121
128
  // 向本地缓存中临时存储compatible
122
- localStorage.setItem('compatible', this.compatible)
123
- if (loginRes.access_token) {
129
+ console.log(loginRes)
130
+ if (loginRes.access_token || pass) {
124
131
  const encrypt = new JSEncrypt()
125
132
  encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
126
133
  const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
@@ -3,7 +3,7 @@ let Amap
3
3
  async function GetGDMap () {
4
4
  if (!Amap) {
5
5
  window._AMapSecurityConfig = {
6
- securityJsCode:'275e59edb26ab1f917cfe7f05bea7979'
6
+ securityJsCode: '275e59edb26ab1f917cfe7f05bea7979'
7
7
  }
8
8
  Amap = await AMapLoader.load({
9
9
  key: '55a4807a6fc3adca5510f69578b1ae4a', // 申请好的Web端开发者Key,首次调用 load 时必填
@@ -4,7 +4,7 @@ import Vue from 'vue'
4
4
  import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
5
5
  import notification from 'ant-design-vue/es/notification'
6
6
 
7
- const setting = require('../config/default/setting.config')
7
+ const compatible = localStorage.getItem('compatible')
8
8
 
9
9
  // 跨域认证信息 header 名
10
10
  const xsrfHeaderName = 'Authorization'
@@ -156,7 +156,7 @@ function loadInterceptors () {
156
156
  // 让每个请求携带自定义 token 请根据实际情况自行修改
157
157
  if (token) {
158
158
  // 判断是否为V4环境
159
- if (setting.compatible === 'V4') {
159
+ if (compatible === 'V4') {
160
160
  // V4 环境则添加 V4请求头
161
161
  config.headers['ACCESS_TOKEN'] = localStorage.getItem('ACCESS_TOKEN')
162
162
  config.headers['ACCESS_TOKEN_EXPIRES'] = localStorage.getItem('ACCESS_TOKEN_EXPIRES')
@@ -172,7 +172,7 @@ function loadInterceptors () {
172
172
  // 加载响应拦截器
173
173
  axios.interceptors.response.use((response) => {
174
174
  // 判断是否为V4环境
175
- if (setting.compatible === 'V4') {
175
+ if (compatible === 'V4') {
176
176
  if (response.data.data) {
177
177
  return response.data.data
178
178
  } else {