gree_leran/unpackage/dist/dev/mp-weixin/pages/intergral/intergral.js

67 lines
2.6 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
nowTime: "",
baseUrl,
scocre: null,
rankList: []
};
},
onLoad() {
this.getTime();
this.getRanking();
},
methods: {
async getRanking() {
const resp = await getUserIntegral();
console.log(resp);
this.rankList = resp.data;
this.rankList.forEach((e) => {
this.scocre += e.integral;
});
},
getTime: function() {
var date = /* @__PURE__ */ new Date(), year = date.getFullYear(), month = date.getMonth() + 1, day = date.getDate(), hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? month = "0" + month : "";
day >= 0 && day <= 9 ? day = "0" + day : "";
var timer = year + "-" + month + "-" + day + " " + hour + ":00";
this.nowTime = timer;
console.log(this.nowTime);
}
},
filters: {}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.rankList[1].user.avatar ? $data.baseUrl + $data.rankList[1].user.avatar : "/static/hands.png",
b: common_vendor.t($data.rankList[1].user.nickName),
c: common_vendor.t($data.rankList[1].integral),
d: $data.rankList[0].user.avatar ? $data.baseUrl + $data.rankList[0].user.avatar : "/static/hands.png",
e: common_vendor.t($data.rankList[0].user.nickName),
f: common_vendor.t($data.rankList[0].integral),
g: $data.rankList[2].user.avatar ? $data.baseUrl + $data.rankList[2].user.avatar : "/static/hands.png",
h: common_vendor.t($data.rankList[1].user.nickName),
i: common_vendor.t($data.rankList[1].integral),
j: common_vendor.t($data.nowTime),
k: common_vendor.t(new Number($data.scocre / $data.rankList.length).toFixed(2)),
l: _ctx.index < 100
}, _ctx.index < 100 ? {
m: common_vendor.f($data.rankList, (item, index, i0) => {
return {
a: common_vendor.t(index + 4),
b: item.user.avatar ? $data.baseUrl + item.user.avatar : "/static/hands.png",
c: common_vendor.t(item.user.nickName),
d: common_vendor.t(item.post),
e: common_vendor.t(item.integral),
f: index
};
})
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "C:/Users/33043/Desktop/文件/work/newStud学习/greenStu/pages/intergral/intergral.vue"]]);
wx.createPage(MiniProgramPage);