lxs vor 4 Jahren
Ursprung
Commit
b204ac92f6
3 geänderte Dateien mit 65 neuen und 47 gelöschten Zeilen
  1. 54 41
      src/views/Rank.vue
  2. 7 2
      src/views/SeasonSet.vue
  3. 4 4
      vue.config.js

+ 54 - 41
src/views/Rank.vue

@@ -12,9 +12,9 @@
         maxlength="11"
         placeholder="输入手机号 / 用户昵称搜索"
         prefix-icon="el-icon-search"
-        @keyup.enter.native="handleSearch()"
+        @keyup.enter.native="switchRequests()"
       />
-      <el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch()">搜索/刷新</el-button>
+      <el-button type="primary" icon="el-icon-search" :loading="loading" @click="switchRequest()">搜索/刷新</el-button>
     </div>
     <el-table
       v-loading="loading"
@@ -64,11 +64,19 @@
         </template>
       </el-table-column>
       <el-table-column
-        :label="rankType === 3 ? '总套数' : '上级名称'"
+        v-if="rankType === 1 || rankType === 2 || rankType === 4"
+        label="上级名称"
         prop="up_name"
         label-class-name="label"
       />
       <el-table-column
+        prop="total"
+        label="总套数"
+        label-class-name="label"
+      >
+        <span slot-scope="{ row }">{{ row.total || 0 }}</span>
+      </el-table-column>
+      <el-table-column
         v-if="rankType !== 3"
         label="上级手机"
         prop="up_phone"
