zzzz
2024-04-09 19061b17591c3a2310348033eb51194f5a9a4527
first commit
4 files modified
80 ■■■■ changed files
src/App.vue 23 ●●●● patch | view | raw | blame | history
src/page/login/login.vue 4 ●●● patch | view | raw | blame | history
src/page/trading/buy.vue 28 ●●●●● patch | view | raw | blame | history
src/store/index.js 25 ●●●● patch | view | raw | blame | history
src/App.vue
@@ -40,7 +40,8 @@
// 引入css
import "@/assets/iconfont/iconfont.css";
import "@/assets/iconfont/iconfont.ttf";
import { getUserInfodata } from "./axios/api";
import { mapActions } from "vuex";
export default {
  components: {
@@ -50,9 +51,8 @@
  },
  name: "App",
  created() {
    this.getUserInfo();
    this.setUseInfo();
    this.$state.theme = "red";
    console.log(this.$state.theme, "asdasdasd");
    let title = this.$route.meta.title || this.$t("hj224");
    this.title = title;
    if (this.$route.meta.is_Show) {
@@ -108,21 +108,8 @@
    };
  },
  methods: {
    async getUserInfo() {
      // 获取用户信息
      //   let showcookie = this.getCookie('USER_TOKEN');
      let data = await getUserInfodata();
      if (data.status === 0) {
        // this.getProductSetting()
        this.$store.state.userInfo = data.data;
      } else {
        this.$store.commit("elAlertShow", {
          elAlertShow: true,
          elAlertText: data.msg,
        });
      }
      this.$store.state.user = this.user;
    },
    ...mapActions(["setUseInfo"]),
    footColse() {
      this.$store.commit("dialogVisible", true);
    },
src/page/login/login.vue
@@ -62,7 +62,7 @@
import headers from "./components/header.vue";
import * as api from "@/axios/api";
import { Notify } from "vant";
import { mapMutations } from "vuex";
import { mapActions, mapMutations } from "vuex";
export default {
  name: "newLogin",
@@ -92,6 +92,7 @@
  },
  methods: {
    ...mapActions(["setUseInfo"]),
    ...mapMutations(["undataToken"]),
    checkboxChange(e) {
      window.localStorage.setItem("login_checked", e);
@@ -116,6 +117,7 @@
      let data = await api.login(opts);
      if (data.status === 0) {
        this.setUseInfo();
        if (this.checked) {
          window.localStorage.setItem(
            "login_admin",
src/page/trading/buy.vue
@@ -228,6 +228,7 @@
<script>
import * as api from "@/axios/api";
import { mapActions } from "vuex";
export default {
  name: "trBuy",
@@ -313,7 +314,7 @@
    } else if (this.bayType == "qh") {
      this.priceTabs = [this.$t("hj108")];
    }
    this.getUserInfo();
    this.setUseInfo();
    this.getMoneyData();
    this.getSettingInfo();
  },
@@ -332,6 +333,8 @@
    },
  },
  methods: {
    ...mapActions(["setUseInfo"]),
    async getMoneyData() {
      let data = await api.getMoney();
      let type = this.bayType === "SZHB" ? "US" : this.bayType;
@@ -476,15 +479,7 @@
        this.$router.push("/authentications");
        return;
      }
      // if (!this.agree) {
      //   Toast('需同意合作协议才能交易!')
      // } else if (isNull(this.selectNumber) && isNull(this.autoNumber)) {
      //   Toast('请选择购买手数')
      // } else if (isNull(this.selectType)) {
      //   Toast('请选择买卖方向')
      // } else if(isNull(this.subaccountNumber)) {
      //   Toast('请选择子账户')
      // } else {}
      if (this.buying) {
        return;
      }
@@ -538,18 +533,17 @@
          elAlertType: "success",
        });
        this.getUserInfo();
        var buyType = ''
        var buyType = "";
        if (this.tabsCurrentIndex == 0) {
          buyType = 1;
        } else {
          buyType = 0;
        }
        if(this.bayType=='US'){
          this.$router.push("/warehouse?index=1&buyType="+buyType);
        }else if(this.bayType=='MAS'){
          this.$router.push("/warehouse?index=0&buyType="+buyType);
        }else {
        if (this.bayType == "US") {
          this.$router.push("/warehouse?index=1&buyType=" + buyType);
        } else if (this.bayType == "MAS") {
          this.$router.push("/warehouse?index=0&buyType=" + buyType);
        } else {
          this.$router.push("/warehouse");
        }
      } else {
src/store/index.js
@@ -1,3 +1,4 @@
import { getUserInfodata } from "@/axios/api";
import Vue from "vue";
import Vuex from "vuex";
// import getters from './getters'
@@ -9,9 +10,9 @@
let state = {
  className: "black",
  theme: "red",
  userInfo: {
    // 用户信息
  },
  userInfo: window.localStorage.getItem("useInfo")
    ? JSON.parse(window.localStorage.getItem("useInfo"))
    : {},
  user: {},
  bankInfo: {
    bankNo: ""
@@ -34,8 +35,24 @@
export default new Vuex.Store({
  state,
  actions: {},
  actions: {
    async setUseInfo({ commit }) {
      let data = await getUserInfodata();
      if (data.status === 0) {
        commit("SET_USE_INFO", data.data);
      } else {
        commit("elAlertShow", {
          elAlertShow: true,
          elAlertText: data.msg
        });
      }
    }
  },
  mutations: {
    SET_USE_INFO(state, useInfo) {
      state.userInfo = useInfo;
      window.localStorage.setItem("useInfo", JSON.stringify(useInfo));
    },
    undataToken(state, token) {
      state.token = token || null;
    },