From d0a11de9521c4323036e3ed6206f359b4e4534dc Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Tue, 24 Nov 2020 14:40:06 +0800
Subject: [PATCH] 调整目录结构

---
 /dev/null                      |   26 ------
 layout/h5/page/CPage.vue       |    0 
 bases/Fetcher.js               |    4 
 layout/h5/page/cPage.scss      |    0 
 layout/h5/index.js             |   14 +++
 layout/h5/navBar/cNavBar.scss  |   79 +++++++++++++++++++
 layout/h5/content/CContent.vue |    0 
 layout/h5/navBar/CNavBar.vue   |   69 +++++++++++++++++
 8 files changed, 164 insertions(+), 28 deletions(-)

diff --git a/bases/Fetcher.js b/bases/Fetcher.js
index d9b9e76..f80ee41 100644
--- a/bases/Fetcher.js
+++ b/bases/Fetcher.js
@@ -482,8 +482,8 @@
         if (Tools.getTopUrlParam('query') === 'real') {
             return false;
         }
-        // 当没有 url 指定时,只有内网 ip 和 35** 的端口号,视为本地开发模式
-        return /^(192|127|localhost).*?:35\d{2}$/i.test(window.location.host);
+        // 当没有 url 指定时,只有内网 ip 和 33** 的端口号,视为本地开发模式
+        return /^(192|127|localhost).*?:33\d{2}$/i.test(window.location.host);
     })();
 
 
