浏览代码

活动GM开发

Administrator 8 月之前
父节点
当前提交
8f6bf40515
共有 3 个文件被更改,包括 126 次插入159 次删除
  1. 2 2
      src/api/request.ts
  2. 115 148
      src/views/activity/rule/index.vue
  3. 9 9
      src/views/activity/template/index.vue

+ 2 - 2
src/api/request.ts

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

+ 115 - 148
src/views/activity/rule/index.vue

@@ -16,14 +16,15 @@
         </div>
       </template>
       <template v-slot:type="scope">{{ getTypeLabel(scope.row.type) }}</template>
-      <template v-slot:validTime="scope">{{ dateUtils.getDate(scope.row.validTime) }}</template>
-      <template v-slot:invalidTime="scope">{{ dateUtils.getDate(scope.row.invalidTime) }}</template>
+      <template v-slot:isOpen="scope">{{ getIsOpenLabel(scope.row.isOpen) }}</template>
+      <template v-slot:tipsTime="scope">{{ dateUtils.getDate(scope.row.tipsTime) }}</template>
+      <template v-slot:startTime="scope">{{ dateUtils.getDate(scope.row.startTime) }}</template>
+      <template v-slot:endTime="scope">{{ dateUtils.getDate(scope.row.endTime) }}</template>
+      <template v-slot:stayTime="scope">{{ dateUtils.getDate(scope.row.stayTime) }}</template>
       <template v-slot:state="scope">{{ getStateLabel(scope.row) }}</template>
-      <template v-slot:createTime="scope">{{ dateUtils.getDate(scope.row.createTime) }}</template>
-      <template v-slot:items="scope">{{ getItemsLabel(scope.row.items) }}</template>
       <template v-slot:operation="scope">
-        <el-button type="primary" size="small" icon="More" @click="more(scope.row)">
-          详情
+        <el-button type="primary" size="small" icon="Edit" @click="edit(scope.row)">
+          编辑
         </el-button>
         <el-button @click="del(scope.row)" type="danger" size="small" icon="Delete">
           删除
@@ -37,78 +38,71 @@
         <el-form-item label="ID" prop="id" v-show="isIdShow">
           <el-input readonly v-model="ruleForm.id" />
         </el-form-item>
-        <el-form-item label="收件人服务器ID" prop="toServerIds">
-          <el-input v-model="ruleForm.toServerIds" placeholder="默认不填为全服,支持数组,格式:1,2,3..."/>
+        <el-form-item label="活动类型" prop="type">
+          <el-radio-group v-model="ruleForm.type">
+            <el-radio :label="0">限时活动</el-radio>
+            <el-radio :label="1">循环活动</el-radio>
+            <el-radio :label="2">开服活动</el-radio>
+          </el-radio-group>
         </el-form-item>
-        <el-form-item label="收件人角色ID" prop="toPlayerIds">
-          <el-input v-model="ruleForm.toPlayerIds" placeholder="指定具体角色发送,支持数组,格式:10000001,10000002..." />
+        <el-form-item label="活动模版" prop="actTem">
+          <el-radio-group v-model="ruleForm.actTem">
+            <el-radio :label="0">1-模版一</el-radio>
+            <el-radio :label="1">2-模版二</el-radio>
+            <el-radio :label="2">3-模版三</el-radio>
+          </el-radio-group>
         </el-form-item>
-        <el-form-item label="收件人等级条件" prop="levelCondition">
-          <el-input v-model="ruleForm.levelCondition" placeholder="指定角色等级区间[min,max],格式:1,100" />
+        <el-form-item label="生效服务器" prop="gameIds">
+          <el-input v-model="ruleForm.gameIds" placeholder="默认不填为全服,支持数组,格式:1,2,3..."/>
         </el-form-item>
-        <el-form-item label="收件人道具条件" prop="itemCondition">
-          <el-input v-model="ruleForm.itemCondition" placeholder="指定角色拥有道具,支持数组,格式:1001-100,1002-200..." />
+        <el-form-item label="排除服务器" prop="noGameIds">
+          <el-input v-model="ruleForm.noGameIds" placeholder="支持数组,格式:1,2,3..."/>
         </el-form-item>
