GivenSir 4 rokov pred
rodič
commit
4ed526a9d7

+ 1 - 0
.env.development

@@ -4,3 +4,4 @@ ENV = 'development'
 # base api
 VUE_APP_BASE_API = ''
 VUE_APP_BASE_URL = 'http://devapi.youxi9.com/'
+VUE_APP_IMG_URL = 'https://cdn.youxi9.com/'

+ 3 - 2
.env.production

@@ -2,5 +2,6 @@
 ENV = 'production'
 
 # base api
-VUE_APP_BASE_API = '/prod-api'
-
+VUE_APP_BASE_API = ''
+VUE_APP_BASE_URL = 'http://devapi.youxi9.com/'
+VUE_APP_IMG_URL = 'https://cdn.youxi9.com/'

+ 62 - 17
mock/common.js

@@ -1,31 +1,76 @@
 
 module.exports = [
+  // 游戏平台
   {
-    url: '/v1/recharge/player/type',
+    url: '/v1/recharge/channel/platform',
+    type: 'get',
+    response: config => {
+      return {
+        code: 200,
+        status: true,
+        data: {
+          data: [
+            {
+              'pid': 'd65aa6d7614589bffe62456b88e98811',
+              'platform': 'MM',
+              'disRate': 9.8,
+              'rate': 9.7,
+              'type': 0,
+              'length': 2
+            }
+          ]
+        },
+        message: '成功'
+      }
+    }
+  },
+  // 渠道余额
+  {
+    url: '/v1/getMainChannelMoney',
     type: 'post',
     response: config => {
-      if (Math.round(Math.random() * 2) < 1) {
-        return {
-          code: 200,
-          status: true,
-          data: [],
-          message: '成功'
-        }
-      } else {
-        return {
-          code: 200,
-          status: false,
-          data: [],
-          message: '失败'
-        }
+      return {
+        code: 200,
+        status: true,
+        data: {
+          data: 8816
+        },
+        message: '成功'
       }
     }
   },
+  // 渠道账号
   {
-    url: '/v1/recharge/player',
+    url: '/v1/recharge/channel/platform',
+    type: 'get',
+    response: config => {
+      return {
+        code: 200,
+        status: true,
+        data: {
+          data: [
+            {
+              'cid': 18150,
+              'title': null,
+              'account': 'MM17696178'
+            },
+            {
+              'cid': 18368,
+              'title': '',
+              'account': 'MM14590945'
+            }
+          ]
+        },
+        message: '成功'
+      }
+    }
+  },
+  // 查询充值账号是否正常
+  {
+    url: '/v1/recharge/player/type',
     type: 'post',
     response: config => {
-      if (Math.round(Math.random() * 2) > 1) {
+      if (Math.round(Math.random() * 2) < 1) {
         return {
           code: 200,
           status: true,

+ 1 - 0
mock/index.js

@@ -15,6 +15,7 @@ const mocks = [
   ...search
 ]
 
+console.log('# 注意使用了 mock .')
 // for front mock
 // please use it cautiously, it will redefine XMLHttpRequest,
 // which will cause many of your third-party libraries to be invalidated(like progress event).

+ 1 - 1
mock/user.js

@@ -33,7 +33,7 @@ module.exports = [
         code: 200,
         status: true,
         data: [],
-        message: '成功'
+        message: '成功~'
       }
     }
   },

+ 39 - 3
src/api/common.js

@@ -9,19 +9,55 @@ export function getSmsCode(data) {
   })
 }
 
+// 游戏平台
+export function rechargeChannelPlatform(data) {
+  return request({
+    url: '/v1/recharge/channel/platform',
+    method: 'get',
+    data
+  })
+}
+
+// 渠道余额
+export function getMainChannelMoney(data) {
+  return request({
+    url: '/v1/getMainChannelMoney',
+    method: 'post',
+    data
+  })
+}
+
+// 渠道账号
+export function rechargeChannelPlatformAccount(id) {
+  return request({
+    url: `/v1/recharge/channel/platform/${id}`,
+    // url: '/v1/recharge/channel/platform-s',
+    method: 'get'
+  })
+}
+
+// 游戏列表
+export function rechargeGame(data) {
+  return request({
+    url: '/v1/recharge/game',
+    method: 'get',
+    params: data
+  })
+}
+
 // 查询充值账号是否正常
 export function rechargePlayerType(data) {
   return request({
-    url: 'v1/recharge/player/type',
+    url: '/v1/recharge/player/type',
     method: 'post',
-    data
+    params: data
   })
 }
 
 // 进行充值
 export function rechargePlayer(data) {
   return request({
-    url: 'v1/recharge/player',
+    url: '/v1/recharge/player',
     method: 'post',
     data
   })

+ 7 - 0
src/api/user.js

@@ -21,3 +21,10 @@ export function getInfo() {
     method: 'get'
   })
 }
+
+export function getRoutes() {
+  return request({
+    url: '/v1/personal/user/info',
+    method: 'get'
+  })
+}

+ 1 - 0
src/permission.js

@@ -35,6 +35,7 @@ router.beforeEach(async(to, from, next) => {
           // get user info
           // note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
           const { roles } = await store.dispatch('user/getInfo')
+          console.error('# permission:', roles)
 
           // generate accessible routes map based on roles
           const accessRoutes = await store.dispatch('permission/generateRoutes', roles)

+ 15 - 326
src/router/index.js

@@ -6,12 +6,6 @@ Vue.use(Router)
 /* Layout */
 import Layout from '@/layout'
 
-/* Router Modules */
-import componentsRouter from './modules/components'
-import chartsRouter from './modules/charts'
-import tableRouter from './modules/table'
-import nestedRouter from './modules/nested'
-
 /**
  * Note: sub-menu only appear when route children.length >= 1
  * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@@ -70,70 +64,31 @@ export const constantRoutes = [
     component: () => import('@/views/error-page/401'),
     hidden: true
   },
+  // {
+  //   path: '/dashboard',
+  //   component: Layout,
+  //   redirect: '/dashboard',
+  //   children: [
+  //     {
+  //       path: 'dashboard',
+  //       component: () => import('@/views/dashboard/index'),
+  //       name: '首页',
+  //       meta: { title: '首页', icon: 'dashboard', affix: true }
+  //     }
+  //   ]
+  // },
   {
     path: '/',
     component: Layout,
-    redirect: '/dashboard',
-    children: [
-      {
-        path: 'dashboard',
-        component: () => import('@/views/dashboard/index'),
-        name: 'Dashboard',
-        meta: { title: 'dashboard', icon: 'dashboard', affix: true }
-      }
-    ]
-  },
-  {
-    path: '/recharge',
-    component: Layout,
-    redirect: '/recharge/index',
+    redirect: '/recharge',
     children: [
       {
-        path: 'index',
+        path: 'recharge',
         component: () => import('@/views/recharge/index'),
         name: '充值',
         meta: { title: '充值', icon: 'shopping', noCache: true }
       }
     ]
-  },
-  {
-    path: '/documentation',
-    component: Layout,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/documentation/index'),
-        name: 'Documentation',
-        meta: { title: 'documentation', icon: 'documentation', affix: true }
-      }
-    ]
-  },
-  {
-    path: '/guide',
-    component: Layout,
-    redirect: '/guide/index',
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/guide/index'),
-        name: 'Guide',
-        meta: { title: 'guide', icon: 'guide', noCache: true }
-      }
-    ]
-  },
-  {
-    path: '/profile',
-    component: Layout,
-    redirect: '/profile/index',
-    hidden: true,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/profile/index'),
-        name: 'Profile',
-        meta: { title: 'profile', icon: 'user', noCache: true }
-      }
-    ]
   }
 ]
 
@@ -142,272 +97,6 @@ export const constantRoutes = [
  * the routes that need to be dynamically loaded based on user roles
  */
 export const asyncRoutes = [
-  {
-    path: '/permission',
-    component: Layout,
-    redirect: '/permission/page',
-    alwaysShow: true, // will always show the root menu
-    name: 'Permission',
-    meta: {
-      title: 'permission',
-      icon: 'lock',
-      roles: ['admin', 'editor'] // you can set roles in root nav
-    },
-    children: [
-      {
-        path: 'page',
-        component: () => import('@/views/permission/page'),
-        name: 'PagePermission',
-        meta: {
-          title: 'pagePermission',
-          roles: ['admin'] // or you can only set roles in sub nav
-        }
-      },
-      {
-        path: 'directive',
-        component: () => import('@/views/permission/directive'),
-        name: 'DirectivePermission',
-        meta: {
-          title: 'directivePermission'
-          // if do not set roles, means: this page does not require permission
-        }
-      },
-      {
-        path: 'role',
-        component: () => import('@/views/permission/role'),
-        name: 'RolePermission',
-        meta: {
-          title: 'rolePermission',
-          roles: ['admin']
-        }
-      }
-    ]
-  },
-
-  {
-    path: '/icon',
-    component: Layout,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/icons/index'),
-        name: 'Icons',
-        meta: { title: 'icons', icon: 'icon', noCache: true }
-      }
-    ]
-  },
-
-  /** when your routing map is too long, you can split it into small modules **/
-  componentsRouter,
-  chartsRouter,
-  nestedRouter,
-  tableRouter,
-
-  {
-    path: '/example',
-    component: Layout,
-    redirect: '/example/list',
-    name: 'Example',
-    meta: {
-      title: 'example',
-      icon: 'el-icon-s-help'
-    },
-    children: [
-      {
-        path: 'create',
-        component: () => import('@/views/example/create'),
-        name: 'CreateArticle',
-        meta: { title: 'createArticle', icon: 'edit' }
-      },
-      {
-        path: 'edit/:id(\\d+)',
-        component: () => import('@/views/example/edit'),
-        name: 'EditArticle',
-        meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' },
-        hidden: true
-      },
-      {
-        path: 'list',
-        component: () => import('@/views/example/list'),
-        name: 'ArticleList',
-        meta: { title: 'articleList', icon: 'list' }
-      }
-    ]
-  },
-
-  {
-    path: '/tab',
-    component: Layout,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/tab/index'),
-        name: 'Tab',
-        meta: { title: 'tab', icon: 'tab' }
-      }
-    ]
-  },
-
-  {
-    path: '/error',
-    component: Layout,
-    redirect: 'noRedirect',
-    name: 'ErrorPages',
-    meta: {
-      title: 'errorPages',
-      icon: '404'
-    },
-    children: [
-      {
-        path: '401',
-        component: () => import('@/views/error-page/401'),
-        name: 'Page401',
-        meta: { title: 'page401', noCache: true }
-      },
-      {
-        path: '404',
-        component: () => import('@/views/error-page/404'),
-        name: 'Page404',
-        meta: { title: 'page404', noCache: true }
-      }
-    ]
-  },
-
-  {
-    path: '/error-log',
-    component: Layout,
-    children: [
-      {
-        path: 'log',
-        component: () => import('@/views/error-log/index'),
-        name: 'ErrorLog',
-        meta: { title: 'errorLog', icon: 'bug' }
-      }
-    ]
-  },
-
-  {
-    path: '/excel',
-    component: Layout,
-    redirect: '/excel/export-excel',
-    name: 'Excel',
-    meta: {
-      title: 'excel',
-      icon: 'excel'
-    },
-    children: [
-      {
-        path: 'export-excel',
-        component: () => import('@/views/excel/export-excel'),
-        name: 'ExportExcel',
-        meta: { title: 'exportExcel' }
-      },
-      {
-        path: 'export-selected-excel',
-        component: () => import('@/views/excel/select-excel'),
-        name: 'SelectExcel',
-        meta: { title: 'selectExcel' }
-      },
-      {
-        path: 'export-merge-header',
-        component: () => import('@/views/excel/merge-header'),
-        name: 'MergeHeader',
-        meta: { title: 'mergeHeader' }
-      },
-      {
-        path: 'upload-excel',
-        component: () => import('@/views/excel/upload-excel'),
-        name: 'UploadExcel',
-        meta: { title: 'uploadExcel' }
-      }
-    ]
-  },
-
-  {
-    path: '/zip',
-    component: Layout,
-    redirect: '/zip/download',
-    alwaysShow: true,
-    name: 'Zip',
-    meta: { title: 'zip', icon: 'zip' },
-    children: [
-      {
-        path: 'download',
-        component: () => import('@/views/zip/index'),
-        name: 'ExportZip',
-        meta: { title: 'exportZip' }
-      }
-    ]
-  },
-
-  {
-    path: '/pdf',
-    component: Layout,
-    redirect: '/pdf/index',
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/pdf/index'),
-        name: 'PDF',
-        meta: { title: 'pdf', icon: 'pdf' }
-      }
-    ]
-  },
-  {
-    path: '/pdf/download',
-    component: () => import('@/views/pdf/download'),
-    hidden: true
-  },
-
-  {
-    path: '/theme',
-    component: Layout,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/theme/index'),
-        name: 'Theme',
-        meta: { title: 'theme', icon: 'theme' }
-      }
-    ]
-  },
-
-  {
-    path: '/clipboard',
-    component: Layout,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/clipboard/index'),
-        name: 'ClipboardDemo',
-        meta: { title: 'clipboardDemo', icon: 'clipboard' }
-      }
-    ]
-  },
-
-  {
-    path: '/i18n',
-    component: Layout,
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/i18n-demo/index'),
-        name: 'I18n',
-        meta: { title: 'i18n', icon: 'international' }
-      }
-    ]
-  },
-
-  {
-    path: 'external-link',
-    component: Layout,
-    children: [
-      {
-        path: 'https://github.com/PanJiaChen/vue-element-admin',
-        meta: { title: 'externalLink', icon: 'link' }
-      }
-    ]
-  },
 
   // 404 page must be placed at the end !!!
   { path: '*', redirect: '/404', hidden: true }

