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,47 @@
<template>
<div id="app">
<yd-layout>
<v-header :NavbarTitle="TopTitle"/>
<div class="content">
<router-view/>
</div>
<v-footer @fatherEvent="changeName"/>
</yd-layout>
</div>
</template>
<script>
import Header from "./components/public/navbar";
import Tabbar from "./components/public/tabbar";
export default {
data () {
return {
TopTitle: '首页'
}
},
methods: {
changeName (name) {
this.TopTitle = name
}
},
components: {
'v-header': Header,
'v-footer': Tabbar
}
}
</script>
<style>
.content {
margin-top: 56px;
margin-bottom: 61px;
}
.router-link-active {
color: red !important;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,16 @@
<template>
<div class="about">
<h2>关于我</h2>
</div>
</template>
<script>
// nodej语法 model.export
export default {
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,55 @@
<template>
<div class="hello">
<ul>
<li v-for="(item,index) in $store.getters.GET_LIST" :key="index">
{{ item.title }}
</li>
</ul>
<yd-button type="primary">primary</yd-button>
</div>
</template>
<script>
import { mapGetters, mapActions } from "vuex"
export default {
name: 'HelloWorld',
data () {
return {
list: []
}
},
created() {
//this.getData();
//this.$store.commit('SET_LIST')
//this.$store.dispatch('SaveList', { id: 3, title: '45645643' })
this.sList({ id: 3, title: '45645643' })
console.log(this.getList)
},
methods: {
...mapActions({
sList: 'SaveList'
})
// async getData () {
// let list = await this.$http.get({
// url: '/getWeather',
// par: {
// cityname: '合肥'
// }
// });
// this.list = list.result.future;
// }
},
computed: {
...mapGetters({
getList: "GET_LIST"
})
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@@ -0,0 +1,21 @@
<template>
<div class="headers">
<yd-navbar fixed slot="navbar" :title="NavbarTitle">
<router-link to="#" slot="left">
<yd-navbar-back-icon></yd-navbar-back-icon>
</router-link>
</yd-navbar>
</div>
</template>
<script>
export default {
props: {
NavbarTitle: String
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,30 @@
<template>
<div class="footer">
<yd-tabbar fixed slot="tabbar">
<yd-tabbar-item title="首页" link="/" @click.native="changeTitle('首页')">
<yd-icon name="home" slot="icon"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="购物车" link="/about" @click.native="changeTitle('购物车')">
<yd-icon name="shopcart-outline" slot="icon"></yd-icon>
</yd-tabbar-item>
<yd-tabbar-item title="个人中心" link="#" @click.native="changeTitle('个人中心')">
<yd-icon name="ucenter-outline" slot="icon"></yd-icon>
</yd-tabbar-item>
</yd-tabbar>
</div>
</template>
<script>
export default {
methods: {
changeTitle (name) {
this.$emit("fatherEvent", name)
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,46 @@
import axios from 'axios';
axios.defaults.baseURL = 'http://127.0.0.1:3000'
import { Toast, Loading } from 'vue-ydui/dist/lib.rem/dialog'
// 添加请求拦截器 做接口一些验证参数的配置
axios.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
Loading.open('正在请求数据..')
return config
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error);
});
// 添加响应拦截器 一般做接口错误的判断
axios.interceptors.response.use(function (response) {
// 对响应数据做点什么
Loading.close()
if(response.data.resultcode == "200") {
return response;
} else {
Toast({
mes: response.data.reason,
timeout: 1500,
icon: 'error'
})
}
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
export default {
get(params) {
return new Promise((resolve,reject) => {
axios.get(params.url, {
params: params.par
}).then(function (response) {
resolve(response.data)
}).catch(function (error) {
error(error)
})
})
}
}

View File

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

View File

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

View File

@@ -0,0 +1,31 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
list: [
{ id: 1, title: '123456' },
{ id: 2, title: '5678765' }
]
},
getters: {
GET_LIST: state => {
return state.list
}
},
mutations: {
SET_LIST (state, listData) {
state.list.push(listData)
}
},
actions: {
SaveList (context, list) {
context.commit('SET_LIST', list)
}
}
});
export default store;