first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<template lang="pug">
#app
keep-alive
router-view
</template>
<script>
export default {
name: 'App'
}
</script>
<style lang="less">
#app {
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,23 @@
import Vant from 'vant';
import 'vant/lib/index.css';
import Service from '../service'
export default {
DevUrl: 'http://127.0.0.1:3000/api/json',
ProdUrl: 'http://103.91.219.114:3000/api/json',
ApiList: {
index: '/index', // 获取首页接口吃撒从
info: '/info', // 进入详情
mechanism: '/mechanism', // 获取机构
mechanismList: '/mechanismList', // 获取机构下面的列表
type: '/class', // 获取首页顶部的分类
classList: '/classList', // 获取分类列表
allModel: '/allModel', // 所有模特
modelList: '/modelList', // 进入模特的个人主页
search: '/search', // 搜索接口
},
VuePlugs: [Vant],
NotVuePlugs: [
{ n: '$http', v: Service }
]
}

View File

@@ -0,0 +1,64 @@
import axios from 'axios'
import utils from '../utils'
class HTTP {
constructor () {
this.request()
this.response()
}
async get (params) {
this.SetBaseUrl()
return await axios.get(params.url, {
params: params.data,
headers: params.header
})
}
async post (params) {
this.SetBaseUrl()
return await axios.post(params.url, params.data, {
headers: params.header
})
}
/**
* 请求拦截器
*/
request () {
axios.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
return config
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error)
})
}
/**
* 添加响应拦截器
*/
response () {
axios.interceptors.response.use(function (response) {
// 对响应数据做点什么
switch (response.data.status) {
case 200:
return response.data.data;
break;
default:
throw new Error(response.data.msg)
break
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error)
})
}
SetBaseUrl () {
axios.defaults.baseURL = utils.checkUrl()
}
}
export default new HTTP()

View File

@@ -0,0 +1,19 @@
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import config from './config'
Vue.config.productionTip = false
config.NotVuePlugs.forEach(v=> Vue.prototype[v.n] = v.v)
config.VuePlugs.forEach(v=>Vue.use(v))
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,16 @@
<template lang="pug">
.main
router-link(to='/') 首页
router-link(to='/about') 我的
router-view
</template>
<script>
export default {
name: "Main"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,11 @@
<template lang="pug">
.about
h2 关于我
</template>
<script>
export default {}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,31 @@
<template lang="pug">
.home(v-if="Object.keys(List).length != 0")
ul
li(v-for="(item,index) in List.recommended.list" :key="index")
router-link(:to="{ name: 'info', query: { id: item.id } }") {{ item.title }}
</template>
<script>
export default {
data() {
return {
List: {}
}
},
async created() {
this.GetIndexData()
},
methods: {
async GetIndexData() {
let res = await this.$http.index.GetIndex({id:1})
console.log(res)
this.List = res
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,27 @@
<template lang="pug">
.info
h2 {{ InfoList.title }}
</template>
<script>
export default {
name: "info",
data() {
return {
InfoList: {}
}
},
created () {
this.GetInfo()
},
methods: {
async GetInfo() {
this.InfoList = await this.$http.index.GetInfo({ id: this.$route.query.id, page: 1 });
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,30 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router);
export default new Router({
routes: [
{
path: '/',
component: () => import(/* webpackChunkName: "home" */ '@/page/Main'),
children: [
{
path: '/',
name: 'home',
component: () => import(/* webpackChunkName: "home" */ '@/page/home')
},
{
path: '/about',
name: 'about',
component: () => import(/* webpackChunkName: "about" */ '@/page/about')
},
]
},
{
path: '/info',
name: 'info',
component: () => import(/* webpackChunkName: "info" */ '@/page/info')
}
]
})

View File

@@ -0,0 +1,22 @@
import http from '../http'
import config from '../config'
class IndexService {
async GetIndex(data = {},header = {}) {
return await http.get({
url: config.ApiList.index,
data: data,
header: header
})
}
async GetInfo(data = {},header = {}) {
return await http.get({
url: config.ApiList.info,
data: data,
header: header
})
}
}
export default new IndexService()

View File

@@ -0,0 +1,5 @@
class PublicService {
}
export default new PublicService()

View File

@@ -0,0 +1,7 @@
import IndexService from './IndexService';
import PublicService from './PublicService';
export default {
index: IndexService,
public: PublicService
}

View File

@@ -0,0 +1,14 @@
import config from "../config"
class Utils {
checkUrl() {
if (!process.env.NODE_ENV == "development") {
return config.DevUrl
} else {
return config.ProdUrl
}
}
}
export default new Utils()