Newer
Older
XinYang_SanWei+RongYun / src / services / index.js
@张强云笔记本 张强云笔记本 on 17 Dec 2021 1 KB 融云通话接入
'use strict'
import request from '@/api';
import {
  Notification
} from 'element-ui';

const notify = ({
  code = 500,
  type = 'error',
  title = '异常提醒',
  message = '请通知管理员检查异常!',
} = {}) => {
  // 弹窗状态,只报错
  if (code !== 200) {
    Notification({
      title,
      message,
      type,
    })
  }
}

/* 用户登录 */
export const login = async (params = {}) => {
  let response = await request({
    "url": "/api/login",
    "method": "post",
    "data": params
  });
  response = response['data'] || {};
  
  if (!!response.code) {
    notify({
      code: response.code,
      message: response.message || '请通知管理员检查异常!'
    });
  }
  return response
}

/* 群组沟通 */
export const getPeoplesMembers = async (params = {}) => {
  let response = await request({
    "url": "/api/getMembers",
    "method": "post",
    "data": params
  });
  response = response['data'] || {};
  
  if (!!response.code) {
    notify({
      code: response.code,
      message: response.message || '请通知管理员检查异常!'
    });
  }
  return response
}