团队第二阶段冲刺07

一、前言

1、昨天完成了:

文献推荐系统:基于用户的历史搜索记录和行为数据,建立推荐系统,为用户提供个性化的文献推荐服务。

2、今天完成了:

文献阅读和笔记功能:为用户提供文献阅读和笔记功能,方便用户进行学习和研究。

3、遇到的困难:

文献阅读和笔记的功能还不够完善,还需要继续改进

二、冲刺进度

  • 1.任务量:10天

    目前已经花费的时间:7天

    还剩余的时间:3天

三、逻辑代码

<template>
  <div class="login-wrap">
    <el-form class="login-container">
      <h1 class="title">用户登录:</h1>
      <el-form-item>
        <el-input
          type="text"
          placeholder="用户账号"
          v-model="username"
          autocomplete="off"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-input
          type="password"
          placeholder="用户密码"
          v-model="password"
          autocomplete="off"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="doLogin" style="width: 100%">登录</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="toRegister" style="width: 100%">注册</el-button>
      </el-form-item>
        <!-- <el-link type="primary" @click="toRegister">用户注册</el-link> -->
        <!-- <el-link type="primary">忘记密码</el-link> -->
    </el-form>
  </div>
</template>
 
<script>
import { reqUserLogin } from '@/api';
import { mapState } from "vuex";
export default {
  name: "Login",
  data: function () {
    return {
      username: "",
      password: "",
    };
  },
  // mounted() {
  //   //派发action,通知vuex发请求
  //   this.$store.dispatch("userLoginMock");
  // },
  // computed: {
  //   ...mapState({
  //      usermock: (state) => state.user.usermock,
  //     //bookList: (state) => state.booktext.bookList,
  //   }),
  // },
  methods: {
      doLogin (){
      //alert(132);
       const { username, password } = this;
      //在发登录请求
      try {
        //登录成功
        this.$store.dispatch("userLoginMock", { username, password });
        // const res = reqUserLogin({username,password});
        // console.log(res);
        // console.log(222);
        if (JSON.parse(sessionStorage.getItem("userinfo"))) {
           alert("登录成功")
        }else{
          alert("登陆失败")
        }
         //  let goPath = this.$route.query.redirect||'/home';
        //跳转到首页
        this.$router.push('search');
        } catch (error) {
        alert(error.message);
      }
      },
      
    toRegister: function () {
      this.$router.push("/register");
    },
  },
};
</script>
 
<style>
.login-wrap {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding-top: 10%;
}

.login-container {
  border-radius: 10px;
  margin: 0px auto;
  width: 350px;
  padding: 30px 35px 15px 35px;
  background: #fff;
  border: 1px solid #eaeaea;
  text-align: left;
  box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.1);
}

.title {
  margin: 0px auto 40px auto;
  text-align: center;
  color: #505458;
}
</style>

 

posted @ 2023-05-30 23:40  玛卡巴卡突击队  阅读(3)  评论(0编辑  收藏  举报