lucky 2 gadi atpakaļ
vecāks
revīzija
ae9df8dc68

+ 10 - 10
src/App.vue

@@ -1,8 +1,8 @@
 <template>
   <div id="app" v-cloak>
     <!-- <div class="bg-box"></div> -->
-    <button @click="theme('light')" class="aaa">按他变色</button>
-    <button @click="theme('dark')" class="bbb">按他变色2</button>
+    <!-- <button @click="theme('active1')" class="aaa">按他变色</button>
+    <button @click="theme('active2')" class="bbb">按他变色2</button> -->
     <router-view />
   </div>
 </template>
@@ -15,17 +15,17 @@ export default {
   },
   mounted() {
     // this.theme('light')
-      this.theme('dark')
+      // this.theme('dark')
     
   },
   methods: {
-    theme(type) {
+    // theme(type) {
 
-      // this.$store.commit('upDate', {themeType: type});
-      localStorage.setItem("type",type)
-      window.document.documentElement.setAttribute( "data-theme", type );
+    //   // this.$store.commit('upDate', {themeType: type});
+    //   sessionStorage.setItem("type",type)
+    //   window.document.documentElement.setAttribute( "data-theme", type );
 
-      }
+    // }
   },
 };
 </script>
@@ -109,9 +109,9 @@ html {
           width: 100%;
           height: auto;
         }
