haoxuan
2024-04-16 e42df755d23d421fa07602d0ea6cf822986c4b40
src/components/header/index.vue
@@ -9,11 +9,12 @@
        </div>
        <div class="topright">
          <a href="">首页</a>
          <a href="http://fai365.com:9080/login">智慧工厂</a>
          <a :href="link">智慧工厂</a>
          <a href="">管理中心</a>
          <a href="">算法</a>
          <a href="">应用</a>
          <a href="">管理服务</a>
          <span class="right-btn"><a :href="link">登录</a></span>
        </div>
      </div>
    </div>
@@ -21,16 +22,46 @@
</template>
<script>
import util from "@/libs/util.js";
import Cookies from "js-cookie";
export default {
  props: {},
  data() {
    return {};
    return {
      link:""
    };
  },
  computed: {},
  created() {},
  created() {
    this.link=this.getApsPage()
  },
  mounted() {},
  watch: {},
  methods: {},
  methods: {
    environmentType(){
      let type
      if (location.href.includes('192.168.20.119')) {
        type = 'test'
      } else if (location.href.includes('192.168') || location.href.includes('localhost')) {
        type = 'dev'
      } else {
        type = 'prod'
      }
      return type
    },
    getApsPage(){
      // let token = util.cookies.get("token");
      // Cookies.set("token", token, { expires: 7, path: "/" });
      // console.log(util.cookies.get("token"),'==token')
      // window.open(`//aps.fai365.com:${getPort()}${this.startPage}`); ${window.location.hostname}
      const loginPathMap = {
        prod:`//aps.fai365.com:9080`,
        test:`//192.168.20.119:9080`,
        dev: `//192.168.8.117:8080`
      }
      return loginPathMap[this.environmentType()]
    },
  },
  components: {},
};
</script>
@@ -94,9 +125,12 @@
        }
      }
      .topright {
        width: 453px;
        width: 533px;
        height: 44px;
        line-height: 44px;
        .right-btn{
          margin-left:40px;
        }
        a {
          margin-left: 40px;
          font-size: 14px;