ソースを参照

部门管理,游戏权限取分组游戏信息

ith5 5 ヶ月 前
コミット
b8ae4ecd9e
2 ファイル変更57 行追加61 行削除
  1. 34 38
      src/views/system/dept/game.vue
  2. 23 23
      src/views/v1/api/common.js

+ 34 - 38
src/views/system/dept/game.vue

@@ -1,73 +1,69 @@
 <template>
 <template>
-  <a-modal
-    :unmount-on-close="true"
-    v-model:visible="visible"
-    width="600px"
-    @close="handleClose"
-    @ok="handleOk"
-  >
+  <a-modal :unmount-on-close="true" v-model:visible="visible" width="600px" @close="handleClose" @ok="handleOk">
     <template #title>部门游戏权限设置</template>
     <template #title>部门游戏权限设置</template>
     <game-permission ref="gamePermissionRef" />
     <game-permission ref="gamePermissionRef" />
   </a-modal>
   </a-modal>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import { ref, computed } from "vue";
-import api from "@/api/center/game";
-import GamePermission from "@/components/game-permission/index.vue";
+import { ref, computed } from 'vue'
+import commonApi from '@/views/v1/api/common'
+import api from '@/api/center/game'
 
 
-const emit = defineEmits(["success"]);
+import GamePermission from '@/components/game-permission/index.vue'
 
 
-const visible = ref(false);
-const deptId = ref();
-const gamePermissionRef = ref();
-const checkedGameList = ref("");
+const emit = defineEmits(['success'])
+
+const visible = ref(false)
+const deptId = ref()
+const gamePermissionRef = ref()
+const checkedGameList = ref('')
 
 
 // 打开弹框
 // 打开弹框
 const open = async (row) => {
 const open = async (row) => {
-  let rowData = JSON.parse(JSON.stringify(row));
+  let rowData = JSON.parse(JSON.stringify(row))
 
 
-  deptId.value = rowData.id;
-  checkedGameList.value = rowData.game_list;
+  deptId.value = rowData.id
+  checkedGameList.value = rowData.game_list
 
 
-  visible.value = true;
+  visible.value = true
 
 
-  await initPage();
-};
+  await initPage()
+}
 
 
 // 获取所有的游戏数据
 // 获取所有的游戏数据
 const getAllGameData = async () => {
 const getAllGameData = async () => {
-  const resp = await api.getAllGameData();
-  let allGameData = JSON.parse(JSON.stringify(resp.data));
-  gamePermissionRef.value.init(allGameData, checkedGameList.value);
-};
+  const resp = await commonApi.getGameOptionsNoAuthApi()
+  let allGameData = JSON.parse(JSON.stringify(resp.data))
+  gamePermissionRef.value.init(allGameData, checkedGameList.value)
+}
 
 
 // 初始化页面数据
 // 初始化页面数据
 const initPage = async () => {
 const initPage = async () => {
-  await getAllGameData();
-};
+  await getAllGameData()
+}
 
 
 // 设置部门游戏权限
 // 设置部门游戏权限
 const setGameListByDeptId = async () => {
 const setGameListByDeptId = async () => {
-  let { selectType, checkedKeys } =
-    await gamePermissionRef.value.getGamePermissionData();
+  let { selectType, checkedKeys } = await gamePermissionRef.value.getGamePermissionData()
   try {
   try {
     const resp = await api.setGameListByDeptId({
     const resp = await api.setGameListByDeptId({
       dept_id: deptId.value,
       dept_id: deptId.value,
-      game_list: selectType === "*" ? "*" : checkedKeys.join(","),
-    });
+      game_list: selectType === '*' ? '*' : checkedKeys.join(','),
+    })
   } catch (error) {
   } catch (error) {
-    console.error("设置部门游戏权限失败:", error);
+    Message.error('设置部门游戏权限失败')
+    console.error('设置部门游戏权限失败:', error)
   }
   }
-};
+}
 
 
 const handleClose = async () => {
 const handleClose = async () => {
-  emit("success", true);
-};
+  emit('success', true)
+}
 
 
 const handleOk = async () => {
 const handleOk = async () => {
-  setGameListByDeptId();
-};
+  setGameListByDeptId()
+}
 
 
-defineExpose({ open });
+defineExpose({ open })
 </script>
 </script>

+ 23 - 23
src/views/v1/api/common.js

@@ -32,7 +32,7 @@ export default {
   /**
   /**
    * 获取子游戏options(无权限)
    * 获取子游戏options(无权限)
    */
    */
-  getGameOptionsApiNoAuth(params = {}) {
+  getGameOptionsNoAuthApi(params = {}) {
     return request({
     return request({
       url: '/v1/common/getGameOptionsNoAuth',
       url: '/v1/common/getGameOptionsNoAuth',
       method: 'get',
       method: 'get',
@@ -40,30 +40,30 @@ export default {
     })
     })
   },
   },
 
 
-  /**
-   * 获取子游戏TreeOptions
-   */
-  getGameListTreeNoAuthApi(params = {}) {
-    return request({
-      url: '/v1/common/getGameListTreeNoAuth',
-      method: 'get',
-      params
-    })
-  },
+  // /**
+  //  * 获取子游戏TreeOptions
+  //  */
+  // getGameListTreeNoAuthApi(params = {}) {
+  //   return request({
+  //     url: '/v1/common/getGameListTreeNoAuth',
+  //     method: 'get',
+  //     params
+  //   })
+  // },
 
 
-  /**
-   * 获取子游戏TreeOptions(有权限)
-   * @param {*} params
-   * @returns
-   */
+  // /**
+  //  * 获取子游戏TreeOptions(有权限)
+  //  * @param {*} params
+  //  * @returns
+  //  */
 
 
-  getGameListTreeApi(params = {}) {
-    return request({
-      url: '/v1/common/getGameListTree',
-      method: 'get',
-      params
-    })
-  },
+  // getGameListTreeApi(params = {}) {
+  //   return request({
+  //     url: '/v1/common/getGameListTree',
+  //     method: 'get',
+  //     params
+  //   })
+  // },
 
 
   /**
   /**
    * 获取广告位options
    * 获取广告位options