Răsfoiți Sursa

add prod api

ustbhuangyi 7 ani în urmă
părinte
comite
34e9450d57
3 a modificat fișierele cu 11 adăugiri și 5 ștergeri
  1. 5 3
      src/App.vue
  2. 3 1
      src/components/goods/goods.vue
  3. 3 1
      src/components/ratings/ratings.vue

+ 5 - 3
src/App.vue

@@ -19,10 +19,11 @@
 </template>
 
 <script type="text/ecmascript-6">
-  import {urlParse} from 'common/js/util';
+  import { urlParse } from 'common/js/util';
   import header from 'components/header/header.vue';
 
   const ERR_OK = 0;
+  const debug = process.env.NODE_ENV !== 'production';
 
   export default {
     data() {
@@ -36,7 +37,8 @@
       };
     },
     created() {
-      this.$http.get('/api/seller?id=' + this.seller.id).then((response) => {
+      const url = debug ? '/api/seller' : 'http://ustbhuangyi.com/sell/api/seller';
+      this.$http.get(url + '?id=' + this.seller.id).then((response) => {
         response = response.body;
         if (response.errno === ERR_OK) {
           this.seller = Object.assign({}, this.seller, response.data);
@@ -58,7 +60,7 @@
     width: 100%
     height: 40px
     line-height: 40px
-    // border-bottom: 1px solid rgba(7, 17, 27, 0.1)
+  // border-bottom: 1px solid rgba(7, 17, 27, 0.1)
     border-1px(rgba(7, 17, 27, 0.1))
     .tab-item
       flex: 1

+ 3 - 1
src/components/goods/goods.vue

@@ -53,6 +53,7 @@
   import food from 'components/food/food';
 
   const ERR_OK = 0;
+  const debug = process.env.NODE_ENV !== 'production';
 
   export default {
     props: {
@@ -95,7 +96,8 @@
     created() {
       this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee'];
 
-      this.$http.get('/api/goods').then((response) => {
+      const url = debug ? '/api/goods' : 'http://ustbhuangyi.com/sell/api/goods';
+      this.$http.get(url).then((response) => {
         response = response.body;
         if (response.errno === ERR_OK) {
           this.goods = response.data;

+ 3 - 1
src/components/ratings/ratings.vue

@@ -64,6 +64,7 @@
 
   const ALL = 2;
   const ERR_OK = 0;
+  const debug = process.env.NODE_ENV !== 'production';
 
   export default {
     props: {
@@ -79,7 +80,8 @@
       };
     },
     created() {
-      this.$http.get('/api/ratings').then((response) => {
+      const url = debug ? '/api/ratings' : 'http://ustbhuangyi.com/sell/api/ratings';
+      this.$http.get(url).then((response) => {
         response = response.body;
         if (response.errno === ERR_OK) {
           this.ratings = response.data;