+ 0 - 36
src/router/modules/charts.js

@@ -1,36 +0,0 @@
-/** When your routing table is too long, you can split it into small modules**/
-
-import Layout from '@/layout'
-
-const chartsRouter = {
-  path: '/charts',
-  component: Layout,
-  redirect: 'noRedirect',
-  name: 'Charts',
-  meta: {
-    title: 'charts',
-    icon: 'chart'
-  },
-  children: [
-    {
-      path: 'keyboard',
-      component: () => import('@/views/charts/keyboard'),
-      name: 'KeyboardChart',
-      meta: { title: 'keyboardChart', noCache: true }
-    },
-    {
-      path: 'line',
-      component: () => import('@/views/charts/line'),
-      name: 'LineChart',
-      meta: { title: 'lineChart', noCache: true }
-    },
-    {
-      path: 'mix-chart',
-      component: () => import('@/views/charts/mix-chart'),
-      name: 'MixChart',
-      meta: { title: 'mixChart', noCache: true }
-    }
-  ]
-}
-
-export default chartsRouter

+ 0 - 102
src/router/modules/components.js

@@ -1,102 +0,0 @@
-/** When your routing table is too long, you can split it into small modules **/
-
-import Layout from '@/layout'
-
-const componentsRouter = {
-  path: '/components',
-  component: Layout,
-  redirect: 'noRedirect',
-  name: 'ComponentDemo',
-  meta: {
-    title: 'components',
-    icon: 'component'
-  },
-  children: [
-    {
-      path: 'tinymce',
-      component: () => import('@/views/components-demo/tinymce'),
-      name: 'TinymceDemo',
-      meta: { title: 'tinymce' }
-    },
-    {
-      path: 'markdown',
-      component: () => import('@/views/components-demo/markdown'),
-      name: 'MarkdownDemo',
-      meta: { title: 'markdown' }
-    },
-    {
-      path: 'json-editor',
-      component: () => import('@/views/components-demo/json-editor'),
-      name: 'JsonEditorDemo',
-      meta: { title: 'jsonEditor' }
-    },
-    {
-      path: 'split-pane',
-      component: () => import('@/views/components-demo/split-pane'),
-      name: 'SplitpaneDemo',
-      meta: { title: 'splitPane' }
-    },
-    {
-      path: 'avatar-upload',
-      component: () => import('@/views/components-demo/avatar-upload'),
-      name: 'AvatarUploadDemo',
-      meta: { title: 'avatarUpload' }
-    },
-    {
-      path: 'dropzone',
-      component: () => import('@/views/components-demo/dropzone'),
-      name: 'DropzoneDemo',
-      meta: { title: 'dropzone' }
-    },
-    {
-      path: 'sticky',
-      component: () => import('@/views/components-demo/sticky'),
-      name: 'StickyDemo',
-      meta: { title: 'sticky' }
-    },
-    {
-      path: 'count-to',
-      component: () => import('@/views/components-demo/count-to'),
-      name: 'CountToDemo',
-      meta: { title: 'countTo' }
-    },
-    {
-      path: 'mixin',
-      component: () => import('@/views/components-demo/mixin'),
-      name: 'ComponentMixinDemo',
-      meta: { title: 'componentMixin' }
-    },
-    {
-      path: 'back-to-top',
-      component: () => import('@/views/components-demo/back-to-top'),
-      name: 'BackToTopDemo',
-      meta: { title: 'backToTop' }
-    },
-    {
-      path: 'drag-dialog',
-      component: () => import('@/views/components-demo/drag-dialog'),
-      name: 'DragDialogDemo',
-      meta: { title: 'dragDialog' }
-    },
-    {
-      path: 'drag-select',
-      component: () => import('@/views/components-demo/drag-select'),
-      name: 'DragSelectDemo',
-      meta: { title: 'dragSelect' }
-    },
-    {
-      path: 'dnd-list',
-      component: () => import('@/views/components-demo/dnd-list'),
-      name: 'DndListDemo',
-      meta: { title: 'dndList' }
-    },
-    {
-      path: 'drag-kanban',
-      component: () => import('@/views/components-demo/drag-kanban'),
-      name: 'DragKanbanDemo',
-      meta: { title: 'dragKanban' }
-    }
-  ]
-}
-
-export default componentsRouter

