Kaynağa Gözat

Merge branch 'master' of ssh://git.web.ximengnaikang.com:2222/daweiboshi/admin

yinchengnuo 4 yıl önce
ebeveyn
işleme
d6f10f1b17

+ 8 - 0
src/api/challenge.js

@@ -15,3 +15,11 @@ export function getInfo(params) {
     params
   })
 }
+
+export function toExport(params) {
+  return request({
+    method: 'get',
+    url: '/download/excel_challenge',
+    params
+  })
+}

+ 15 - 0
src/api/data.js

@@ -26,3 +26,18 @@ export const api_Data3 = params => request({ url: '/data/per_capita', method: 'g
 export const api_Data4 = params => request({ url: '/data/sale_per_capita', method: 'get', params })
 export const api_Data5 = params => request({ url: '/data/level_capita', method: 'get', params })
 
+export function getChallenge(params) {
+  return request({
+    method: 'get',
+    url: '/challenge/index_current_data',
+    params
+  })
+}
+
+export function getChallengeInfo(params) {
+  return request({
+    method: 'get',
+    url: '/challenge/guess_current_data',
+    params
+  })
+}

+ 1 - 1
src/components/Charts/SoldLineChart.vue

@@ -192,7 +192,7 @@ export default {
           {
             name: '总销量',
             type: this.type,
-            data: this.chartData.hard.map((e, i) => +e + +this.chartData.simple[i] + +this.chartData.hard[i])
+            data: this.chartData.hard.map((e, i) => +e + +this.chartData.simple[i] + +this.chartData.old[i])
           }
         ]
       })

+ 8 - 4
src/vendor/Export2Excel.js

@@ -195,12 +195,16 @@ export function export_json_to_excel({
     }))
     /*以第一行为初始值*/
     let result = colWidth[0];
