142 lines
4.8 KiB
JavaScript
142 lines
4.8 KiB
JavaScript
var t, a, e;
|
|
|
|
t = getApp(), a = require("../../utils/util.js"), e = t.globalData.api_host, t.globalData.api,
|
|
Page({
|
|
data: {
|
|
xz: t.globalData.xz,
|
|
swidth: t.globalData.swidth,
|
|
list: "",
|
|
q: "",
|
|
type: 0,
|
|
animationData: "",
|
|
birthday: "",
|
|
sharelayer: !1,
|
|
sharebox: !1,
|
|
sharemodal: !1,
|
|
bot: "-100%",
|
|
openSettingBtnHidden: !0,
|
|
hide_qcode: 1,
|
|
show: !1
|
|
},
|
|
onLoad: function(o) {
|
|
var n = this, s = this.options.q, i = this;
|
|
s = (s = a.authcode(s, "decode")).substr(2, s.length - 1);
|
|
var r = decodeURIComponent(this.options.scene);
|
|
if (r) {
|
|
var l = t._get(r, "q");
|
|
l && (s = l);
|
|
}
|
|
var d, h, c, u = s.split("_");
|
|
u.length > 3 ? (d = u[0] + "年" + u[1] + "月" + u[2] + "日" + u[3] + "时" + u[4] + "分",
|
|
h = u[1] + "月" + u[2] + "日", c = u[0] + "," + u[1] + "," + u[2] + "_" + u[3] + "," + u[4] + "_" + u[6] + "," + u[7]) : (d = u[0] + "月" + u[1] + "日",
|
|
h = u[0] + "月" + u[1] + "日", c = u[0] + "-" + u[1]), console.log(c), i.setData({
|
|
q: s,
|
|
birthday: d,
|
|
mday: h
|
|
});
|
|
var f = e + "/cquery.js?q=" + c + "&vc=xcx&token=Mh8tGmRZ3qXvo6smQ";
|
|
wx.request({
|
|
url: f,
|
|
success: function(t) {
|
|
var a = t.data.data, e = i.data.xz.indexOf(a[0].index[0]) + 1;
|
|
if (a.length > 1) var o = i.data.xz.indexOf(a[1].index[0]) + 1;
|
|
i.setData({
|
|
list: a,
|
|
sunid: e,
|
|
moonid: o || ""
|
|
}), encodeURIComponent("q=" + i.data.q);
|
|
}
|
|
}), t.globalData.userInfo ? this.setData({
|
|
userInfo: t.globalData.userInfo,
|
|
hasUserInfo: !0
|
|
}) : this.data.canIUse ? t.userInfoReadyCallback = function(t) {
|
|
n.setData({
|
|
userInfo: t.userInfo,
|
|
hasUserInfo: !0
|
|
});
|
|
} : wx.getUserInfo({
|
|
success: function(a) {
|
|
t.globalData.userInfo = a.userInfo, n.setData({
|
|
userInfo: a.userInfo,
|
|
hasUserInfo: !0
|
|
});
|
|
}
|
|
}), i.data.infodata;
|
|
},
|
|
dealDate: function(t, a) {
|
|
var e, o;
|
|
if (t.split("_").length > 1) {
|
|
var n = (i = t.split("_"))[0].split(","), s = i[1].split(",");
|
|
e = n[0] + "年" + n[1] + "月" + n[2] + "日" + s[0] + "时" + s[1] + "分", o = n[1] + "月" + n[2] + "日";
|
|
} else {
|
|
var i = t.split(",");
|
|
e = i[0] + "年" + i[1] + "月" + i[2] + "日", o = i[1] + "月" + i[2] + "日";
|
|
}
|
|
a.setData({
|
|
q: t,
|
|
birthday: e,
|
|
mday: o
|
|
});
|
|
},
|
|
changexz: function(t) {
|
|
var a = this, e = t.currentTarget.id, o = -a.data.swidth, n = wx.createAnimation({
|
|
duration: 300,
|
|
timingFunction: "ease-in",
|
|
delay: 0
|
|
});
|
|
n.translateX(o * e).step(), a.setData({
|
|
animationData: n.export(),
|
|
i: e
|
|
}), console.log(a.data.i), a.setConHeight();
|
|
},
|
|
setConHeight: function() {
|
|
var t = this, a = wx.createSelectorQuery().in(this);
|
|
a.select(".conbox .cbox.cur").boundingClientRect(), a.exec(function(a) {
|
|
var e = a[0].height;
|
|
t.setData({
|
|
conHeight: e
|
|
});
|
|
});
|
|
},
|
|
showShareModal: function() {
|
|
a.showModal(this, "sharebox", "sharemodal", "sharelayer", "bot");
|
|
},
|
|
hideShareModal: function() {
|
|
a.hideModal(this, "sharemodal", "sharelayer", "bot");
|
|
},
|
|
getUserInfo: function(a) {
|
|
console.log(a), t.globalData.userInfo = a.detail.userInfo, this.setData({
|
|
userInfo: a.detail.userInfo,
|
|
hasUserInfo: !0
|
|
});
|
|
},
|
|
share: function() {
|
|
a.hideModal(this, "sharemodal", "sharelayer", "bot"), this.setData({
|
|
hide_qcode: 0
|
|
});
|
|
},
|
|
test: function() {
|
|
var t = encodeURIComponent("q=2017,07,22_12,25");
|
|
wx.navigateTo({
|
|
url: "/pages/astrocx_info/astrocx_info?scene=" + t
|
|
});
|
|
},
|
|
closeQcode: function() {
|
|
this.setData({
|
|
hide_qcode: 1
|
|
});
|
|
},
|
|
handleSetting: function(t) {
|
|
t.detail.authSetting["scope.writePhotosAlbum"] && (this.setData({
|
|
openSettingBtnHidden: !0
|
|
}), drawImg.save_file(this));
|
|
},
|
|
onShareAppMessage: function(t) {
|
|
return "button" === t.from && console.log(t.target), {
|
|
title: "星座查询",
|
|
path: "/pages/astrocx/astrocx_info?q=" + a.authcode("0_" + this.data.q, "encode"),
|
|
success: function(t) {},
|
|
fail: function(t) {}
|
|
};
|
|
}
|
|
}); |