毕业设计:Vue3+FastApi+Python+Neo4j实现主题知识图谱网页应用——前端:首页与导航栏

简介

资源链接:https://download.csdn.net/download/m0_46573428/87796553

详细信息请看:https://blog.csdn.net/m0_46573428/article/details/130071302

这一部分的网页结构相对简单,主要是css的内容和router-link的跳转。

效果如下。

主要的CSS效果

所有的tab通过li来排列。【float: left;】使所有tab横向排列。

.tab {
    float: left;
    height: 60px;
    line-height: 60px;
    text-align: center;
    padding-left: 20px;
    padding-right: 20px;
}

移动到tab上,会有上横线出现。

.tab:hover {
    border-top: #486E53 solid 3px;
}

点击选中后字体会加粗。

.tab_all>a>li:hover {
    color: #486E53;
}

页面跳转

通过router-link进行页面跳转。

<router-link to="/VisualInterface" active-class="_active" class="tab"
          >图谱展示</router-link>
<router-view></router-view>

主要代码

App.vue

<template>
  <div>
    <router-link to="/"></router-link>
    <!-- 顶部导航栏 -->
    <div id="header">
      <!-- Logo -->
      <div class="logo">
        <img src="./assets/logo.png" alt="logo" />
        <h1>IME</h1>
      </div>

      <!-- Tab -->
      <div class="tab_all">
        <router-link
          to="/DataManagement"
          active-class="_active"
          class="tab"
          style="margin-left: 20px"
          >数据管理</router-link
        >
        <router-link to="/DataProcessing" active-class="_active" class="tab"
          >数据处理</router-link
        >
        <router-link to="/Crawl" active-class="_active" class="tab"
          >数据爬虫</router-link
        >
        <router-link to="/Query" active-class="_active" class="tab"
          >知识问答</router-link
        >
        <router-link to="/News" active-class="_active" class="tab"
          >新闻热点</router-link
        >
        <router-link to="/Search" active-class="_active" class="tab"
          >词条检索</router-link
        >
        <router-link to="/VisualInterface" active-class="_active" class="tab"
          >图谱展示</router-link
        >
      </div>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "App",
  components: {},
  methods: {},
};
</script>

 index.css

#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
}

* {
    margin: 0;
    padding: 0;
    color: #555;
    font-size: 17px;
    /* background-size: 100% 100%; */
}

body {
    background-image: url('./assets/background.jpg');
    background-size: cover;
    /* height: 1200px; */
}

a {
    text-decoration: none;
}

._active {
    font-weight: bolder;
    color: #486E53;
}

#header {
    z-index: 1;
    float: left;
    position: fixed;
    height: 55px;
    width: 100%;
    background: #F2F2F2;
    border-bottom: none;
    box-shadow: 0px 3px 5px rgb(0 0 0 / 14%);
}

#header>div>img {
    float: left;
    height: 30px;
    width: auto;
    padding: 10px 10px 15px 15px;
    margin-left: 30px;
}

#header>div>h1 {
    float: left;
    font-size: 30px;
    margin: 10px 0px 0px 0px;
    color: #558161;
}

#header>div>div {
    float: left;
    width: 8%;
    height: 100%;
    text-align: center;
    /* line-height: 100%; */
}

#header>div>div>span {
    color: #486E53;
    line-height: 60px;
}

.tab {
    float: left;
    height: 60px;
    line-height: 60px;
    text-align: center;
    padding-left: 20px;
    padding-right: 20px;
}

.tab:hover {
    border-top: #486E53 solid 3px;
}

.tab_all>a>li:hover {
    color: #486E53;
}

.side_nav {
    height: 600px;
    width: 250px;
    background-color: rgba(250, 250, 250, 0.6);
    box-sizing: border-box;
    border-width: 1px;
    border-style: solid;
    border-color: rgba(242, 242, 242, 1);
    border-radius: 10px;
    box-shadow: none;
}

.side_tab {
    padding: 20px;
}

.side_tab:hover span {
    color: #486E53;
    cursor: pointer;
}

.side_tab:hover {
    border-left: 5px solid #486E53;
}

 

 ./assets/logo.png

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
要在Django中使用Neo4j数据库,需要执行以下步骤: 1. 安装py2neo库:这是一个Python库,用于在Python中与Neo4j数据库进行交互。可以使用以下命令安装: ``` pip install py2neo ``` 2. 在Django项目中配置数据库连接:在settings.py文件中,添加以下内容来配置Neo4j数据库连接: ```python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', }, 'neo4j': { 'ENGINE': 'django_neo4j_engine', 'NAME': 'neo4j', 'HOST': 'localhost', 'PORT': 7687, 'OPTIONS': { 'username': 'neo4j', 'password': 'password', } } } ``` 在这个例子中,我们使用django_neo4j_engine来连接到Neo4j数据库,使用的是默认的用户名和密码。 3. 创建模型:在models.py文件中创建模型,例如: ```python from django_neomodel import DjangoNode class Person(DjangoNode): name = StringProperty(max_length=255) age = IntegerProperty() # ...其他属性和方法 ``` 这个模型继承自DjangoNode,它允许我们在Django中使用Neo4j模型。 4. 执行查询:在views.py文件中,我们可以执行Neo4j查询,例如: ```python from django.http import HttpResponse from myapp.models import Person def myview(request): # 查询所有人物 people = Person.nodes.all() # 构建响应 response = '' for person in people: response += f'{person.name}, {person.age}<br/>' return HttpResponse(response) ``` 这个视图查询所有人物,并返回他们的名字和年龄。 5. 启动Django服务器:现在我们可以启动Django服务器并访问这个视图了。使用以下命令启动服务器: ``` python manage.py runserver ``` 在浏览器中访问http://localhost:8000/myview,应该能够看到查询结果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

人工智能技术小白修炼手册

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值