浏览代码

首页暗夜模式

panhui 3 年之前
父节点
当前提交
d89331d219

二进制
public/font/iconfont.ttf


二进制
public/font/iconfont.woff


二进制
public/font/iconfont.woff2


+ 17 - 6
src/components/creator/RankInfo.vue

@@ -42,7 +42,7 @@ export default {
     .flex();
     padding: 8px 16px;
     overflow: hidden;
-    background: #f5f7fa;
+    background: var(--rankBg);
 
     .rank-icon {
         width: 42px;
@@ -76,34 +76,45 @@ export default {
             font-size: 14px;
             line-height: 24px;
             margin-left: 10px;
+            color: var(--text0);
         }
     }
 
     &.rank0 {
-        background: #fff4e5;
+        background: var(--rankBg0);
+        // border: 1px solid #ffdca2;
         .content {
             .name {
-                color: #f5791d;
+                color: var(--rankText0);
                 font-weight: bold;
             }
+            .van-image {
+                border: 1px solid var(--rankBorder0);
+            }
         }
     }
 
     &.rank1 {
-        background: #f2f2f2;
+        background: var(--rankBg1);
         .content {
             .name {
                 font-weight: bold;
             }
+            .van-image {
+                border: 1px solid var(--rankBorder1);
+            }
         }
     }
     &.rank2 {
-        background: #fff8f5;
+        background: var(--rankBg2);
         .content {
             .name {
-                color: #e48154;
+                color: var(--rankText2);
                 font-weight: bold;
             }
+            .van-image {
+                border: 1px solid var(--rankBorder2);
+            }
         }
     }
 }

+ 17 - 17
src/components/product/NewsRecord.vue

