|
@@ -290,47 +290,27 @@ var _default = {
|
|
|
scrollTop: 0
|
|
|
};
|
|
|
},
|
|
|
- onLoad: function () {
|
|
|
- var _onLoad = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
|
+ onShow: function () {
|
|
|
+ var _onShow = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
|
var that;
|
|
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
|
while (1) {
|
|
|
switch (_context.prev = _context.next) {
|
|
|
- case 0:
|
|
|
- that = this;
|
|
|
- case 1:
|
|
|
- case "end":
|
|
|
- return _context.stop();
|
|
|
- }
|
|
|
- }
|
|
|
- }, _callee, this);
|
|
|
- }));
|
|
|
- function onLoad() {
|
|
|
- return _onLoad.apply(this, arguments);
|
|
|
- }
|
|
|
- return onLoad;
|
|
|
- }(),
|
|
|
- onShow: function () {
|
|
|
- var _onShow = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(e) {
|
|
|
- var that;
|
|
|
- return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
|
- while (1) {
|
|
|
- switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
that = this;
|
|
|
that.searchToken();
|
|
|
- _context2.next = 4;
|
|
|
+ _context.next = 4;
|
|
|
return that.searchOther();
|
|
|
case 4:
|
|
|
that.clearPage();
|
|
|
- _context2.next = 7;
|
|
|
+ _context.next = 7;
|
|
|
return that.search();
|
|
|
case 7:
|
|
|
case "end":
|
|
|
- return _context2.stop();
|
|
|
+ return _context.stop();
|
|
|
}
|
|
|
}
|
|
|
- }, _callee2, this);
|
|
|
+ }, _callee, this);
|
|
|
}));
|
|
|
function onShow(_x) {
|
|
|
return _onShow.apply(this, arguments);
|
|
@@ -338,24 +318,27 @@ var _default = {
|
|
|
return onShow;
|
|
|
}(),
|
|
|
onPullDownRefresh: function () {
|
|
|
- var _onPullDownRefresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
|
+ var _onPullDownRefresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
|
var that;
|
|
|
- return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
|
+ return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
|
while (1) {
|
|
|
- switch (_context3.prev = _context3.next) {
|
|
|
+ switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
that = this;
|
|
|
+ _context2.next = 3;
|
|
|
+ return that.searchOther();
|
|
|
+ case 3:
|
|
|
that.clearPage();
|
|
|
- _context3.next = 4;
|
|
|
+ _context2.next = 6;
|
|
|
return that.search();
|
|
|
- case 4:
|
|
|
+ case 6:
|
|
|
uni.stopPullDownRefresh();
|
|
|
- case 5:
|
|
|
+ case 7:
|
|
|
case "end":
|
|
|
- return _context3.stop();
|
|
|
+ return _context2.stop();
|
|
|
}
|
|
|
}
|
|
|
- }, _callee3, this);
|
|
|
+ }, _callee2, this);
|
|
|
}));
|
|
|
function onPullDownRefresh() {
|
|
|
return _onPullDownRefresh.apply(this, arguments);
|
|
@@ -379,11 +362,11 @@ var _default = {
|
|
|
// 查询
|
|
|
search: function search() {
|
|
|
var _this = this;
|
|
|
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
|
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
|
var that, info, res, list;
|
|
|
- return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
|
+ return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
|
while (1) {
|
|
|
- switch (_context4.prev = _context4.next) {
|
|
|
+ switch (_context3.prev = _context3.next) {
|
|
|
case 0:
|
|
|
that = _this;
|
|
|
info = {
|
|
@@ -394,10 +377,10 @@ var _default = {
|
|
|
type: that.tabs.active
|
|
|
};
|
|
|
if (that.user._id) info.user = that.user._id;
|
|
|
- _context4.next = 5;
|
|
|
+ _context3.next = 5;
|
|
|
return that.$api("/article/article", 'GET', _objectSpread({}, info));
|
|
|
case 5:
|
|
|
- res = _context4.sent;
|
|
|
+ res = _context3.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
list = [].concat((0, _toConsumableArray2.default)(that.list), (0, _toConsumableArray2.default)(res.data));
|
|
|
that.$set(that, "list", list);
|
|
@@ -410,10 +393,10 @@ var _default = {
|
|
|
}
|
|
|
case 7:
|
|
|
case "end":
|
|
|
- return _context4.stop();
|
|
|
+ return _context3.stop();
|
|
|
}
|
|
|
}
|
|
|
- }, _callee4);
|
|
|
+ }, _callee3);
|
|
|
}))();
|
|
|
},
|
|
|
// 点击模块
|
|
@@ -437,15 +420,15 @@ var _default = {
|
|
|
// 点赞/取消点赞
|
|
|
toLike: function toLike(item) {
|
|
|
var _this2 = this;
|
|
|
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
|
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
|
var that, res, form;
|
|
|
- return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
|
+ return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
|
while (1) {
|
|
|
- switch (_context5.prev = _context5.next) {
|
|
|
+ switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
|
that = _this2;
|
|
|
if (!(item.is_like == false)) {
|
|
|
- _context5.next = 8;
|
|
|
+ _context4.next = 8;
|
|
|
break;
|
|
|
}
|
|
|
form = {
|
|
@@ -454,17 +437,17 @@ var _default = {
|
|
|
type: '0',
|
|
|
create_time: (0, _moment.default)().format('YYYY-MM-DD HH:mm:ss')
|
|
|
};
|
|
|
- _context5.next = 5;
|
|
|
+ _context4.next = 5;
|
|
|
return that.$api("/like", 'POST', form);
|
|
|
case 5:
|
|
|
- res = _context5.sent;
|
|
|
- _context5.next = 11;
|
|
|
+ res = _context4.sent;
|
|
|
+ _context4.next = 11;
|
|
|
break;
|
|
|
case 8:
|
|
|
- _context5.next = 10;
|
|
|
+ _context4.next = 10;
|
|
|
return that.$api("/like/".concat(item.like), 'DELETE', {});
|
|
|
case 10:
|
|
|
- res = _context5.sent;
|
|
|
+ res = _context4.sent;
|
|
|
case 11:
|
|
|
if (res.errcode == '0') {
|
|
|
that.clearPage();
|
|
@@ -472,37 +455,37 @@ var _default = {
|
|
|
}
|
|
|
case 12:
|
|
|
case "end":
|
|
|
- return _context5.stop();
|
|
|
+ return _context4.stop();
|
|
|
}
|
|
|
}
|
|
|
- }, _callee5);
|
|
|
+ }, _callee4);
|
|
|
}))();
|
|
|
},
|
|
|
// 查询其他信息
|
|
|
searchOther: function searchOther() {
|
|
|
var _this3 = this;
|
|
|
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
|
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
|
var that, res, data, menu;
|
|
|
- return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
|
+ return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
|
while (1) {
|
|
|
- switch (_context6.prev = _context6.next) {
|
|
|
+ switch (_context5.prev = _context5.next) {
|
|
|
case 0:
|
|
|
that = _this3;
|
|
|
- _context6.next = 3;
|
|
|
+ _context5.next = 3;
|
|
|
return that.$api("/config", 'GET', {});
|
|
|
case 3:
|
|
|
- res = _context6.sent;
|
|
|
+ res = _context5.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
that.$set(that, "imgList", res.data.file);
|
|
|
that.$set(that, "config", res.data);
|
|
|
}
|
|
|
//模块
|
|
|
- _context6.next = 7;
|
|
|
+ _context5.next = 7;
|
|
|
return that.$api("/module", 'GET', {
|
|
|
is_use: '0'
|
|
|
});
|
|
|
case 7:
|
|
|
- res = _context6.sent;
|
|
|
+ res = _context5.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
data = res.data.reduce(function (acc, cur, i) {
|
|
|
if (i % 10 === 0) acc.push([cur]); // 新增一个小数组
|
|
@@ -512,22 +495,22 @@ var _default = {
|
|
|
that.$set(that, "moduleList", data);
|
|
|
}
|
|
|
// 公告
|
|
|
- _context6.next = 11;
|
|
|
+ _context5.next = 11;
|
|
|
return that.$api("/notice", 'GET', {
|
|
|
is_use: '0',
|
|
|
limit: 1
|
|
|
});
|
|
|
case 11:
|
|
|
- res = _context6.sent;
|
|
|
+ res = _context5.sent;
|
|
|
if (res.errcode == '0') that.$set(that, "content", res.data[0].name);
|
|
|
// 查询状态
|
|
|
- _context6.next = 15;
|
|
|
+ _context5.next = 15;
|
|
|
return that.$api("/dictData", 'GET', {
|
|
|
type: 'home_tabs',
|
|
|
is_use: '0'
|
|
|
});
|
|
|
case 15:
|
|
|
- res = _context6.sent;
|
|
|
+ res = _context5.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
menu = res.data.map(function (item) {
|
|
|
return {
|
|
@@ -538,19 +521,19 @@ var _default = {
|
|
|
that.$set(that.tabs, "menu", menu);
|
|
|
}
|
|
|
// 广告
|
|
|
- _context6.next = 19;
|
|
|
+ _context5.next = 19;
|
|
|
return that.$api("/advert", 'GET', {
|
|
|
is_use: '0'
|
|
|
});
|
|
|
case 19:
|
|
|
- res = _context6.sent;
|
|
|
+ res = _context5.sent;
|
|
|
if (res.errcode == '0') that.$set(that, "advertList", res.data);
|
|
|
case 21:
|
|
|
case "end":
|
|
|
- return _context6.stop();
|
|
|
+ return _context5.stop();
|
|
|
}
|
|
|
}
|
|
|
- }, _callee6);
|
|
|
+ }, _callee5);
|
|
|
}))();
|
|
|
},
|
|
|
// 选择选项卡
|