GivenSir 4 lat temu
rodzic
commit
8dd5e77116

+ 7 - 0
.env

@@ -0,0 +1,7 @@
+# just a flag
+ENV = 'development'
+
+# base api
+VUE_APP_BASE_API = 'http://devapi.youxi9.com/'
+# VUE_APP_BASE_URL = 'http://devapi.youxi9.com/'
+VUE_APP_IMG_URL = 'https://cdn.youxi9.com/'

+ 2 - 2
.env.development

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

+ 2 - 2
.env.production

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

Plik diff jest za duży
+ 45 - 200
README.zh-CN.md


+ 91 - 0
mock/common.js

@@ -1,5 +1,18 @@
 
 module.exports = [
+  // sms code
+  {
+    url: '/v1/tel/code',
+    type: 'get',
+    response: config => {
+      return {
+        code: 200,
+        status: true,
+        data: [],
+        message: '成功~'
+      }
+    }
+  },
   // 游戏平台
   {
     url: '/v1/recharge/channel/platform',
@@ -65,6 +78,45 @@ module.exports = [
       }
     }
   },
+  // 游戏列表
+  {
+    url: '/v1/recharge/game',
+    type: 'get',
+    response: config => {
+      return {
+        'status': true,
+        'code': 200,
+        'time': 1637054942,
+        'message': '成功',
+        'data': {
+          'data': [
+            {
+              'id': 42667,
+              'gid': 20240,
+              'pid': 'd65aa6d7614589bffe62456b88e98811',
+              'name': '魅族测试游戏',
+              'yxid': '666639',
+              'firRate': 3,
+              'lastRate': 4,
+              'toRate': '自然点位5',
+              'from': 1
+            },
+            {
+              'id': 42670,
+              'gid': 8267,
+              'pid': 'd65aa6d7614589bffe62456b88e98811',
+              'name': '蜀门',
+              'yxid': '3175430',
+              'firRate': 10,
+              'lastRate': 10,
+              'toRate': '自然点位39',
+              'from': 1
+            }
+          ]
+        }
+      }
+    }
+  },
   // 查询充值账号是否正常
   {
     url: '/v1/recharge/player/type',
@@ -86,5 +138,44 @@ module.exports = [
         }
       }
     }
+  },
+  // 进行充值
+  {
+    url: '/v1/recharge/player',
+    type: 'post',
+    response: config => {
+      const math = Math.round(Math.random() * 2)
+      var result = []
+      switch (math) {
+        case 0:
+          result = {
+            'status': true,
+            'code': 200,
+            'time': 1637055309,
+            'message': '成功',
+            'data': []
+          }
+          break
+        case 1:
+          result = {
+            'status': false,
+            'code': 35203,
+            'time': 1637032613,
+            'message': '您的支付密码有误',
+            'data': []
+          }
+          break
+        case 2:
+          result = {
+            code: 401,
+            status: false,
+            data: [],
+            message: '操作失败'
+          }
+          break
+      }
+
+      return result
+    }
   }
 ]

+ 0 - 14
mock/user.js