-    for (let i = 1; i < colWidth.length; i++) {
-      for (let j = 0; j < colWidth[i].length; j++) {
-        if (result[j]['wch'] < colWidth[i][j]['wch']) {
-          result[j]['wch'] = colWidth[i][j]['wch'];
+    try {
+      for (let i = 1; i < colWidth.length; i++) {
+        for (let j = 0; j < colWidth[i].length; j++) {
+          if (result[j]['wch'] < colWidth[i][j]['wch']) {
+            result[j]['wch'] = colWidth[i][j]['wch'];
+          }
         }
       }
+    } catch(e) {
+      console.log(e)
     }
     ws['!cols'] = result;
   }

+ 107 - 18
src/views/Challenge.vue

@@ -5,6 +5,7 @@
       <el-input v-model="params.challenge_name" type="text" placeholder="挑战者昵称/手机号" style="width:300px" />
       <el-input v-model="params.accept_name" type="text" placeholder="应战人昵称/手机号" style="width:300px" />
       <el-button type="primary" @click="params.page_index = 1; getList()">搜索</el-button>
+      <el-button type="primary" @click="toExport">导出</el-button>
     </div>
     <el-table
       v-loading="loading"
@@ -14,13 +15,6 @@
       style="width: 100%;margin: 20px 0"
     >
       <el-table-column
-        label="序号"
-        type="index"
-        width="60"
-        align="center"
-        :index="params.page_size * (params.page_index - 1) + 1"
-      />
-      <el-table-column
         prop="u_name"
         label="挑战人昵称"
         align="center"
@@ -31,6 +25,12 @@
         align="center"
       />
       <el-table-column
+        prop="challenge_total"
+        label="挑战人成绩"
+        align="center"
+        width="100"
+      />
+      <el-table-column
         prop="uu_name"
         label="应战人昵称"
         align="center"
@@ -41,31 +41,51 @@
         align="center"
       />
       <el-table-column
-        prop="is_pay"
-        label="挑战失败红包"
-        align="center"
-      />
-      <el-table-column
-        prop="challenge_num"
-        label="挑战卖货数"
+        prop="accept_total"
+        label="应战人成绩"
         align="center"
+        width="100"
       />
       <el-table-column
         prop="challenge_inte"
         label="挑战获胜学分"
         align="center"
+        width="110"
       />
       <el-table-column
+        label="是否结算"
+        align="center"
+        width="90"
+      >
+        <span slot-scope="{ row: { is_pay } }"> {{ +is_pay === 0 ? '未结算' : '已结算' }}</span>
+      </el-table-column>
+      <el-table-column
+        label="状态"
+        align="center"
+        width="90"
+      >
+        <span slot-scope="{ row: { challenge_status } }">{{ challengeType(challenge_status) }}</span>
+      </el-table-column>
+      <el-table-column
         prop="challenge_time"
         label="挑战时间"
         align="center"
       />
       <el-table-column
+        label="获胜方"
+        align="center"
+      >
+        <span slot-scope="{ row }">
+          {{ isWinner(row) }}
+        </span>
+      </el-table-column>
+      <el-table-column
         label="查看详情"
         align="center"
+        width="120"
       >
         <template slot-scope="{ row }">
-          <el-button type="primary" @click="handleInfo(row)">查看详情</el-button>
+          <el-button :disabled="row.challenge_status === 0 || row.challenge_status === 3" type="primary" @click="handleInfo(row)">竞猜详情</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -89,6 +109,16 @@
           <span>应战人: {{ info.accept_name }}</span>
         </el-col>
       </el-row>
+      <el-row>
+        <el-col :span="12">
+          <p>支持人数: {{ info.challenge_num }}</p>
+          <p>学分: {{ info.challenge_total }}</p>
+        </el-col>
+        <el-col :span="12">
+          <p>支持人数: {{ info.accept_num }}</p>
+          <p>学分: {{ info.accept_total }}</p>
+        </el-col>
+      </el-row>
       <p>竞猜人: </p>
       <el-row>
         <el-col :span="12">
@@ -106,7 +136,7 @@
   </div>
 </template>
 <script>
-import { getList, getInfo } from '@/api/challenge'
+import { getList, getInfo, toExport } from '@/api/challenge'
 export default {
   data() {
     return {
@@ -115,8 +145,8 @@ export default {
         page_size: 15,
         challenge_name: '',
         accept_name: '',
-        // season: this.$store.state.user.season_list[0].season
-        season: ''
+        season: this.$store.state.user.season_list[0].season
+        // season: ''
       },
       loading: false,
       total: 0,
@@ -134,6 +164,35 @@ export default {
     this.getList()
   },
   methods: {
+    async toExport() {
+      const { challenge_name, accept_name, season } = this.params
+      this.loading = true
+      try {
+        const { data } = await toExport({
+          challenge_name, accept_name, season
+        })
+        this.loading = false
+        if (data && data.length > 0) {
+          import('@/vendor/Export2Excel').then(excel => {
+            const header = ['挑战人昵称', '挑战人手机号', '挑战人学分', '挑战人战区', '挑战人支持人数', '挑战人卖货套数', '挑战人卖货-精装版', '挑战人卖货-老人版', '挑战人卖货-简约版', '应战人昵称', '应战人手机号', '应战人学分', '应战人战区', '应战人支持人数', '应战人卖货套数', '应战人卖货-精装版', '应战人卖货-老人版', '应战人卖货-简约版']
+            const filterVal = ['u_name', 'u_phone', 'c_inte', 'u_war_names', 'challenge_num', 'challenge_total', 'c_hard', 'c_old', 'c_simple', 'uu_name',
+              'uu_phone', 'a_inte', 'uu_war_names', 'accept_num', 'accept_total', 'a_hard', 'a_old', 'a_simple']
+            const out = data.map(v => filterVal.map(j => v[j] || ''))
+            excel.export_json_to_excel({
+              header,
+              data: out,
+              filename: `${(new Date()).toLocaleString()}挑战数据`,
+              autoWidth: true,
+              bookType: 'xlsx'
+            })
+          })
+        } else {
+          this.$message.error('没有可导出数据')
+        }
+      } catch (e) {
+        this.loading = false
+      }
+    },
     switchseason(index) { // 切换赛季
       this.params.season = this.season_list[index].season
       this.getList()
@@ -174,6 +233,36 @@ export default {
     resetInfo() {
       this.challengeInfo = false
       this.info = {}
+    },
+    isWinner(row) {
+      if (!row.challenge_success_id && row.challenge_success_id !== 0) return '暂无'
+      if (row.challenge_success_id === 0) {
+        return '平局'
+      } else {
+        if (row.challenge_success_id === row.challenge_id) {
+          return row.u_name
+        } else {
+          return row.uu_name
+        }
+      }
+    },
+    challengeType(status) {
+      let out
+      switch (+status) {
+        case 0:
+          out = '未接受'
+          break
+        case 1:
+          out = '已接受'
+          break
+        case 2:
+          out = '已结束'
+          break
+        default:
+          out = '已拒绝'
+          break
+      }
+      return out
     }
   }
 }

+ 6 - 3
src/views/DataScreen3/Contrast/index.vue

@@ -6,7 +6,7 @@
     <Chart
       :data="{
         x: { name: '赛季', value: data1.map(e => `第${e.season}赛季`) },
-        y: { '销售主管': data1.map(e => e.tj), '销售经理': data1.map(e => e.top), '报名人数': data1.map(e => e.all) }
+        y: { '销售主管': data1.map(e => e.tj), '销售经理': data1.map(e => e.top), '代理公司': data1.map(e => e.crown),'报名人数': data1.map(e => e.all) }
       }"
       title="报名数据对比"
       unit="人"
@@ -16,6 +16,7 @@
       <el-table-column label="赛季" prop="season" align="center" width="54" />
       <el-table-column label="销售主管" prop="tj" align="center" />
       <el-table-column label="销售经理" prop="top" align="center" />
+      <el-table-column label="代理公司" prop="crown" align="center" />
       <el-table-column label="报名人数" prop="all" align="center" />
     </el-table>
     <div class="header">
@@ -78,7 +79,7 @@
     <Chart
       :data="{
         x: { name: '赛季', value: data4.map(e => `第${e.season}赛季`) },
-        y: { '销售主管': data4.map(e => +e.tj.replace('%', '')), '销售经理': data4.map(e => +e.top.replace('%', '')), '总人数': data4.map(e => +e.all.replace('%', '')) }
+        y: { '销售主管': data4.map(e => +e.tj.replace('%', '')), '销售经理': data4.map(e => +e.top.replace('%', '')), '代理公司': data4.map(e => +e.crown.replace('%', '')), '总人数': data4.map(e => +e.all.replace('%', '')) }
       }"
       title="销售人员占比对比"
       unit="%"
@@ -88,6 +89,7 @@
       <el-table-column label="赛季" prop="season" align="center" width="54" />
       <el-table-column label="销售主管" prop="tj" align="center" />
       <el-table-column label="销售经理" prop="top" align="center" />
+      <el-table-column label="代理公司" prop="crown" align="center" />
       <el-table-column label="总人数" prop="all" align="center" />
     </el-table>
     <div class="header">
@@ -96,7 +98,7 @@
     <Chart
       :data="{
         x: { name: '赛季', value: data5.map(e => `第${e.season}赛季`) },
-        y: { '销售主管': data5.map(e => +e.tj.replace('%', '')), '销售经理': data5.map(e => +e.top.replace('%', '')) }
+        y: { '销售主管': data5.map(e => +e.tj.replace('%', '')), '销售经理': data5.map(e => +e.top.replace('%', '')), '代理公司': data5.map(e => +e.crown.replace('%', '')) }
       }"
       title="各级别销售数量对比"
       unit="%"
@@ -106,6 +108,7 @@
       <el-table-column label="赛季" prop="season" align="center" width="54" />
       <el-table-column label="销售主管" prop="tj" align="center" />
       <el-table-column label="销售经理" prop="top" align="center" />
+      <el-table-column label="代理公司" prop="crown" align="center" />
     </el-table>
   </div>
 </template>

+ 273 - 8
src/views/DataScreen3/index.vue

@@ -85,11 +85,13 @@
       <div class="chooseItem" style="background: #A583F3;" @click="showDataType = 0;">各省排名</div>
       <div class="chooseItem" style="background: #24A8E8;" @click="showDataType = 2">城市排名</div>
       <div class="chooseItem" style="background: #617FF1;" @click="showDataType = 1">代理公司排名</div>
+      <div class="chooseItem" style="background: #617FF1;" @click="showDataType = 4">销售经理排名</div>
+      <div class="chooseItem" style="background: #617FF1;" @click="showDataType = 8">销售主管排名</div>
       <div class="chooseItem" style="background: #25C1CA;" @click="showDataType = 3">政委战区排名</div>
-      <div class="chooseItem" style="background: #617FF1;" @click="showDataType = 4">销售排名</div>
       <div class="chooseItem" style="background: #25C1CA;" @click="showDataType = 5">数据分析</div>
       <div class="chooseItem" style="background: #A583F3;" @click="showDataType = 6">往期对比</div>
       <div class="chooseItem" style="background: #24A8E8;" @click="showDataType = 7">报名数据</div>
+      <div class="chooseItem" style="background: #24A8E8;" @click="showDataType = 9">挑战管理</div>
     </div>
     <div v-show="showDataType === 0" class="header">
       <span>各省销售情况</span>
@@ -136,13 +138,22 @@
       <span>代理公司排名</span>
     </div>
     <div v-show="showDataType === 1" class="table-wrapper table-wrapper-rank">
-      <el-table :data="rank" style="width: 100%" border>
+      <!-- <el-table :data="soldRank" style="width: 100%" border>
         <el-table-column label="排名" type="index" align="center" :index="index => index + 1" />
         <el-table-column label="代理公司" prop="nickname" align="center" />
         <el-table-column label="销售数量" prop="value" align="center" />
         <el-table-column label="销售金额" prop="money" align="center" />
       </el-table>
-      <el-button id="more" plain style="width: 100%;" @click="more">{{ rank.length >= data.list5.length ? '没有更多了' : '查看更多' }}</el-button>
+      <el-button id="more" plain style="width: 100%;" @click="more">{{ rank.length >= data.list5.length ? '没有更多了' : '查看更多' }}</el-button> -->
+      <el-table :data="soldRank" border>
+        <el-table-column label="排名" type="index" align="center" :index="index => index + 1" />
+        <el-table-column label="昵称" prop="nickname" align="center" />
+        <el-table-column label="精装版" prop="hard" align="center" />
+        <el-table-column label="简约版" prop="simple" align="center" />
+        <el-table-column label="老人版" prop="old" align="center" />
+        <el-table-column label="合计数量" prop="num" align="center" />
+        <el-table-column label="合计金额" prop="money" align="center" />
+      </el-table>
     </div>
     <div v-show="showDataType === 2" class="header">
       <span>各级别城市销售情况</span>
@@ -191,7 +202,7 @@
       </el-table>
     </div>
     <div v-show="showDataType === 4" class="header">
-      <span>销售排名</span>
+      <span>销售经理排名</span>
     </div>
     <div v-show="showDataType === 4" class="table-wrapper">
       <el-table :data="soldRank" border>
@@ -204,6 +215,20 @@
         <el-table-column label="合计金额" prop="money" align="center" />
       </el-table>
     </div>
+    <div v-show="showDataType === 8" class="header">
+      <span>销售主管排名</span>
+    </div>
+    <div v-show="showDataType === 8" class="table-wrapper">
+      <el-table :data="soldRank" border>
+        <el-table-column label="排名" type="index" align="center" :index="index => index + 1" />
+        <el-table-column label="昵称" prop="nickname" align="center" />
+        <el-table-column label="精装版" prop="hard" align="center" />
+        <el-table-column label="简约版" prop="simple" align="center" />
+        <el-table-column label="老人版" prop="old" align="center" />
+        <el-table-column label="合计数量" prop="num" align="center" />
+        <el-table-column label="合计金额" prop="money" align="center" />
+      </el-table>
+    </div>
     <div v-show="showDataType === 5" class="header">
       <span>数据分析</span>
     </div>
@@ -220,6 +245,7 @@
               <div class="merge-item-item item">总人数</div>
               <div class="merge-item-item item">销售主管人数</div>
               <div class="merge-item-item item">销售经理人数</div>
+              <div class="merge-item-item item">代理公司人数</div>
             </div>
             <div v-if="scope.$index === 2" class="merge-item">
               <div class="merge-item-item item">销售数量</div>
@@ -228,13 +254,16 @@
             <div v-if="scope.$index === 3" class="merge-item">
               <div class="merge-item-item item">销售主管</div>
               <div class="merge-item-item item">销售经理</div>
+              <div class="merge-item-item item">代理公司</div>
             </div>
             <div v-if="scope.$index === 4" class="merge-item">
               <div class="merge-item-item item">总人数</div>
               <div class="merge-item-item item">销售主管/报名人数</div>
               <div class="merge-item-item item">销售经理/报名人数</div>
+              <div class="merge-item-item item">代理公司/报名人数</div>
               <div class="merge-item-item item">销售主管/总人数</div>
               <div class="merge-item-item item">销售经理/总人数</div>
+              <div class="merge-item-item item">代理公司/总人数</div>
             </div>
           </template>
         </el-table-column>
@@ -248,6 +277,7 @@
               <div class="merge-item-item item">{{ scope.row.data.total }}</div>
               <div class="merge-item-item item">{{ scope.row.data.tj }}</div>
               <div class="merge-item-item item">{{ scope.row.data.top }}</div>
+              <div class="merge-item-item item">{{ scope.row.data.crown }}</div>
             </div>
             <div v-if="scope.$index === 2" class="merge-item">
               <div class="merge-item-item item">{{ scope.row.data.num }}</div>
@@ -256,13 +286,16 @@
             <div v-if="scope.$index === 3" class="merge-item">
               <div class="merge-item-item item">{{ scope.row.data.tj }}</div>
               <div class="merge-item-item item">{{ scope.row.data.top }}</div>
+              <div class="merge-item-item item">{{ scope.row.data.crown }}</div>
             </div>
             <div v-if="scope.$index === 4" class="merge-item">
               <div class="merge-item-item item">{{ scope.row.data.p1 }}</div>
               <div class="merge-item-item item">{{ scope.row.data.p2 }}</div>
               <div class="merge-item-item item">{{ scope.row.data.p3 }}</div>
+              <div class="merge-item-item item">{{ scope.row.data.p6 }}</div>
               <div class="merge-item-item item">{{ scope.row.data.p4 }}</div>
               <div class="merge-item-item item">{{ scope.row.data.p5 }}</div>
+              <div class="merge-item-item item">{{ scope.row.data.p7 }}</div>
             </div>
           </template>
         </el-table-column>
@@ -284,6 +317,128 @@
       <span>全国销售情况</span>
     </div>
     <sold-line-chart v-if="lineChartData.old" :chart-data="lineChartData" /> -->
+    <div v-show="showDataType === 9" class="header">
+      <span>挑战信息</span>
+    </div>
+    <div v-show="showDataType === 9" class="table-wrapper table-wrapper5">
+      <el-table :data="challengeList" border>
+        <el-table-column
+          prop="u_name"
+          label="挑战人昵称"
+          align="center"
+        />
+        <el-table-column
+          prop="u_phone"
+          label="挑战人手机号"
+          align="center"
+        />
+        <el-table-column
+          prop="challenge_total"
+          label="挑战人成绩"
+          align="center"
+        />
+        <el-table-column
+          prop="uu_name"
+          label="应战人昵称"
+          align="center"
+        />
+        <el-table-column
+          prop="uu_phone"
+          label="应战人手机号"
+          align="center"
+        />
+        <el-table-column
+          prop="accept_total"
+          label="应战人成绩"
+          align="center"
+        />
+        <el-table-column
+          prop="challenge_inte"
+          label="挑战获胜学分"
+          align="center"
+        />
+        <el-table-column
+          label="是否结算"
+          align="center"
+          width="90"
+        >
+          <span slot-scope="{ row: { is_pay } }"> {{ +is_pay === 0 ? '未结算' : '已结算' }}</span>
+        </el-table-column>
+        <el-table-column
+          label="状态"
+          align="center"
+          width="90"
+        >
+          <span slot-scope="{ row: { challenge_status } }">{{ challengeType(challenge_status) }}</span>
+        </el-table-column>
+        <el-table-column
+          prop="challenge_time"
+          label="挑战时间"
+          align="center"
+        />
+        <el-table-column
+          label="获胜方"
+          align="center"
+        >
+          <span slot-scope="{ row }">
+            {{ isWinner(row) }}
+          </span>
+        </el-table-column>
+        <el-table-column
+          label="查看详情"
+          align="center"
+        >
+          <template slot-scope="{ row }">
+            <el-button :disabled="row.challenge_status === 0 || row.challenge_status === 3" type="primary" @click="handleInfo(row)">竞猜详情</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        style="margin: 20px 0"
+        background
+        :total="challengeTotal"
+        :page-size="challengeParams.page_size"
+        layout="total, prev, pager, next, jumper"
+        @current-change="handleCurrentChange"
+      />
+      <el-dialog
+        title="竞猜详情"
+        :visible.sync="challengeInfoShow"
+        :before-close="resetInfo"
+      >
+        <el-row :gutter="20">
+          <el-col :span="12" class="info-header">
+            <span>挑战人: {{ challengeInfo.challenge_name }}</span>
+          </el-col>
+          <el-col :span="12" class="info-header">
+            <span>应战人: {{ challengeInfo.accept_name }}</span>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <p>支持人数: {{ challengeInfo.challenge_num }}</p>
+            <p>学分: {{ challengeInfo.challenge_total }}</p>
+          </el-col>
+          <el-col :span="12">
+            <p>支持人数: {{ challengeInfo.accept_num }}</p>
+            <p>学分: {{ challengeInfo.accept_total }}</p>
+          </el-col>
+        </el-row>
+        <p>竞猜人: </p>
+        <el-row>
+          <el-col :span="12">
+            <p v-for="item in challengeInfo.challenge" :key="item.id">
+              {{ item.nickname }}
+            </p>
+          </el-col>
+          <el-col :span="12">
+            <p v-for="item in challengeInfo.accept" :key="item.id">
+              {{ item.nickname }}
+            </p>
+          </el-col>
+        </el-row>
+      </el-dialog>
+    </div>
   </div>
 </template>
 
@@ -294,7 +449,7 @@ import DataScreen1 from '@/views/DataScreen1'
 import SoldLineChart from '@/components/Charts/SoldLineChart'
 import ColumnarSoldChart from '@/components/Charts/ColumnarSoldChart'
 import Contrast from './Contrast/index'
-import { dataSoldMap, dataSoldProvince, dataSoldProvinceChart, dataSoldCity, dataSoldRank, dataDataAna, dataWarRank } from '@/api/data'
+import { getChallenge, getChallengeInfo, dataSoldMap, dataSoldProvince, dataSoldProvinceChart, dataSoldCity, dataSoldRank, dataDataAna, dataWarRank } from '@/api/data'
 export default {
   name: 'DataScreen3',
   components: { SoldLineChart, ColumnarSoldChart, DataScreen1, Contrast },
@@ -317,7 +472,18 @@ export default {
         { name: '老人版销售量排名', value: 3 }
       ],
       dataAna: [],
-      warRank: []
+      warRank: [],
+      challengeParams: {
+        page_index: 1,
+        page_size: 15,
+        challenge_name: '',
+        accept_name: '',
+        season: ''
+      },
+      challengeList: [],
+      challengeTotal: 0,
+      challengeInfo: {},
+      challengeInfoShow: false
     }
   },
   computed: {
@@ -363,9 +529,23 @@ export default {
             window.scrollTo(0, document.getElementsByClassName('chooseBar')[0].offsetTop)
           })
         })
