From fa9ffa66e33b54e40a8a993df74cf50929945f5b Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 19 Apr 2021 16:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=97=E9=93=BA=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/shop.ts | 37 ++++++ src/api/types.d.ts | 6 + src/icons/components/index.ts | 1 + src/icons/components/shop_list.ts | 12 ++ src/icons/svg/shop_list.svg | 1 + src/lang/en.ts | 3 + src/lang/zh.ts | 3 + src/router/modules/shop.ts | 31 +++++ src/utils/index.ts | 2 +- src/views/shop/edit.vue | 210 ++++++++++++++++++++++++++++++ src/views/shop/list.vue | 155 ++++++++++++++++++++++ 11 files changed, 460 insertions(+), 1 deletion(-) create mode 100644 src/api/shop.ts create mode 100644 src/icons/components/shop_list.ts create mode 100644 src/icons/svg/shop_list.svg create mode 100644 src/views/shop/edit.vue create mode 100644 src/views/shop/list.vue diff --git a/src/api/shop.ts b/src/api/shop.ts new file mode 100644 index 0000000..5033a70 --- /dev/null +++ b/src/api/shop.ts @@ -0,0 +1,37 @@ +import request from '@/utils/request' +import { IShopData } from './types' + +export const defaultShopData: IShopData = { + name: '', + id: '' + +} + +export const getShops = (params: any) => + request({ + url: '/shops', + method: 'post', + params + }) + +export const getShop = (id: string, params: any) => + request({ + url: `/shop/${id}`, + method: 'get', + params + }) + + +export const saveShop = (data: any) => + request({ + url: `/shop/save`, + method: 'post', + data + }) + +export const deleteShop = (id: string) => + request({ + url: `/shop/${id}/delete`, + method: 'post' + }) + diff --git a/src/api/types.d.ts b/src/api/types.d.ts index 04b8bca..04a6a68 100644 --- a/src/api/types.d.ts +++ b/src/api/types.d.ts @@ -40,3 +40,9 @@ export interface IQuestionData { stars: number, status: number, } + +export interface IShopData { + id: string, + name: string, + createdAt?: Date +} diff --git a/src/icons/components/index.ts b/src/icons/components/index.ts index 9719b02..90073f7 100644 --- a/src/icons/components/index.ts +++ b/src/icons/components/index.ts @@ -42,6 +42,7 @@ import './question_list' import './role' import './search' import './sell' +import './shop_list' import './shop' import './shopping' import './size' diff --git a/src/icons/components/shop_list.ts b/src/icons/components/shop_list.ts new file mode 100644 index 0000000..b44733e --- /dev/null +++ b/src/icons/components/shop_list.ts @@ -0,0 +1,12 @@ +/* eslint-disable */ +/* tslint:disable */ +// @ts-ignore +import icon from 'vue-svgicon' +icon.register({ + 'shop_list': { + width: 64, + height: 64, + viewBox: '0 0 1024 1024', + data: '' + } +}) diff --git a/src/icons/svg/shop_list.svg b/src/icons/svg/shop_list.svg new file mode 100644 index 0000000..41bf924 --- /dev/null +++ b/src/icons/svg/shop_list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lang/en.ts b/src/lang/en.ts index 7bdff4f..01ea204 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -75,6 +75,9 @@ export default { question_prepare: 'Question Edit', createQuestion: 'Create Question', shop: 'Shop Setting', + shop_list: 'Shop List', + create_shop: 'Create Shop', + shop_edit: 'Shop Editor', game_setting: 'Game Setting' }, navbar: { diff --git a/src/lang/zh.ts b/src/lang/zh.ts index ccdbc3e..53e98bc 100644 --- a/src/lang/zh.ts +++ b/src/lang/zh.ts @@ -75,6 +75,9 @@ export default { question_prepare: '题目编辑', createQuestion: '创建题目', shop: '店铺设置', + shop_list: '店铺列表', + create_shop: '创建店铺', + shop_edit: '编辑店铺', game_setting: '游戏设置' }, navbar: { diff --git a/src/router/modules/shop.ts b/src/router/modules/shop.ts index f2bc33a..e9d2369 100644 --- a/src/router/modules/shop.ts +++ b/src/router/modules/shop.ts @@ -10,6 +10,37 @@ const shopRoutes: RouteConfig = { alwaysShow: true }, children: [ + { + path: 'list', + component: () => import('@/views/shop/list.vue'), + name: 'ShopList', + meta: { + title: 'shop_list', + permissions: ['shop:read'], + icon: 'shop_list' + } + }, + { + path: 'create', + component: () => import('@/views/shop/edit.vue'), + name: 'CreateShop', + meta: { + title: 'create_shop', + icon: 'edit', + hidden: true + } + }, + { + path: 'edit/:id', + component: () => import('@/views/shop/edit.vue'), + name: 'ShopEditor', + meta: { + title: 'shop_edit', + permissions: ['shop:read'], + elicon: 'el-icon-arrow-right', + hidden: true + } + }, { path: 'setting', component: () => import('@/views/shop/game_setting.vue'), diff --git a/src/utils/index.ts b/src/utils/index.ts index ae52252..760855d 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -18,7 +18,7 @@ export const parseTime = ( } else { // support safari // https://stackoverflow.com/questions/4310953/invalid-date-in-safari - time = time.replace(new RegExp(/-/gm), '/') + // time = time.replace(new RegExp(/-/gm), '/') } } if (typeof time === 'number' && time.toString().length === 10) { diff --git a/src/views/shop/edit.vue b/src/views/shop/edit.vue new file mode 100644 index 0000000..3e880a3 --- /dev/null +++ b/src/views/shop/edit.vue @@ -0,0 +1,210 @@ + + + + + + diff --git a/src/views/shop/list.vue b/src/views/shop/list.vue new file mode 100644 index 0000000..835fccf --- /dev/null +++ b/src/views/shop/list.vue @@ -0,0 +1,155 @@ + + + + +