Przeglądaj źródła

用户列表IOS添加最新登陆IP和同IP视频数阈值检索

wangzhiqiang 1 miesiąc temu
rodzic
commit
ebc1f93aae

+ 1 - 1
src/components/from/index.vue

@@ -10,7 +10,7 @@
             <template #append>岁</template>
           </el-input>
           <el-input v-if="item.type === 'input'" v-model.trim="form[item.prop]"
-            :placeholder="form[item.placeholder] || '请输入'" :clearable="true" @keyup.enter="handleEnter(item)"
+            :placeholder="item.placeholder || '请输入'" :clearable="true" @keyup.enter="handleEnter(item)"
             @clear="form[item.prop] = ''" class="fixed-width-input"></el-input>
           <el-select v-else-if="item.type === 'select'" v-model="form[item.prop]" :placeholder="item.placeholder || '请选择'"
             filterable :clearable="item.clearable === false ? false : true" @clear="form[item.prop] = ''"

+ 75 - 10
src/views/main/userModule/userList.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="layout-container">
     <!-- 菜单栏 -->
-    <From :form-items="dynamicFormItems" @formSubmitted="handleFormSubmitted" @formReset="handleFormReset" />
+    <From :form-items="dynamicFormItemsTarget" @formSubmitted="handleFormSubmitted" @formReset="handleFormReset"
+      @formChangeSelect="handleFormSelect" />
 
     <div class="btn">
       <el-button type="" v-if="formSearch.appIds && selectData.length > 0" @click="clearSelection">取消全选</el-button>
@@ -44,7 +45,7 @@
         <el-table-column prop="ditchName" label="渠道来源" width="150" />
         <el-table-column prop="todayAnswer" label="今日答题数" width="100">
           <template #default="scope">
-               {{scope.row.todayAnswer || 0}}
+            {{ scope.row.todayAnswer || 0 }}
           </template>
         </el-table-column>
         <el-table-column prop="todayVideo" label="当日视频播放数" width="130" />
@@ -73,7 +74,19 @@
         </el-table-column>
         <el-table-column prop="deviceRepeatCount" label="设备重复数量" width="110" />
         <el-table-column prop="ipRepeatCount" label="IP重复数量" width="100" />
-        <el-table-column prop="lastLoginIp" label="最新登录IP" width="150" />
+        <el-table-column prop="lastLoginIp" label="最新登录IP" width="150">
+          <template #default="scope">
+            <div v-if="scope.row.maybeDone === 1 && scope.row.appType === 2" style="color: red">
+              <el-tooltip class="box-item" effect="dark" content="该ip当日已完成过任务" placement="top">
+                {{ scope.row.lastLoginIp || '' }}
+              </el-tooltip>
+            </div>
+            <div v-else>
+              {{ scope.row.lastLoginIp || '' }}
+            </div>
+          </template>
+        </el-table-column>
+
         <el-table-column prop="lastLoginTime" label="最新登录时间" width="160">
           <template #default="scope">
             {{ convertUTCToBeijing(scope.row.lastLoginTime) }}
@@ -190,6 +203,7 @@ const store = useStore()
 const { loadDictData, getOptions, getDictionaryName } = useGetDictList();
 const tableData = ref([]);
 const table = ref(null)
