diff --git a/public/index.html b/public/index.html
index 2d048bc..e61292d 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,9 +5,13 @@
-
user-demo
+ 在线商城
+
We're sorry but user-demo doesn't work properly without JavaScript enabled. Please enable it to continue.
diff --git a/src/App.vue b/src/App.vue
index 9d44285..ae860bc 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -7,6 +7,7 @@
diff --git a/src/components/PageLoading.vue b/src/components/PageLoading.vue
new file mode 100644
index 0000000..bcf4971
--- /dev/null
+++ b/src/components/PageLoading.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/http.js b/src/components/http.js
index 4b5f7a7..d6d30c2 100644
--- a/src/components/http.js
+++ b/src/components/http.js
@@ -1,7 +1,7 @@
import qs from 'qs';
// import { async } from 'q';
-const baseUri = "http://127.0.0.1:8080/api";
+const baseUri = "http://127.0.0.1:8000";
const processResponse = (promise) => {
return new Promise((resolve, reject) => {
promise.then(ret => {
@@ -17,18 +17,39 @@ const processResponse = (promise) => {
})
})
}
+
class Api {
constructor(baseUri) {
this.baseUri = baseUri;
}
+
$getUrl(url) {
return this.baseUri + url;
}
- async get(url) {
+
+ buildToken(data) {
+ if(!data) data= {};
+ if (!data['token']) {
+ let token = localStorage.getItem('gg_user_token');
+ if (token) {
+ data['token'] = token;
+ }
+ }
+ return data;
+ }
+
+ async get(url, data = null) {
+ data = this.buildToken(data)
+ if (data) {
+ url += url.indexOf('?') == -1 ? '?' : '&'
+ url += qs.stringify(data);
+ }
const resp = await fetch(this.$getUrl(url));
return processResponse(resp.json());
}
+
async post(url, data) {
+ data = this.buildToken(data)
const resp = await fetch(this.$getUrl(url), {
body: qs.stringify(data),
method: 'post',
@@ -39,8 +60,9 @@ class Api {
return processResponse(resp.json());
}
}
+
const http = new Api(baseUri);
export default {
http,
- shop:new Api('https://fj-server.os.wm-app.xyz/shop/api')
-};
\ No newline at end of file
+ shop: new Api(baseUri)
+};
diff --git a/src/main.js b/src/main.js
index 7a9efca..8b8e768 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,13 +5,28 @@ import router from './router'
import Vant from 'vant';
import 'vant/lib/index.css';
import './style.less';
-import { Lazyload } from 'vant';
+import {Lazyload} from 'vant';
Vue.config.productionTip = false
Vue.use(Vant);
Vue.use(Lazyload);
-
+Vue.filter('nft', function (value) {
+ if (!value) return '';
+ value = parseInt(value);
+ if (value >= 10000) {
+ value = (value / 10000).toFixed(2).toString();
+ let di = value.lastIndexOf('.'),
+ f = value.substr(di + 1);
+ value = value.substr(0, di);
+ if (parseInt(f) != 0) {
+ value += '.' + f.replace(/0+$/g,'');
+ }
+ return value + '万';
+ }
+ return value;
+ // return value.toString().replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,');
+})
new Vue({
- router,
- render: h => h(App)
+ router,
+ render: h => h(App)
}).$mount('#app')
diff --git a/src/router.js b/src/router.js
index b824a99..4215632 100644
--- a/src/router.js
+++ b/src/router.js
@@ -30,8 +30,8 @@ const router = new Router({
},
{
path: '/my',
- name: 'Orders',
- component: () => import( /* webpackChunkName: "Orders" */ './views/Orders.vue')
+ name: 'UserIndex',
+ component: () => import( /* webpackChunkName: "UserIndex" */ './views/UserIndex.vue')
}
]
},
@@ -63,4 +63,4 @@ router.beforeEach((to, from, next) => {
next();
});
-export default router;
\ No newline at end of file
+export default router;
diff --git a/src/style.less b/src/style.less
index 4b73851..c2dd021 100644
--- a/src/style.less
+++ b/src/style.less
@@ -1,3 +1,33 @@
+body,p,input,text,a{
+ text-decoration: none;
+ color:#333;
+}
.text-center{
text-align:center;
-}
\ No newline at end of file
+}
+.text-left{
+ text-align:left;
+}
+.text-right{
+ text-align:right;
+}
+
+.content-v-center{
+ height: 100vh;
+ align-items: center;
+ display: flex;
+}
+
+.float-left{
+ float:left;
+}
+.float-right{
+ float: right;
+}
+.row{
+ &:after{
+ content:' ';
+ display: block;
+ clear: both;
+ }
+}
diff --git a/src/views/Cart.vue b/src/views/Cart.vue
index ae4a122..e5eb3c6 100644
--- a/src/views/Cart.vue
+++ b/src/views/Cart.vue
@@ -1,44 +1,66 @@
-
-
-
-
-
- {{item.title}}
-
-
-
-
-
-
-
-
- -
-
- {{item.count}}
- +
-
-
-
-
-
-
- 全选
-
+
+
+
+
+
+
+ {{item.title}}
+
+
+
+
+
+
+
+
+ ¥
+ {{ item.sell_price | int }}
+ {{ item.sell_price | dec }}
+
+
+
+ -
+
+
+ +
+
+
+
+
+
+
+
+ 全选
+
+
+
+
+ 登录
+
+
+
-
\ No newline at end of file
+
diff --git a/src/views/GoodsList.vue b/src/views/GoodsList.vue
index 3588cb3..5e8239e 100644
--- a/src/views/GoodsList.vue
+++ b/src/views/GoodsList.vue
@@ -1,14 +1,16 @@
+
+
¥{{g.sell_price}}
-
{{g.sell_count}} 人已经付款购买
+
{{g.sell_count | nft}} 人已经付款购买
+
+
+
+