-        .van-nav-bar-my-fixed {
+        // .van-nav-bar-my-fixed {
          
-        }
+        // }
         .van-tabbar--fixed {
           z-index: 999999;
           background-color: #111111;

+ 2 - 2
src/assets/css/_themes.scss

@@ -6,7 +6,7 @@
 
 //注意一点是,每套配色方案里的key可以自定义但必须一致,不然就会混乱
 
-$themes: (light: ( //边框
+$themes: (active1: ( //边框
         border_color1: #3d414a,
         //底部导航--------------------------------------
         //文字
@@ -81,7 +81,7 @@ $themes: (light: ( //边框
 
     ),
 
-    dark: ( //边框
+    active2: ( //边框
 
         border_color1: #3d414a,
         //底部导航--------------------------------------

BIN
src/assets/images/active1/product/unit3.png


+ 7 - 5
src/assets/js/active.js

@@ -1,9 +1,9 @@
 let activeObj = {};
-let type = localStorage.getItem("type")
+let type = sessionStorage.getItem("type")
 
-if(type == 'light'){
+if(type == 'active1'){
     Fn1()
-}else if(type == 'dark'){
+}else if(type == 'active2'){
     Fn2()
 }else{
     alert('1-3')
@@ -13,6 +13,7 @@ if(type == 'light'){
 function Fn1(){
     activeObj = {
         //底部导航
+        type,
         bottomTabs:tabBar()
     };
 };
@@ -20,6 +21,7 @@ function Fn1(){
 function Fn2(){
   activeObj = {
     //底部导航
+    type,
     bottomTabs:tabBar()
 };
 
@@ -27,7 +29,7 @@ function Fn2(){
 
 //底部导航函数
 function tabBar(){
-  if(type == 'light'){
+  if(type == 'active1'){
     return  [
       //底部导航配置
       {
@@ -55,7 +57,7 @@ function tabBar(){
         },
       },
     ]
-  }else if(type == 'dark'){
+  }else if(type == 'active2'){
     return  [
       //底部导航配置
       {

+ 2 - 2
src/components/inputNumber.vue

@@ -55,7 +55,7 @@ export default {
     jian() {
       this.leix();
       if (this.num > 0) {
-        this.num-=2;
+        this.num-=Number(this.$store.getters.type_jjnum);
         this.$emit("backNum", this.num);
       }
     },
@@ -63,7 +63,7 @@ export default {
       this.leix();
       this.num = parseInt(this.num);
       if (this.num < this.max) {
-        this.num+=2;
+        this.num+=Number(this.$store.getters.type_jjnum);
         this.$emit("backNum", this.num);
       }
     },

+ 33 - 30
src/layout/index.vue

@@ -11,7 +11,7 @@
       route
     >
       <van-tabbar-item
-        v-for="(item, index) in activeObj"
+        v-for="(item, index) in bottomTabs"
         :key="index"
         :to="item.to"
       >
@@ -26,7 +26,7 @@
 
 <script>
 import { Tabbar, TabbarItem } from "vant";
-import {activeObj} from '@/assets/js/active.js'
+// import {activeObj} from '@/assets/js/active.js'
 
 // import RightPanel from "@/components/RightPanel";
 // import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
@@ -38,38 +38,41 @@ export default {
   components: {
     "van-tabbar": Tabbar,
     "van-tabbar-item": TabbarItem,
+  },
+  created() {
+    
   },
   data() {
     return {
-      activeObj:activeObj.bottomTabs,
+      
       active: 0,
-      // bottomTabs: [
-      //   //底部导航配置
-      //   {
-      //     to: "/home/paddy",
-      //     title: "藏金·1745",
-      //     icon: {
-      //       active: require("@/assets/images/active1/home/1745-active.png"),
-      //       inactive: require("@/assets/images/active1/home/bottomBtn1.png"),
-      //     },
-      //   },
-      //   {
-      //     to: "/home/product",
-      //     title: "兑换中心",
-      //     icon: {
-      //       active: require("@/assets/images/active1/home/product-active.png"),
-      //       inactive: require("@/assets/images/active1/home/bottomBtn2.png"),
-      //     },
-      //   },
-      //   {
-      //     to: "/home/my",
-      //     title: "个人中心",
-      //     icon: {
-      //       active: require("@/assets/images/active1/home/personal-active.png"),
-      //       inactive: require("@/assets/images/active1/home/bottomBtn3.png"),
-      //     },
-      //   },
-      // ],
+      bottomTabs: [
+        //底部导航配置
+        {
+          to: "/home/paddy",
+          title: "藏金·1745",
+          icon: {
+            active: require(`@/assets/images/${this.$store.getters.type}/home/1745-active.png`),
+            inactive: require(`@/assets/images/${this.$store.getters.type}/home/bottomBtn1.png`),
+          },
+        },
+        {
+          to: "/home/product",
+          title: "兑换中心",
+          icon: {
+            active: require(`@/assets/images/${this.$store.getters.type}/home/product-active.png`),
+            inactive: require(`@/assets/images/${this.$store.getters.type}/home/bottomBtn2.png`),
+          },
+        },
+        {
+          to: "/home/my",
+          title: "个人中心",
+          icon: {
+            active: require(`@/assets/images/${this.$store.getters.type}/home/personal-active.png`),
+            inactive: require(`@/assets/images/${this.$store.getters.type}/home/bottomBtn3.png`),
+          },
+        },
+      ],
     };
   },
 

+ 2 - 0
src/main.js

@@ -11,6 +11,8 @@ require('video.js/dist/video-js.css')
 
 const hls = require("videojs-contrib-hls")
 import * as filters from './filters' // global filters
+// import {activeObj} from './assets/js/active'
+// Vue.prototype.$activeObj = activeObj
 import Components from "./components";
 Vue.use(Components);
 // register global utility filters

+ 3 - 0
src/store/getters.js

@@ -1,4 +1,7 @@
 const getters = {
+  type: state => state.app.type,
+  type_jjnum: state => state.app.type_jjnum,
+
   sidebar: state => state.app.sidebar,
   size: state => state.app.size,
   searchSize: state => state.app.searchSize,

+ 16 - 1
src/store/modules/app.js

@@ -11,10 +11,25 @@ const state = {
   //medium / small / mini
   searchSize: 'medium',
   size: Cookies.get('size') || 'mini',
-  tablebtnSize: 'mini'
+  tablebtnSize: 'mini',
+  type:sessionStorage.getItem("type"),
+  type_jjnum:2,
+  
 }
 
 const mutations = {
+  SET_TYPE: (state, type) => {
+    state.type = type
+    
+    if(type == 'active1'){
+    state.type_jjnum = 1
+    }else if(type == 'active2'){
+    state.type_jjnum = 2
+    }else{
+    state.type_jjnum = 2
+    }
+
+  },
   TOGGLE_SIDEBAR: state => {
     state.sidebar.opened = !state.sidebar.opened
     state.sidebar.withoutAnimation = false

+ 2 - 0
src/store/modules/user.js

@@ -22,9 +22,11 @@ const state = {
   ad: getAd() ? JSON.parse(getAd()) : {},
   goodsNum: isNaN(getGoodsNum()) ? 0 : parseInt(getGoodsNum()),
   goodsUnit: isNaN(getGoodsUnit()) ? 0 : parseInt(getGoodsUnit()),
+  
 }
 
 const mutations = {
+  
   SET_TOKEN: (state, token) => {
     state.token = token
   },

+ 20 - 1
src/views/login/index.vue

@@ -102,8 +102,18 @@ export default {
       },
     };
   },
-
+  created(){
+    // sessionStorage.setItem("type",'active1')
+  },
   methods: {
+    //主题
+    theme(type) {
+      
+      sessionStorage.setItem("type",type)
+      this.$store.commit('app/SET_TYPE', type);
+      window.document.documentElement.setAttribute( "data-theme", type );
+
+    },
     // 点击 登陆按钮 后执行提交
     async onSubmit() {
       if (!this.loadding) {
@@ -121,6 +131,15 @@ export default {
                     this.$store
                       .dispatch("user/login", parmValue)
                       .then((res) => {
+                        //登录成功后根据当前账号设置主题
+                        //截取输入框账号第一位进行判断
+                        let status = this.form.mobile.substr(0,1)
+                        if(isnumber(status)){
+                          this.theme("active2")
+                        }else{
+                          this.theme("active1")
+                        }
+                        // return;
                         this.loadding = false;
                         if (res.code === 0) {
                           this.loginSuccess("/home/paddy");

+ 3 - 2
src/views/order/detail.vue

@@ -114,12 +114,13 @@ export default {
           provice_name,
           area_name,
           addr,
-          unit_weight
+          unit_weight,
+          good_name,
         } = res.data;
         this.list1[0].value = order_sn;
         this.list1[1].value = status === "1" ? "待发货" : "待收货";
         this.status = status;
-        this.list4[0].value = unit === "盒" ? "藏金1745礼盒" : "藏金1745普通装";
+        this.list4[0].value = good_name;
         this.list4[1].value = order_num + unit+"/"+unit_weight+'kg';
         this.list1[2].value = order_time;
         if (this.status === "2") {

+ 1 - 1
src/views/order/index.vue

@@ -135,7 +135,7 @@ export default {
           const { list } = res.data;
           list.forEach((v1) => {
             let item = Object.assign(
-              { name: v1.unit === "盒" ? "藏金1745礼盒" : "藏金1745普通装" },
+              { name: v1.good_name },
               v1
             );
             this.goodList.push(item);

+ 8 - 3
src/views/product/index.vue

@@ -48,7 +48,8 @@
     </div>
     <div class="product-footer clear">
       <div class="fl">
-        <input-number :numb="num" :max="stock" @backNum="backNum" />
+       
+        <input-number :numb="num" :max="stock"  @backNum="backNum" />
       </div>
       <div>
         <van-button type="info" class="fr" @click="placeOrder"
@@ -109,6 +110,7 @@ export default {
       }
     },
     async getaddress() {
+      
       let numRes = await this.set_user_goodsNum(this.num);
       let unitRes = await this.set_user_goodsUnit(this.radioV);
       if (numRes && numRes.code === 0 && unitRes && unitRes.code === 0) {
@@ -130,7 +132,8 @@ export default {
           }
           this.canStockBag = res.data.stock;
           this.canStockBox = res.data.stock;
-
+          
+          console.log(limit)
           this.distributeGoods(limit);
           // await this.getUnitist(limit);
           this.total = parseInt(stock + "");
@@ -160,8 +163,10 @@ export default {
         list.forEach((v1) => {
           let item = {
             id: v1.id,
-            name: v1.id === "1" ? "藏金·1745-实惠装" : "藏金·1745-礼盒装",
+            // name: v1.id === "1" ? "藏金·1745-实惠装" : "藏金·1745-礼盒装",
+            name: v1.good_name,
             img: require(`@/assets/images/active1/product/unit${v1.id}.png`),
+
             stock: parseInt(v1.limit_num + ""),
             weight: v1.weight,
             unit: v1.name,