Browse Source

返回保留页码信息

lyn7568 6 years ago
parent
commit
61ce3b10b2

+ 0 - 1
package.json

@ -17,7 +17,6 @@
17 17
    "babel-polyfill": "^6.26.0",
18 18
    "element-theme-chalk": "^2.4.11",
19 19
    "element-ui": "^2.3.5",
20
    "js-cookie": "^2.2.0",
21 20
    "normalize.css": "^7.0.0",
22 21
    "nprogress": "^0.2.0",
23 22
    "vue": "^2.5.10",

+ 1 - 8
src/components/Breadcrumb/index.vue

@ -10,7 +10,6 @@
10 10
</template>
11 11
12 12
<script>
13
import Cookies from 'js-cookie'
14 13
export default {
15 14
  created() {
16 15
    this.getBreadcrumb()
@ -27,13 +26,7 @@ export default {
27 26
  },
28 27
  methods: {
29 28
    getBreadcrumb() {
30
      const bridgeName = Cookies.get('bridgeName')
31
      let matched = this.$route.matched.filter(item => {
32
        if (bridgeName && item.path === '/bridgeHome') {
33
          item.meta.title = bridgeName
34
        }
35
        return item.name
36
      })
29
      let matched = this.$route.matched.filter(item => item.name)
37 30
      const first = matched[0]
38 31
      if (first && first.name !== 'dashboard') {
39 32
        matched = [{ path: '/dashboard', meta: { title: '主页' }}].concat(matched)

+ 1 - 2
src/permission.js

@ -3,7 +3,6 @@ import store from './store'
3 3
import NProgress from 'nprogress' // Progress 进度条
4 4
import 'nprogress/nprogress.css'// Progress 进度条样式
5 5
import { Message } from 'element-ui'
6
import Cookies from 'js-cookie'
7 6
8 7
NProgress.configure({ showSpinner: false })// NProgress Configuration
9 8
@ -11,7 +10,7 @@ const whiteList = ['/login', '/findPwd'] // 不重定向白名单
11 10
12 11
router.beforeEach((to, from, next) => {
13 12
  NProgress.start()
14
  if (Cookies.get('userid')) {
13
  if (localStorage.getItem('ad-userid')) {
15 14
    if (to.path === '/login') {
16 15
      next({ path: '/' })
17 16
      NProgress.done()

+ 4 - 6
src/store/modules/app.js

@ -1,9 +1,7 @@
1
import Cookies from 'js-cookie'
2
3 1
const app = {
4 2
  state: {
5 3
    sidebar: {
6
      opened: !+Cookies.get('sidebarStatus'),
4
      opened: !+localStorage.getItem('sidebarStatus'),
7 5
      withoutAnimation: false
8 6
    },
9 7
    device: 'desktop'
@ -11,15 +9,15 @@ const app = {
11 9
  mutations: {
12 10
    TOGGLE_SIDEBAR: state => {
13 11
      if (state.sidebar.opened) {
14
        Cookies.set('sidebarStatus', 1)
12
        localStorage.setItem('sidebarStatus', 1)
15 13
      } else {
16
        Cookies.set('sidebarStatus', 0)
14
        localStorage.setItem('sidebarStatus', 0)
17 15
      }
18 16
      state.sidebar.opened = !state.sidebar.opened
19 17
      state.sidebar.withoutAnimation = false
20 18
    },
21 19
    CLOSE_SIDEBAR: (state, withoutAnimation) => {
22
      Cookies.set('sidebarStatus', 1)
20
      localStorage.setItem('sidebarStatus', 1)
23 21
      state.sidebar.opened = false
24 22
      state.sidebar.withoutAnimation = withoutAnimation
25 23
    },

+ 6 - 7
src/store/modules/user.js

@ -1,6 +1,5 @@
1 1
import { loginUrl, logoutUrl, getInfoUrl } from '@/api/login'
2 2
import http from '@/utils/request'
3
import Cookies from 'js-cookie'
4 3
5 4
const user = {
6 5
  state: {
@ -31,12 +30,12 @@ const user = {
31 30
              if (dataS.actived) {
32 31
                commit('SET_USERID', dataS.id)
33 32
                commit('SET_NAME', dataS.name)
34
                Cookies.set('userid', dataS.id)
33
                localStorage.setItem('ad-userid', dataS.id)
35 34
              }
36 35
            } else {
37 36
              commit('SET_USERID', '')
38 37
              commit('SET_NAME', '')
39
              Cookies.remove('userid')
38
              localStorage.removeItem('ad-userid')
40 39
            }
41 40
          }
42 41
          resolve(response)
@ -57,13 +56,13 @@ const user = {
57 56
                commit('SET_USERID', dataS.id)
58 57
                commit('SET_NAME', dataS.name)
59 58
                commit('SET_COUNT', dataS.account)
60
                Cookies.set('userid', dataS.id)
59
                localStorage.setItem('ad-userid', dataS.id)
61 60
              }
62 61
            } else {
63 62
              commit('SET_USERID', '')
64 63
              commit('SET_NAME', '')
65 64
              commit('SET_COUNT', '')
66
              Cookies.remove('userid')
65
              localStorage.removeItem('ad-userid')
67 66
            }
68 67
          }
69 68
          resolve(response)
@ -79,7 +78,7 @@ const user = {
79 78
        http.get(logoutUrl, '', (response) => {
80 79
          commit('SET_USERID', '')
81 80
          commit('SET_NAME', '')
82
          Cookies.remove('userid')
81
          localStorage.removeItem('ad-userid')
83 82
          resolve(response)
84 83
        }, error => {
85 84
          reject(error)
@ -92,7 +91,7 @@ const user = {
92 91
      return new Promise(resolve => {
93 92
        commit('SET_USERID', '')
94 93
        commit('SET_NAME', '')
95
        Cookies.remove('userid')
94
        localStorage.removeItem('ad-userid')
96 95
        resolve()
97 96
      })
98 97
    }

+ 0 - 13
src/utils/auth.js

@ -1,13 +0,0 @@
1
import Cookies from 'js-cookie'
2
3
export function getCookiesName() {
4
  return Cookies.get('nameKey')
5
}
6
7
export function setCookiesName(name) {
8
  return Cookies.set('nameKey', name)
9
}
10
11
export function removeCookiesName() {
12
  return Cookies.remove('nameKey')
13
}

+ 4 - 1
src/views/companyCen/noactive/compProduct.vue

@ -66,7 +66,8 @@
66 66
            :current-page.sync="pageNo"
67 67
            :page-size="pageSize"
68 68
            layout="prev, pager, next, jumper"
69
            :total="total">
69
            :total="total"
70
            v-if="total!==0">
70 71
          </el-pagination>
71 72
        </div>
72 73
      </div>
@ -119,6 +120,7 @@ export default {
119 120
    }
120 121
  },
121 122
  created() {
123
    this.pageNo = sessionStorage.getItem('p-page') || 1
122 124
    if (urlParse('cid')) {
123 125
      this.companyId = urlParse('cid')
124 126
      this.getCompanyInfo()
@ -235,6 +237,7 @@ export default {
235 237
    handleCurrentChange(val) {
236 238
      this.$refs.tableEle.bodyWrapper.scrollTop = 0
237 239
      this.pageNo = val
240
      sessionStorage.setItem('p-page', this.pageNo)
238 241
      this.pageQuery()
239 242
    },
240 243
    queryDetailShow(id) {

+ 4 - 1
src/views/companyCen/noactive/noactiveList.vue

@ -56,7 +56,8 @@
56 56
          :current-page.sync="pageNo"
57 57
          :page-size="pageSize"
58 58
          layout="prev, pager, next, jumper"
59
          :total="total">
59
          :total="total"
60
          v-if="total !== 0">
60 61
        </el-pagination>
61 62
      </div>
62 63
    </div>
@ -134,6 +135,7 @@ export default {
134 135
    inviteIn
135 136
  },
136 137
  created() {
138
    this.pageNo = sessionStorage.getItem('c-active-page') || 1
137 139
    this.pageQuery()
138 140
  },
139 141
  methods: {
@ -237,6 +239,7 @@ export default {
237 239
    handleCurrentChange(val) {
238 240
      this.$refs.tableEle.bodyWrapper.scrollTop = 0
239 241
      this.pageNo = val
242
      sessionStorage.setItem('c-active-page', this.pageNo)
240 243
      this.pageQuery()
241 244
    },
242 245
    queryDetailShow(id) {

+ 4 - 1
src/views/demandCen/closedList.vue

@ -40,7 +40,8 @@
40 40
          :current-page.sync="pageNo"
41 41
          :page-size="pageSize"
42 42
          layout="prev, pager, next, jumper"
43
          :total="total">
43
          :total="total"
44
          v-if="total !== 0">
44 45
        </el-pagination>
45 46
      </div>
46 47
    </div>
@ -115,6 +116,7 @@
115 116
      closeOperate
116 117
    },
117 118
    created() {
119
      this.pageNo = sessionStorage.getItem('d-close-page') || 1
118 120
      this.pageQuery()
119 121
    },
120 122
    methods: {
@ -225,6 +227,7 @@
225 227
      handleCurrentChange(val) {
226 228
        this.$refs.tableEle.bodyWrapper.scrollTop = 0
227 229
        this.pageNo = val
230
        sessionStorage.setItem('d-close-page', this.pageNo)
228 231
        this.pageQuery()
229 232
      }
230 233
    }

+ 4 - 1
src/views/demandCen/completedList.vue

@ -44,7 +44,8 @@
44 44
          :current-page.sync="pageNo"
45 45
          :page-size="pageSize"
46 46
          layout="prev, pager, next, jumper"
47
          :total="total">
47
          :total="total"
48
          v-if="total !== 0">
48 49
        </el-pagination>
49 50
      </div>
50 51
    </div>
@ -124,6 +125,7 @@
124 125
      closeOperate
125 126
    },
126 127
    created() {
128
      this.pageNo = sessionStorage.getItem('d-complete-page') || 1
127 129
      this.pageQuery()
128 130
    },
129 131
    methods: {
@ -285,6 +287,7 @@
285 287
      handleCurrentChange(val) {
286 288
        this.$refs.tableEle.bodyWrapper.scrollTop = 0
287 289
        this.pageNo = val
290
        sessionStorage.setItem('d-complete-page', this.pageNo)
288 291
        this.pageQuery()
289 292
      }
290 293
    }

+ 4 - 1
src/views/demandCen/expiredList.vue

@ -48,7 +48,8 @@
48 48
          :current-page.sync="pageNo"
49 49
          :page-size="pageSize"
50 50
          layout="prev, pager, next, jumper"
51
          :total="total">
51
          :total="total"
52
          v-if="total !== 0">
52 53
        </el-pagination>
53 54
      </div>
54 55
    </div>
@ -121,6 +122,7 @@
121 122
      delayDate
122 123
    },
123 124
    created() {
125
      this.pageNo = sessionStorage.getItem('d-delay-page') || 1
124 126
      this.pageQuery()
125 127
    },
126 128
    methods: {
@ -217,6 +219,7 @@
217 219
      handleCurrentChange(val) {
218 220
        this.$refs.tableEle.bodyWrapper.scrollTop = 0
219 221
        this.pageNo = val
222
        sessionStorage.setItem('d-delay-page', this.pageNo)
220 223
        this.pageQuery()
221 224
      }
222 225
    }

+ 13 - 10
src/views/demandCen/previewExpert.vue

@ -99,19 +99,22 @@
99 99
            var h = 0
100 100
            if (obj.length > 0) {
101 101
              for (let i = 0; i < obj.length; ++i) {
102
                (function(item, h) {
103
                  h++
104
                  crossDomain.getUserInfo(item.uid, data => {
102
                h++
103
                if (obj[i].uid) {
104
                  crossDomain.getUserInfo(obj[i].uid, data => {
105 105
                    h--
106
                    Object.assign(item, data)
106
                    Object.assign(obj[i], data)
107
                    if (h === 0) {
108
                      that.tableData = obj
109
                      that.total = res.data.total
110
                    }
111
                    comTable.gapFilling(that.tableData)
107 112
                  })
108
                })(obj[i], h)
113
                }
109 114
              }
110
              if (h === 0) {
111
                that.tableData = obj
112
                that.total = res.data.total
113
              }
114
              comTable.gapFilling(that.tableData)
115
            } else {
116
              that.total = 0
117
              that.tableData = []
115 118
            }
116 119
          } else {
117 120
            that.total = 0

+ 4 - 1
src/views/demandCen/publishedList.vue

@ -48,7 +48,8 @@
48 48
          :current-page.sync="pageNo"
49 49
          :page-size="pageSize"
50 50
          layout="prev, pager, next, jumper"
51
          :total="total">
51
          :total="total"
52
          v-if="total !== 0">
52 53
        </el-pagination>
53 54
      </div>
54 55
    </div>
@ -118,6 +119,7 @@
118 119
      closeOperate
119 120
    },
120 121
    created() {
122
      this.pageNo = sessionStorage.getItem('d-pub-page') || 1
121 123
      this.pageQuery()
122 124
    },
123 125
    methods: {
@ -218,6 +220,7 @@
218 220
      handleCurrentChange(val) {
219 221
        this.$refs.tableEle.bodyWrapper.scrollTop = 0
220 222
        this.pageNo = val
223
        sessionStorage.setItem('d-pub-page', this.pageNo)
221 224
        this.pageQuery()
222 225
      }
223 226
    }