+ 0 - 66
src/router/modules/nested.js

@@ -1,66 +0,0 @@
-/** When your routing table is too long, you can split it into small modules **/
-
-import Layout from '@/layout'
-
-const nestedRouter = {
-  path: '/nested',
-  component: Layout,
-  redirect: '/nested/menu1/menu1-1',
-  name: 'Nested',
-  meta: {
-    title: 'nested',
-    icon: 'nested'
-  },
-  children: [
-    {
-      path: 'menu1',
-      component: () => import('@/views/nested/menu1/index'), // Parent router-view
-      name: 'Menu1',
-      meta: { title: 'menu1' },
-      redirect: '/nested/menu1/menu1-1',
-      children: [
-        {
-          path: 'menu1-1',
-          component: () => import('@/views/nested/menu1/menu1-1'),
-          name: 'Menu1-1',
-          meta: { title: 'menu1-1' }
-        },
-        {
-          path: 'menu1-2',
-          component: () => import('@/views/nested/menu1/menu1-2'),
-          name: 'Menu1-2',
-          redirect: '/nested/menu1/menu1-2/menu1-2-1',
-          meta: { title: 'menu1-2' },
-          children: [
-            {
-              path: 'menu1-2-1',
-              component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
-              name: 'Menu1-2-1',
-              meta: { title: 'menu1-2-1' }
-            },
-            {
-              path: 'menu1-2-2',
-              component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
-              name: 'Menu1-2-2',
-              meta: { title: 'menu1-2-2' }
-            }
-          ]
-        },
-        {
-          path: 'menu1-3',
-          component: () => import('@/views/nested/menu1/menu1-3'),
-          name: 'Menu1-3',
-          meta: { title: 'menu1-3' }
-        }
-      ]
-    },
-    {
-      path: 'menu2',
-      name: 'Menu2',
-      component: () => import('@/views/nested/menu2/index'),
-      meta: { title: 'menu2' }
-    }
-  ]
-}
-
-export default nestedRouter

+ 0 - 41
src/router/modules/table.js

@@ -1,41 +0,0 @@
-/** When your routing table is too long, you can split it into small modules **/
-
-import Layout from '@/layout'
-
-const tableRouter = {
-  path: '/table',
-  component: Layout,
-  redirect: '/table/complex-table',
-  name: 'Table',
-  meta: {
-    title: 'Table',
-    icon: 'table'
-  },
-  children: [
-    {
-      path: 'dynamic-table',
-      component: () => import('@/views/table/dynamic-table/index'),
-      name: 'DynamicTable',
-      meta: { title: 'dynamicTable' }
-    },
-    {
-      path: 'drag-table',
-      component: () => import('@/views/table/drag-table'),
-      name: 'DragTable',
-      meta: { title: 'dragTable' }
-    },
-    {
-      path: 'inline-edit-table',
-      component: () => import('@/views/table/inline-edit-table'),
-      name: 'InlineEditTable',
-      meta: { title: 'inlineEditTable' }
-    },
-    {
-      path: 'complex-table',
-      component: () => import('@/views/table/complex-table'),
-      name: 'ComplexTable',
-      meta: { title: 'complexTable' }
-    }
-  ]
-}
-export default tableRouter

+ 5 - 5
src/settings.js

@@ -5,32 +5,32 @@ module.exports = {
    * @type {boolean} true | false
    * @description Whether show the settings right-panel
    */
-  showSettings: true,
+  showSettings: false, // 系统布局配置
 
   /**
    * @type {boolean} true | false
    * @description Whether need tagsView
    */
-  tagsView: true,
+  tagsView: false, // 标签页
 
   /**
    * @type {boolean} true | false
    * @description Whether fix the header
    */
-  fixedHeader: true,
+  fixedHeader: true, // 固定 Header
 
   /**
    * @type {boolean} true | false
    * @description Whether show the logo in sidebar
    */
-  sidebarLogo: false,
+  sidebarLogo: false, // 侧边栏 Logo
 
   /**
    * @type {boolean} true | false
    * @description Whether support pinyin search in headerSearch
    * Bundle size minified 47.3kb,minified + gzipped 63kb
    */
-  supportPinyinSearch: true,
+  supportPinyinSearch: true, // 菜单支持拼音搜索
 
   /**
    * @type {string | array} 'production' | ['production', 'development']

+ 56 - 5
src/store/modules/common.js

@@ -1,7 +1,7 @@
-import { getSmsCode, rechargePlayerType, rechargePlayer } from '@/api/common'
+import { getSmsCode, rechargePlayerType, rechargeChannelPlatform, getMainChannelMoney, rechargeChannelPlatformAccount, rechargePlayer, rechargeGame } from '@/api/common'
 
 const actions = {
-  // get sms_code
+  // 获取验证码
   getSmsCode({ commit }, mobile) {
     return new Promise((resolve, reject) => {
       getSmsCode({ tel: mobile, type: 3 }).then(response => {
@@ -13,27 +13,78 @@ const actions = {
     })
   },
 
+  // 游戏平台
+  rechargeChannelPlatform({ commit }, data) {
+    return new Promise((resolve, reject) => {
+      rechargeChannelPlatform(data).then(response => {
+        const { data } = response
+        resolve(data.data)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
+
+  // 渠道余额
+  getMainChannelMoney({ commit }, pid) {
+    return new Promise((resolve, reject) => {
+      getMainChannelMoney({ pid: pid }).then(response => {
+        const { data } = response
+        resolve(data.data)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
+
+  // 渠道账号
+  rechargeChannelPlatformAccount({ commit }, id) {
+    return new Promise((resolve, reject) => {
+      rechargeChannelPlatformAccount(id).then(response => {
+        const { data } = response
+        resolve(data.data)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
+
+  // 游戏列表
+  rechargeGame({ commit }, pid) {
+    return new Promise((resolve, reject) => {
+      rechargeGame({ pid: pid }).then(response => {
+        const { data } = response
+        resolve(data.data)
+      }).catch(error => {
+        reject(error)
+      })
+    })
+  },
+
+  // 查询充值账号是否正常
   rechargePlayerType({ commit }, data) {
     return new Promise((resolve, reject) => {
       rechargePlayerType(data).then(response => {
         // const { message } = response
         resolve(response)
       }).catch(error => {
-        reject(error)
+        reject(data.username + ':' + error)
       })
     })
   },
 
+  // 进行充值
   rechargePlayer({ commit }, data) {
     return new Promise((resolve, reject) => {
       rechargePlayer(data).then(response => {
-        const { message } = response
-        resolve(message)
+        // const { data } = response
+        resolve(response)
       }).catch(error => {
         reject(error)
       })
     })
   }
+
 }
 
 export default {

+ 35 - 23
src/store/modules/user.js

@@ -1,4 +1,5 @@
-import { login, logout, getInfo } from '@/api/user'
+// import { login, logout, getInfo } from '@/api/user'
+import { logout, getInfo } from '@/api/user'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import router, { resetRouter } from '@/router'
 
@@ -36,17 +37,22 @@ const actions = {
   // user login
   login({ commit }, userInfo) {
     const { mobile, smsCode } = userInfo
-
     return new Promise((resolve, reject) => {
-      login({ tel: mobile, code: smsCode }).then(response => {
-        const { data } = response
+      const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxNzEwLCJ1c2VyX3Bob25lIjoiMTc3MTkxMTg3NjMiLCJ1c2VyX3JlYWxuYW1lIjoi6auY5paw5piOIiwic3RhdHVzIjowLCJsb2dpbmlwIjoiMTE1LjE5My4xMzcuMTQ4IiwidXBkYXRlZF9hdCI6MTYzNjkzODkyNywibGV2ZWxfaWQiOjQsImF1dGhfZmFjZSI6MSwiZXhwIjoxNjM3MDI2NDc0LCJpc3MiOiIxNzcxOTExODc2MyJ9.VE3vmxFAJ2xh_UVAoHdw9A-TBkjczSujTlBj9mJ-4Xg'
+      console.log({ tel: mobile, code: smsCode })
+      commit('SET_TOKEN', token)
+      setToken(token)
+      resolve()
 
-        commit('SET_TOKEN', data.data)
-        setToken(data.data)
-        resolve()
-      }).catch(error => {
-        reject(error)
-      })
+      // login({ tel: mobile, code: smsCode }).then(response => {
+      //   const { data } = response
+
+      //   commit('SET_TOKEN', data.data)
+      //   setToken(data.data)
+      //   resolve()
+      // }).catch(error => {
+      //   reject(error)
+      // })
     })
   },
 
@@ -54,24 +60,30 @@ const actions = {
   getInfo({ commit, state }) {
     return new Promise((resolve, reject) => {
       getInfo().then(response => {
-        const { data } = response
+        const { data, message } = response
 
         if (!data) {
-          reject('Verification failed, please Login again.')
+          reject(message)
         }
+        const user_info = data.data
 
-        const { roles, name, avatar, introduction } = data
-
+        // const { roles, name, avatar, introduction } = data
         // roles must be a non-empty array
-        if (!roles || roles.length <= 0) {
-          reject('getInfo: roles must be a non-null array!')
-        }
-
-        commit('SET_ROLES', roles)
-        commit('SET_NAME', name)
-        commit('SET_AVATAR', avatar)
-        commit('SET_INTRODUCTION', introduction)
-        commit('SET_USER_INFO', data.data)
+        // if (!roles || roles.length <= 0) {
+        //   reject('getInfo: roles must be a non-null array!')
+        // }
+        data['roles'] = ['admin']
+        data['name'] = user_info.user_realname
+        data['avatar'] = 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'
+        data['introduction'] = user_info
+
+        commit('SET_ROLES', ['admin'])
+        commit('SET_NAME', user_info.user_realname)
+        // commit('SET_AVATAR', user_info.user_id_1_qy)
+        // commit('SET_INTRODUCTION', user_info.user_phone ?? '' + '-' + user_info.star_name ?? '')
+        commit('SET_AVATAR', 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif')
+        commit('SET_INTRODUCTION', '摇拽的萨克斯~')
+        commit('SET_USER_INFO', user_info)
         resolve(data)
       }).catch(error => {
         reject(error)

+ 10 - 34
src/views/login/index.vue

@@ -66,24 +66,15 @@
       >登录</el-button>
     </el-form>
 
-    <el-dialog title="Or connect with" :visible.sync="showDialog">
-      Can not be simulated on local, so please combine you own business
-      simulation! ! !
-      <br>
-      <br>
-      <br>
-      <social-sign />
-    </el-dialog>
   </div>
 </template>
 
 <script>
 import { validMobile } from '@/utils/validate'
-import SocialSign from './components/SocialSignin'
+import { Message } from 'element-ui'
 
 export default {
   name: 'Login',
-  components: { SocialSign },
   data() {
     const validateMobile = (rule, value, callback) => {
       if (!validMobile(value)) {
@@ -113,7 +104,6 @@ export default {
         ]
       },
       loading: false,
-      showDialog: false,
       redirect: undefined,
       otherQuery: {},
 
@@ -153,18 +143,22 @@ export default {
     handleLogin() {
       this.$refs.loginForm.validate((valid) => {
         if (valid) {
-          console.log(this.loginForm)
-
           this.loading = true
           this.$store.dispatch('user/login', this.loginForm).then(() => {
+            // console.log('# then:')
             this.$router.push({ path: this.redirect || '/', query: this.otherQuery })
             this.loading = false
-          }).catch(() => {
+          }).catch((res) => {
+            // console.log('# res:', res)
             this.loading = false
           })
         } else {
-          console.log('error submit!!')
-          return false
+          // console.log('# if-error:')
+          return Message({
+            message: 'error submit!!',
+            type: 'error',
+            duration: 5 * 1000
+          })
         }
       })
     },
@@ -176,24 +170,6 @@ export default {
         return acc
       }, {})
     }
-    // afterQRScan() {
-    //   if (e.key === 'x-admin-oauth-code') {
-    //     const code = getQueryObject(e.newValue)
-    //     const codeMap = {
-    //       wechat: 'code',
-    //       tencent: 'code'
-    //     }
-    //     const type = codeMap[this.auth_type]
-    //     const codeName = code[type]
-    //     if (codeName) {
-    //       this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
-    //         this.$router.push({ path: this.redirect || '/' })
-    //       })
-    //     } else {
-    //       alert('第三方登录失败')
-    //     }
-    //   }
-    // }
   }
 }
 </script>

+ 234 - 104
src/views/recharge/index.vue

@@ -1,149 +1,273 @@
 <template>
   <div class="login-container">
-    <el-container>
-      <el-aside width="500px">
-        <el-row class="row-bg" gutter="10">
-          <el-col :span="8">
-            <span style="font-size: 5px;">贴入充值账号,一行一个账号.</span>
-            <el-input
-              v-model="accountHandle"
-              :rows="25"
-              type="textarea"
-              placeholder="待检测账号."
-            />
-          </el-col>
-          <el-col :span="6">
-            <el-button type="success" @click="confirmAccount">确认账号</el-button>
-          </el-col>
-          <el-col :span="8">
-            <span style="font-size: 5px;">账号确认成功后会显示到这里.</span>
-            <el-input
-              v-model="accountHandleSuccess"
-              :rows="25"
-              type="textarea"
-              placeholder="账号检测成功."
-            />
-          </el-col>
-        </el-row>
-      </el-aside>
-      <el-main>
-        <el-form ref="form" :model="form" label-width="100px">
+    <el-form ref="form" :model="form">
+      <el-row :gutter="30">
+        <el-col :span="5">
           <el-form-item label="游戏平台">
-            <el-select v-model="value" placeholder="Select">
+            <el-select v-model="rechargePlatformDefault" placeholder="Select">
               <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                v-for="(item, index) in rechargePlatform"
+                :key="index"
+                :label="item.platform"
+                :value="item.pid"
               />
             </el-select>
           </el-form-item>
+          <el-form-item label="渠道余额" style="width: 300px;">
+            <el-input v-model="balanceMoney" type="number" class="inline-input" disabled style="width: 160px;" />&nbsp;元
+          </el-form-item>
           <el-form-item label="渠道账号">
-            <el-select v-model="value" placeholder="Select">
+            <el-select v-model="rechargeChannelPlatformDefault" placeholder="Select">
               <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                v-for="(item, index) in rechargeChannelPlatform"
+                :key="index"
+                :label="item.account"
+                :value="item.cid"
+                @change="testingCid"
               />
             </el-select>
           </el-form-item>
           <el-form-item label="选择游戏">
-            <el-select v-model="value" placeholder="Select">
+            <el-select v-model="rechargeGameDefault" placeholder="Select">
               <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                v-for="(item, index) in rechargeGame"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+                @change="testingGfid"
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="充值金额">
-            <el-input v-model="form.name" type="number" class="inline-input" />
+        </el-col>
+
+        <el-divider direction="vertical" />
+
+        <el-col :span="8">
+          <el-row class="row-bg" gutter="10">
+            <el-col :span="9">
+              <span style="font-size: 5px; color: #67C23A;">贴入充值账号,一行一个账号.</span>
+              <!-- :rows="25" -->
+              <el-input
+                v-model="accountHandle"
+                type="textarea"
+                placeholder="待检测账号."
+                :autosize="{ minRows: 10, maxRows: 30 }"
+              />
+            </el-col>
+            <el-col :span="6" style="margin-top: 150px;">
+              <el-button type="success" @click="confirmAccount">确认账号</el-button>
+            </el-col>
+            <el-col :span="9">
+              <span style="font-size: 5px; color: #67C23A;">账号确认成功后会显示到这里.</span>
+              <el-input
+                v-model="accountHandleSuccess"
+                type="textarea"
+                placeholder="账号检测成功."
+                :autosize="{ minRows: 10, maxRows: 30 }"
+              />
+            </el-col>
+          </el-row>
+        </el-col>
+
+        <el-divider direction="vertical" />
+
+        <el-col :span="8">
+          <el-form-item label="充值金额" style="width: 300px;">
+            <el-input v-model="form.payMoney" type="number" class="inline-input" min="0" />
           </el-form-item>
-          <el-form-item label="平台折扣">
+          <!-- <el-form-item label="平台折扣">
             <span>9.8折</span>
           </el-form-item>
           <el-form-item label="游戏折扣">
             <span>9.8折</span>
-          </el-form-item>
+          </el-form-item> -->
           <el-form-item label="支付方式">
-            <el-radio-group v-model="form.resource">
-              <el-radio label="久币支付" />
-              <el-radio label="商务币支付" />
+            <el-radio-group v-model="form.resource" disabled>
+              <el-radio :label="0">久币支付</el-radio>
+              <el-radio :label="1">商务币支付</el-radio>
             </el-radio-group>
           </el-form-item>
           <el-form-item label="支付金额">
-            <span>99.999元</span>
+            <span>{{ form.payMoney }} 元</span>
           </el-form-item>
           <el-form-item>
             <el-button type="primary" @click="onSubmit">立即支付</el-button>
           </el-form-item>
-        </el-form>
-      </el-main>
-    </el-container>
+        </el-col>
+      </el-row>
+    </el-form>
+
   </div>
 </template>
 
 <script>
-// import { validMobile } from '@/utils/validate'
+import { Message, MessageBox } from 'element-ui'
+import { rechargeChannelPlatformAccount } from '@/api/common'
 
 export default {
   name: 'Recharge',
   data() {
     return {
       // accountHandle: '13121776520\n13121776521\n13121776522\n13121776523\n13121776524\n13121776525', // 待处理账号
-      accountHandle: '', // 待处理账号
+      accountHandle: '13121776520\n17719118763', // 待处理账号
       accountHandleSuccess: '', // 处理成功账号
       form: {
-        name: '',
-        region: '',
-        date1: '',
-        date2: '',
-        delivery: false,
-        type: [],
-        resource: '',
-        desc: ''
+        resource: 0, // 支付方式
+        payMoney: 0, // 支付金额
+        paypwd: '' // 支付密码
       },
-      value: [],
-      options: [
+      // 默认魅族平台
+      rechargePlatformDefault: 'd65aa6d7614589bffe62456b88e98811', // 默认账户-pid
+      // 游戏平台列表
+      rechargePlatform: [
         {
-          value: 'aaaa',
-          label: 'aaaa'
-        }, {
-          value: 'xxx',
-          label: 'bbb'
-        }, {
-          value: 'ccc',
-          label: 'ccc'
-        }, {
-          value: 'ddd',
-          label: 'ddd'
+          'pid': 'd65aa6d7614589bffe62456b88e98811',
+          'platform': 'MM',
+          'disRate': 9.8,
+          'rate': 9.7,
+          'type': 0,
+          'length': 2
         }
-      ]
+      ],
+      // 渠道余额
+      balanceMoney: 0,
+      // 渠道账号
+      rechargeChannelPlatformDefault: '', // cid
+      rechargeChannelPlatform: [],
+      // 游戏列表
+      rechargeGameDefault: '', // gid
+      rechargeGame: []
     }
   },
   created() {
+    this.getBalanceMoney(this.rechargePlatformDefault)
+    this.getRechargePlatform(this.rechargePlatformDefault)
+    this.getRechargeGame(this.rechargePlatformDefault)
   },
   methods: {
-    onSubmit() {
-      console.log('submit!')
+    async onSubmit() {
+      // TODO: form 数据内容判断
+      // TODO: 检测数据页面改为 tree 格式,方便查看某一条数据状态(成功/失败)
+
+      const _this = this
+      // 截取每一条数据
+      var accountHandle = _this.accountHandleSuccess.split('\n')
+      console.log(accountHandle)
+
+      await MessageBox.prompt('输入支付密码', 'Tip', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消'
+      }).then(({ value }) => {
+        _this.form.paypwd = value
+      }).catch(() => {
+        Message({
+          type: 'info',
+          message: '取消充值.'
+        })
+      })
+      console.log('# 支付密码:', this.form.paypwd)
+
+      var successList = [] // 成功数据
+      var failList = [] // 失败数据
+      for (var i = 0; i < accountHandle.length; i++) {
+        await this.rechargePlayer({ successList, failList }, accountHandle[i])
+      }
+      // if (successList) {
+      //   this.accountHandleSuccess = successList.join('\n')
+      // }
+      console.log('# 成功:', successList)
+      console.log('# 失败:', failList)
+    },
+    // 异步进行账户充值
+    rechargePlayer(request, mobile) {
+      return new Promise((resolve, reject) => {
+        const _this = this
+        const _request = request
+        const _data = { pid: this.rechargePlatformDefault, cid: this.rechargeChannelPlatformDefault, gfid: this.rechargeGameDefault, paypwd: this.form.paypwd, username: mobile, money: this.form.payMoney, recharge: 2, payway: 1, type: 3 }
+        setTimeout((_this, _request, _data) => {
+          _this.$store.dispatch('common/rechargePlayer', _data).then((res) => {
+            const { code, status } = res
+            if (code === 200 && status === true) {
+              _request.successList.push(_data.username)
+              resolve()
+            } else {
+              _request.failList.push(_data.username)
+              resolve()
+            }
+          }).catch((res) => {
+            // Message({
+            //   message: res,
+            //   type: 'error',
+            //   duration: 5 * 1000
+            // })
+            resolve()
+          })
+        }, 1000, _this, _request, _data)
+      })
+    },
+
+    // 账户余额
+    getBalanceMoney(val) {
+      this.$store.dispatch('common/getMainChannelMoney', val).then((res) => {
+        this.balanceMoney = res
+      }).catch((res) => {
+        return Message({
+          message: res,
+          type: 'error',
+          duration: 5 * 1000
+        })
+      })
     },
-    handleChange1(value) {
-      console.log(value)
+    // 渠道账号列表
+    getRechargePlatform(val) {
+      rechargeChannelPlatformAccount(val).then(response => {
+        // console.log('# getRechargePlatform:', response)
+        this.rechargeChannelPlatform = response.data.data
+        this.rechargeChannelPlatformDefault = response.data.data[0]['cid']
+      }).catch(res => {
+        return Message({
+          message: res,
+          type: 'error',
+          duration: 5 * 1000
+        })
+      })
     },
-    handleChange2(value) {
-      console.log(value)
+    testingCid(val) {
+      console.log(val)
+    },
+    // 游戏列表
+    getRechargeGame(pid) {
+      this.$store.dispatch('common/rechargeGame', pid).then((res) => {
+        this.rechargeGame = res
+        this.rechargeGameDefault = res[0]['id']
+      }).catch((res) => {
+        return Message({
+          message: res,
+          type: 'error',
+          duration: 5 * 1000
+        })
+      })
     },
-    handleChange3(value) {
-      console.log(value)
+    testingGfid(val) {
+      console.log(val)
     },
+    // 账号检测
     async confirmAccount() {
+      if (this.accountHandle === '') {
+        return Message({
+          message: '请输入检测账号!',
+          type: 'error',
+          duration: 5 * 1000
+        })
+      }
+
       // 截取每一条数据
       var accountHandle = this.accountHandle.split('\n')
-      // console.log(list)
-      var successList = []
-      var failList = []
+
+      // TODO: 检测账号数据去重
+
+      var successList = [] // 成功数据
+      var failList = [] // 失败数据
       for (var i = 0; i < accountHandle.length; i++) {
         await this.requestFunc({ successList, failList }, accountHandle[i])
       }
@@ -153,27 +277,33 @@ export default {
       console.log('# 成功:', successList)
       console.log('# 失败:', failList)
     },
-    requestFunc(request, data) {
+    // 异步进行账户检测处理
+    requestFunc(request, mobile) {
       return new Promise((resolve, reject) => {
-        this.$store.dispatch('common/rechargePlayerType', data).then((res) => {
-          // console.log('# then:', res)
-          if (res.status === true) {
-            request.successList.push(data)
-          } else {
-            request.failList.push(data)
-          }
-          resolve()
-        }).catch((res) => {
-          resolve()
-        })
+        const _this = this
+        const _request = request
+        const _mobile = mobile
+        setTimeout((_this, _request, _mobile, { pid, cid, gfid }) => {
+          _this.$store.dispatch('common/rechargePlayerType', { pid: pid, cid: cid, gfid: gfid, username: _mobile }).then((res) => {
+            if (res.status === true) {
+              _request.successList.push(_mobile)
+            } else {
+              _request.failList.push(_mobile)
+            }
+            resolve()
+          }).catch(() => {
+            resolve()
+          })
+        }, 1000, _this, _request, _mobile, { pid: this.rechargePlatformDefault, cid: this.rechargeChannelPlatformDefault, gfid: this.rechargeGameDefault })
       })
     }
+
   }
 }
 </script>
 
 <style lang="scss">
-.login-container{
-  margin: 10px;
-}
+  .login-container{
+    margin: 20px;
+  }
 </style>

+ 11 - 11
vue.config.js

@@ -36,18 +36,18 @@ module.exports = {
       warnings: true,
       errors: true
     },
-    before: require('./mock/mock-server.js')
+    // before: require('./mock/mock-server.js'),
 
-    // proxy: {
-    //   [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
-    //     target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
-    //     changeOrigin: true // 必须加上这个才能跨域请求
-    //     // logLevel: 'debug'
-    //     // pathRewrite: { // 重命名
-    //     //   ['^/' + process.env.VUE_APP_BASE_API]: ''
-    //     // }
-    //   }
-    // }
+    proxy: {
+      [process.env.VUE_APP_BASE_API]: { // 这里是公共部分,在调用接口时后面接不相同的部分,/api就相当于http://192.168.0.199:8926/api这一段
+        target: process.env.VUE_APP_BASE_URL, // 这里写的是访问接口的域名和端口号
+        changeOrigin: true, // 必须加上这个才能跨域请求
+        logLevel: 'debug'
+        // pathRewrite: { // 重命名
+        //   ['^/' + process.env.VUE_APP_BASE_API]: ''
+        // }
+      }
+    }
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that