asd123a20 3 years ago
parent
commit
558258ee3d

+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <title>经济纵横</title>
   </head>
   <body>
     <noscript>

+ 4 - 2
src/components/banner.vue

@@ -35,8 +35,10 @@ export default {
   },
   methods: {
     btn (e) {
-      console.log(e)
-      this.$router.push(`/page/${e.id}`)
+      const routeData = this.$router.resolve({
+        path: `/www/page/${e.id}`
+      })
+      window.open(routeData.href)
     }
   },
   mounted () {}

+ 17 - 12
src/components/heads/menus.vue

@@ -17,29 +17,34 @@ export default {
   components: {},
   data () {
     return {
-      itemId: sessionStorage.getItem('itemId') || '0'
+      itemId: localStorage.getItem('itemId') || '0'
     }
   },
   methods: {
     ...mapActions(['getmenu']),
     btn (e) {
       this.itemId = e.code
-      let types
       if (e.code === '0') {
-        this.$router.push('/')
+        this.$router.push('/www/')
         return
       }
       if (e.type === 1) {
         window.open(e.uri)
         return
       }
-      if (e.type === 0) types = 'list'
-      if (e.type === 2) types = 'page'
-      this.$router.push(
-        { path: `/${types}/${e.code}` },
-        onComplete => {},
-        onAbort => {}
-      )
+      if (e.type === 0) {
+        this.$router.push(
+          { path: `/www/list/${e.code}` },
+          onComplete => {},
+          onAbort => {}
+        )
+      }
+      if (e.type === 2) {
+        const routeData = this.$router.resolve({
+          path: `/www/page/${e.code}`
+        })
+        window.open(routeData.href)
+      }
     }
   },
   mounted () {
@@ -50,10 +55,10 @@ export default {
   },
   watch: {
     itemId (val) {
-      sessionStorage.setItem('itemId', val)
+      localStorage.setItem('itemId', val)
     },
     $route (to, from) {
-      this.itemId = sessionStorage.getItem('itemId') || '0'
+      this.itemId = localStorage.getItem('itemId') || '0'
     }
   }
 }

+ 1 - 1
src/components/sidebar/buttons.vue

@@ -63,7 +63,7 @@ export default {
         window.open(e.uri)
         return false
       }
-      this.$router.push(e.path)
+      this.$router.push(`/www${e.path}`)
     }
   },
   mounted () {}

+ 4 - 4
src/router/index.js

@@ -5,24 +5,24 @@ Vue.use(VueRouter)
 
 const routes = [
   {
-    path: '/',
+    path: '/www/',
     name: 'home',
     component: () => import('../views/home.vue')
   },
   {
-    path: '/page/:id',
+    path: '/www/page/:id',
     name: 'page',
     component: () => import('../views/page.vue'),
     props: true
   },
   {
-    path: '/list/:id',
+    path: '/www/list/:id',
     name: 'list',
     component: () => import('../views/list.vue'),
     props: true
   },
   {
-    path: '/details/:id',
+    path: '/www/details/:id',
     name: 'details',
     component: () => import('../views/details.vue'),
     props: true

+ 11 - 3
src/views/Home.vue

@@ -134,12 +134,15 @@ export default {
       this.mous = -1
     },
     jump (e, num) {
-      sessionStorage.setItem('itemId', num)
-      this.$router.push(`/details/${e._id}`)
+      localStorage.setItem('itemId', num)
+      const routeData = this.$router.resolve({
+        path: `/www/details/${e._id}`
+      })
+      window.open(routeData.href)
     },
     jumpList (e) {
       console.log(e)
-      this.$router.push(`/list/${e}`)
+      this.$router.push(`/www/list/${e}`)
     }
   },
   async mounted () {
@@ -241,6 +244,7 @@ export default {
           color: #696969;
         }
         .text {
+          height: 2.5em;
           cursor: pointer;
           overflow: hidden;
           text-overflow: ellipsis;
@@ -274,6 +278,10 @@ export default {
           font-weight: 700;
           color: #000;
           cursor: pointer;
+          word-break: keep-all;
+          white-space: nowrap;
+          overflow: hidden;
+          text-overflow: ellipsis;
         }
         p {
           color: #696969;

+ 4 - 4
src/views/details.vue

@@ -43,15 +43,15 @@ export default {
     ...mapActions(['getmenu']),
     ...contentmapActions(['getdetails']),
     async filteritem () {
-      this.code = sessionStorage.getItem('itemId')
+      this.code = localStorage.getItem('itemId')
       const items = this.items.filter(p => p.code === this.code)[0]
       this.item = items.name
       this.en = items.en
     }
   },
-  mounted () {
-    this.getmenu()
-    this.filteritem()
+  async mounted () {
+    const res = await this.getmenu()
+    if (res.data.errcode === 0) this.filteritem()
     this.getdetails({ id: this.id })
   },
   computed: {

+ 5 - 1
src/views/list.vue

@@ -60,7 +60,11 @@ export default {
     },
     // 跳转正文
     btn (e) {
-      this.$router.push(`/details/${e._id}`)
+      // this.$router.resolve(`/www/details/${e._id}`)
+      const routeData = this.$router.resolve({
+        path: `/www/details/${e._id}`
+      })
+      window.open(routeData.href)
     },
     async filteritem () {
       const items = this.items.filter(p => p.code === this.id)[0]

+ 4 - 4
src/views/page.vue

@@ -43,15 +43,15 @@ export default {
     ...mapActions(['getmenu']),
     ...pagemapActions(['getdetails']),
     async filteritem () {
-      this.code = sessionStorage.getItem('itemId')
+      this.code = localStorage.getItem('itemId')
       const items = this.items.filter(p => p.code === this.id)[0]
       this.item = items.name
       this.en = items.en
     }
   },
-  mounted () {
-    this.getmenu()
-    this.filteritem()
+  async mounted () {
+    const res = await this.getmenu()
+    if (res.data.errcode === 0) this.filteritem()
     this.getdetails({ code: this.id })
   },
   computed: {

+ 1 - 1
vue.config.js

@@ -1,5 +1,5 @@
 
-const baseUrl = '/'
+const baseUrl = '/www'
 
 module.exports = {
   publicPath: baseUrl,