去掉冲突
This commit is contained in:
parent
ca76069d42
commit
ce46044fbc
|
@ -4,9 +4,5 @@ const prodEnv = require('./prod.env')
|
|||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"',
|
||||
<<<<<<< HEAD
|
||||
BASE_API: '"http://117.50.100.12:8001"',
|
||||
=======
|
||||
BASE_API: '"http://117.50.100.12:8001/"',
|
||||
>>>>>>> fc06b2b (bug)
|
||||
})
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
<template>
|
||||
<div class="headerBox">
|
||||
<div class="headerContent">
|
||||
|
@ -344,402 +343,3 @@ export default {
|
|||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
=======
|
||||
<template>
|
||||
<div class="headerBox">
|
||||
<div class="headerContent">
|
||||
<a href="" class="headerImg"><img src="../assets/1nav.png" alt="" /></a>
|
||||
<div class="head-nav pr">
|
||||
<ul id="header-nav">
|
||||
<li
|
||||
class="pr"
|
||||
v-for="item in navData"
|
||||
:key="item.name"
|
||||
:class="{ active: actRouter == item.name }"
|
||||
>
|
||||
<a :href="item.url">{{ item.name }}</a>
|
||||
</li>
|
||||
<!-- <li class="pr" :class="{'active':actRouter=='achive'}" @click="changeRouter('achive')"><p>成果列表</p></li>
|
||||
<li class="pr" :class="{'active':actRouter=='needsList'}" @click="changeRouter('needsList')"><p>需求大厅</p></li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="head-right"></div>
|
||||
<span style="font-size: 15px" v-show="!logindata">
|
||||
<a class="cg6" @click="login">登录</a>
|
||||
<span>
|
||||
<em class="vertical-line"></em>
|
||||
<a class="cg6" href="http://117.50.100.12:8000/user_join">注册</a>
|
||||
</span>
|
||||
</span>
|
||||
<span v-show="logindata">
|
||||
<el-dropdown @command="handDown">
|
||||
<span style="display: flex"
|
||||
><img
|
||||
style="width: 30px; height: 30px"
|
||||
class="userImg"
|
||||
:src="imgUrl"
|
||||
alt="" /><i
|
||||
class="el-icon-arrow-down el-icon--right"
|
||||
style="line-height: 30px"
|
||||
></i
|
||||
></span>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="person">个人中心</el-dropdown-item>
|
||||
<el-dropdown-item command="achive">我的成果</el-dropdown-item>
|
||||
<el-dropdown-item command="needs">我的需求</el-dropdown-item>
|
||||
<el-dropdown-item command="logout">退出</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</span>
|
||||
<el-dialog title="登录" :visible.sync="loginVissible" width="405px">
|
||||
<div class="loginBox">
|
||||
<el-form
|
||||
:model="loginForm"
|
||||
:rules="rules"
|
||||
ref="loginForm"
|
||||
label-width="10px"
|
||||
>
|
||||
<el-form-item label-width=""
|
||||
><el-input
|
||||
placeholder="请输入用户名"
|
||||
v-model="loginForm.userName"
|
||||
clearable
|
||||
></el-input
|
||||
></el-form-item>
|
||||
<el-form-item label-width=""
|
||||
><el-input
|
||||
placeholder="请输入密码"
|
||||
show-password
|
||||
v-model="loginForm.password"
|
||||
clearable
|
||||
></el-input
|
||||
></el-form-item>
|
||||
<el-form-item label-width="">
|
||||
<el-button
|
||||
size="small"
|
||||
style="width: 355px"
|
||||
type="primary"
|
||||
@click.native.prevent="handleLogin"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="">
|
||||
<div class="loginO">
|
||||
<el-checkbox v-model="loginForm.rememberMe"
|
||||
>记住密码</el-checkbox
|
||||
>
|
||||
<span style="font-size: 12px">
|
||||
<a
|
||||
class="cg6"
|
||||
href="http://117.50.100.12:8000/account/lost_password"
|
||||
>忘记密码</a
|
||||
>
|
||||
<span>
|
||||
<em class="vertical-line"></em>
|
||||
<a class="cg6" href="http://117.50.100.12:8000/user_join"
|
||||
>注册</a
|
||||
>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import user from "@/api/user/user";
|
||||
import { getToken, removeToken } from "@/api/user/auth";
|
||||
import { login, logout, getInfo, getnav } from "@/api/user/login";
|
||||
import boy from "../assets/boy.jpg";
|
||||
import girl from "../assets/girl.jpg";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export default {
|
||||
name: "achiveHeader",
|
||||
props: {
|
||||
type: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
navData: [],
|
||||
loading: false,
|
||||
logindata: this.isLogin,
|
||||
actRouter: "",
|
||||
loginVissible: false,
|
||||
loginForm: {
|
||||
userName: null,
|
||||
password: null,
|
||||
rememberMe: false,
|
||||
},
|
||||
imgUrl: boy,
|
||||
rules: {},
|
||||
userdata: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getNav();
|
||||
getInfo().then((resd) => {
|
||||
if (resd.data.login == "" || resd.data.login == null) {
|
||||
} else {
|
||||
this.logindata = true;
|
||||
this.isLogin = true;
|
||||
sessionStorage.setItem("access_token", resd.data.token);
|
||||
sessionStorage.setItem("SET_NAME", resd.data.username);
|
||||
sessionStorage.setItem("SET_ID", resd.data.user_id);
|
||||
sessionStorage.setItem("SET_Account", resd.data.login);
|
||||
sessionStorage.setItem("SET_operator", resd.data.operator);
|
||||
sessionStorage.setItem("SET_admin", resd.data.admin);
|
||||
sessionStorage.setItem("image_url", resd.data.image_url);
|
||||
if (resd.data.image_url == "avatars/User/boy.jpg") {
|
||||
this.imgUrl = boy;
|
||||
} else {
|
||||
this.imgUrl = girl;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (
|
||||
this.$route.path == "/needsList" ||
|
||||
this.$route.path == "/needsDetail" ||
|
||||
this.$route.path == "/needsEdit"
|
||||
) {
|
||||
this.actRouter = "创客行动";
|
||||
} else if (
|
||||
this.$route.path == "/" ||
|
||||
this.$route.path == "/achiveDetail" ||
|
||||
this.$route.path == "/achiveEdit"
|
||||
) {
|
||||
this.actRouter = "成果库";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getNav() {
|
||||
getnav().then((res) => {
|
||||
// console.log(res.data.config)
|
||||
let nav = JSON.parse(res.data.config);
|
||||
// console.log(nav)
|
||||
let navData = nav.navbar;
|
||||
for (let i = 0; i < navData.length; i++) {
|
||||
if (!navData[i].hidden) {
|
||||
let q = {
|
||||
name: navData[i].name,
|
||||
url: navData[i].link,
|
||||
id: i,
|
||||
};
|
||||
// if(navData[i].name=="成果库"){
|
||||
// q={
|
||||
// name:navData[i].name,
|
||||
// url:'achive',
|
||||
// }
|
||||
// }else if(navData[i].name=="创客空间"){
|
||||
// q={
|
||||
// name:navData[i].name,
|
||||
// url:'/needsList'
|
||||
// }
|
||||
// }else{
|
||||
// q={
|
||||
// name:navData[i].name,
|
||||
// url:navData[i].link
|
||||
// }
|
||||
// }
|
||||
|
||||
this.navData.push(q);
|
||||
}
|
||||
}
|
||||
// console.log(this.navData)
|
||||
});
|
||||
},
|
||||
changeRouter(routers) {
|
||||
this.actRouter = routers;
|
||||
this.$router.push({ name: routers });
|
||||
},
|
||||
login() {
|
||||
this.loginVissible = true;
|
||||
},
|
||||
handleLogin() {
|
||||
let that = this;
|
||||
let logins = user.actions.Login;
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set("username", this.loginForm.userName, { expires: 30 });
|
||||
Cookies.set("password", this.loginForm.password, { expires: 30 });
|
||||
Cookies.set("rememberMe", this.loginForm.rememberMe, {
|
||||
expires: 30,
|
||||
});
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
logins(that.loginForm)
|
||||
.then((res) => {
|
||||
this.isLogin = true;
|
||||
this.logindata = true;
|
||||
// this.userdata=res.data
|
||||
this.loginVissible = false;
|
||||
that.$emit("loginData", true);
|
||||
getInfo().then((resd) => {
|
||||
console.log(resd);
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$set(this.loginForm, "password", "");
|
||||
console.log("登录错误");
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
goRouter(url) {},
|
||||
logouts() {
|
||||
removeToken();
|
||||
logout().then((res) => {
|
||||
this.$emit("loginData", false);
|
||||
this.logindata = false;
|
||||
this.isLogin = false;
|
||||
this.$router.replace({ name: "achive" });
|
||||
});
|
||||
},
|
||||
handDown(com) {
|
||||
console.log(com);
|
||||
|
||||
if (com == "person") {
|
||||
if (getToken()) {
|
||||
// this.$router.push({name:'myAchive'});
|
||||
}
|
||||
let url =
|
||||
"http://117.50.100.12:8000/accounts/" +
|
||||
sessionStorage.getItem("SET_Account");
|
||||
window.open(url);
|
||||
} else if (com == "achive") {
|
||||
this.actRouter = "";
|
||||
if (sessionStorage.getItem("SET_NAME")) {
|
||||
this.$router.push({ name: "myAchive" });
|
||||
}
|
||||
} else if (com == "needs") {
|
||||
this.actRouter = "";
|
||||
if (sessionStorage.getItem("SET_NAME")) {
|
||||
sessionStorage.setItem("mananeNeed", "my");
|
||||
this.$router.push({ name: "mananerNeeds" });
|
||||
}
|
||||
} else if (com == "logout") {
|
||||
this.logouts();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.headerBox {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
height: 70px;
|
||||
/* position: fixed; */
|
||||
min-width: 1200px;
|
||||
max-width: unset;
|
||||
}
|
||||
.headerContent {
|
||||
/* width: 100%; */
|
||||
padding: 0 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
.headerImg {
|
||||
margin-right: 30px;
|
||||
float: left;
|
||||
}
|
||||
.headerImg img {
|
||||
height: 40px;
|
||||
min-width: 40px;
|
||||
}
|
||||
.head-nav {
|
||||
text-align: center;
|
||||
height: 70px;
|
||||
box-sizing: border-box;
|
||||
min-width: 780px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
}
|
||||
.pr {
|
||||
position: relative;
|
||||
}
|
||||
#header-nav {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
/* z-index: 3; */
|
||||
height: 70px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#header-nav li {
|
||||
float: left;
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
padding: 0px 20px;
|
||||
display: flex;
|
||||
color: #333;
|
||||
}
|
||||
.userImg {
|
||||
border-radius: 15px;
|
||||
}
|
||||
li a {
|
||||
color: #333;
|
||||
}
|
||||
#header-nav a:hover {
|
||||
color: #5091ff;
|
||||
}
|
||||
#header-nav li:hover {
|
||||
color: #5091ff;
|
||||
}
|
||||
li.active p {
|
||||
color: #5091ff;
|
||||
}
|
||||
li.active a {
|
||||
color: #5091ff;
|
||||
}
|
||||
.head-right {
|
||||
box-sizing: border-box;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
em.vertical-line {
|
||||
display: inline-block;
|
||||
width: 2px;
|
||||
background: #999;
|
||||
height: 10px;
|
||||
}
|
||||
.cg6 {
|
||||
color: #666;
|
||||
cursor: pointer;
|
||||
}
|
||||
.loginO {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.el-dropdwon-link {
|
||||
cursor: pointer;
|
||||
}
|
||||
.el-icon--right {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
>>>>>>> fc06b2b (bug)
|
||||
|
|
Loading…
Reference in New Issue