Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samuel #20

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# e-commerce
# e-commerce

### deploy API : https://ecommerce-zega.herokuapp.com

### deploy client for user : http://ecommerce-zega-client.s3-website-ap-southeast-1.amazonaws.com/

### deploy client for admin : http://ecommerce-zega-server.s3-website-ap-southeast-1.amazonaws.com/
2 changes: 2 additions & 0 deletions admin/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 1%
last 2 versions
21 changes: 21 additions & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
19 changes: 19 additions & 0 deletions admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# admin

## 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/).
5 changes: 5 additions & 0 deletions admin/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
11,789 changes: 11,789 additions & 0 deletions admin/package-lock.json

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions admin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "admin",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.19.2",
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.5.0",
"core-js": "^3.6.4",
"element-ui": "^2.13.0",
"vue": "^2.6.11",
"vue-moment": "^4.1.0",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.2.0",
"@vue/cli-plugin-router": "~4.2.0",
"@vue/cli-plugin-vuex": "~4.2.0",
"@vue/cli-service": "~4.2.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
},
"_id": "[email protected]",
"readme": "ERROR: No README data found!"
}
Binary file added admin/public/favicon.ico
Binary file not shown.
26 changes: 26 additions & 0 deletions admin/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<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>
<meta
name="google-signin-client_id"
content="1059223375909-g54juk1tju593npg9ai4n4cpp1030euh.apps.googleusercontent.com"
/>
<script src="https://apis.google.com/js/platform.js" async defer></script>
</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>
33 changes: 33 additions & 0 deletions admin/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link>|
<router-link to="/product">Product</router-link>|
<router-link to="/transaction">Transaction</router-link>
</div>
<router-view />
</div>
</template>

<style lang="scss">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}

#nav {
padding: 30px;

a {
font-weight: bold;
color: #2c3e50;

&.router-link-exact-active {
color: #42b983;
}
}
}
</style>
Binary file added admin/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions admin/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>

<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
20 changes: 20 additions & 0 deletions admin/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Vue.use(require('vue-moment'))
Vue.use(ElementUI)
Vue.use(BootstrapVue)
Vue.use(IconsPlugin)
Vue.config.productionTip = false

new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
39 changes: 39 additions & 0 deletions admin/src/router/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/product',
name: 'Product',
component: () =>
import(/* webpackChunkName: "about" */ '../views/About.vue')
},
{
path: '/registerlogin',
name: 'registerLogin',
component: () =>
import(/* webpackChunkName: "about" */ '../views/RegisterLogin.vue')
},
{
path: '/transaction',
name: 'transaction',
component: () =>
import(/* webpackChunkName: "about" */ '../views/Transaction.vue')
}
]

const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})

export default router
13 changes: 13 additions & 0 deletions admin/src/store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
state: {
baseUrl: 'https://ecommerce-zega.herokuapp.com'
},
mutations: {},
actions: {},
modules: {}
})
82 changes: 82 additions & 0 deletions admin/src/views/About.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<template>
<el-table
v-if="tableData"
:data="tableData"
style="width: 100%"
max-height="400"
>
<el-table-column fixed prop="category" label="Category" width="150">
</el-table-column>
<el-table-column prop="name" label="Name" width="200"> </el-table-column>
<el-table-column prop="price" label="Price" width="200"> </el-table-column>
<el-table-column prop="stock" label="Stock" width="200"> </el-table-column>
<el-table-column prop="imageUrl" label="image Url" width="300">
<template slot-scope="scope">
<a :href="tableData[scope.$index].imageUrl" target="_blank">
Image
</a>
</template>
</el-table-column>
<el-table-column label="createdAt" width="200">
<template slot-scope="scope">
<span>{{
tableData[scope.$index].createdAt.toString()
| moment('dddd, MMMM Do YYYY')
}}</span>
</template>
</el-table-column>
<el-table-column label="Operations" width="200">
<template slot-scope="scope">
<el-button
@click.native.prevent="deleteRow(scope.$index, tableData)"
type="text"
size="small"
>
Remove
</el-button>
<el-button @click="handleClick" type="text" size="small"
>Detail</el-button
>
<el-button type="text" size="small">Edit</el-button>
</template>
</el-table-column>
</el-table>
</template>

<script>
import axios from 'axios'
export default {
methods: {
deleteRow(index, rows) {
// rows.splice(index, 1)
console.log(index, rows)
},
handleClick() {
console.log('click')
}
},
data() {
return {
tableData: null
}
},
created() {
if (!localStorage['e_musicToken_admin']) {
this.$router.push({
path: '/registerlogin'
})
}
axios({
method: 'get',
url: `${this.$store.state.baseUrl}/malls`
})
.then(({ data }) => {
console.log(data)
this.tableData = data
})
.catch(err => {
console.log(err)
})
}
}
</script>
Loading