Commit a3f1b22a by LiuZuwang

yyds

parent 202c9ddb
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# question
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "question",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"element-ui": "^2.15.4",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
}
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div>
<router-view>
</router-view>
</div>
</template>
<style lang="scss">
html,body{
height: 100%!important;
}
body{
background-color: #f7f7f7;
}
*{
margin: 0;
padding:0;
list-style:none;
outline:none;
text-decoration: none;
}
.flex{
display:flex;
}
.j-c{
justify-content:center;
}
.j-s{
justify-content:space-between;
}
.a-c{
align-items:center;
}
</style>
/*数据请求的唯一入口*/
//import axios from './http';
import index from './index';
export default{
index
}
\ No newline at end of file
import axios from 'axios';
import qs from 'qs';
axios.defaults.baseURL = "http://127.0.0.1:3000";
//axios.defaults.timeout = 10000;
//axios.defaults.withCredentials = true;
/*
TOKEN 校验
请求拦截
*/
//axios.defaults.headers['content-Type']='application/json';
//axios.defaults.headers['content-Type']='application/x-www-form-urlencoded';
axios.interceptors.request.use((config)=>{
let token = localStorage.getItem('token');
token&&(config.headers.Authorization=token);
return config;//返回配置项
},err=>{
return config;
});
//客户端发送请求=>[请求拦截器]=>服务器
//响应拦截器
axios.interceptors.response.use(response=>{
return response.data;
},err=>{
let{response}=err;
if(response){
switch(response.status){
case 401:
break;
case 403:
break;//token过期
case 404:
break;//找不到页面
}
}
else{
if(!window.navigator.onLine){
return ;
}
return Promise.reject(err);
}
})
export default axios;
\ No newline at end of file
import axios from './http'
function getallCatagory(){
var url = "";
return axios.get(url);
}
function SearchCatagory(aid)
{
var url = "catagory"+"\\"+aid;
return axios.get(url);
}
function SearchcQuestion(aid,aic){
var url = "catagory"+"/"+aid+`/`+aic;
console.log(url)
return axios.get(url);
//return url;
}
function SearchQuestion(aid,aic,aib)
{
var url ="catagory/"+aid+"\\"+aic+"\\"+aib;
// console.log(url);
return axios.get(url);
}
export default{
getallCatagory,
SearchCatagory,
SearchcQuestion,
SearchQuestion
}
\ No newline at end of file
console.log('\\'+1);
var a = "11";
var b ="11";
var c =11;
console.log(a==b);
console.log(a==c);
\ No newline at end of file
<template>
<keep-alive>
<div class="sort">
<span @click="gogo()">
hahahaha
</span>
<ul v-for="(item,index1) in frClass" :key="index1">
{{item.catagory_name}}
<li v-for="(itemson,index2) in item.que_list" :key="index2" @click="seeQuestion(item.catagory_id,itemson.catagory_id)">{{itemson.catagory_name}}</li>
<li><a> 更多</a></li>
</ul>
</div>
</keep-alive>
</template>
<script>
export default {
name:'Ctable',
data(){
return{
frClass:[],
// frClass:[
// {
// class_name:'财经类',
// secClass:[
// "会计初级","注册税务师","会计中级","注册会计师","统计师"
// ]
// },
// {
// class_name:'资格类',
// secClass:[
// "会计初级","注册税务师","会计中级","注册会计师","统计师"
// ]
// },
// {
// class_name:'计算机',
// secClass:[
// "会计初级","注册税务师","会计中级","注册会计师","统计师"
// ]
// },
// {
// class_name:'财经类',
// secClass:[
// "会计初级","注册税务师","会计中级","注册会计师","统计师"
// ]
// },
// {
// class_name:'招录类',
// secClass:[
// "会计初级","注册税务师","会计中级","注册会计师","统计师"
// ]
// },
// {
// class_name:'医学类',
// secClass:[
// "会计初级","注册税务师","会计中级","注册会计师","统计师"
// ]
// }
// ]
}
},
created(){
var m = this.$api.index.getallCatagory();
let that =this;
m.then(ok=>{
that.frClass = ok;
})
console.log(m);
// this.frClass = m;
//console.log(m);
},
methods:{
gogo(){
console.log(this.frClass)
},
seeQuestion(aid,cid){
this.$router.push({path:`/catagory/${aid}/${cid}`})
}
}
}
</script>
<style scoped>
.sort ul{
list-style-type: none;
text-align: center;
text-align:left;
margin-left: 40px;
margin-top: 20px;
}
.sort ,.sort li:last-child{
border: none;
margin-right: 10px;
padding: 8px 0px 8px 0px;
background-color: #ffffff;
color: black;
}
.sort li:first-child{
margin-left:30px;
}
.sort li .router-link-exact-active:hover{
color: #ffffff;
}
.sort li{
display: inline-block;
text-align: center;
width: 100px;
/* margin-left: 10px;
margin-right: 10px; */
border: 1px solid #e2e3f6;
/*边框合并*/
margin-right: 26px;
/* margin:0 30px 0 10px; */
position: relative;
z-index: 0;
padding: 8px 12px 8px 12px;
}
li:hover{ background-color:#484dc3;
color:#ffffff;
cursor:pointer;}
.sort{
/* width: 1104px;
height: 504px;
background-color: #ffffff;
margin: 260px 200px 120px 350px; */
background-color:#ffffff;
margin: 20px auto;
padding: 15px 10px 15px 10px;
width: 1000px;
font-family: Source Han Sans CN;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
line-height: 21px;
letter-spacing: 0px;
color: #333333;
}
.router-link-exact-active{
text-decoration: none;
color: #333333;
}
a{
text-decoration: none;
color: black;
}
a:hover{
color: #ffffff;
}
</style>
\ No newline at end of file
<template>
<div class="search">
<h1 class="home-center">
云芯问答库
</h1>
<a class="search_text">考研资料·注册会计师·研究生考试·会计初级·职称英语·论文撰写</a>
<search-bar class="search_center"></search-bar>
</div>
</template>
<script>
import searchBar from './search-bar.vue'
export default {
name:'daohang',
components: { searchBar },
}
</script>
<style>
.home-center{
width:1020px;
margin:0 auto;
}
/* input{
width: 600px;
height: 38px;
background-color: #ffffff;
border: solid 1px #484dc33d;
margin: 30px 100px 0px 100px;
float: left;
}
input:focus{
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)
} */
/* .el-select .el-input {
width: 130px;
}
.input-with-select .el-input-group__prepend {
background-color: #fff;
}
button{
width: 120px;
height: 48px;
background-color: #484dc3;
margin: 0px 50px 50px 50px;
float: left;
}
button:focus{
width: 28px;
height: 19px;
font-family: Source Han Sans CN;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
line-height: 19px;
letter-spacing: 0px;
color: #ffffff;
}*/
.search_center{
width:816px;
margin:64px auto 64px;
}
h1{
width: 242px;
height: 64px;
font-family: 江城正君体;
font-size: 40px;
font-weight: normal;
font-stretch: normal;
line-height: 64px;
letter-spacing: 1px;
color: #484dc3;
margin: 50px 600px 0px 420px;
}
.search_text{
width: 384px;
height: 19px;
display: inline-block;
font-family: Source Han Sans CN;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
line-height: 19px;
letter-spacing: 0px;
color: #333333;
text-align: center;
}
.search{
padding: 0 100px 0 100px;
text-align: center;
}
</style>
\ No newline at end of file
<template>
<div>
<div class="search_wrap" >
<el-input placeholder="请输入内容" v-model="input" class="input-with-select">
<el-select v-model="select" slot="prepend" placeholder="全部分类">
<el-option label="财经类" value="1" ></el-option>
<el-option label="资格类" value="2"></el-option>
<el-option label="计算机类" value="3"></el-option>
<el-option label="招录类" value="4"></el-option>
<el-option label="学历类" value="5"></el-option>
<el-option label="医学类" value="6"></el-option>
</el-select>
<el-button slot="append" icon="el-icon-search">搜索</el-button>
</el-input>
</div>
</div>
</template>
<script>
export default {
data() {
return {
input: '',
select: ''
}
},
methods:{
gog0(id1,id2)
{
this.$router.push(`catagory/${id1}/${id2}`)
}
}
}
</script>
<style long='scss'>
.search_wrap{
width: 816px;
}
.el-select{
width: 120px!important;
}
/* .el-select .el-input {
width: 130px;
} */
.input-with-select .el-input-group__prepend {
background-color: #fff;
}
.el-input-group__append{
background-color:#484dc3;
}
.el-input-group__append button.el-button{
color:#fff;
}
</style>
\ No newline at end of file
<template>
<div class="main">
<el-menu
:default-active="activeIndex2"
class="el-menu-demo"
mode="horizontal"
@select="handleSelect"
background-color="#484dc3"
text-color="#f7f7f7"
active-text-color="#fff">
<el-menu-item index="1"><p @click="gogo()">返回首页</p></el-menu-item>
<el-menu-item index="2" ><p @click="gogo(2)">财经类</p></el-menu-item>
<el-menu-item index="3" ><p @click="gogo(11)">资格类</p></el-menu-item>
<el-menu-item index="4" ><p @click="gogo(12)">计算机类</p></el-menu-item>
<el-menu-item index="5" ><p @click="gogo(13)">招录类</p></el-menu-item>
<el-menu-item index="6" ><p @click="gogo(14)">学历类</p></el-menu-item>
<el-menu-item index="7"><p @click="gogo(15)">医学类</p></el-menu-item>
<el-menu-item index="9" >其他类</el-menu-item>
</el-menu>
</div>
</template>
<script>
export default {
data() {
return {
activeIndex: '1',
activeIndex2: '1'
};
},
methods: {
// handleSelect(key, keyPath) {
// console.log(key, keyPath);
// }
gogo(id){
//router.go(0)
if(id==null)
this.$router.push("/");
else if(id==17)
this.$router.push(`/catagory/${id}/${16}`);
else
this.$router.push(`/catagory/${id}/${17}`);
}
},
watch: {
  '$route': function (to, from) {
// 我这里还是用了Vuex,不过应该不影响理解
this.$store.dispatch('updateActiveTemplateId', this.$route.params.templateId)
// 通过更新Vuex中的store的数据,让数据发生变化
this.getTemplateById()
  }
},
}
</script>
<style long='scss' scoped>
/* .main /deep/ .el-menu-demo {
width: 100%!important;
height: 10px!important;
} */
.main{
width: 1200px;
margin: 0 auto;
}
ul,li{
height: 49px!important;
line-height: 49px!important;
}
</style>
\ No newline at end of file
import Vue from 'vue'
import App from './App.vue'
//导入路由
import router from './router'
//导入状态管理
import store from './store'
import api from './api/api';
//导入插件
//imoprt './plugin'
//注册element-ui组件
//import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
//组件库只有被执行后才能注册
Vue.config.productionTip = false
Vue.prototype.$api = api;
var c =new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
import Vue from 'vue'
import VueRouter from 'vue-router'
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)
//路由信息数组
const routes = [
//登录页
{
path:'/detials',
component:()=>import('../views/details.vue'),
// children:[
// path:'/'
// ]
},
{
path:'/question',
component:()=>import('../views/question.vue')
},
{
path:'/',
component:()=>import('../views/Home.vue')
},
// {
// path:'/catagory/:aid',
// component:()=>import("../views/question.vue")
// },
{
path:'/catagory/:aid/:cid',
component:()=>import("../views/question.vue")
},
{
path:'/catagory/:aid/:cid/:bid',
component:()=>import("../views/details.vue")
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
modules: {
}
})
<template>
<div class="homes">
<div class="home-center">
<div class="header01">欢迎使用云芯知识检索平台</div>
<div class="header02" @click="go()">已收录:1234条问答</div>
</div>
<daohang></daohang>
<test-1></test-1>
<div class="bottom0 home-center">Copyright © 2021 山西云芯新一代信息技术研究院</div>
</div>
</template>
<script>
import Daohang from '../components/daohang.vue'
import Table from '../components/Ctable.vue'
// @ is an alias to /src
export default {
name: 'Home',
components:
{
'test1':Table,
'daohang':Daohang,
},
data(){
return {
catagory:""
}
},
async created(){
//this.catagory=await this.$api.index.getallCatagory();
},
methods:{
async go(){
// this.catagory= await this.$api.index.getallCatagory();
console.log(1);
//console.log(this.catagory);
}
}
}
</script>
<style scoped>
.home-center{
width:1020px;
margin:0 auto;
}
.header01{
width: 168px;
height: 19px;
font-family: Source Han Sans CN;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
line-height: 19px;
letter-spacing: 0px;
color: #333333;
float: left;
}
.header02{
height: 100px;
font-family: Source Han Sans CN;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
line-height: 19px;
letter-spacing: 0px;
color: #333333;
padding: 0 0 0 850px;
}
.homes{
/* background-color: #f7f7f7; */
margin-top: 0%;
/* float: left; */
overflow: hidden;
padding: 10px 150px 70px 150px;
background-size:100% 100%;
background-attachment:fixed;
}
.bottom0{
font-family: Source Han Sans CN;
font-size: 12px;
font-weight: normal;
font-stretch: normal;
line-height: 16px;
letter-spacing: 0px;
color: #999999;
text-align: center;
}
</style>
\ No newline at end of file
<template>
<div class="main">
<div class="login">
<el-form
size="mini"
:model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="账号" prop="loginId">
<el-input v-model="ruleForm.loginId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="密码" prop="loginPwd">
<el-input type="password" v-model="ruleForm.loginPwd" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
<el-button @click="resetForm('ruleForm')">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
data() {
//验证账号的方法
var validateloginId = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入账号'));
}
};
//验证密码的方法
var validateloginPwd = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
}
};
return {
//表单数据
ruleForm: {
//登录名
loginId: '',
//登录密码
loginPwd: '',
},
rules: {
//验证账号
loginId: [
{ validator: validateloginId, trigger: 'blur' }
],
//验证密码
loginPwd: [
{ validator: validateloginPwd, trigger: 'blur' }
],
}
};
},
methods: {
//表单提交方法
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
//表单提交方法
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
}
</script>
<style scoped long='scss'>
.main{
display: flex;
justify-content: center;
align-items: center;
height:100vh;
}
.login{
width:460px;
height:220px;
border:1px solid #ccc;
}
</style>
\ No newline at end of file
...@@ -5,9 +5,9 @@ function getallQuestion(){ ...@@ -5,9 +5,9 @@ function getallQuestion(){
return axios.get(url); return axios.get(url);
} }
function addQuestion(aid) function addQuestion()
{ {
var url = "question_admin"+"\\"+aid; var url = "question_admin"+"\\"+add; //"//"与"\"意义相同
return axios.get(url); return axios.get(url);
} }
function SearchcQuestion(aid,aic){ function SearchcQuestion(aid,aic){
...@@ -24,7 +24,7 @@ function SearchQuestion(aid,aic,aib) ...@@ -24,7 +24,7 @@ function SearchQuestion(aid,aic,aib)
} }
export default{ export default{
getallQuestion, getallQuestion,
addQuestion,
SearchcQuestion, SearchcQuestion,
SearchQuestion SearchQuestion
} }
...@@ -276,13 +276,8 @@ ...@@ -276,13 +276,8 @@
console.log(ok[tt].length) console.log(ok[tt].length)
console.log(aaaa+"lalalalal"); console.log(aaaa+"lalalalal");
} }
}) })
}, },
methods: { methods: {
open() { open() {
this.$alert('这是一段内容', '问题创建', { this.$alert('这是一段内容', '问题创建', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment