Bladeren bron

添加导航栏

aaa 4 jaren geleden
bovenliggende
commit
e35899ad00

+ 2 - 7
src/App.vue

@@ -1,7 +1,6 @@
 <template>
   <div>
-    <loading :visible=false />
-    <template v-if="!firstLoading">
+    <template>
       <transition name="router-fade" mode="out-in">
         <keep-alive>
           <router-view v-if="$route.meta.keepAlive"></router-view>
@@ -15,14 +14,10 @@
 </template>
 
 <script>
-import Loading from "@/components/loading";
 export default {
   name: "app",
-  components: { Loading },
   data() {
-    return {
-      firstLoading: true
-    };
+    return {};
   }
 };
 </script>

+ 111 - 0
src/components/navigationBar.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="navigationBarAll">
+    <div class="navigationBarBox" :style="styles">
+      <div>
+        <div class="titleDiv" style="text-align: center;">{{title}}</div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "navigationBar",
+  props: {
+    title: {
+      type: String,
+      required: false,
+      default: ""
+    },
+    styles: {
+      type: Object,
+      required: false
+    },
+    isHome: {
+      type: Boolean,
+      required: false
+    },
+    isHaveHome: {
+      type: Boolean,
+      required: false,
+      default: true
+    }
+  },
+  data() {
+    return {
+    };
+  },
+  methods: {
+    navBackFun() {
+      this.$router.back();
+    },
+    navBackHomeFun() {
+      this.$router.push({
+        name: "home-index"
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.navigationBarAll {
+  min-height: calc(1.7rem + 2px);
+}
+.navigationBarBox {
+  width: 100%;
+  padding: 0.25rem 0.5rem;
+  position: fixed;
+  left: 0;
+  right: 0;
+  z-index: 2;
+  background-color: #fff;
+  color: black;
+  min-height: calc(1.7rem + 2px);
+  .backHomeDiv {
+    position: relative;
+    z-index: 2;
+    width: 3.5rem;
+    padding: 0.2rem 0.5rem;
+    border: 1px solid #E1E4E9;
+    border-radius: 1rem;
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    align-items: center;
+  }
+  .backHomeDivHome {
+    position: relative;
+    z-index: 2;
+    width: 1.3rem;
+    padding: 0.2rem 0.2rem;
+    border: 1px solid #E1E4E9;
+    border-radius: 2rem;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+  .iconBox {
+    width: 0.8rem;
+    height: 0.8rem;
+    .icon {
+      width: 0.8rem;
+      height: 0.8rem;
+      display: block;
+    }
+  }
+  .lineDiv {
+    height: 0.8rem;
+    width: 1px;
+    border-right: 1px solid #E1E4E9;
+  }
+  .titleDiv {
+    width: 100%;
+    position: absolute;
+    font-size: 0.7rem;
+    line-height: 1.2rem;
+    left: 0;
+    top: 0.25rem;
+  }
+}
+</style>

+ 5 - 5
src/router/index.js

@@ -1,15 +1,15 @@
 import Vue from "vue";
 import Router from "vue-router";
+import Home from "@/views/home";
 
 Vue.use(Router);
 
 let routes = [
   {
-    alias: "/",
-    path: "/index",
-    name: "home-index", // 首页
-    // meta: { keepAlive: true },
-    component: () => import("@/views/home/test")
+    path: "/home", // 专家门诊
+    name: "home",
+    // meta: { keepAlive: true }
+    component: Home
   }
 ];
 

+ 169 - 0
src/styles/common.scss

@@ -0,0 +1,169 @@
+* {
+  -webkit-overflow-scrolling: touch;
+}
+
+body,
+div,
+span,
+header,
+footer,
+nav,
+section,
+aside,
+article,
+ul,
+dl,
+dt,
+dd,
+li,
+a,
+p,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+i,
+b,
+textarea,
+button,
+input,
+select,
+figure,
+figcaption {
+  padding: 0;
+  margin: 0;
+  list-style: none;
+  font-style: normal;
+  text-decoration: none;
+  border: none;
+  font-weight: normal;
+  font-family: "Microsoft Yahei";
+  box-sizing: border-box;
+  -webkit-tap-highlight-color: transparent;
+  -webkit-font-smoothing: antialiased;
+  &:hover {
+    outline: none;
+  }
+}
+
+img {
+  object-fit: cover;
+}
+
+/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
+::-webkit-scrollbar {
+  width: 0;
+  height: 0;
+  background-color: #f5f5f5;
+}
+
+/*定义滚动条轨道 内阴影+圆角*/
+::-webkit-scrollbar-track {
+  -webkit-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0);
+  border-radius: 0.4rem;
+  background-color: #f5f5f5;
+}
+
+/*定义滑块 内阴影+圆角*/
+::-webkit-scrollbar-thumb {
+  border-radius: 0.4rem;
+  -webkit-box-shadow: inset 0 0 0.25rem rgba(0, 0, 0, 0.3);
+  background-color: #555;
+}
+
+input[type="button"],
+input[type="submit"],
+input[type="search"],
+input[type="reset"] {
+  -webkit-appearance: none;
+}
+
+textarea {
+  -webkit-appearance: none;
+}
+
+html,
+body {
+  height: 100%;
+  width: 100%;
+  background-color: #f5f5f5;
+}
+
+.clear:after {
+  content: "";
+  display: block;
+  clear: both;
+}
+
+.clear {
+  zoom: 1;
+}
+
+.back_img {
+  background-repeat: no-repeat;
+  background-size: 100% 100%;
+}
+
+.margin {
+  margin: 0 auto;
+}
+
+.left {
+  float: left;
+}
+
+.right {
+  float: right;
+}
+
+.hide {
+  display: none;
+}
+
+.show {
+  display: block;
+}
+
+.ellipsis {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.flex {
+  display: flex;
+}
+
+.flex-column {
+  display: flex;
+  flex-direction: column;
+}
+
+.minimum {
+  font-size: 0.5rem;
+  opacity: 0.8;
+}
+
+@keyframes backOpacity {
+  0% {
+    opacity: 1;
+  }
+  25% {
+    opacity: 0.5;
+  }
+  50% {
+    opacity: 1;
+  }
+  75% {
+    opacity: 0.5;
+  }
+  100% {
+    opacity: 1;
+  }
+}
+
+.animation_opactiy {
+  animation: backOpacity 2s ease-in-out infinite;
+}

+ 2 - 0
src/styles/index.scss

@@ -0,0 +1,2 @@
+@import "./common";
+@import "./vant";

+ 69 - 0
src/styles/mixin.scss

@@ -0,0 +1,69 @@
+$blue: #3190e8;
+$bc: #e4e4e4;
+$fc: #fff;
+
+// 背景图片地址和大小
+@mixin bis($url) {
+  background-image: url($url);
+  background-repeat: no-repeat;
+  background-size: 100% 100%;
+}
+
+@mixin borderRadius($radius) {
+  -webkit-border-radius: $radius;
+  -moz-border-radius: $radius;
+  -ms-border-radius: $radius;
+  -o-border-radius: $radius;
+  border-radius: $radius;
+}
+//定位全屏
+@mixin allcover {
+  position: absolute;
+  top: 0;
+  left: 0;
+}
+
+//定位上下左右居中
+@mixin center {
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+}
+
+//定位上下居中
+@mixin ct {
+  position: absolute;
+  top: 50%;
+  transform: translateY(-50%);
+}
+
+//定位左右居中
+@mixin cl {
+  position: absolute;
+  left: 50%;
+  transform: translateX(-50%);
+}
+
+//宽高
+@mixin wh($width, $height) {
+  width: $width;
+  height: $height;
+}
+
+//字体大小、行高、字体
+@mixin font($size, $line-height, $family: "Microsoft YaHei") {
+  font: #{$size}/#{$line-height} $family;
+}
+
+//字体大小,颜色
+@mixin sc($size, $color) {
+  font-size: $size;
+  color: $color;
+}
+
+//flex 布局和 子元素 对其方式
+@mixin fj($type: space-between) {
+  display: flex;
+  justify-content: $type;
+}

+ 18 - 0
src/styles/vant.scss

@@ -0,0 +1,18 @@
+// 覆盖Van的部分样式
+.van-image {
+  img.van-image__img {
+    width: inherit;
+    height: inherit;
+    border-radius: inherit;
+    max-width: inherit;
+    min-width: inherit;
+  }
+  .van-image__loading,
+  .van-image__error {
+    border-radius: inherit;
+  }
+}
+.van-swipe .van-swipe-item img.van-image__img {
+  width: 100%;
+  height: 100%;
+}

+ 30 - 0
src/views/home/answer/page-answer.vue

@@ -0,0 +1,30 @@
+<template>
+  <div class="scroll">
+    <navigation-bar
+      :isHome="true"
+      title="京铁学堂"
+      style="text-align: center"
+    />
+    <div class="contentBody">
+      <span>page-answer</span>
+    </div>
+  </div>
+</template>
+
+<script>
+import navigationBar from "@/components/navigationBar";
+export default {
+  name: "page-answer",
+  components: {
+    navigationBar
+  },
+  data() {
+    return {};
+  },
+  computed: {},
+  methods: {}
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 30 - 0
src/views/home/exam/page-exam.vue

@@ -0,0 +1,30 @@
+<template>
+  <div class="scroll">
+    <navigation-bar
+      :isHome="true"
+      title="京铁学堂"
+      style="text-align: center"
+    />
+    <div class="contentBody">
+      <span>page-exam</span>
+    </div>
+  </div>
+</template>
+
+<script>
+import navigationBar from "@/components/navigationBar";
+export default {
+  name: "page-exam",
+  components: {
+    navigationBar
+  },
+  data() {
+    return {};
+  },
+  computed: {},
+  methods: {}
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 122 - 0
src/views/home/index.vue

@@ -0,0 +1,122 @@
+<template>
+  <div class="home flex-column">
+    <transition name="tab" mode="out-in">
+      <component :is="current" class="page" />
+    </transition>
+    <footer class="footer">
+      <div class="btnDiv" @click="handleGoPage('page-learn')">
+        <!-- <img class="btnImg" :src="current === 'page-home' ? homeSelected: homeNormal" /> -->
+        <button
+          class="btn"
+          :class="[current === 'page-learn' ? 'page-select' : '']"
+        >
+          学习
+        </button>
+      </div>
+      <div class="btnDiv" @click="handleGoPage('page-answer')">
+        <!-- <img class="btnImg" :src="current === 'page-home' ? homeSelected: homeNormal" /> -->
+        <button
+          class="btn"
+          :class="[current === 'page-answer' ? 'page-select' : '']"
+        >
+          答题
+        </button>
+      </div>
+      <div class="btnDiv" @click="handleGoPage('page-exam')">
+        <!-- <img class="btnImg" :src="current === 'page-home' ? homeSelected: homeNormal" /> -->
+        <button
+          class="btn"
+          :class="[current === 'page-exam' ? 'page-select' : '']"
+        >
+          考试
+        </button>
+      </div>
+      <div class="btnDiv" @click="handleGoPage('page-person')">
+        <!-- <img class="btnImg" :src="current === 'page-personal-center' ? personalSelected: personalNormal" /> -->
+        <button
+          class="btn"
+          :class="[current === 'page-personal' ? 'page-select' : '']"
+        >
+          我的
+        </button>
+      </div>
+    </footer>
+  </div>
+</template>
+
+<script>
+import PageLearn from "./learn/page-learn";
+import PageAnswer from "./answer/page-answer";
+import PageExam from "./exam/page-exam";
+import PagePerson from "./person/page-person";
+export default {
+  name: "home",
+  components: { PageLearn, PageAnswer, PageExam, PagePerson },
+  data() {
+    return {
+      current: "page-learn"
+    };
+  },
+  methods: {
+    handleGoPage(name) {
+      this.current = name;
+      this.$router.replace({ name: "home", query: { page: name } });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.home {
+  height: 100vh;
+}
+.tab-leave-active,
+.tab-enter-active {
+  transition: all 0.3s;
+}
+.tab-enter {
+  opacity: 0;
+  transform: translateX(-1.25rem);
+}
+.tab-leave-to {
+  opacity: 0;
+  transform: translateX(1.25rem);
+}
+.page {
+  width: 100%;
+  height: calc(100vh - 2.5rem);
+  flex: 1;
+}
+.footer {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  z-index: 10;
+  height: 2.5rem;
+  display: flex;
+  justify-content: space-around;
+  border-top: 1px solid #f7f5f6;
+  background-color: #fff;
+}
+.btnDiv {
+  width: 25%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  position: relative;
+  .btnImg {
+    width: 1rem;
+    height: 1rem;
+  }
+  .btn {
+    border: none;
+    font-size: 0.7rem;
+    background-color: white;
+  }
+}
+.page-select {
+  color: #438bef;
+}
+</style>

+ 51 - 0
src/views/home/learn/page-learn.vue

@@ -0,0 +1,51 @@
+<template>
+  <div class="scroll">
+    <navigation-bar
+      :isHome="true"
+      title="京铁学堂"
+      style="text-align: center"
+    />
+    <div class="contentBody">
+        <span>page-learn</span>
+    </div>
+  </div>
+</template>
+
+<script>
+import navigationBar from "@/components/navigationBar";
+export default {
+  name: "page-learn",
+  components: {
+    navigationBar
+  },
+  data() {
+    return {};
+  },
+  computed: {},
+  created() {
+    this.startLog();
+  },
+  mounted() {},
+  methods: {
+    startLog() {
+      console.log("--page-learn--");
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+@import "~@/styles/mixin";
+.scroll {
+  overflow-y: auto;
+  overflow-x: hidden;
+  position: relative;
+  background-color: #f7f5f6;
+  font-size: 0.6rem;
+  width: 100%;
+  padding-bottom: 3rem;
+}
+.contentBody {
+  background-color: #fff;
+}
+</style>

+ 30 - 0
src/views/home/person/page-person.vue

@@ -0,0 +1,30 @@
+<template>
+  <div class="scroll">
+    <navigation-bar
+      :isHome="true"
+      title="京铁学堂"
+      style="text-align: center"
+    />
+    <div class="contentBody">
+      <span>page-person-center</span>
+    </div>
+  </div>
+</template>
+
+<script>
+import navigationBar from "@/components/navigationBar";
+export default {
+  name: "page-personal-center",
+  components: {
+    navigationBar
+  },
+  data() {
+    return {};
+  },
+  computed: {},
+  methods: {}
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 0 - 26
src/views/home/test.vue

@@ -1,26 +0,0 @@
-<template>
-  <div>
-    test
-  </div>
-</template>
-
-<script>
-
-export default {
-  components: {
-  },
-  data() {
-    return {
-    };
-  },
-  computed: {
-  },
-  created() {
-  },
-  methods: {
-  }
-};
-</script>
-
-<style lang="scss" scoped>
-</style>