Browse Source

页面运营优化等

pansl 1 year ago
parent
commit
de3453c4ee

+ 6 - 0
src/api/pageLayout/channelPage/index.ts

@@ -27,3 +27,9 @@ export function operationChannelAdd(params: object) {
 export function operationChannelSetConfig(id: number | string, params: object) {
   return http.post(`/operation/channel/setting/${id}`, params);
 }
+/**
+ * 频道管理-删除
+ */
+export function operationChannelDel(id: number | string, params?: object) {
+  return http.post(`/operation/channel/del/${id}`, params);
+}

+ 6 - 0
src/api/pageLayout/homePage/index.ts

@@ -23,4 +23,10 @@ export function operationManageFirstPageAdd(params: object) {
  */
 export function operationManageFirstPageSetConfig(params: object) {
   return http.post(`/operationManage/firstPage/setConfig`, params);
+}
+/**
+ * 首页列表-删除
+ */
+export function operationManageFirstPageDelete(params: object) {
+  return http.post(`/operationManage/firstPage/delete`, params);
 }

+ 4 - 4
src/views/appletManage/miniProgramList/index.vue

@@ -36,7 +36,7 @@
                     <span class="text-base">app id:</span>
                     <span class="text-base font-bold">{{ scope.row.appid }}</span>
                   </div>
-                  <div>
+                  <div v-if="isShowSecret">
                     <span class="text-base">app 密匙:</span>
                     <span class="text-base font-bold">{{ scope.row.appsecret }}</span>
                   </div>
@@ -48,7 +48,7 @@
                   <span class="text-base">app id:</span>
                   <span class="text-base font-bold">{{ scope.row.appid }}</span>
                 </div>
-                <div>
+                <div v-if="isShowSecret">
                   <span class="text-base">app 密匙:</span>
                   <span class="text-base font-bold">{{ scope.row.appsecret }}</span>
                 </div>
@@ -98,9 +98,9 @@ const miniprogramTypelist = ref([])
 
 const { data, query, search, reset, loading } = useGetList(api);
 const { open, close, title, visible, id } = useOpen();
-
+const rolesIdentify = inject('rolesIdentify')
 const tableData = computed(() => data.value?.data);
-
+const isShowSecret = computed(() => !rolesIdentify.value.includes('company') && !rolesIdentify.value.includes('optimizer'))
 
 const opendepots = (data) => {
   depotsVisible.value = true

+ 85 - 30
src/views/pageLayout/channelPageManage/index.vue

@@ -1,33 +1,59 @@
 <template>
-  <div class="table-default">
-    <div class="pt-5 pl-2" v-action="'operation.Channel.add'">
-      <el-button type="primary" size="default" @click="openForm(null)">新增</el-button>
-    </div>
-    <el-table :data="tableData" class="mt-3" v-loading="loading">
-      <el-table-column label="频道ID" prop="id"></el-table-column>
-      <el-table-column label="频道名称" prop="type_txt">
-      </el-table-column>
-      <el-table-column label="添加时间" prop="created_at">
-      </el-table-column>
-      <el-table-column label="小程序类型" prop="miniprogram_type_text">
-      </el-table-column>
-      <el-table-column label="状态" v-action="'operation.Channel.enableStatus'">
-        <template #default="scope">
-          <div>
-            <el-switch v-model="scope.row.status" :disabled="Boolean(scope.row.status)" @change="switchStatus(scope.row)"
-              :active-value="1" :inactive-value="0">
-            </el-switch>
-          </div>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作">
-        <template #default="scope">
-          <el-button link type="primary" size="small" @click="handleConfigure(scope.row)"
-            v-action="'operation.Channel.setting'">配置</el-button>
+  <div class="flex flex-col justify-between w-full sm:flex-row">
+    <div class="w-full">
+      <Search :search="search" :reset="reset">
+        <template v-slot:body>
+          <el-form-item label="频道名称">
+            <el-select v-model="query.type" clearable filterable placeholder="请选择频道名称">
+              <el-option v-for="(item, index) in typeList" :key="index" :label="item.name" :value="item.value" />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="小程序类型">
+            <el-select v-model="query.miniprogram_type" clearable filterable placeholder="请选择小程序类型">
+              <el-option v-for="(item, index) in miniprogramTypelist" :key="index" :label="item.label"
+                :value="item.value" />
+            </el-select>
+          </el-form-item>
         </template>
-      </el-table-column>
-    </el-table>
-    <Paginate />
+      </Search>
+      <el-card shadow="always" class="mt-3" :body-style="{ padding: '20px' }">
+        <div class="m-3">
+          <el-alert title="启用状态后,最新开启的记录排序在上面" type="warning" :closable="false" />
+        </div>
+        <div class="table-default">
+          <div class="pt-5 pl-2" v-action="'operation.Channel.add'">
+            <el-button type="primary" size="default" @click="openForm(null)">新增</el-button>
+          </div>
+          <el-table :data="tableData" class="mt-3" v-loading="loading">
+            <el-table-column label="频道ID" prop="id"></el-table-column>
+            <el-table-column label="频道名称" prop="type_txt">
+            </el-table-column>
+            <el-table-column label="添加时间" prop="created_at">
+            </el-table-column>
+            <el-table-column label="小程序类型" prop="miniprogram_type_text">
+            </el-table-column>
+            <el-table-column label="状态" v-action="'operation.Channel.enableStatus'">
+              <template #default="scope">
+                <div>
+                  <el-switch v-model="scope.row.status" :disabled="Boolean(scope.row.status)"
+                    @change="switchStatus(scope.row)" :active-value="1" :inactive-value="0">
+                  </el-switch>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作">
+              <template #default="scope">
+                <el-button link type="primary" size="small" @click="handleConfigure(scope.row)"
+                  v-action="'operation.Channel.setting'">配置</el-button>
+                <el-button link type="primary" size="small" @click="handleDel(scope.row)" v-if="!scope.row.status"
+                  v-action="'operation.Channel.del'">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <Paginate />
+        </div>
+      </el-card>
+    </div>
   </div>
   <Dialog v-model="configVisible" title="配置" width="50%" destroy-on-close>
     <config @close="closeType('configVisible')" :primary="currentConfig"></config>
@@ -44,16 +70,44 @@ import { computed, onMounted, ref } from 'vue';
 import create from './form/create.vue';
 import config from './form/config.vue';
 import { useGetList } from '@/hook/curd/useGetList';
-import { operationChannelEnableStatus } from '@/api/pageLayout/channelPage/index'
+import { operationChannelEnableStatus, operationChannelDel } from '@/api/pageLayout/channelPage/index'
+import { optionsCommonParams } from '@/api/common/index'
 
 const api = 'operation/channel/list';
-
+const typeList = ref([{ name: '排行榜', value: 1 }, { name: '最新', value: 2 }])
+const miniprogramTypelist = ref([])
 const { data, query, search, reset, loading } = useGetList(api, true);
 const tableData = computed(() => data.value?.data);
 const addVisible = ref(false)
 const currentConfig = ref({})
 const configVisible = ref(false) //设置回传弹窗
+const init = () => {
+  optionsCommonParams().then(res => {
+    console.log(res, 'optionsCommonParams');
+    miniprogramTypelist.value = res.data.miniprogramType
+  })
+}
 
+const handleDel = (row: object) => {
+  ElMessageBox.confirm(
+    `确认删除此列表吗?`,
+    '提示',
+    {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning',
+    }
+  )
+    .then(() => {
+      operationChannelDel(row.id).then(res => {
+        ElMessage.success(res.message)
+        search()
+      })
+    })
+    .catch(() => {
+      search()
+    })
+}
 const closeType = (type: string) => {
   switch (type) {
     case 'configVisible':
@@ -85,6 +139,7 @@ const handleConfigure = (data: object) => {
 };
 onMounted(() => {
   search();
+  init()
 });
 </script>
 <style  lang='scss' scoped></style>

+ 85 - 31
src/views/pageLayout/homePageManage/index.vue

@@ -1,33 +1,59 @@
 <template>
-  <div class="table-default">
-    <div class="pt-5 pl-2" v-action="'operation.FirstPage.add'">
-      <el-button type="primary" size="default" @click="openForm(null)">新增</el-button>
-    </div>
-    <el-table :data="tableData" class="mt-3" v-loading="loading">
-      <el-table-column label="ID" prop="id"></el-table-column>
-      <el-table-column label="列表名称" prop="type_str">
-      </el-table-column>
-      <el-table-column label="添加时间" prop="created_at">
-      </el-table-column>
-      <el-table-column label="小程序类型" prop="miniprogram_type_str">
-      </el-table-column>
-      <el-table-column label="状态" v-action="'operation.FirstPage.enableStatus'">
-        <template #default="scope">
-          <div>
-            <el-switch v-model="scope.row.status" :disabled="Boolean(scope.row.status)" @change="switchStatus(scope.row)"
-              :active-value="1" :inactive-value="0">
-            </el-switch>
-          </div>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作">
-        <template #default="scope">
-          <el-button link type="primary" size="default" @click="handleConfigure(scope.row)"
-            v-action="'operation.FirstPage.setConfig'">配置</el-button>
+  <div class="flex flex-col justify-between w-full sm:flex-row">
+    <div class="w-full">
+      <Search :search="search" :reset="reset">
+        <template v-slot:body>
+          <el-form-item label="列表名称">
+            <el-select v-model="query.type" clearable filterable placeholder="请选择列表名称">
+              <el-option v-for="(item, index) in typeList" :key="index" :label="item.name" :value="item.value" />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="小程序类型">
+            <el-select v-model="query.miniprogram_type" clearable filterable placeholder="请选择小程序类型">
+              <el-option v-for="(item, index) in miniprogramTypelist" :key="index" :label="item.label"
+                :value="item.value" />
+            </el-select>
+          </el-form-item>
         </template>
-      </el-table-column>
-    </el-table>
-    <Paginate />
+      </Search>
+      <el-card shadow="always" class="mt-3" :body-style="{ padding: '20px' }">
+        <div class="m-3">
+          <el-alert title="启用状态后,最新开启的记录排序在上面" type="warning" :closable="false" />
+        </div>
+        <div class="table-default">
+          <div class="pt-5 pl-2" v-action="'operation.FirstPage.add'">
+            <el-button type="primary" size="default" @click="openForm(null)">新增</el-button>
+          </div>
+          <el-table :data="tableData" class="mt-3" v-loading="loading">
+            <el-table-column label="ID" prop="id"></el-table-column>
+            <el-table-column label="列表名称" prop="type_str">
+            </el-table-column>
+            <el-table-column label="添加时间" prop="created_at">
+            </el-table-column>
+            <el-table-column label="小程序类型" prop="miniprogram_type_str">
+            </el-table-column>
+            <el-table-column label="状态" v-action="'operation.FirstPage.enableStatus'">
+              <template #default="scope">
+                <div>
+                  <el-switch v-model="scope.row.status" :disabled="Boolean(scope.row.status)"
+                    @change="switchStatus(scope.row)" :active-value="1" :inactive-value="0">
+                  </el-switch>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作">
+              <template #default="scope">
+                <el-button link type="primary" size="default" @click="handleConfigure(scope.row)"
+                  v-action="'operation.FirstPage.setConfig'">配置</el-button>
+                <el-button link type="primary" size="small" @click="handleDel(scope.row)" v-if="!scope.row.status"
+                  v-action="'operation.FirstPage.delete'">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <Paginate />
+        </div>
+      </el-card>
+    </div>
   </div>
   <Dialog v-model="configVisible" title="配置" width="50%" destroy-on-close>
     <config @close="closeType('configVisible')" :primary="currentConfig"></config>
@@ -44,16 +70,23 @@ import { computed, onMounted, ref } from 'vue';
 import create from './form/create.vue';
 import config from './form/config.vue';
 import { useGetList } from '@/hook/curd/useGetList';
-import { operationManageFirstPageEnableStatus } from '@/api/pageLayout/homePage/index'
+import { operationManageFirstPageEnableStatus, operationManageFirstPageDelete } from '@/api/pageLayout/homePage/index'
+import { optionsCommonParams } from '@/api/common/index'
 
 const api = 'operationManage/firstPage/list';
-
+const typeList = ref([{ name: '本周精选', value: 1 }, { name: '优选好剧', value: 2 }])
+const miniprogramTypelist = ref([])
 const { data, query, search, reset, loading } = useGetList(api, true);
 const tableData = computed(() => data.value?.data);
 const addVisible = ref(false)
 const currentConfig = ref({})
 const configVisible = ref(false) //设置回传弹窗
-
+const init = () => {
+  optionsCommonParams().then(res => {
+    console.log(res, 'optionsCommonParams');
+    miniprogramTypelist.value = res.data.miniprogramType
+  })
+}
 const closeType = (type: string) => {
   switch (type) {
     case 'configVisible':
@@ -65,6 +98,26 @@ const closeType = (type: string) => {
   }
   search()
 }
+const handleDel = (row: object) => {
+  ElMessageBox.confirm(
+    `确认删除此列表吗?`,
+    '提示',
+    {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning',
+    }
+  )
+    .then(() => {
+      operationManageFirstPageDelete({ id: row.id }).then(res => {
+        ElMessage.success(res.message)
+        search()
+      })
+    })
+    .catch(() => {
+      search()
+    })
+}
 
 const switchStatus = (data: object) => {
   operationManageFirstPageEnableStatus({ id: data.id }).then(res => {
@@ -85,6 +138,7 @@ const handleConfigure = (data: object) => {
 };
 onMounted(() => {
   search();
+  init()
 });
 </script>
 <style  lang='scss' scoped></style>

+ 68 - 41
src/views/pageLayout/viewpagerPageManage/index.vue

@@ -1,44 +1,62 @@
 <template>
-  <div class="table-default">
-    <div class="pt-5 pl-2" v-action="'operation.Banner.add'">
-      <el-button type="primary" size="default" @click="openForm(null)">新增</el-button>
-    </div>
-    <el-table :data="tableData" class="mt-3" v-loading="loading">
-      <el-table-column label="轮播图ID" prop="id"></el-table-column>
-      <el-table-column label="轮播图名称" prop="title">
-      </el-table-column>
-      <el-table-column label="封面" prop="img_url">
-        <template #default="scope">
-          <el-image :src="scope.row.img_url" fit="fill" :lazy="true"></el-image>
-        </template>
-      </el-table-column>
-      <el-table-column label="排序" prop="sort">
-      </el-table-column>
-      <el-table-column label="添加时间" prop="created_at">
-      </el-table-column>
-      <el-table-column label="小程序类型" prop="miniprogram_type_text">
-      </el-table-column>
-      <el-table-column label="状态" v-action="'operation.Banner.updateStatus'">
-        <template #default="scope">
-          <div>
-            <el-switch v-model="scope.row.status" @change="switchStatus(scope.row)" :active-value="1" :inactive-value="0">
-            </el-switch>
-          </div>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作">
-        <template #default="scope">
-          <el-button link type="primary" size="small" @click="handleEdit(scope.row)"
-            v-action="'operation.Banner.edit'">编辑</el-button>
-          <br />
-          <el-button link type="primary" size="small" @click="handleDel(scope.row)"
-            v-action="'operation.Banner.del'">删除</el-button>
+  <div class="flex flex-col justify-between w-full sm:flex-row">
+    <div class="w-full">
+      <Search :search="search" :reset="reset">
+        <template v-slot:body>
+          <el-form-item label="轮播图名称">
+            <el-input v-model="query.title" size="default" placeholder="请输入轮播图名称" clearable></el-input>
+          </el-form-item>
+          <el-form-item label="小程序类型">
+            <el-select v-model="query.miniprogram_type" clearable filterable placeholder="请选择小程序类型">
+              <el-option v-for="(item, index) in miniprogramTypelist" :key="index" :label="item.label"
+                :value="item.value" />
+            </el-select>
+          </el-form-item>
         </template>
-      </el-table-column>
-    </el-table>
-    <Paginate />
+      </Search>
+      <div class="table-default">
+        <div class="pt-5 pl-2" v-action="'operation.Banner.add'">
+          <el-button type="primary" size="default" @click="openForm(null)">新增</el-button>
+        </div>
+        <el-table :data="tableData" class="mt-3" v-loading="loading">
+          <el-table-column label="轮播图ID" prop="id"></el-table-column>
+          <el-table-column label="轮播图名称" prop="title">
+          </el-table-column>
+          <el-table-column label="封面" prop="img_url">
+            <template #default="scope">
+              <el-image :src="scope.row.img_url" fit="fill" :lazy="true"></el-image>
+            </template>
+          </el-table-column>
+          <el-table-column label="排序" prop="sort">
+          </el-table-column>
+          <el-table-column label="添加时间" prop="created_at">
+          </el-table-column>
+          <el-table-column label="小程序类型" prop="miniprogram_type_text">
+          </el-table-column>
+          <el-table-column label="状态" v-action="'operation.Banner.updateStatus'">
+            <template #default="scope">
+              <div>
+                <el-switch v-model="scope.row.status" @change="switchStatus(scope.row)" :active-value="1"
+                  :inactive-value="0">
+                </el-switch>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作">
+            <template #default="scope">
+              <el-button link type="primary" size="small" @click="handleEdit(scope.row)"
+                v-action="'operation.Banner.edit'">编辑</el-button>
+              <br />
+              <el-button link type="primary" size="small" @click="handleDel(scope.row)"
+                v-action="'operation.Banner.del'">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <Paginate />
+      </div>
+    </div>
   </div>
-  <Dialog v-model="addVisible" title="新增" width="30%" destroy-on-close>
+  <Dialog v-model="addVisible" :title="title" width="30%" destroy-on-close>
     <create @close="closeType('addVisible')" :primary="currentConfig"></create>
   </Dialog>
 </template>
@@ -53,15 +71,21 @@ import {
   operationBannerEditStatus,
   operationBannerDel
 } from '@/api/pageLayout/viewpagerPage/index';
-
+import { optionsCommonParams } from '@/api/common/index'
 const api = 'operation/banner/list';
-
+const miniprogramTypelist = ref([])
 const { data, query, search, reset, loading } = useGetList(api, true);
 const tableData = computed(() => data.value?.data);
 const addVisible = ref(false)
 const currentConfig = ref({})
+const title = ref('')
 const configVisible = ref(false) //设置回传弹窗
-
+const init = () => {
+  optionsCommonParams().then(res => {
+    console.log(res, 'optionsCommonParams');
+    miniprogramTypelist.value = res.data.miniprogramType
+  })
+}
 const closeType = (type: string) => {
   switch (type) {
     case 'configVisible':
@@ -105,15 +129,18 @@ const handleDel = (row: object) => {
 }
 
 const openForm = (data: any) => {
+  title.value = '新增'
   currentConfig.value = {}
   addVisible.value = true
 };
 const handleEdit = (data: object) => {
+  title.value = '编辑'
   currentConfig.value = data
   addVisible.value = true
 };
 onMounted(() => {
   search();
+  init()
 });
 </script>
 <style  lang='scss' scoped></style>