| | |
| | | let fun1 = util.deepCopy(cb) |
| | | fun1.success = function (res) { |
| | | if (res.success) { |
| | | res.data.forEach(r => { |
| | | if (r.imgUrl && r.imgUrl != '' && r.imgUrl != null) { |
| | | r.imgUrl = $f.basePicUrl + r.imgUrl |
| | | } |
| | | r.time = util.formatTime(r.time) |
| | | r.des = r.des.replaceAll('\\n', '<br/>') |
| | | }); |
| | | if (cb.onPage) { |
| | | cb.onPage(res.head) |
| | | } |
| | | cb.success(res.data) |
| | | } else { |
| | | cb.fail(res.message) |
| | | if (cb.fail) { |
| | | cb.fail(res.message) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | Object.assign(cb, fun) |
| | | $f.get(cb) |
| | | }, |
| | | |
| | | //获取热门问答 |
| | | getTopicQA: function (userId, fun) { |
| | | let cb = { |
| | | url: `/consultation/topic/qa`, |
| | | params: { |
| | | userId: userId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | $f.get(cb) |
| | | }, |
| | | |
| | | //获取热门案例 |
| | | getTopicCase: function (userId, fun) { |
| | | let cb = { |
| | | url: `/consultation/topic/case`, |
| | | params: { |
| | | userId: userId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | |
| | | let fun1 = util.deepCopy(cb) |
| | | fun1.success = function (res) { |
| | | res.forEach(r => { |
| | | if (r.ecAppendixUrl && r.ecAppendixUrl != '' && r.ecAppendixUrl != null) { |
| | | r.ecAppendixUrl = r.ecAppendixUrl.split(';').map((value, index) => { |
| | | return $f.basePicUrl + value |
| | | }) |
| | | } |
| | | }); |
| | | cb.success(res) |
| | | } |
| | | |
| | | $f.get(fun1) |
| | | }, |
| | | |
| | | //获取法律法规文件 |
| | |
| | | |
| | | $f.get(cb) |
| | | }, |
| | | |
| | | //根据类型获取问题 |
| | | getQuestionsByType: function (userId, kind, subKind, page, perPage, fun) { |
| | | let cb = { |
| | | url: `/consultation/question/type`, |
| | | params: { |
| | | userId: userId, |
| | | page: page, |
| | | perPage: perPage |
| | | }, |
| | | } |
| | | if (kind != null) { |
| | | cb.params.kind = kind |
| | | } |
| | | if (subKind != null) { |
| | | cb.params.subKind = subKind |
| | | } |
| | | Object.assign(cb, fun) |
| | | |
| | | let fun1 = util.deepCopy(cb) |
| | | fun1.success = function (res) { |
| | | if (cb.onPage) { |
| | | cb.onPage(res.head) |
| | | } |
| | | if (res.success) { |
| | | cb.success(res.data) |
| | | } else { |
| | | if (cb.fail) { |
| | | cb.fail(res.message) |
| | | } |
| | | } |
| | | } |
| | | |
| | | $f.get(fun1) |
| | | }, |
| | | |
| | | //获取问题 |
| | | getQuestion: function (userId, qId, fun) { |
| | | let cb = { |
| | | url: `/consultation/law/question`, |
| | | params: { |
| | | userId: userId, |
| | | qId: qId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | $f.get(cb) |
| | | }, |
| | | |
| | | //获取答案 |
| | | getAnswers: function (userId, qId, fun) { |
| | | let cb = { |
| | | url: `/consultation/law/answer`, |
| | | params: { |
| | | userId: userId, |
| | | qId: qId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | $f.get(cb) |
| | | }, |
| | | |
| | | //获取案例 |
| | | getCase: function (userId, caseId, fun) { |
| | | let cb = { |
| | | url: `/consultation/law/case`, |
| | | params: { |
| | | userId: userId, |
| | | caseId: caseId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | |
| | | let fun1 = util.deepCopy(cb) |
| | | fun1.success = function (res) { |
| | | if (res.ecAppendixUrl && res.ecAppendixUrl != '' && res.ecAppendixUrl != null) { |
| | | let urls = [] |
| | | let texts = [] |
| | | res.ecAppendixUrl.split(';').forEach(r => { |
| | | urls.push($f.basePicUrl + r) |
| | | const i1 = r.lastIndexOf('/') + 1 |
| | | const i2 = r.lastIndexOf('.') |
| | | texts.push(r.slice(i1, i2)) |
| | | }); |
| | | res.ecAppendixUrl = urls |
| | | res.ecAppendixText = texts |
| | | } |
| | | cb.success(res) |
| | | } |
| | | |
| | | $f.get(fun1) |
| | | }, |
| | | |
| | | //获取环保要素大类 |
| | | getEnElementTypes: function (userId, fun) { |
| | | let cb = { |
| | | url: `/consultation/elementtype`, |
| | | params: { |
| | | userId: userId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | $f.get(cb) |
| | | }, |
| | | |
| | | //获取环保要素小类 |
| | | getEnElementSubTypes: function (userId, fun) { |
| | | let cb = { |
| | | url: `/consultation/elementsubtype`, |
| | | params: { |
| | | userId: userId, |
| | | }, |
| | | } |
| | | Object.assign(cb, fun) |
| | | $f.get(cb) |
| | | }, |
| | | } |