-        <el-form-item label="收件人英雄条件" prop="heroCondition">
-          <el-input v-model="ruleForm.heroCondition" placeholder="指定角色拥有英雄,支持数组,格式:101,102..."/>
+        <el-form-item label="是否开启" prop="isOpen">
+          <el-radio-group v-model="ruleForm.isOpen">
+            <el-radio :label="0">否</el-radio>
+            <el-radio :label="1">是</el-radio>
+          </el-radio-group>
         </el-form-item>
-
-        <el-form-item label="收件人角色创建">
+        <el-form-item label="活动展示时间">
           <el-col :span="11">
-            <el-form-item prop="roleCreateTimeStart">
-              <el-date-picker v-model="ruleForm.roleCreateTimeStart" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
-                placeholder="选择起始时间" style="width: 100%" />
+            <el-form-item prop="tipsTime">
+              <el-date-picker v-model="ruleForm.tipsTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
+                placeholder="选择预告时间" style="width: 100%" />
             </el-form-item>
           </el-col>
           <el-col class="text-center" :span="2" style="text-align: center">
             <span class="text-gray-500">-</span>
           </el-col>
           <el-col :span="11">
-            <el-form-item prop="roleCreateTimeEnd">
-              <el-date-picker v-model="ruleForm.roleCreateTimeEnd" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
-                placeholder="选择截止时间" style="width: 100%" />
+            <el-form-item prop="stayTime">
+              <el-date-picker v-model="ruleForm.stayTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
+                placeholder="选择停留时间" style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-form-item>
-        <el-form-item label="邮件标题" prop="title">
-          <el-input v-model="ruleForm.title" placeholder="限制7字"/>
-        </el-form-item>
-        <el-form-item label="邮件类型" prop="type">
-          <el-radio-group v-model="ruleForm.type">
-            <el-radio :label="0">一次性(进入游戏或打开邮箱判断一次条件,满足则收到邮件)</el-radio>
-            <el-radio :label="1">常驻(邮件生效期间满足条件,都可以收到邮件)</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="发送者名称" prop="sendName">
-          <el-input v-model="ruleForm.sendName" placeholder="限制10字"/>
-        </el-form-item>
-        <el-form-item label="邮件道具" prop="items">
-          <el-input v-model="ruleForm.items" placeholder="支持数组,格式:1001-100,1002-200..."/>
-        </el-form-item>
-        <el-form-item label="邮件生效时间" required>
-          <el-col :span="7">
-            <el-form-item prop="validTime">
-              <el-date-picker v-model="ruleForm.validTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
-                placeholder="选择起始时间" style="width: 100%" />
+        <el-form-item label="活动生效时间">
+          <el-col :span="11">
+            <el-form-item prop="startTime">
+              <el-date-picker v-model="ruleForm.startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
+                placeholder="选择开启时间" style="width: 100%" />
             </el-form-item>
           </el-col>
           <el-col class="text-center" :span="2" style="text-align: center">
             <span class="text-gray-500">-</span>
           </el-col>
-          <el-col :span="7">
-            <el-form-item prop="invalidTime">
-              <el-date-picker v-model="ruleForm.invalidTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
-                placeholder="选择截止时间" style="width: 100%" />
+          <el-col :span="11">
+            <el-form-item prop="endTime">
+              <el-date-picker v-model="ruleForm.endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
+                placeholder="选择结束时间" style="width: 100%" />
             </el-form-item>
           </el-col>
-          <el-col class="text-enpty" :span="1">
-          </el-col>
-          <el-button type="primary" @click="valid7Day">7天</el-button>
-          <el-button type="primary" @click="valid15Day">15天</el-button>
-          <el-button type="primary" @click="valid30Day">30天</el-button>
         </el-form-item>
