From 0bd81688e70cfa47108fdccf3f9a0f1510f029dc Mon Sep 17 00:00:00 2001
From: "Adam.Gong" <admin@xiuyetang.com>
Date: Mon, 11 May 2020 23:34:15 +0800
Subject: [PATCH] auto commit the code by alias command

---
 mock/prod.js | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100644 mock/prod.js

diff --git a/mock/prod.js b/mock/prod.js
new file mode 100644
index 0000000..7e98179
--- /dev/null
+++ b/mock/prod.js
@@ -0,0 +1,135 @@
+import Mock from 'mockjs'
+// import logoPath from "~@/assets/img/yp_logo.jpeg"
+
+const List = []
+const count = 20
+
+const baseContent = '<p>I am testing data, I am testing data.</p><p></p>'
+// const image_uri = logoPath
+const image_uri = 'https://wpimg.wallstcn.com/360e4842-4db5-42d0-b078-f9a84a825546.gif'
+
+for (let i = 0; i < count; i++) {
+  List.push(Mock.mock({
+    pid: '@increment',
+    pname: '@title(5,10)',
+    timestamp: +Mock.Random.date('T'),
+    shoper: '@first', //所属工厂
+    salescount: '@first', //购买次数
+    importance: '@integer(1, 3)', //排序权重
+    prod_info_weight: '@integer(1, 3)', //重量
+    prod_info_leg_long: '@integer(1, 3)', //腿长
+    prod_info_glass_width: '@integer(1, 3)', //镜宽
+    prod_info_glass_height: '@integer(1, 3)', //镜高
+    prod_info_frame_width: '@integer(1, 3)', //框宽
+    prod_info_frame_height: '@integer(1, 3)', //框高
+    prod_info_norse_width: '@integer(1, 3)', //鼻宽
+    prod_info_window_pic: [], //鼻宽
+    image_uri: image_uri
+  }))
+}
+
+export default [{
+    url: '/yp/prod/list',
+    type: 'post',
+    response: config => {
+      const {
+        importance,
+        type,
+        title,
+        page = 1,
+        limit = 20,
+        sort
+      } = config.query
+
+      let mockList = List.filter(item => {
+        if (importance && item.importance !== +importance) return false
+        if (type && item.type !== type) return false
+        if (title && item.title.indexOf(title) < 0) return false
+        return true
+      })
+
+      if (sort === '-id') {
+        mockList = mockList.reverse()
+      }
+
+      const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
+
+      return {
+        code: 20000,
+        data: {
+          total: mockList.length,
+          items: pageList
+        }
+      }
+    }
+  },
+
+  {
+    url: '/yp/prod/detail',
+    type: 'get',
+    response: config => {
+      const {
+        id
+      } = config.query
+      for (const prod of List) {
+        if (prod.id === +id) {
+          return {
+            code: 20000,
+            data: prod
+          }
+        }
+      }
+    }
+  },
+
+  {
+    url: '/yp/prod/pv',
+    type: 'get',
+    response: _ => {
+      return {
+        code: 20000,
+        data: {
+          pvData: [{
+              key: 'PC',
+              pv: 1024
+            },
+            {
+              key: 'mobile',
+              pv: 1024
+            },
+            {
+              key: 'ios',
+              pv: 1024
+            },
+            {
+              key: 'android',
+              pv: 1024
+            }
+          ]
+        }
+      }
+    }
+  },
+
+  {
+    url: '/yp/prod/create',
+    type: 'post',
+    response: _ => {
+      return {
+        code: 20000,
+        data: 'success'
+      }
+    }
+  },
+
+  {
+    url: '/yp/prod/update',
+    type: 'post',
+    response: _ => {
+      return {
+        code: 20000,
+        data: 'success'
+      }
+    }
+  }
+]
-- 
2.0.0