/*
 * @Description:
 * @Author: leizhe
 * @Date: 2021-12-23 17:51:09
 * @LastEditTime: 2022-05-20 11:47:20
 * @LastEditors: leizhe
 */
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
import qs from 'qs';

/**
 * @param {*} params
 */
export const miniAppSiteTree = params => get(`${CITY_SERVICE}/OMS.svc/MiniAppSiteTree`, params);

/**
 * 获取网站配置
 * @param {*} params
 * title:'名称'
 */
export const getWebsite = params => get(`${PUBLISH_SERVICE}/WebSite/MiniApp_GetWebsite`, params);
/**
 *
 * @param {*} params
 * /**
 *  编辑小程序网站配置
    title:"节水平台",
    "shortcutIcon":"assets/images/icon/小程序logo/gck.png",
    "style":"default",
    "mode":"single",
    "client":"miniapp",
    "loginTemplate":"default",
    "theme":"default",
    "cloudLogin":false
*/
export const editWebsite = (params, options) => {
  let strParams = params;
  let qsParams = strParams;
  return post(`${PUBLISH_SERVICE}/WebSite/MiniApp_EditWebsite?_version=9999`, qsParams, options);
};

/**
 * @获取菜单配置
 * {
 * userMode:''
 * } 必填 super 或 admin 或common
 */
export const getMiniAppModuleTree = params =>
  get(`${PUBLISH_SERVICE}/PlatformCenter/MiniAppModuleTree`, params);

/**
 *
 * @新增功能菜单组
 * @请求参数 {*}{
 * version: 9999
    _dc: 1606203896370
    parentID: -1
    subSystemValue: miniapp
    menuName: 分组名称
    imageUrl: assets/images/appMenu/小程序tab/enterprise_select.png
    offlineImgUrl: assets/images/appMenu/小程序tab/enterprise_unselect.png
    shortName: 分组别名
    pageUrl: //功能路径
    funParam: 测试功能参数
    relatedRoleList： //角色数组
  }
 */
export const addMenu = params => post(`${PUBLISH_SERVICE}/WebSite/MiniApp_AddMenu`, params);

// 获取菜单详情
/**
 * {
 * menuID:''
 * }
 */
export const getMenuInfo = params => get(`${PUBLISH_SERVICE}/PlatformCenter/GetMenuInfo`, params);

// 编辑菜单
export const editMenu = params => post(`${PUBLISH_SERVICE}/WebSite/MiniApp_EditMenu`, params);

// 删除菜单
export const deleteMenu = params => post(`${PUBLISH_SERVICE}/WebSite/MiniApp_DeleteMenu`, params);

// 获取角色列表
export const getRoleListPlain = params =>
  get(`${PUBLISH_SERVICE}/UserCenter/GetRoleListPlain`, params);

// 删除小程序
export const deleteWebsite = params =>
  get(`${PUBLISH_SERVICE}/WebSite/MiniApp_DeleteWebsite`, params);
// 新增小程序
export const addWebsite = (params, options) =>
  // let strParams = JSON.stringify(params);
  // let qsParams = qs.stringify({ config: strParams });
  post(`${PUBLISH_SERVICE}/WebSite/MiniApp_AddWebsite?_version=9999`, params, options);

// 菜单拖拽
export const dragMenu = params => post(`${PUBLISH_SERVICE}/WebSite/DragMenu `, params);

export const deleteMiniMenu = params =>
  get(`${PUBLISH_SERVICE}/PlatformCenter/DeleteMiniMenu`, params);

// 获取移动应用上传APK信息
export const getMobileFiles = params => get(`${PUBLISH_SERVICE}/FileCenter/GetMobileFiles`, params);

//工作台方案列表接口
export const getSchemeList = parmas => get(`${PUBLISH_SERVICE}/WebSite/AppWorkSpace_GetSchemeList`, parmas);

//获取角色列表
export const roleGroupList = parmas => get(`${PUBLISH_SERVICE}/UserCenter/RoleGroupList`, parmas);

//保存工作台方案
export const saveScheme = parmas => post(`${PUBLISH_SERVICE}/WebSite/AppWorkSpace_SaveScheme`, parmas);

//删除方案
export const deleteScheme = parmas => post(`${PUBLISH_SERVICE}/WebSite/AppWorkSpace_DeleteScheme`, parmas);
