|
楼主 |
发表于 2016-8-8 21:56:55
|
显示全部楼层
本帖最后由 ecoolper 于 2016-8-8 22:07 编辑
/chat/wex5/js/im.wex5.impl.js
代码片段:
loginByWx5
- var loginByWex5 = function(params) {
- var ret;
- var userParams = {};
- userParams.CurrentPersonID = "";
- userParams.CurrentPersonName = "";
- userParams.CurrentPersonFID = "";
- userParams.CurrentPersonFName = "";
- userParams.CurrentOgnID = "";
- userParams.CurrentOgnName = "";
- userParams.CurrentDeptID = "";
- userParams.CurrentDeptName = "";
- userParams.CurrentDeptFID = "";
- userParams.CurrentDeptFName = "";
- userParams.CurrentOgnFID = "";
- userParams.CurrentOgnFName = "";
- userParams.CurrentFunRole = "3";// 默认为3:普通员工。(1:公司领导;2:部门主管;3:普通员工)
- justep.Baas.sendRequest({
- //"url" : "/org/login",
- "url" : "/ecoolper/chat",
- //"action" : "loginAction",
- "action" : "login",
- "async" : false,
- "params" : {
- "userName" : params.username,
- "password" : params.password
- },
- "success" : function(data) {
- ret = data;
- if (ret.flag) {
- userParams.CurrentPersonID = ret.personID;
- userParams.CurrentPersonName = ret.personName;
-
- //wjw(20160806),注释。。。
- // userParams.CurrentPersonFID = ret.CurrentFID;
- // userParams.CurrentPersonFName = ret.CurrentFName;
- // userParams.CurrentOgnID = ret.CurrentOgnID;
- // userParams.CurrentOgnName = ret.CurrentOgnName;
- // userParams.CurrentFunRole = ret.CurrentFunRole;
- //
- // userParams.CurrentOgnFID = "/" + ret.CurrentFID.split("/")[1];
- // userParams.CurrentOgnFName = "/" + ret.CurrentFName.split("/")[1];
- // if (ret.CurrentFID.indexOf("dpt") > 0) {
- // userParams.CurrentDeptID = ret.CurrentDeptID;
- // userParams.CurrentDeptName = ret.CurrentDeptName;
- // userParams.CurrentDeptFID = ret.CurrentFID.substring(0, ret.CurrentFID.indexOf("dpt") + 3);
- // userParams.CurrentDeptFName = ret.CurrentFName.substring(0, ret.CurrentFName.indexOf("/", ret.CurrentFName.indexOf("/", 2) + 1));
- // }
- saveLoginDataToStore(userParams);
- }
- }
- });
- return ret;
- };
复制代码
loadPerson - loadPerson : function(persons, pid) {
- var deferred = $.Deferred();
- justep.Baas.sendRequest({
- //"url" : "/org/loadPerson",
- "url" : "/ecoolper/chat",
- "action" : "loadPerson",
- "async" : false,
- "params" : {
- "sPersonID" : pid
- },
- "success" : function(data) {
- //客户id
- localStorage.setItem("customerSrv", data.customerSrv);
- $.each(data.persons, function(i, v) {
- var p = {
- id : v.sPersonID,
- name : v.sName,
- uid : v.sNumb,
- avatar : getPersonAvatar(v.sPhoto),
- nick : '',
- phones : [],
- about : ''
- };
- persons[v.sPersonID] = new Person(p);
- });
- deferred.resolve(persons);
- }
- });
- return deferred.promise();
- },
复制代码
updatePersonUid:更新数据库中的sNumb字段
- updatePersonUid : function(uid, pid) {
- var self = this;
- var deferred = $.Deferred();
- justep.Baas.sendRequest({
- "url" : "/zlz/crm/person",
- "action" : "updateUid",
- "async" : false,
- "params" : {
- "uid" : uid,
- "pid" : pid
- },
- "success" : function(data) {
- if (data.state) {
- var person = self._getPerson(pid);
- if (person) {
- person.uid = uid;
- }
- }
- deferred.resolve();
- }
- });
- return deferred.promise();
- },
复制代码
|
|