@@ -95,7 +95,7 @@ export default {
 <style lang="less" scoped>
 .news-record {
     position: relative;
-    background-color: #373b3e;
+    background-color: var(--bg2);
     display: inline-block;
     border-radius: 12px;
     overflow: hidden;
@@ -148,7 +148,7 @@ export default {
         .name {
             font-size: 14px;
             font-weight: bold;
-            color: #fff;
+            color: var(--text0);
             line-height: 24px;
         }
 
@@ -223,25 +223,24 @@ export default {
         left: 0;
     }
 
-    &.isLight {
-        background-color: @bg;
-        .content {
-            .name {
-                color: #000000;
-            }
-            .bottom {
-                .miner {
-                    color: #939599;
-                }
-            }
-        }
-    }
+    // &.isLight {
+    //     .content {
+    //         .name {
+    //             color: #000000;
+    //         }
+    //         .bottom {
+    //             .miner {
+    //                 color: #939599;
+    //             }
+    //         }
+    //     }
+    // }
 
     &:not(:last-child) {
         &::after {
             content: '';
             height: 1px;
-            background-color: #f5f7fa;
+            background-color: var(--border);
             position: absolute;
             left: 74px;
             right: 16px;
@@ -267,7 +266,8 @@ export default {
     z-index: 3;
 }
 .van-button {
-    background: #f5f7fa;
+    background: var(--btnplaintBg);
+    border: 1px solid var(--btnplaintBorder);
     min-width: 68px;
     font-size: 16px;
     font-weight: bold;

+ 15 - 12
src/components/product/productLarge.vue

@@ -38,7 +38,8 @@
                     </div>
                     <div class="flex1"></div>
                     <div class="price" v-if="info.salable">
-                        <img src="@assets/icon_jiage.png" alt="" />
+                        <!-- <img src="@assets/icon_jiage.png" alt="" /> -->
+                        <van-icon name="icon-icon_jiage" class-prefix="font_family" />
                         <span> {{ info.price }}</span>
                     </div>
                     <div v-else class="status">仅展示</div>
@@ -142,7 +143,7 @@ export default {
     width: calc(100vw - 32px);
     margin: 8px 16px;
     position: relative;
-    background-color: @bg2;
+    background-color: var(--bg2);
     display: inline-block;
     border-radius: 30px;
     overflow: hidden;
@@ -183,9 +184,9 @@ export default {
     .content {
         padding: 10px 16px 18px;
         .name {
-            font-size: @font2;
+            font-size: 16px;
             font-weight: bold;
-            color: @text0;
+            color: var(--text0);
             line-height: 24px;
         }
 
@@ -201,14 +202,14 @@ export default {
 
             span {
                 padding: 0 10px;
-                line-height: 20px;
-                height: 20px;
+                line-height: 18px;
+                height: 18px;
                 display: inline-block;
                 &.sales-fir {
                     background: @prim;
                     color: @bg;
                 }
-                background-color: @bg3;
+                background-color: var(--saleBg);
                 color: @prim;
             }
         }
@@ -234,12 +235,14 @@ export default {
 
             .price {
                 font-size: @font4;
-                color: @text0;
+                color: var(--text0);
                 line-height: 20px;
                 font-family: OSP;
-                img {
-                    width: 8px;
-                    display: inline-block;
+                .flex();
+                .font_family {
+                    font-size: 8px;
+                    line-height: 16px;
+                    margin-top: 3px;
                 }
             }
         }
@@ -263,7 +266,7 @@ export default {
 
 .status {
     font-size: @font2;
-    color: @text0;
+    color: var(--text0);
 }
 .sold {
     background-color: @bg2;

+ 1 - 0
src/main.js

@@ -7,6 +7,7 @@ import { ConfigProvider } from 'vant';
 import 'vant/lib/index.css';
 import './styles/app.less';
 import './styles/font.less';
+import './styles/theme.less';
 import http from './plugins/http';
 import colors from './plugins/colors';
 // import ElementUI from 'element-ui';

+ 5 - 1
src/styles/font.less

@@ -25,6 +25,10 @@
     -moz-osx-font-smoothing: grayscale;
 }
 
+.font_family-icon-a-iconarrowdown1:before {
+    content: '\e64c';
+}
+
 .icon-png-u-weixuanzhong:before {
     content: '\e640';
 }
@@ -66,7 +70,7 @@
     content: '\e631';
 }
 
-.icon-icon_jiage:before {
+.font_family-icon-icon_jiage:before {
     content: '\e632';
 }
 

+ 39 - 0
src/styles/theme.less

@@ -0,0 +1,39 @@
+:root {
+    --bg: #f5f7fa;
+    --bg2: #fff;
+    --border: #f5f7fa;
+    --btnplaintBg: #f5f7fa;
+    --btnplaintBorder: #f5f7fa;
+    --rankBg: #f5f7fa;
+    --rankBg0: #fff4e5;
+    --rankBg1: #f2f2f2;
+    --rankBg2: #fff8f5;
+    --rankBorder0: #ff7007;
+    --rankBorder1: #808080;
+    --rankBorder2: #e7926c;
+    --rankText0: #f5791d;
+    --rankText2: #e48154;
+    --saleBg:#f5f7fa;
+    --text0: #000;
+    --text1:rgba(0, 0, 0, 0.2);
+}
+
+.darkTheme {
+    --bg: #272b2e;
+    --bg2: #373b3e;
+    --border: #ffffff10;
+    --btnplaintBg: #373b3e;
+    --btnplaintBorder: #43ce00;
+    --rankBg: rgba(0, 0, 0, 0.1);
+    --rankBg0: rgba(0, 0, 0, 0.1);
+    --rankBg1: rgba(0, 0, 0, 0.1);
+    --rankBg2: rgba(0, 0, 0, 0.1);
+    --rankBorder0: #FF9815;
+    --rankBorder1: #929292;
+    --rankBorder2: #E4AF98;
+    --rankText0: #FF9815;
+    --rankText2: #E4AF98;
+    --saleBg:rgba(255,255,255,0.1);
+    --text0: #fff;
+    --text1:rgba(255, 255, 255, 0.2);
+}

+ 11 - 12
src/views/Home.vue

@@ -99,7 +99,7 @@
                         </swiper-slide>
                     </swiper>
                     <div class="rank-more" :style="{ visibility: hideMore ? 'hidden' : 'visible' }">
-                        <img src="@assets/arrow-up.png" alt="" />
+                        <van-icon name="icon-a-iconarrowdown1" class-prefix="font_family" />
                         <div>上滑显示更多</div>
                     </div>
                 </div>
@@ -550,7 +550,7 @@ export default {
     // background-color: @bg3;
     position: relative;
     z-index: 1;
-    background-color: #f5f7fa;
+    background-color: var(--bg);
     padding-top: var(--safe-top);
 }
 
@@ -601,7 +601,7 @@ export default {
         .text2 {
             font-size: 30px;
             font-weight: bold;
-            color: @text0;
+            color: var(--text0);
             line-height: 40px;
             letter-spacing: 1px;
             margin-top: 2px;
@@ -749,7 +749,7 @@ export default {
 }
 
 .card {
-    background: #ffffff;
+    background: var(--bg2);
     box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
     border-radius: 16px;
     margin: 16px 16px 0;
@@ -774,7 +774,7 @@ export default {
         .text2 {
             font-size: 26px;
             font-weight: bold;
-            color: #000000;
+            color: var(--text0);
             line-height: 36px;
         }
     }
@@ -801,13 +801,12 @@ export default {
         .flex-col();
         align-items: center;
         padding-top: 10px;
-        img {
-            width: 16px;
-            height: 16px;
+        .font_family {
+            color: var(--text1);
         }
         div {
             font-size: 12px;
-            color: rgba(0, 0, 0, 0.2);
+            color: var(--text1);
             line-height: 10px;
             margin-top: 4px;
         }
@@ -875,16 +874,16 @@ export default {
 .listSwiper-title {
     font-size: 20px;
     font-weight: bold;
-    color: #000000;
+    color: var(--text0);
     line-height: 24px;
-    border-top: 1px solid rgba(0, 0, 0, 0.1);
+    border-top: 1px solid var(--border);
     padding: 19px 0 8px;
     margin: 20px 16px 0;
 }
 
 .top-grid {
     --van-grid-item-icon-size: 56px;
-    --van-grid-item-text-color: #000000;
+    --van-grid-item-text-color: var(--text0);
     --van-grid-item-text-font-size: 12px;
     --van-grid-item-content-padding: 10px 8px 9px;
     /deep/.van-grid-item__icon + .van-grid-item__text {

+ 3 - 1
src/views/Index.vue

@@ -25,8 +25,10 @@
 </template>
 
 <script>
+import { mapState } from 'vuex';
 export default {
     computed: {
+        ...mapState(['darkTheme']),
         menus() {
             let menus = [
                 {
@@ -79,7 +81,7 @@ export default {
             return menus;
         },
         tabClass() {
-            return this.$route.path === '/home' ? '' : 'bgBack';
+            return this.$route.path === '/home' && !this.darkTheme ? '' : 'bgBack';
         }
     },
     inject: ['keeps'],