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,46 @@
<template>
<div id="app">
<yd-navbar fixed title="首页"></yd-navbar>
<div class="content">
<img src="./assets/logo.png">
<ul>
<li><a href="#/index">首页</a></li>
<li><a href="#/about">关于我</a></li>
</ul>
<router-view/>
</div>
<yd-tabbar fixed>
<yd-tabbar-item title="首页" link="/index">
<yd-icon name="home" slot="icon" size="0.54rem"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="购物车" link="#">
<yd-icon name="shopcart-outline" slot="icon" size="0.54rem"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="个人中心" link="/about">
<yd-icon name="ucenter-outline" slot="icon" size="0.54rem"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="图片" link="#">
<img slot="icon" style="height: 25px;" src="http://static.ydcss.com/ydui/img/logo.png">
</yd-tabbar-item>
</yd-tabbar>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
.content {
margin-top:50px;
margin-bottom: 54px;
}
</style>

View File

@@ -0,0 +1,67 @@
import Vue from 'vue'
import axios from 'axios'
import { Loading, Toast } from 'vue-ydui/dist/lib.rem/dialog';
axios.defaults.baseURL = 'http://localhost:3000';
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
Loading.open('很快加载好了')
return config;
}, function (error) {
return Promise.reject(error);
});
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
switch (response.data.status){
case 200:
Loading.close()
return response;
break;
default:
Toast({
mes: '网络请求失败',
timeout: 1500,
icon: 'error'
})
break;
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
export default {
get (params) {
return new Promise(function(resolve,reject){
axios.get(params.url, {
params: params.parameter
})
.then((success) => {
resolve(success.data)
})
.catch((err) => {
reject(err)
})
})
},
post () {
return new Promise(function(resolve,reject){
axios.post(params.url,params.parameter)
.then((success) => {
resolve(success.data)
})
.catch((err) => {
reject(err)
})
})
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,13 @@
<template>
<div class="about">
<h2>关于我</h2>
</div>
</template>
<script>
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,33 @@
<template>
<div class="hello">
<ul>
<li v-for="(item,index) in BookList" :key="index">
<a :href="item.text_url">{{item.text_title}}</a>
</li>
</ul>
</div>
</template>
<script>
export default {
created () {
this.getIndexData()
},
data () {
return {
BookList: []
}
},
methods: {
async getIndexData() {
this.BookList = (await this.$http.get({ url: this.$config.api.home.index, parameter: {}})).data
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,7 @@
export default {
api: {
home: {
index: '/home/index'
}
}
}

View File

@@ -0,0 +1,25 @@
// 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 http from './api/index'
import YDUI from 'vue-ydui'
import 'vue-ydui/dist/ydui.rem.css'
import config from './config'
Vue.use(YDUI);
Vue.prototype.$config = config
Vue.prototype.$http = http
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,21 @@
import Vue from 'vue'
import Router from 'vue-router'
import IndexComponents from '~/components/index/index'
import AboutComponents from '~/components/about/index'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/index',
name: 'index',
component: IndexComponents
},
{
path: '/about',
name: 'about',
component: AboutComponents
}
]
})