-        <el-form-item label="邮件内容" prop="content">
-          <el-input v-model="ruleForm.content" :rows="8" type="textarea" placeholder="限制3000字" />
+        <el-form-item label="循环模版列表" prop="lpActTemList">
+          <el-input v-model="ruleForm.lpActTemList" placeholder="循环活动列表,和循环间隔天数长度一致,格式:1,2..." />
+        </el-form-item>
+        <el-form-item label="循环间隔天数" prop="lpActInterval">
+          <el-input v-model="ruleForm.lpActInterval" placeholder="循环间隔天数,和循环模版列表长度一致,格式:7,7..." />
         </el-form-item>
       </el-form>
       <template #footer>
@@ -164,8 +158,8 @@ const tableData = ref([])
 const tableHeader = ref([])
 const upload = ref<UploadInstance>()
 
-const tableColumn = ["title","sendName","items","validTime","invalidTime",
-  "content","toServerIds","toPlayerIds","levelCondition","roleCreateTimeStart","roleCreateTimeEnd"]
+const tableColumn = ["type","actTem","gameIds","noGameIds","isOpen",
+  "tipsTime","startTime","endTime","stayTime","lpActTemList","lpActInterval"]
 const beforeUploadAction = (file, fileLi) => {
   return new Promise((resolve, reject) => {
     const reader = new FileReader()
@@ -248,36 +242,52 @@ const loadActivityRuleInfo = () => {
 const column = [
   { type: 'selection', width: 60, fixed: 'left' },
   { name: 'id', label: 'ID', width: 80 },
-  { name: 'type', label: '活动类型', inSearch: true, valueType: 'input' },
+  { name: 'type', label: '活动类型', slot: true, inSearch: true, valueType: 'input' },
   { name: 'actTem', label: '活动模版', inSearch: true, valueType: 'input' },
-  { name: 'serverIds', label: '生效服务器', slot: true, inSearch: true, valueType: 'input' },
-  { name: 'noServerIds', label: '排除服务器'},
+  { name: 'gameIds', label: '生效服务器', inSearch: true, valueType: 'input' },
+  { name: 'noGameIds', label: '排除服务器'},
   { name: 'isOpen', label: '是否开启', slot: true},
   { name: 'tipsTime', label: '预告时间', slot: true, valueType: 'datetime' },
   { name: 'startTime', label: '开始时间', slot: true, valueType: 'datetime' },
   { name: 'endTime', label: '结束时间', slot: true, valueType: 'datetime' },
   { name: 'stayTime', label: '停留时间', slot: true, valueType: 'datetime' },
+  { name: 'lpActTemList', label: '循环模版列表', slot: true },
+  { name: 'lpActInterval', label: '循环间隔天数', slot: true },
   { name: 'state', label: '活动状态', slot: true },
   { name: 'operation', slot: true, fixed: 'right', width: 200, label: '操作' },
 ]
 
 const getTypeLabel = (val) => {
   if (val == 0) {
-    return '一次性'
+    return '限时活动'
+  } else if (val == 1) {
+    return '循环活动'
+  } else if (val == 2) {
+    return '开服活动'
+  }
+}
+
+const getIsOpenLabel = (val) => {
+  if (val == 0) {
+    return '否'
   } else if (val == 1) {
-    return '常驻'
+    return ''
   }
 }
 
 const getStateLabel = (val) => {
   // 取得当前时间,单位:秒
   const timestamp: number = Date.parse(new Date().toString());
-  if (timestamp < val.validTime) {
-    return '未发送'
-  } else if (timestamp >= val.validTime && timestamp <= val.invalidTime) {
-    return '发送中'
+  if (timestamp < val.tipsTime) {
+    return '未激活'
+  } else if (timestamp >= val.tipsTime && timestamp <= val.startTime) {
+    return '预告中'
+  } else if (timestamp >= val.startTime && timestamp <= val.endTime) {
+    return '进行中'
+  } else if (timestamp >= val.endTime && timestamp <= val.stayTime) {
+    return '停留中'
   } else {
-    return '已送达'
+    return '已结束'
   }
 }
 
@@ -302,74 +312,36 @@ const ruleFormRef = ref<FormInstance>()
 
 const ruleForm = reactive({
   id: null,
-  title: null,
   type: 0,
-  validTime: null,
-  invalidTime: null,
-  items: null,
-  sendName: '深渊联盟',
-  toServerIds: null,
-  toPlayerIds: null,
-  levelCondition: null,
-  itemCondition: null,
-  heroCondition: null,
-  roleCreateTimeStart: null,
-  roleCreateTimeEnd: null,
-  content: null,
-  createTime: null
+  actTem: 0,
+  gameIds: null,
+  noGameIds: null,
+  isOpen: 0,
+  tipsTime: null,
+  startTime: null,
+  endTime: null,
+  stayTime: null,
+  lpActTemList: null,
+  lpActInterval: null,
 })
 
 const rules = reactive({
-  type: [
-    {
-      required: true,
-    }
-  ],
-  title: [
-    {
-      required: true,
-      message: '请输入邮件标题',
-      trigger: 'change',
-      
-    }, {max: 7, message: "邮件标题长度不能超过7字"}
-  ],
-  sendName: [
-    {
-      required: true,
-      message: '请输入发送者名称',
-      trigger: 'change',
-    }, {max: 10, message: "发送者名称长度不能超过10字"}
-  ],
-  // items: [
-  //   {
-  //     required: true,
-  //     message: '请输入邮件道具',
-  //     trigger: 'change',
-  //   },
-  // ],
-  validTime: [
+  startTime: [
     {
       required: true,
       type: 'date',
-      message: '请选择邮件生效时间',
+      message: '请选择活动开始时间',
       trigger: 'change',
     },
   ],
-  invalidTime: [
+  endTime: [
     {
       required: true,
       type: 'date',
-      message: '请选择邮件失效时间',
+      message: '请选择活动结束时间',
       trigger: 'change',
     },
-  ],
-  content: [
-    {
-      required: true,
-      message: '请输入邮件内容',
-      trigger: 'change',
-    }, {max: 3000, message: "邮件内容长度不能超过3000字"}
-  ],
+  ]
 })
 
 
@@ -380,6 +352,7 @@ const rowObj = ref({})
 const selectObj = ref([])
 const title = ref('详情')
 const isIdShow = ref(true)
+const isLoopShow = ref(true)
 
 const importClose = () => {
   importVisible.value = false
@@ -401,19 +374,16 @@ const add = () => {
   dialogVisible.value = true
   ruleForm.id = null
   ruleForm.type = 0
-  ruleForm.toServerIds = null
-  ruleForm.toPlayerIds = null
-  ruleForm.levelCondition = null
-  ruleForm.itemCondition = null
-  ruleForm.heroCondition = null
-  ruleForm.roleCreateTimeStart = null
-  ruleForm.roleCreateTimeEnd = null
-  ruleForm.title = null
-  ruleForm.sendName = '深渊联盟'
-  ruleForm.items = null
-  ruleForm.validTime = null
-  ruleForm.invalidTime = null
-  ruleForm.content = null
+  ruleForm.actTem = 0
+  ruleForm.gameIds = null
+  ruleForm.noGameIds = null
+  ruleForm.isOpen = 0
+  ruleForm.tipsTime = null
+  ruleForm.startTime = null
+  ruleForm.endTime = null
+  ruleForm.stayTime = null
+  ruleForm.lpActTemList = null
+  ruleForm.lpActInterval = null
 }
 
 const valid7Day = () => {
@@ -424,6 +394,7 @@ const valid7Day = () => {
   ruleForm.invalidTime = dateUtils.getDate(invalidDate)
 }
 
+
 const valid15Day = () => {
   let now = new Date();
   ruleForm.validTime = dateUtils.getDate(now);
@@ -547,27 +518,23 @@ const selectionChange = (val) => {
   selectObj.value = val
 }
 
-const more = (row) => {
+const edit = (row) => {
   title.value = '详情'
   isIdShow.value = true
   rowObj.value = row
-  console.log(row)
   dialogVisible.value = true
   ruleForm.id = row.id
   ruleForm.type = row.type
-  ruleForm.toServerIds = row.toServerIds
-  ruleForm.toPlayerIds = row.toPlayerIds
-  ruleForm.levelCondition = row.levelCondition
-  ruleForm.itemCondition = getItemsLabel(row.itemCondition)
-  ruleForm.heroCondition = row.heroCondition
-  ruleForm.roleCreateTimeStart = dateUtils.getDate(row.roleCreateTimeStart)
-  ruleForm.roleCreateTimeEnd = dateUtils.getDate(row.roleCreateTimeEnd)
-  ruleForm.title = row.title
-  ruleForm.sendName = row.sendName
-  ruleForm.items = getItemsLabel(row.items)
-  ruleForm.validTime = dateUtils.getDate(row.validTime)
-  ruleForm.invalidTime = dateUtils.getDate(row.invalidTime)
-  ruleForm.content = row.content
+  ruleForm.actTem = row.actTem
+  ruleForm.gameIds = row.gameIds
+  ruleForm.noGameIds = row.noGameIds
+  ruleForm.isOpen = row.isOpen
+  ruleForm.tipsTime = dateUtils.getDate(row.tipsTime)
+  ruleForm.startTime = dateUtils.getDate(row.startTime)
+  ruleForm.endTime = dateUtils.getDate(row.endTime)
+  ruleForm.stayTime = dateUtils.getDate(row.stayTime)
+  ruleForm.lpActTemList = row.lpActTemList
+  ruleForm.lpActInterval = row.lpActInterval
   console.log(ruleForm)
 }
 

+ 9 - 9
src/views/activity/template/index.vue

@@ -15,7 +15,7 @@
             </el-icon>删除</el-button>
         </div>
       </template>
-      <template v-slot:type="scope">{{ getIsOpenSvrLabel(scope.row.isOpenSvr) }}</template>
+      <template v-slot:isOpenSvr="scope">{{ getIsOpenSvrLabel(scope.row.isOpenSvr) }}</template>
       <template v-slot:operation="scope">
         <el-button type="primary" size="small" icon="Edit" @click="edit(scope.row)">
           编辑
@@ -199,7 +199,7 @@ const column = [
   { name: 'remark', label: '模版备注'},
   { name: 'keepDay', label: '持续天数'},
   { name: 'stayDay', label: '停留天数'},
-  { name: 'isOpenSvr', label: '开服活动', slot: true},
+  { name: 'isOpenSvr', label: '开服活动', slot: true },
   { name: 'operation', slot: true, fixed: 'right', width: 200, label: '操作' },
 ]
 
@@ -347,12 +347,12 @@ const batchDelete = () => {
     draggable: true,
   })
     .then(() => {
-      let selectactivityTemplateIds = reactive([])
+      let selectActivityTemplateIds = reactive([])
       for (let value of selectObj.value) {
-        selectactivityTemplateIds.push(value.id)
+        selectActivityTemplateIds.push(value.id)
       }
       let deleteParams = reactive({
-        activityTemplateIds: selectactivityTemplateIds
+        actTemIds: selectActivityTemplateIds
       })
       activityTemplateApi.deleteBatch(deleteParams).then(res => {
         loadActivityTemplateInfo()
@@ -373,13 +373,13 @@ const edit = (row) => {
   title.value = '编辑'
   rowObj.value = row
   dialogVisible.value = true
-  ruleForm.id = row.id
+  ruleForm.id = row.id.toString()
   ruleForm.name = row.name
   ruleForm.des = row.des
   ruleForm.reward = row.reward
   ruleForm.remark = row.remark
-  ruleForm.keepDay = row.keepDay
-  ruleForm.stayDay = row.stayDay
+  ruleForm.keepDay = row.keepDay.toString()
+  ruleForm.stayDay = row.stayDay.toString()
   ruleForm.isOpenSvr = row.isOpenSvr
 }
 
@@ -417,7 +417,7 @@ const reset = () => {
 }
 
 const onSubmit = (val) => {
-  if ((val.title == null || val.title == "") && val.type == null) {
+  if ((val.name == null || val.name == "") && val.isOpenSvr == null) {
     ElMessage.warning('请输入查询条件')
     return
   }