Pārlūkot izejas kodu

Merge branch 'master' of http://192.168.123.2:3000/fort23/010GMClient

Administrator 8 mēneši atpakaļ
vecāks
revīzija
de1d94a7f8

+ 6 - 0
src/api/player.ts

@@ -175,5 +175,11 @@ export default {
             url: '/server/getSrvList',
             method: 'get'
         });
+    },editTaskState(data) {
+        return request({
+            url: '/player/editTaskState',
+            method: 'post',
+            data
+        });
     }
 }

+ 2 - 1
src/api/request.ts

@@ -6,7 +6,8 @@ const service = axios.create({
     // 默认请求地址,根据环境的不同可在.env 文件中进行修改
     // baseURL: import.meta.env.VUE_APP_BASE_
     // 本地地址
-    baseURL: "http://127.0.0.1:8001/api",
+    //baseURL: "http://127.0.0.1:8001/api",
+    baseURL: "http://119.91.156.147:1007/api",
     // 华为云地址
     // baseURL: "http://119.3.32.162:666/api",
     // 测试服地址

+ 1 - 1
src/components/player/BPInfo/index.vue

@@ -160,7 +160,7 @@ const editBps = (row: any) => {
     let data = {
         playerId: props.ruleForm.id,
         bluePrintId: row.bid,
-        srvI:props.ruleForm.gId
+        srvId:props.ruleForm.gId
     }
 
     playerApi.makeBps(data).then((resp) => {

+ 254 - 0
src/components/player/taskInfo/index.vue

@@ -0,0 +1,254 @@
+<template>
+    <div class="container">
+        <!-- 搜索框 -->
+        <el-input v-model="search" placeholder="输入关键字" :maxlength="20" />
+        <el-button class="searchButton" @Click="tableData()" type="primary">搜索</el-button>
+    </div>
+
+    <el-table :data="tableData()" class="table-container" :border="true">
+        <el-table-column prop="id" label="任务ID" align="center" />
+        <el-table-column prop="ty" label="任务类型" align="center" />
+        <el-table-column prop="rvl" label="完成值" align="center" value="0" />
+        <el-table-column prop="tia" label="领取状态" align="center" />
+        <el-table-column label="操作" width="500" align="center">
+            <template #default="scope">
+                <el-button @click="editTask(scope.row,0)" type="Edit" :icon="Edit">未完成</el-button>
+                <el-button @click="editTask(scope.row,1)" type="Edit" :icon="Edit">完成未领奖</el-button>
+                <el-button @click="editTask(scope.row,2)" type="Edit" :icon="Edit">完成已领奖</el-button>
+            </template>
+        </el-table-column>
+    </el-table>
+
+    <el-pagination style="margin: auto;" class="pagination-container" background layout="prev, pager, next ,total,sizes"
+        :total="state.total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
+
+    <!-- 模态框 -->
+    <el-dialog :title="dialogTitle" v-model="showModal" @close="closeModal" width="350px">
+
+        <el-form-item label="引导组">
+            <el-input v-model="itemId" placeholder="输入道具ID" :maxlength="10"
+                style="width: 200px;position: relative; left: 41.219px;" />
+        </el-form-item>
+        <el-form-item label="引导ID">
+            <el-input v-model="itemNum" placeholder="请输入道具数量" :maxlength="5"
+                style="width: 200px;position: relative; left: 28px;" />
+        </el-form-item>
+
+        <span slot="footer" class="dialog-footer" style="position: absolute; right: 20px; bottom: 10px;">
+            <el-button type="primary" @click="saveItem">保存</el-button>
+            <el-button @click="closeModal">关闭</el-button>
+        </span>
+    </el-dialog>
+</template>
+<script lang="ts" setup>
+import { id } from 'element-plus/es/locale';
+import { ElMessageBox, ElMessage } from 'element-plus';
+import { reactive, ref, toRefs, defineComponent } from 'vue'
+import { Edit, Check, Close, Delete } from '@element-plus/icons-vue'
+import playerApi from '@/api/player'
+
+const props = defineProps({
+    tasks: Array,
+    ruleForm: Object,
+    callback: {
+        type: Function,
+        required: true
+    }
+});
+
+
+let dialogTitle = ref<string>('');
+
+const showModal = ref<Boolean>(false);
+const itemId = ref("");
+const itemNum = ref<Number>(1);
+const search = ref("");
+
+const state = reactive({
+    page: 1,
+    limit: 10,
+    total: props.tasks.length
+});
+
+const tableData = () => {
+    let tasks: any = [];
+    if (search.value == "") {
+        state.total = props.tasks.length;
+        tasks = props.tasks;
+    } else {
+        const regex = new RegExp(search.value, 'i');
+        tasks = props.tasks.filter(
+            (task: { id: string}, index) => {
+                return regex.test(task.id);
+            }
+        );
+        state.total = tasks.length;
+
+    }
+
+    return tasks.filter(
+        (item, index) =>
+            index < state.page * state.limit &&
+            index >= state.limit * (state.page - 1)
+    );
+};
+
+// 分页
+// 删除引导
+const editTask = (row: any,state1) => {
+    ElMessageBox.confirm('确定要修改引导吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消'
+    }).then(() => {
+        let data = {
+            playerId: props.ruleForm.id,
+            taskIds: row.id,
+            state: state1,
+            srvId: props.ruleForm.gId
+        }
+
+        console.log(data);
+
+        let resp = playerApi.editTaskState(data);
+
+        ElMessage({
+            message: "修改成功",
+            type: 'info',
+            duration: 3000
+        });
+        // let index = props.tasks.indexOf(row);
+        // props.tasks.splice(index, 1);
+    }).catch(() => { });
+}
+
+const addItem = () => {
+    dialogTitle.value = "添加道具";
+    showModal.value = true;
+}
+
+const closeModal = () => {
+    itemId.value = null;
+    itemNum.value = 1;
+    showModal.value = false;
+    dialogTitle.value = "添加图纸";
+}
+
+// 保存
+const saveItem = () => {
+    let data = {
+        playerId: props.ruleForm.id,
+        itemId: itemId.value,
+        itemNum: itemNum.value,
+        srvId: props.ruleForm.gId
+    }
+
+    // playerApi.addPlayerItem(data).then((resp) => {
+    //     let data = resp.data.result;
+
+    //     if (data === '道具添加失败' || data === '已拥有该道具') {
+    //         ElMessage({
+    //             message: data,
+    //             type: 'error',
+    //             duration: 3000
+    //         });
+    //     } else {
+    //         props.callback(data)
+    //     }
+    // });
+
+    showModal.value = false;
+}
+
+const handleCurrentChange = (e) => {
+    state.page = e;
+};
+
+const handleSizeChange = (e) => {
+    state.limit = e;
+};
+
+
+// 道具修改
+const handlEditClick = (row: any) => {
+    row.editing = true;
+    row.tempCount = row.count;
+};
+
+const handleSaveClick = (row: any) => {
+    // row.editing = false;
+
+    ElMessageBox.confirm('确定要修改道具数量吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消'
+    }).then(() => {
+        row.editing = false;
+        let data = {
+            playerId: props.ruleForm.id,
+            itemId: row.id,
+            itemNum: row.tempCount,
+            srvId: props.ruleForm.gId
+        }
+
+        let resp = playerApi.editPlayerItem(data);
+
+        row.count = row.tempCount;
+        ElMessage({
+            message: "修改成功",
+            type: 'info',
+            duration: 3000
+        });
+    }).catch(() => { });
+};
+
+const handleCancelClick = (row: any) => {
+    row.editing = false;
+    row.tempCount = row.count;
+};
+</script>
+
+<style>
+.con {
+    display: flex;
+    align-items: center;
+}
+
+.input-container {
+    align-items: center;
+    width: 250px;
+}
+
+
+.searchButton {
+    margin-right: 10px;
+}
+
+.button-container {
+    position: relative;
+    left: 1%;
+    transform: translateY(-8%);
+}
+
+.container {
+    display: flex;
+    align-items: center;
+    width: 200px;
+    margin-bottom: 20px;
+}
+
+.edit-button {
+    position: absolute;
+    top: 50%;
+    left: 400px;
+    transform: translateY(-50%);
+}
+
+.table-container {
+    display: grid;
+    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+}
+
+.pagination-container {
+    display: flex;
+    justify-content: center;
+}
+</style>

+ 17 - 3
src/views/player/index.vue

@@ -40,6 +40,9 @@
         <el-collapse-item name="6" title="引导信息">
           <guidesInfo :guides="guides" :ruleForm="ruleForm" :callback="addGuides"></guidesInfo>
         </el-collapse-item>
+        <el-collapse-item name="7" title="任务信息">
+          <taskInfo :tasks="taskss" :ruleForm="ruleForm" :callback="taskCallBack"></taskInfo>
+        </el-collapse-item>
       </el-collapse>
     </div>
   </div>
@@ -71,6 +74,7 @@ import msaInfo from "@/components/player/msaInfo/index.vue"
 import heroInfo from "@/components/player/heroInfo/index.vue"
 import bpInfo from "@/components/player/BPInfo/index.vue"
 import relicInfo from "@/components/player/relicInfo/index.vue"
+import taskInfo from "@/components/player/taskInfo/index.vue"
 import { reactive, ref, toRefs, defineEmits } from 'vue'
 import { FormInstance, ElMessage } from 'element-plus'
 import playerApi from '@/api/player'
@@ -118,6 +122,8 @@ const rls = reactive([]);
 
 const guides = reactive([]);
 
+const taskss = reactive([]);
+
 const onSubmit = async () => {
 
   let resp = playerApi.queryPlayerInfo(formInline1);
@@ -149,6 +155,13 @@ const onSubmit = async () => {
       ruleForm.luTm = jsonData.luTm == null ? '无' : formatDate(new Date(jsonData.luTm * 1000), 'yyyy-MM-dd hh:mm:ss');
     }
 
+    taskss.splice(0, taskss.length);
+    const tasksKey = Object.keys(jsonData.tks);
+    // console.log(tasks);
+    for (let i = 0; i < tasksKey.length; i++) {
+      const k = jsonData.tks[tasksKey[i]];
+      taskss.push(k);
+    }
 
     guides.splice(0, guides.length);
     const guidesKeys = Object.keys(jsonData.pgd);
@@ -161,9 +174,6 @@ const onSubmit = async () => {
       guides.push(json);
     }
 
-    console.log(guides);
-
-
     const itemKeys = Object.keys(jsonData.its);
     for (let i = 0; i < itemKeys.length; i++) {
       const json = jsonData.its[itemKeys[i]];
@@ -207,6 +217,10 @@ const onSubmit = async () => {
   }
 }
 
+const taskCallBack = () => {
+
+}
+
 const addGuides = () => {
 
 }