+const appType = ref(1)
 
 // 分页参数, 供table使用
 const page = reactive({
@@ -210,10 +224,14 @@ const formSearch = ref({
   page: 1,// 当前页码
   limit: 20,// 当前页数量(查询量)
   lastLoginTimeBegin: getTodayRangeLocal(), //最新登录时间开始
-  lastLoginTimeEnd:undefined //最新登录时间结束
+  lastLoginTimeEnd: undefined, //最新登录时间结束
+  lastLoginIp: undefined, //最新登陆IP
+  videoThreshold: undefined //同IP激励视频数提醒阈值
 });
 
+
 const dynamicFormItems = ref([])
+const dynamicFormItemsTarget = ref([])
 
 onBeforeMount(() => {
   settingData()
@@ -258,6 +276,19 @@ const settingData = async () => {
       },
       { label: '登录时间开始', prop: 'lastLoginTimeBegin', type: 'date', defaultVal: getTodayRangeLocal() },
       { label: '登录时间结束', prop: 'lastLoginTimeEnd', type: 'date' },
+      {
+        label: '最新登陆IP',
+        prop: 'lastLoginIp',
+        type: 'input',
+        needEnterEvent: true
+      },
+      {
+        label: '同IP视频数阈值',
+        prop: 'videoThreshold',
+        type: 'input',
+        needEnterEvent: true,
+        placeholder: '请输入同IP激励视频数提醒阈值'
+      }
     ]
 
     // 设置动态选项
@@ -283,7 +314,8 @@ const getApiOptions = async () => {
 
     const appsOptions = appData.map(item => ({
       label: item.appName,
-      value: item.appId
+      value: item.appId,
+      appType: item.appType
     }))
 
     // 赋值到表单项
@@ -296,6 +328,10 @@ const getApiOptions = async () => {
       firstApp.value = appsOptions[0].value
       dynamicFormItems.value[2].defaultVal = firstApp.value
       formSearch.value.appIds = firstApp.value
+
+      dynamicFormItemsTarget.value = appsOptions[0].appType === 1
+        ? dynamicFormItems.value.slice(0, 7)
+        : dynamicFormItems.value
     }
 
     // 获取列表数据
@@ -364,6 +400,8 @@ const handleFormSubmitted = (formData) => {
   formSearch.value.appIds = formData.appIds;
   formSearch.value.lastLoginTimeBegin = convertUTCToBeijing(formData.lastLoginTimeBegin, false) || undefined
   formSearch.value.lastLoginTimeEnd = convertUTCToBeijing(formData.lastLoginTimeEnd, false) || undefined
+  formSearch.value.lastLoginIp = formData.lastLoginIp
+  formSearch.value.videoThreshold = formData.videoThreshold
 
   getList(0);
 };
@@ -381,7 +419,9 @@ const handleFormReset = () => {
     page: 1,// 当前页码
     limit: 20,// 当前页数量(查询量)
     lastLoginTimeBegin: getTodayRangeLocal(), //最新登录时间开始
-    lastLoginTimeEnd:undefined //最新登录时间结束
+    lastLoginTimeEnd: undefined, //最新登录时间结束
+    lastLoginIp: undefined, //最新登陆IP
+    videoThreshold: undefined //同IP激励视频数提醒阈值
   };
 
   page.pageNum = 1
@@ -391,6 +431,31 @@ const handleFormReset = () => {
   settingData()
 };
 
+const handleFormSelect = (item, e) => {
+  if (item.prop === 'appIds') {
+    const options = item.options
+    // appType 1-安卓 2-IOS
+    const appTypeNum = options.find((item) => item.value === e).appType
+
+
+    dynamicFormItems.value[0].defaultVal = formSearch.value.nickName
+    dynamicFormItems.value[1].defaultVal = formSearch.value.userId
+    dynamicFormItems.value[2].defaultVal = e
+    dynamicFormItems.value[3].defaultVal = formSearch.value.ditchId
+    dynamicFormItems.value[4].defaultVal = formSearch.value.userStatus
+    dynamicFormItems.value[5].defaultVal = formSearch.value.lastLoginTimeBegin
+    dynamicFormItems.value[6].defaultVal = formSearch.value.lastLoginTimeEnd
+
+    if (appTypeNum === 1) {
+      dynamicFormItemsTarget.value = dynamicFormItems.value.slice(0, 7)
+    } else {
+      dynamicFormItems.value[7].defaultVal = formSearch.value.lastLoginIp
+      dynamicFormItems.value[8].defaultVal = formSearch.value.videoThreshold
+      dynamicFormItemsTarget.value = dynamicFormItems.value
+    }
+  }
+}
+
 const selectData = ref([])
 const currentAppName = ref(null) // 存储允许全选的 appName
 // 选择监听器
@@ -486,11 +551,11 @@ const edit = (row, isMulty = 0) => {
     layer.value.title = '批量封禁用户'
     formEdit.value = {}
 
-  } else if(isMulty === 2) {
+  } else if (isMulty === 2) {
     layer.value.title = '批量封禁母包'
     formEdit.value = {}
 
-  } else if(isMulty === 3) {
+  } else if (isMulty === 3) {
     layer.value.title = '批量封禁IP'
     formEdit.value = {}
   } else {
@@ -534,11 +599,11 @@ const submit = async (formEl) => {
         batchBanned({ ...formEdit.value }).then((res) => {
           layer.value.show = false
           getList().then(() => {
-            const hintText =  layer.value.isMulty === 2 ? '批量封禁母包' : '批量封禁用户'
+            const hintText = layer.value.isMulty === 2 ? '批量封禁母包' : '批量封禁用户'
             ElMessage.success(`${hintText}成功,如未更新状态,请手动刷新`)
           })
         })
-      } else if(layer.value.isMulty === 3) {
+      } else if (layer.value.isMulty === 3) {
         formEdit.value.appId = selectData.value[0].appId
         formEdit.value.bannedIps = selectData.value.map((item) => item.lastLoginIp).join("|")
         batchBannedIps({ ...formEdit.value }).then((res) => {