@@ -24,20 +24,6 @@ const tokens = {
 // }
 
 module.exports = [
-  // sms code
-  {
-    url: '/v1/tel/code',
-    type: 'get',
-    response: config => {
-      return {
-        code: 200,
-        status: true,
-        data: [],
-        message: '成功~'
-      }
-    }
-  },
-
   // user login
   {
     url: '/v1/user/login',

+ 8 - 8
src/layout/components/Navbar.vue

@@ -12,9 +12,9 @@
 
         <screenfull id="screenfull" class="right-menu-item hover-effect" />
 
-        <!-- <el-tooltip :content="$t('navbar.size')" effect="dark" placement="bottom">
+        <el-tooltip :content="$t('navbar.size')" effect="dark" placement="bottom">
           <size-select id="size-select" class="right-menu-item hover-effect" />
-        </el-tooltip> -->
+        </el-tooltip>
 
         <!-- <lang-select class="right-menu-item hover-effect" /> -->
 
@@ -26,11 +26,11 @@
           <i class="el-icon-caret-bottom" />
         </div>
         <el-dropdown-menu slot="dropdown">
-          <!-- <router-link to="/profile/index">
+          <router-link to="">
             <el-dropdown-item>
               {{ $t('navbar.profile') }}
             </el-dropdown-item>
-          </router-link> -->
+          </router-link>
           <el-dropdown-item divided @click.native="logout">
             <span style="display:block;">{{ $t('navbar.logOut') }}</span>
           </el-dropdown-item>
@@ -46,7 +46,7 @@ import Breadcrumb from '@/components/Breadcrumb'
 import Hamburger from '@/components/Hamburger'
 import ErrorLog from '@/components/ErrorLog'
 import Screenfull from '@/components/Screenfull'
-// import SizeSelect from '@/components/SizeSelect'
+import SizeSelect from '@/components/SizeSelect'
 // import LangSelect from '@/components/LangSelect'
 // import Search from '@/components/HeaderSearch'
 
@@ -55,9 +55,9 @@ export default {
     Breadcrumb,
     Hamburger,
     ErrorLog,
-    Screenfull
-    // SizeSelect,
-    // LangSelect
+    Screenfull,
+    SizeSelect
+    // LangSelect,
     // Search
   },
   computed: {

+ 4 - 4
src/main.js

@@ -28,10 +28,10 @@ import * as filters from './filters' // global filters
  * Currently MockJs will be used in the production environment,
  * please remove it before going online ! ! !
  */
-// if (process.env.NODE_ENV === 'production') {
-//   const { mockXHR } = require('../mock')
-//   mockXHR()
-// }
+if (process.env.NODE_ENV === 'development') {
+  const { mockXHR } = require('../mock')
+  mockXHR()
+}
 
 Vue.use(Element, {
   size: Cookies.get('size') || 'medium', // set element-ui default size

+ 2 - 2
src/settings.js

@@ -5,13 +5,13 @@ module.exports = {
    * @type {boolean} true | false
    * @description Whether show the settings right-panel
    */
-  showSettings: false, // 系统布局配置
+  showSettings: true, // 系统布局配置
 
   /**
    * @type {boolean} true | false
    * @description Whether need tagsView
    */
-  tagsView: false, // 标签页
+  tagsView: true, // 标签页
 
   /**
    * @type {boolean} true | false

+ 3 - 2
src/utils/request.js

@@ -3,10 +3,11 @@ import { MessageBox, Message } from 'element-ui'
 import store from '@/store'
 import { getToken } from '@/utils/auth'
 
+console.log('# process.env.ENV: ', process.env.NODE_ENV, process.env.NODE_ENV === 'development' ? undefined : process.env.VUE_APP_BASE_API)
 // create an axios instance
 const service = axios.create({
-  baseURL: process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API, // url = base url + request url
-  // baseURL: process.env.NODE_ENV === 'development' ? undefined : process.env.VUE_APP_BASE_API,
+  // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
+  baseURL: process.env.NODE_ENV === 'development' ? undefined : process.env.VUE_APP_BASE_API,
   // withCredentials: true, // send cookies when cross-domain requests
   timeout: 5000 // request timeout
 })

+ 1 - 1
src/views/login/index.vue

@@ -9,7 +9,7 @@
       label-position="left"
     >
       <div class="title-container">
-        <h3 class="title">Login Form</h3>
+        <h3 class="title">游戏久 - 魅族充值平台</h3>
       </div>
 
       <el-form-item prop="mobile">

+ 40 - 66
src/views/recharge/index.vue

@@ -13,9 +13,9 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="渠道余额" style="width: 300px;">
+          <!-- <el-form-item label="渠道余额" style="width: 300px;">
             <el-input v-model="balanceMoney" type="number" class="inline-input filter-item" disabled style="width: 160px;" />&nbsp;元
-          </el-form-item>
+          </el-form-item> -->
           <el-form-item label="渠道账号" prop="cid">
             <el-select v-model="dataForm.cid" placeholder="Select" class="filter-item">
               <el-option
@@ -78,9 +78,9 @@
             <span>9.8折</span>
           </el-form-item> -->
           <el-form-item label="支付方式">
-            <el-radio-group v-model="dataForm.payway" disabled prop="payway" class="filter-item">
+            <el-radio-group v-model="dataForm.payway" prop="payway" class="filter-item">
               <el-radio :label="1">久币支付</el-radio>
-              <el-radio :label="2">商务币支付</el-radio>
+              <!-- <el-radio :label="2">商务币支付</el-radio> -->
             </el-radio-group>
           </el-form-item>
           <el-form-item label="支付金额">
@@ -90,7 +90,7 @@
             <el-button type="primary" @click="onSubmit">立即支付</el-button>
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <el-col :span="6" class="el-bg-border">
           <el-row :gutter="30">
             <el-col :span="12">
               <span style="font-size: 5px; color: #67C23A;">成功账户:</span>
@@ -111,14 +111,12 @@
           </el-row>
         </el-col>
       </el-row>
-
     </el-form>
-
   </div>
 </template>
 
 <script>
-import { Message, MessageBox } from 'element-ui'
+import { Message, MessageBox, Loading } from 'element-ui'
 import { rechargeChannelPlatformAccount } from '@/api/common'
 
 export default {
@@ -131,7 +129,7 @@ export default {
         cid: '', // 渠道账号ID
         gfid: '', // 游戏ID
         paypwd: '', // 支付密码
-        username: '13121776520\n17719118763', // 充值账户
+        username: '', // 充值账户
         money: 1, // 充值金额(单位:元)
         recharge: 2, //
         payway: 1, // 充值方式
@@ -155,7 +153,7 @@ export default {
           'length': 2
         }
       ],
-      balanceMoney: 0, // 渠道余额
+      // balanceMoney: 0, // 渠道余额
       rechargeChannelPlatform: [], // 渠道账号
       rechargeGame: [], // 游戏列表
 
@@ -164,27 +162,43 @@ export default {
     }
   },
   created() {
-    this.getBalanceMoney(this.dataForm.pid)
+    // this.getBalanceMoney(this.dataForm.pid)
     this.getRechargePlatform(this.dataForm.pid)
     this.getRechargeGame(this.dataForm.pid)
   },
   methods: {
-    async onSubmit() {
+    openFull() {
+      const loading = Loading.service({
+        lock: true,
+        text: 'Loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+      setTimeout(() => {
+        loading.close()
+      }, 2000)
+    },
+    onSubmit() {
+      this.openFull()
+    },
+    async onSubmits() {
       this.thenAccount = ''
       this.catchAccount = ''
 
-      if ((this.balanceMoney - this.dataForm.money) < 0) {
-        return Message({
-          type: 'info',
-          message: '余额不足以充值.'
-        })
-      }
+      // TODO: 正式服务器未上线,暂时不需要
+      // if ((this.balanceMoney - this.dataForm.money) < 0) {
+      //   return Message({
+      //     type: 'info',
+      //     message: '余额不足以充值.'
+      //   })
+      // }
       this.$refs['dataForm'].validate((valid) => {
         console.log('# form-validate:', valid)
         if (valid) {
           // 截取数据
           var userLists = this.dataForm.username.split('\n')
 
+          // TODO: 账号重复判断、账号为空判断
+
           MessageBox.prompt('输入支付密码', 'Tip', {
             confirmButtonText: '确认',
             cancelButtonText: '取消'
@@ -237,7 +251,7 @@ export default {
       })
     },
 
-    // 账户余额
+    // 账户余额 -- 弃用
     getBalanceMoney(val) {
       this.$store.dispatch('common/getMainChannelMoney', val).then((res) => {
         this.balanceMoney = res
@@ -267,7 +281,7 @@ export default {
     getRechargeGame(pid) {
       this.$store.dispatch('common/rechargeGame', pid).then((res) => {
         this.rechargeGame = res
-        this.dataForm.gfid = res[0]['id']
+        this.dataForm.gfid = 42670
       }).catch((res) => {
         return Message({
           message: res,
@@ -275,52 +289,6 @@ export default {
           duration: 5 * 1000
         })
       })
-    },
-    // 账号检测 -- 弃用
-    async confirmAccount() {
-      if (this.accountHandle === '') {
-        return Message({
-          message: '请输入检测账号!',
-          type: 'error',
-          duration: 5 * 1000
-        })
-      }
-
-      // 截取每一条数据
-      var accountHandle = this.accountHandle.split('\n')
-
-      // TODO: 检测账号数据去重
-
-      var successList = [] // 成功数据
-      var failList = [] // 失败数据
-      for (var i = 0; i < accountHandle.length; i++) {
-        await this.requestFunc({ successList, failList }, accountHandle[i])
-      }
-      if (successList) {
-        this.accountHandleSuccess = successList.join('\n')
-      }
-      console.log('# 成功:', successList)
-      console.log('# 失败:', failList)
-    },
-    // 异步进行账户检测处理
-    requestFunc(request, mobile) {
-      return new Promise((resolve, reject) => {
-        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 })
-      })
     }
 
   }
@@ -330,5 +298,11 @@ export default {
 <style lang="scss">
   .login-container{
     margin: 20px;
+    background-color: #FFFFFF;
+
+    .el-bg-border{
+      border: 2px dashed #909399;
+      padding: 10px;
+    }
   }
 </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_API, // 这里写的是访问接口的域名和端口号
+    //     changeOrigin: true, // 必须加上这个才能跨域请求
+    //     logLevel: 'debug',
+    //     pathRewrite: { // 重命名
+    //       ['^/' + process.env.VUE_APP_BASE_API]: ''
+    //     }
+    //   }
+    // }
   },
   configureWebpack: {
     // provide the app's title in webpack's name field, so that