-      } else if (n === 4 && this.soldRank.length === 0) {
+      } else if (n === 4 || n === 1 || n === 8) {
         this._loading = this.$loading()
-        dataSoldRank().then(({ data: { list }}) => {
+        let name
+        switch (+n) {
+          case 8:
+            name = '销售主管'
+            break
+          case 4:
+            name = '销售经理'
+            break
+          default:
+            name = '代理公司'
+            break
+        }
+        dataSoldRank({
+          level_name: name
+        }).then(({ data: { list }}) => {
           this._loading.close()
           this.soldRank = list
           this.$nextTick(() => {
@@ -381,6 +561,18 @@ export default {
             window.scrollTo(0, document.getElementsByClassName('chooseBar')[0].offsetTop)
           })
         })
+      } else if (n === 9) {
+        this._loading = this.$loading()
+        getChallenge(this.challengeParams).then(res => {
+          this._loading.close()
+          if (res.code === 200) {
+            this.challengeList = res.data.list
+            this.challengeTotal = res.data.total
+          }
+        }).catch(() => {
+          this._loading.close()
+          this.$message.error('获取数据失败')
+        })
       } else {
         this.$nextTick(() => {
           window.scrollTo(0, document.getElementsByClassName('chooseBar')[0].offsetTop)
@@ -401,6 +593,69 @@ export default {
     clearInterval(this.timer)
   },
   methods: {
+    resetInfo() {
+      this.challengeInfoShow = false
+      this.challengeInfo = {}
+    },
+    async handleInfo(row) {
+      this._loading = this.$loading()
+      await getChallengeInfo({ id: row.id }).then(res => {
+        this._loading.close()
+        if (res.code === 200) {
+          this.challengeInfo = res.data
+          this.challengeInfoShow = true
+        } else {
+          this.$message.error(res.data)
+        }
+      }).catch(e => {
+        this._loading.close()
+      })
+    },
+    isWinner(row) {
+      if (!row.challenge_success_id && row.challenge_success_id !== 0) return '暂无'
+      if (row.challenge_success_id === 0) {
+        return '平局'
+      } else {
+        if (row.challenge_success_id === row.challenge_id) {
+          return row.u_name
+        } else {
+          return row.uu_name
+        }
+      }
+    },
+    challengeType(status) {
+      let out
+      switch (+status) {
+        case 0:
+          out = '未接受'
+          break
+        case 1:
+          out = '已接受'
+          break
+        case 2:
+          out = '已结束'
+          break
+        default:
+          out = '已拒绝'
+          break
+      }
+      return out
+    },
+    handleCurrentChange(page) { // 换页
+      this.loading = true
+      this.challengeParams.page_index = page
+      this._loading = this.$loading()
+      getChallenge(this.challengeParams).then(res => {
+        this._loading.close()
+        if (res.code === 200) {
+          this.challengeList = res.data.list
+          this.challengeTotal = res.data.total
+        }
+      }).catch(() => {
+        this._loading.close()
+        this.$message.error('获取数据失败')
+      })
+    },
     more() {
       const top = document.getElementById('more').offsetTop
       this.rankIndex++
@@ -738,4 +993,14 @@ export default {
       }
     }
   }
+  .info-header {
+    padding: 10px 0;
+    background: #409EFF;
+    color: #ffffff;
+
+    &:nth-last-of-type(1) {
+      // margin-left: 20px;
+      background: #67C23A;
+    }
+  }
 </style>

+ 154 - 90
src/views/SeasonSet.vue

@@ -19,85 +19,136 @@
       </div>
     </div>
     <div class="set">
-      <el-form :label-position="labelPosition" label-width="116px" :model="formLabelAlign">
-        <el-form-item label="季数:">
-          <el-input v-model="formLabelAlign.season" :disabled="disabled" placeholder="请输入届数" />
-        </el-form-item>
-        <el-form-item label="报名金额:(元)">
-          <el-input v-model="formLabelAlign.cost" :disabled="disabled" placeholder="请输入报名金额" />
-        </el-form-item>
-
-        <el-form-item label="报名开始时间:">
-          <el-date-picker
-            v-model="formLabelAlign.sign_start_time"
-            :disabled="disabled"
-            type="datetime"
-            placeholder="请选择报名开始时间"
-            @change="datechange"
-          />
-        </el-form-item>
-        <el-form-item label="报名结束时间:">
-          <el-date-picker
-            v-model="formLabelAlign.sign_end_time"
-            :disabled="disabled"
-            type="datetime"
-            placeholder="请选择报名结束时间"
-            @change="datechange"
-          />
-        </el-form-item>
-
-        <el-form-item label="比赛开始时间:">
-          <el-date-picker
-            v-model="formLabelAlign.round_start_time"
-            :disabled="disabled"
-            type="datetime"
-            placeholder="请选择比赛开始时间"
-            @change="datechange"
-          />
-        </el-form-item>
-        <el-form-item label="比赛结束时间:">
-          <el-date-picker
-            v-model="formLabelAlign.round_end_time"
-            :disabled="disabled"
-            type="datetime"
-            placeholder="请选择比赛结束时间"
-            @change="datechange"
-          />
-        </el-form-item>
-
-        <el-form-item label="兑换开始时间:">
-          <el-date-picker
-            v-model="formLabelAlign.gift_start_time"
-            :disabled="disabled"
-            type="datetime"
-            placeholder="请选择兑换开始时间"
-            @change="datechange"
-          />
-        </el-form-item>
-        <el-form-item label="兑换结束时间:">
-          <el-date-picker
-            v-model="formLabelAlign.gift_end_time"
-            :disabled="disabled"
-            type="datetime"
-            placeholder="请选择兑换结束时间"
-            @change="datechange"
-          />
-        </el-form-item>
-        <el-form-item label="挑战次数:">
-          <el-input v-model="formLabelAlign.challenge_num" type="number" placeholder="请输入挑战次数" />
-        </el-form-item>
-        <el-form-item label="获胜奖励学分:">
-          <el-input v-model="formLabelAlign.challenge_inte" type="number" placeholder="请输入挑战获胜奖励学分" />
-        </el-form-item>
-        <el-form-item label="竞猜学分:">
-          <el-input v-model="formLabelAlign.guessing_inte" type="number" placeholder="请输入竞猜学分" />
-        </el-form-item>
-        <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-form :label-position="labelPosition" label-width="150px" :model="formLabelAlign">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="季数:">
+              <el-input v-model="formLabelAlign.season" :disabled="disabled" placeholder="请输入届数" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="报名金额:(元)">
+              <el-input v-model="formLabelAlign.cost" :disabled="disabled" placeholder="请输入报名金额" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="报名开始时间:">
+              <el-date-picker
+                v-model="formLabelAlign.sign_start_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="请选择报名开始时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="报名结束时间:">
+              <el-date-picker
+                v-model="formLabelAlign.sign_end_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="请选择报名结束时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="比赛开始时间:">
+              <el-date-picker
+                v-model="formLabelAlign.round_start_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="请选择比赛开始时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="比赛结束时间:">
+              <el-date-picker
+                v-model="formLabelAlign.round_end_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="请选择比赛结束时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="兑换开始时间:">
+              <el-date-picker
+                v-model="formLabelAlign.gift_start_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="请选择兑换开始时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="兑换结束时间:">
+              <el-date-picker
+                v-model="formLabelAlign.gift_end_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="请选择兑换结束时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="挑战次数:">
+              <el-input v-model="formLabelAlign.challenge_num" type="number" placeholder="请输入挑战次数" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="竞猜次数:">
+              <el-input v-model="formLabelAlign.guessing_num" type="number" placeholder="不填写则为不限次数" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="挑战成功学分:">
+              <el-input v-model="formLabelAlign.challenge_inte" type="number" placeholder="请输入挑战获胜奖励学分" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="竞猜学分:">
+              <el-input v-model="formLabelAlign.guessing_inte" type="number" placeholder="请输入竞猜学分" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="挑战失败学分:">
+              <el-input v-model="formLabelAlign.challenge_inte_fail" type="number" placeholder="扣学分请输入负数(例: -10)" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="竞猜失败学分:">
+              <el-input v-model="formLabelAlign.guessing_inte_fail" type="number" placeholder="扣学分请输入负数(例: -10)" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="挑战等待时间(小时):">
+              <el-input v-model="formLabelAlign.give_up_time" type="number" placeholder="默认挑战等待时间(小时)" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="竞猜周期(小时):">
+              <el-input v-model="formLabelAlign.guess_end_time" type="number" placeholder="默认竞猜周期(小时)" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="禁止挑战时间:">
+              <el-date-picker
+                v-model="formLabelAlign.no_challenge_time"
+                :disabled="disabled"
+                type="datetime"
+                placeholder="禁止挑战时间"
+                @change="datechange"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-button v-loading="loading" type="primary" :disabled="disabled" @click="submitForm">设置</el-button>
       </el-form>
     </div>
@@ -126,7 +177,11 @@ export default {
         challenge_inte: '',
         give_up_time: '',
         guessing_inte: '',
-        guess_end_time: ''
+        guess_end_time: '',
+        guessing_num: '',
+        guessing_inte_fail: '',
+        challenge_inte_fail: '',
+        no_challenge_time: ''
       },
       startDay: new Date(),
       disabled: false,
@@ -173,15 +228,23 @@ export default {
         challenge_inte: this.formLabelAlign.challenge_inte,
         give_up_time: this.formLabelAlign.give_up_time,
         guessing_inte: this.formLabelAlign.guessing_inte,
-        guess_end_time: this.formLabelAlign.guess_end_time
-      }).then(() => {
+        guess_end_time: this.formLabelAlign.guess_end_time,
+        guessing_num: this.formLabelAlign.guessing_num,
+        guessing_inte_fail: this.formLabelAlign.guessing_inte_fail,
+        challenge_inte_fail: this.formLabelAlign.challenge_inte_fail,
+        no_challenge_time: this.formLabelAlign.no_challenge_time
+      }).then((res) => {
         this.loading = false
-        Message({
-          message: '设置成功',
-          duration: 3 * 1000,
-          type: 'success'
-        })
-        this.getSetStatus()
+        if (res.code === 200) {
+          Message({
+            message: '设置成功',
+            duration: 3 * 1000,
+            type: 'success'
+          })
+          this.getSetStatus()
+        } else {
+          this.$message.error(res.data)
+        }
       }, () => {
         this.loading = false
         Message({
@@ -257,7 +320,7 @@ export default {
     }
   }
   .set {
-    width: 345px;
+    width: 850px;
     margin: 22px auto;
     .el-input {
       width: 226px;
@@ -271,7 +334,8 @@ export default {
         width: 100%;
       }
       .el-button {
-        width: 100%;
+        width: 300px;
+        margin: 0 auto;
         margin-top: 11px;
       }
     }

+ 2 - 2
vue.config.js

@@ -19,8 +19,8 @@ module.exports = {
     },
     proxy: {
       [process.env.VUE_APP_BASE_API]: {
-        target: 'https://api.admin.jiuweiyun.cn/api',
-        // target: 'http://192.168.0.4:8090/api',
+        // target: 'https://api.admin.jiuweiyun.cn/api',
+        target: 'http://192.168.0.15:8016/api',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''