liyongli 4 years ago
parent
commit
c996344957

+ 1 - 0
.gitignore

@@ -1,6 +1,7 @@
 .DS_Store
 node_modules
 /dist
+/http
 
 # local env files
 .env.local

+ 12 - 0
src/api/article/article.js

@@ -1,5 +1,17 @@
 import request from "@/utils/request.js";
 
+/**
+ * 列表
+ * @param params
+ * @returns {AxiosPromise}
+ */
+export function categoryList() {
+  return request({
+    url: "/category/list/",
+    method: "post"
+  });
+}
+
 /**
  * 列表
  * @param params

+ 2 - 2
src/components/NewsList/NewsList.vue

@@ -40,8 +40,8 @@ export default {
   name: "app",
   props: {
     comId: {
-      type: String,
-      default: ""
+      type: Number,
+      default: -1
     }
   },
   data: function() {

+ 0 - 5
src/config/page.js

@@ -55,11 +55,6 @@ module.exports = {
     requiredParams: {},
     optionalParams: {}
   },
-  about: {
-    title: "关于",
-    requiredParams: {},
-    optionalParams: {}
-  },
   collection: {
     title: "收藏",
     requiredParams: {},

+ 0 - 32
src/pages/about/Index.vue

@@ -1,32 +0,0 @@
-<template>
-  <div id="about" class="app">
-    <van-sticky :offset-top="0">
-      <van-nav-bar left-arrow @click-left="onClickLeft" title="关于我们" />
-    </van-sticky>
-  </div>
-</template>
-
-<script>
-import { NavBar as vanNavBar, Sticky as vanSticky } from "vant";
-import "vant/lib/sticky/style";
-import "vant/lib/nav-bar/style";
-
-export default {
-  name: "app",
-  data: function() {
-    return {};
-  },
-  methods: {
-    onClickLeft() {
-      history.go(-1);
-    }
-  },
-  mounted() {},
-  beforeDestroy: function() {},
-  components: { vanSticky, vanNavBar }
-};
-</script>
-<style lang="scss">
-.app {
-}
-</style>

+ 0 - 16
src/pages/about/index.js

@@ -1,16 +0,0 @@
-import Vue from "vue";
-import App from "./Index.vue";
-import "@/pages/common.js";
-import { validateInitPage } from "@/utils/validateInitPage.js";
-
-validateInitPage() //这里还可以链式then做一些权限拦截
-  .then((pageName, pageParams) => {
-    Vue.prototype.$pageName = pageName;
-    Vue.prototype.$pageParams = pageParams;
-    new Vue({
-      render: h => h(App)
-    }).$mount("#app");
-  })
-  .catch(e => {
-    console.log(e);
-  });

+ 21 - 5
src/pages/aboutUs/Index.vue

@@ -1,21 +1,33 @@
 <template>
   <div id="aboutUs" class="app">
-    <div class="head">
+    <van-sticky :offset-top="0">
+      <van-nav-bar left-arrow @click-left="onClickLeft" title="关于我们" />
+    </van-sticky>
+    <div class="head" v-if="version">
       <van-image width="80" height="80" :src="logo" />
       <br />
       <div class="version">v{{ version }}</div>
       <br />
     </div>
     <div class="sk" v-if="!content">
-      <van-skeleton title avatar :row="10" />
+      <br />
+      <van-skeleton title :row="10" />
     </div>
     <news v-if="content" :item="{ content: content }" />
   </div>
 </template>
 
 <script>
-import { Image as vanImage } from "vant";
+import {
+  Image as vanImage,
+  NavBar as vanNavBar,
+  Skeleton as vanSkeleton,
+  Sticky as vanSticky
+} from "vant";
 import { currentUrlToParams, setToken } from "@/utils/common.js";
+import "vant/lib/image/style";
+import "vant/lib/nav-bar/style";
+import "vant/lib/skeleton/style";
 import news from "@/components/Detail/news.vue";
 import logo from "@/assets/image/0.jpg";
 
@@ -28,7 +40,11 @@ export default {
       version: ""
     };
   },
-  methods: {},
+  methods: {
+    onClickLeft() {
+      history.go(-1);
+    }
+  },
   mounted() {
     let _this = this;
     this.$pageParams = currentUrlToParams();
@@ -39,7 +55,7 @@ export default {
     };
   },
   beforeDestroy: function() {},
-  components: { news, vanImage }
+  components: { news, vanImage, vanNavBar, vanSticky, vanSkeleton }
 };
 </script>
 <style lang="scss">

+ 6 - 1
src/pages/myHome/Index.vue

@@ -36,7 +36,12 @@
         is-link
       />
       <van-cell title="分享" @click="showShare = true" clickable is-link />
-      <van-cell title="关于" @click="() => toUrl('about')" clickable is-link />
+      <van-cell
+        title="关于"
+        @click="() => toUrl('aboutUs')"
+        clickable
+        is-link
+      />
       <!-- <van-cell title="设置" @click="() => toUrl('5')" clickable is-link /> -->
     </van-cell-group>
     <van-share-sheet

+ 15 - 46
src/pages/partyAffairs/Index.vue

@@ -30,62 +30,19 @@
 </template>
 
 <script>
+import { categoryList } from "@/api/article/article.js";
 import ListItemBig from "../../components/ListItem/ListItemBig";
 import NewsList from "../../components/NewsList/NewsList";
 import { Tab as vanTab, Tabs as vanTabs } from "vant";
 import "vant/lib/tab/style";
 import "vant/lib/tabs/style";
 
-const column = [
-  {
-    title: "党建要闻",
-    id: "-1"
-  },
-  {
-    title: "主席专栏",
-    id: "-1"
-  },
-  {
-    title: "专题",
-    id: "-1",
-    type: "1"
-  },
-  {
-    title: "党群党支部",
-    id: "14"
-  },
-  {
-    title: "党建风采",
-    id: "-1"
-  },
-  {
-    title: "文件传达",
-    id: "12"
-  },
-  {
-    title: "组织工作",
-    id: "-1"
-  },
-  {
-    title: "党务公开",
-    id: "-1"
-  },
-  {
-    title: "先进典型",
-    id: "-1"
-  },
-  {
-    title: "党建视听",
-    id: "-1"
-  }
-];
-
 export default {
   name: "app",
   data: function() {
     return {
       active: "partyAffairs",
-      column: column,
+      column: [],
       file: [
         {
           title: "中华魂智慧党建平台",
@@ -131,7 +88,19 @@ export default {
             "./pdfDetail.html?id=" + item.id + "&name=" + item.title);
     }
   },
-  mounted() {},
+  mounted() {
+    categoryList().then(res => {
+      let l = res || [];
+      let col = [];
+      l.map(v => {
+        col.push({
+          title: v.name,
+          id: v.id
+        });
+      });
+      this.column = col;
+    });
+  },
   beforeDestroy: function() {},
   components: {
     NewsList,

+ 1 - 1
src/pages/study/Index.vue

@@ -17,7 +17,7 @@
 
       <template #indicator><div></div> </template>
     </van-swipe>
-    <news-list comId="-1" />
+    <news-list :comId="-1" />
   </div>
 </template>
 

+ 4 - 1
src/utils/request.js

@@ -39,7 +39,10 @@ service.interceptors.response.use(
   res => {
     //if(LoadingInstance){LoadingInstance.clear();}
     if (res.status !== 200) {
-      if (res.status === 403 && !isApp) location.href = "/login.html";
+      if (res.status === 403 && !isApp)
+        window.parent
+          ? (location.location.href = "/login.html")
+          : (location.href = "/login.html");
       if (res.status === 403 && isApp) {
         // 调用app登录
         window.webkit && window.webkit.messageHandlers.doLogin.postMessage();