/** * +------------------------------------------------------------ * | 数据 (cim/index.js) * +------------------------------------------------------------ * | @copyright: CIM (https://cimxx.com) * +------------------------------------------------------------ */ ;(function (factory) { if (typeof define === "function" && define.amd) { define(factory); } else { if (typeof window.cim != "function") window.cim = {}; window.cim.index = factory(); } })(function () { var index = { like: function () { }, hits: function () { var $hits = $('[rel=hits]'); $hits.each(function () { var $this = $(this); var id = $this.data('id'); $.get('/index/api/hits?id=' + id, function (rs) { $this.text(rs); }); }); }, highlight: function (text) { $('*[rel=highlight]').each(function () { $(this).html($(this).html().replace(new RegExp(text, 'gm'), '' + text + '')); }); }, top: function () { }, redpack: function () { $('[rel=redpacket]').each(function () { $(this).click(function () { var id = $(this).data('id'); var cid = $(this).data('cid'); var key = $(this).data('key'); var param = { id: id, cid: cid, key: key }; $.post("/index/api/view_behavior", param, function (rs) { console.log(rs); var data = rs; var peopleHtml = ''; if (data.history.length == 0) { peopleHtml = '
${data.history[i].name}
他们已经抢到了红包
通过移动端登录分享即可获得红包哦