diff --git a/h5/layout/index.js b/h5/layout/index.js
deleted file mode 100644
index 71c2aec..0000000
--- a/h5/layout/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * layout index
- * @author Tevin
- */
-
-import CPage from '@components/h5/layout/page/CPage.vue';
-import CNavBar from '@components/h5/layout/navBar/CNavBar.vue';
-import CContent from '@components/h5/layout/content/CContent.vue';
-
-export {
-    CPage,
-    CNavBar,
-    CContent,
-}
\ No newline at end of file
diff --git a/h5/layout/navBar/CNavBar.vue b/h5/layout/navBar/CNavBar.vue
deleted file mode 100644
index c35288d..0000000
--- a/h5/layout/navBar/CNavBar.vue
+++ /dev/null
@@ -1,41 +0,0 @@
-<template>
-    <view class="c-nav-bar">
-        <AtNavBar
-            :title="title"
-            leftIconType="chevron-left"
-            :onClickLeftIcon="evt=>goBack()"
-        />
-        <view
-            class="c-nav-bar-right"
-            v-if="rightNav"
-            @tap="evt=>goNav()"
-        >
-            <view v-html="rightNav"></view>
-        </view>
-    </view>
-</template>
-
-<script>
-import { AtNavBar } from 'taro-ui-vue';
-import './cNavBar.scss';
-
-export default {
-    name: 'CNavBar',
-    components: {
-        AtNavBar,
-    },
-    props: {
-        title: String,
-        rightNav: String,
-        onClickRigthNav: Function,
-    },
-    methods: {
-        goBack() {
-            window.history.go(-1);
-        },
-        goNav() {
-            this.onClickRigthNav && this.onClickRigthNav();
-        },
-    },
-};
-</script>
\ No newline at end of file
diff --git a/h5/layout/navBar/cNavBar.scss b/h5/layout/navBar/cNavBar.scss
deleted file mode 100644
index 466559b..0000000
--- a/h5/layout/navBar/cNavBar.scss
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * nav-bar
- * @author Tevin
- */
-
-@import "../../../common/sassMixin";
-
-.c-nav-bar {
-    position: relative;
-    .at-nav-bar {
-        background-color: #1e8ad2;
-    }
-    .at-nav-bar__left-view,
-    .at-nav-bar__right-view,
-    .at-nav-bar__title {
-        color: #fff;
-    }
-    .c-nav-bar-right {
-        @include position(absolute, 0 n n 0);
-        @include flexbox(flex, center center);
-        height: 100%;
-        padding: 0 0.3rem 0 1rem;
-        font-size: 0.65rem;
-        color: #fff;
-    }
-}
\ No newline at end of file
diff --git a/h5/layout/content/CContent.vue b/layout/h5/content/CContent.vue
similarity index 100%
rename from h5/layout/content/CContent.vue
rename to layout/h5/content/CContent.vue
diff --git a/layout/h5/index.js b/layout/h5/index.js
new file mode 100644
index 0000000..c5d40f8
--- /dev/null
+++ b/layout/h5/index.js
@@ -0,0 +1,14 @@
+/**
+ * layout
+ * @author Tevin
+ */
+
+import CPage from '@components/layout/h5/page/CPage.vue';
+import CNavBar from '@components/layout/h5/navBar/CNavBar.vue';
+import CContent from '@components/layout/h5/content/CContent.vue';
+
+export {
+    CPage,
+    CNavBar,
+    CContent,
+}
\ No newline at end of file
diff --git a/layout/h5/navBar/CNavBar.vue b/layout/h5/navBar/CNavBar.vue
new file mode 100644
index 0000000..cd6d74e
--- /dev/null
+++ b/layout/h5/navBar/CNavBar.vue
@@ -0,0 +1,69 @@
+<template>
+    <view class="c-nav-bar">
+        <AtNavBar
+            :title="title"
+            leftIconType="chevron-left"
+            :onClickLeftIcon="evt=>goBack()"
+            :rightFirstIconType="dropNav ? 'bullet-list' : ''"
+            :onClickRgIconSt="evt=>dropMenu()"
+        />
+        <view
+            class="c-nav-bar-drop"
+            v-show="dropShow"
+        >
+            <view class="inner">
+                <view class="arrow"></view>
+                <view class="box">
+                    <view
+                        class="item"
+                        v-for="(nav,index) in dropNav"
+                        :key="index"
+                        @tap="evt=>goNav(nav)"
+                    >{{nav.title}}</view>
+                </view>
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+import Taro from '@tarojs/taro';
+import { AtNavBar } from 'taro-ui-vue';
+import './cNavBar.scss';
+
+export default {
+    name: 'CNavBar',
+    components: {
+        AtNavBar,
+    },
+    props: {
+        title: String,
+        dropNav: Array,
+    },
+    data() {
+        return {
+            dropShow: false,
+        };
+    },
+    methods: {
+        goBack() {
+            window.history.go(-1);
+        },
+        goNav(nav) {
+            if (!nav.url) {
+                return;
+            }
+            this.dropShow = false;
+            let method = 'navigateTo';
+            if (/navigate|redirect/.test(nav.method)) {
+                method = nav.method + 'To';
+            }
+            Taro[method]({ url: nav.url });
+        },
+        dropMenu() {
+            this.dropShow = !this.dropShow;
+        },
+    },
+    mounted() {},
+};
+</script>
\ No newline at end of file
diff --git a/layout/h5/navBar/cNavBar.scss b/layout/h5/navBar/cNavBar.scss
new file mode 100644
index 0000000..5b62e2b
--- /dev/null
+++ b/layout/h5/navBar/cNavBar.scss
@@ -0,0 +1,79 @@
+/**
+ * nav-bar
+ * @author Tevin
+ */
+
+@import "../../../common/sassMixin";
+
+.c-nav-bar {
+    position: relative;
+    .at-nav-bar {
+        background-color: #1e8ad2;
+    }
+    .at-nav-bar__left-view,
+    .at-nav-bar__right-view,
+    .at-nav-bar__title {
+        color: #fff;
+    }
+    .at-nav-bar__left-view {
+        &:active {
+            background-color: rgba(#F0F0F0, 0.5);
+            transition: background-color 0s;
+        }
+    }
+    .at-nav-bar__container {
+        width: 100%;
+        text-align: right;
+        &:active {
+            background-color: rgba(#F0F0F0, 0.5);
+            transition: background-color 0s;
+        }
+        .at-icon-bullet-list {
+            margin-right: 6PX;
+        }
+    }
+    .at-nav-bar__container--hide {
+        display: none;
+    }
+    .c-nav-bar-drop {
+        @include position(absolute, n n 0 0, 10);
+        .inner {
+            @include position(absolute, 0 n n 0);
+            padding: 0.3rem;
+            .arrow {
+                @include position(absolute, 0.15rem n n 0.65rem);
+                width: 0;
+                height: 0;
+                border-top: 0.6rem solid #f2f4f7;
+                border-right: 0.6rem solid transparent;
+                transform: rotate(45deg);
+            }
+            .box {
+                position: relative;
+                z-index: 2;
+                width: 4rem;
+                padding: 0.2rem 0;
+                background-color: #f7f8fa;
+                border-radius: 0.1rem;
+                box-shadow: rgba(#000, 0.1) 0 1PX 1PX 1PX;
+                .item {
+                    padding: 0 0.4rem;
+                    text-align: center;
+                    line-height: 1.45rem;
+                    font-size: 0.65rem;
+                    @include ellipsis(100%);
+                    box-sizing: border-box;
+                    border-bottom: #edf0f8 1PX solid;
+                    transition: background-color 0.3s;
+                    &:active {
+                        background-color: #fff;
+                        transition: background-color 0s;
+                    }
+                    &:last-child {
+                        border: none;
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/h5/layout/page/CPage.vue b/layout/h5/page/CPage.vue
similarity index 100%
rename from h5/layout/page/CPage.vue
rename to layout/h5/page/CPage.vue
diff --git a/h5/layout/page/cPage.scss b/layout/h5/page/cPage.scss
similarity index 100%
rename from h5/layout/page/cPage.scss
rename to layout/h5/page/cPage.scss

--
Gitblit v1.9.1