@@ -97,7 +105,7 @@ export default {
   data() {
     return {
       season_list_index: 0,
-      rankType: 1,
+      rankType: 2,
       page: 1,
       loading: false,
       list: [],
@@ -137,12 +145,16 @@ export default {
       },
       typeList: [
         {
-          name: '个人榜',
+          name: '销售主管榜',
+          value: 2
+        },
+        {
+          name: '销售经理榜',
           value: 1
         },
         {
-          name: '皇冠榜',
-          value: 2
+          name: '代理公司榜',
+          value: 4
         },
         {
           name: '战区榜',
@@ -169,16 +181,17 @@ export default {
   },
   created() {
     this.loading = true
-    ranking_user({ season: this.season, type: this.rankType }).then(res => {
-      res.data.list.forEach((e, i) => {
-        e.rank = 15 * (this.page - 1) + i + 1
-      })
-      this.loading = false
-      this.list = res.data.list
-      this.total = res.data.total
-    }).catch(e => {
-      this.loading = false
-    })
+    this.switchRequest()
+    // ranking_user({ season: this.season, type: this.rankType }).then(res => {
+    //   res.data.list.forEach((e, i) => {
+    //     e.rank = 15 * (this.page - 1) + i + 1
+    //   })
+    //   this.loading = false
+    //   this.list = res.data.list
+    //   this.total = res.data.total
+    // }).catch(e => {
+    //   this.loading = false
+    // })
   },
   methods: {
     switchseason(index) { // 切换赛季
@@ -187,9 +200,9 @@ export default {
     },
     switchRequest(page) {
       this.loading = true
-      this.search = ''
+      // this.search = ''
       page ? '' : this.page = 1
-      ranking_user({ season: this.season, type: this.rankType, page: this.page }).then(res => {
+      ranking_user({ season: this.season, type: this.rankType, page: this.page, search_name: this.search }).then(res => {
         res.data.list.forEach((e, i) => {
           e.rank = 15 * (this.page - 1) + i + 1
         })
@@ -202,28 +215,28 @@ export default {
       })
     },
     handleSearch(page) {
-      if (this.search.trim().length) {
-        this.loading = true
-        page ? '' : this.page = 1
-        ranking_search({ page: this.page, type: this.rankType, phone: this.search }).then(res => {
-          res.data.list.sort((a, b) => +a.rank - +b.rank)
-          this.list = res.data.list
-          this.total = res.data.total
-          this.loading = false
-        }).catch(e => {
-          this.loading = false
-        })
-      } else {
-        this.page = 1
-        this.switchRequest()
-      }
+      // if (this.search.trim().length) {
+      this.loading = true
+      page ? '' : this.page = 1
+      ranking_search({ page: this.page, type: this.rankType, search_name: this.search, season: this.season }).then(res => {
+        res.data.list.sort((a, b) => +a.rank - +b.rank)
+        this.list = res.data.list
+        this.total = res.data.total
+        this.loading = false
+      }).catch(e => {
+        this.loading = false
+      })
+      // } else {
+      //   this.page = 1
+      //   this.switchRequest()
+      // }
     },
     handleCurrentChange(page) { // 换页
       this.page = page
-      if (this.search.trim().length) {
-        this.handleSearch(page)
-        return
-      }
+      // if (this.search.trim().length) {
+      //   this.handleSearch(page)
+      //   return
+      // }
       this.switchRequest(page)
     },
     out() {
@@ -243,13 +256,13 @@ export default {
     },
     handleDownload() { // 下载Excel
       import('@/vendor/Export2Excel').then(excel => {
-        const header = ['排名', '用户昵称', '学分', '用户手机号', '用户销售级别', '上级名称', '上级手机', '所属战区']
-        const filterVal = ['rank', 'nickname', 'score', 'phone', 'level_name', 'up_name', 'up_phone', 'war_name']
+        const header = ['排名', '用户昵称', '学分', '用户手机号', '用户销售级别', '上级名称', '上级手机', '所属战区', '总套数']
+        const filterVal = ['rank', 'nickname', 'score', 'phone', 'level_name', 'up_name', 'up_phone', 'war_name', 'total']
         const data = this.DOWNLOADEXCELDATA.map(v => filterVal.map(j => v[j]))
         excel.export_json_to_excel({
           header,
           data,
-          filename: `${+this.rankType === 1 ? '个人' : '皇冠'}榜-${(new Date()).toLocaleString()}`,
+          filename: `${this.typeList.find(i => i.value === this.rankType).name}-${(new Date()).toLocaleString()}`,
           autoWidth: true,
           bookType: 'xlsx'
         })

+ 7 - 2
src/views/SeasonSet.vue

@@ -95,6 +95,9 @@
         <el-form-item label="默认放弃时间:">
           <el-input v-model="formLabelAlign.give_up_time" type="number" placeholder="默认放弃时间(天)" />
         </el-form-item>
+        <el-form-item label="竞猜截至时间:">
+          <el-input v-model="formLabelAlign.guess_end_time" type="number" placeholder="默认竞猜截至时间(天)" />
+        </el-form-item>
         <el-button v-loading="loading" type="primary" :disabled="disabled" @click="submitForm">设置</el-button>
       </el-form>
     </div>
@@ -122,7 +125,8 @@ export default {
         challenge_num: '',
         challenge_inte: '',
         give_up_time: '',
-        guessing_inte: ''
+        guessing_inte: '',
+        guess_end_time: ''
       },
       startDay: new Date(),
       disabled: false,
@@ -168,7 +172,8 @@ export default {
         challenge_num: this.formLabelAlign.challenge_num,
         challenge_inte: this.formLabelAlign.challenge_inte,
         give_up_time: this.formLabelAlign.give_up_time,
-        guessing_inte: this.formLabelAlign.guessing_inte
+        guessing_inte: this.formLabelAlign.guessing_inte,
+        guess_end_time: this.formLabelAlign.guess_end_time
       }).then(() => {
         this.loading = false
         Message({

+ 4 - 4
vue.config.js

@@ -5,7 +5,7 @@ function resolve(dir) {
   return path.join(__dirname, dir)
 }
 module.exports = {
-  publicPath: '/',
+  publicPath: './',
   outputDir: 'dist',
   assetsDir: 'static',
   lintOnSave: process.env.NODE_ENV === 'development',
@@ -39,7 +39,7 @@ module.exports = {
   chainWebpack(config) {
     config.plugins.delete('preload')
     config.plugins.delete('prefetch')
-    
+
     config.module
       .rule('svg')
       .exclude.add(resolve('src/icons'))
@@ -55,7 +55,7 @@ module.exports = {
         symbolId: 'icon-[name]'
       })
       .end()
-      
+
     config.module
       .rule('vue')
       .use('vue-loader')
@@ -110,4 +110,4 @@ module.exports = {
         }
       )
   }
-}
+}