初次接触 dva + react 生态 求大佬解惑

最近需要在项目中使用react + dva.js 生态研究了一段时间还算是能上手做了,但是还是有一个问题不知道怎么处理

项目需要融合第三方的websoket服务,从官方给的代码来看是基于es5封装的函数,目前我的做法是当成工具函数引用,但是现在就出现问题了,它的函数返回的数据和状态等等都是用的console和alert的方式,所以我不知道怎么才能放到dva的models里面做一个全局的弹框提示 代码如下

相关代码

// 第三方代码 代码太长只截取一部分

SetGroupRole: function () {
    var modelJosn = this.GetSendModel("SetGroupRole", SystemAttr.CurrentUser.AgentGroupName);
    console.info("设置用户权限", this.GetSendModel);
    var retruenVal = WebSocktInterface("Send", JSON.stringify(modelJosn));
    if (retruenVal != 1) {
        console.info(WebSocktInterface("GetError", retruenVal));
    }
},
//设置用户权限 回调
Back_SetGroupRole: function (returnVal) {
    if (returnVal.Params == "0") {
        console.info(returnVal.Message);
    } else {
        console.info(returnVal.Message);
    }
},
//登出 当前座席
LogOut: function () {
    var modelJosn = this.GetSendModel("LogOut");
    var retruenVal = WebSocktInterface("Send", JSON.stringify(modelJosn));
    if (retruenVal != 1) {
        console.info(WebSocktInterface("GetError", retruenVal));
    }
},

谢谢各位大佬...

待解决 悬赏分:40 - 离问题结束还有 161天1小时49分49秒
反对 0举报 0 收藏 0

我来回答

回答1