442 lines
18 KiB
JavaScript
Executable File
442 lines
18 KiB
JavaScript
Executable File
var t, a = require("../../@babel/runtime/helpers/defineProperty"), e = getApp(), r = wx.createInnerAudioContext();
|
|
|
|
Page({
|
|
data: (t = {
|
|
active: 0,
|
|
curIndex: 0,
|
|
token: "",
|
|
cardTemplateUseId: "",
|
|
cardTemplateDispatchId: "",
|
|
cardInfo: {},
|
|
areaList: [],
|
|
haveCard: !1,
|
|
bgImg: ""
|
|
}, a(t, "areaList", []), a(t, "cardHeight", ""), a(t, "cardInfo", {}), a(t, "cardUrl", e.baseUrls.baseCardUrl),
|
|
a(t, "personIntro", {}), a(t, "companyIntro", {}), a(t, "shareImg", ""), a(t, "phoneTxt", ""),
|
|
a(t, "emailTxt", ""), a(t, "wechateTxt", ""), a(t, "addressTxt", ""), a(t, "viewInfo", {}),
|
|
a(t, "forwardCount", ""), a(t, "imgUrl", e.baseUrls.baseCardUrl), a(t, "personId", ""),
|
|
a(t, "shareRecordId", ""), a(t, "nameTxt", "名片"), a(t, "dataList", []), a(t, "isShowBarCode", !1),
|
|
a(t, "browUserList", []), a(t, "tempUserId", ""), a(t, "shareImgUrl", ""), t),
|
|
doLogin: function() {
|
|
var t = this;
|
|
wx.showLoading({
|
|
title: "加载中..."
|
|
}), wx.login({
|
|
success: function(a) {
|
|
e.http.post(e.urls.wxLogin, {
|
|
data: {
|
|
jsCode: a.code
|
|
}
|
|
}).then(function(a) {
|
|
wx.hideLoading({});
|
|
var r = a.data.data.split("_")[0];
|
|
wx.setStorageSync("token", r), wx.setStorageSync("bindPhone", a.data.data.split("_")[1]),
|
|
t.setData({
|
|
token: r
|
|
}), e.globalData.token = r, t.getCardId();
|
|
}).catch(function(t) {
|
|
wx.hideLoading({}), console.log(t);
|
|
});
|
|
}
|
|
});
|
|
},
|
|
saveCheckRecord: function() {
|
|
console.log("1123"), e.http.post(e.urls.checkRecord, {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {
|
|
cardTemplateUseId: this.data.cardTemplateUseId,
|
|
cardTemplateDispatchId: this.data.cardTemplateDispatchId
|
|
}
|
|
}).then(function(t) {
|
|
console.log(t);
|
|
}).catch(function(t) {
|
|
console.log(t);
|
|
});
|
|
},
|
|
getCard: function() {
|
|
var t = this;
|
|
e.http.get(e.urls.shareCard.format({
|
|
cardTemplateUseId: t.data.cardTemplateUseId
|
|
}), {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {}
|
|
}).then(function(a) {
|
|
console.log(a.data);
|
|
for (var e = a.data.areaList, r = 0; r < e.length; r++) "1" == e[r].templateAreaFontCenter ? e[r].templateAreaFontCenter = "left" : "2" == e[r].templateAreaFontCenter ? e[r].templateAreaFontCenter = "center" : e[r].templateAreaFontCenter = "right",
|
|
"0" == e[r].templateAreaFontBold ? e[r].templateAreaFontBold = "normal" : "1" == e[r].templateAreaFontBold ? e[r].templateAreaFontBold = "bold" : e[r].templateAreaFontStyle = "italic",
|
|
"phone" == e[r].templateAreaSource ? t.setData({
|
|
phoneTxt: e[r].templateAreaFontValue
|
|
}) : "wechat" == e[r].templateAreaSource ? t.setData({
|
|
wechatTxt: e[r].templateAreaFontValue
|
|
}) : "email" == e[r].templateAreaSource ? t.setData({
|
|
emailTxt: e[r].templateAreaFontValue
|
|
}) : "address" == e[r].templateAreaSource ? t.setData({
|
|
addressTxt: e[r].templateAreaFontValue
|
|
}) : "name" == e[r].templateAreaSource && t.setData({
|
|
nameTxt: e[r].templateAreaFontValue
|
|
});
|
|
t.setData({
|
|
cardInfo: a.data,
|
|
areaList: e,
|
|
dataList: []
|
|
}), a.data && (t.toSaveLocalImg(a.data.cardTemplateUseDispatchPhoto), t.getBrowCardUserList(a.data.cardTemplateUseId),
|
|
t.setData({
|
|
tempUserId: a.data.creator
|
|
}), t.getMainColumn(a.data.creator));
|
|
});
|
|
},
|
|
getMainColumn: function(t) {
|
|
var a = this;
|
|
e.http.get(e.urls.getMainColumn, {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {
|
|
cardTemplateUseId: t
|
|
}
|
|
}).then(function(e) {
|
|
wx.showLoading({
|
|
title: "加载中..."
|
|
}), console.log(e.data), a.getMainMoment(e.data, t, 0);
|
|
}).catch(function(t) {});
|
|
},
|
|
getMainMoment: function(t, a, r) {
|
|
var s = this;
|
|
r < t.length ? e.http.get(e.urls.getMainMoment.format({
|
|
configColumnId: t[s.data.curIndex].configColumnId
|
|
}), {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {
|
|
userId: a
|
|
}
|
|
}).then(function(e) {
|
|
if (e.data.length > 0) {
|
|
var r = {
|
|
cId: t[s.data.curIndex].configColumnId,
|
|
type: t[s.data.curIndex].configColumnType,
|
|
name: t[s.data.curIndex].configColumnName,
|
|
mode: t[s.data.curIndex].configTableMode,
|
|
list: e.data.slice(0, t[s.data.curIndex].configColumnRowCount)
|
|
};
|
|
s.data.dataList.push(r);
|
|
}
|
|
s.setData({
|
|
curIndex: ++s.data.curIndex
|
|
}), s.getMainMoment(t, a, s.data.curIndex);
|
|
}).catch(function(e) {
|
|
s.setData({
|
|
curIndex: ++s.data.curIndex
|
|
}), s.getMainMoment(t, a, s.data.curIndex);
|
|
}) : (wx.hideLoading({}), wx.stopPullDownRefresh({}), s.buildMainData());
|
|
},
|
|
buildMainData: function() {
|
|
this.data.dataList.forEach(function(t) {
|
|
t.list.forEach(function(t) {
|
|
t.list.forEach(function(t) {
|
|
switch (t.dataType) {
|
|
case "2":
|
|
var a = t.value.split(","), r = [];
|
|
a.forEach(function(t) {
|
|
var a = {
|
|
id: t,
|
|
path: e.baseUrls.baseCardUrl + t
|
|
};
|
|
r.push(a);
|
|
}), t.valueList = r;
|
|
break;
|
|
|
|
case "3":
|
|
a = t.value.split(","), r = [];
|
|
a.forEach(function(t) {
|
|
var a = {
|
|
id: t,
|
|
path: e.baseUrls.baseCardUrl + t,
|
|
isPlay: !1,
|
|
duration: 1e5,
|
|
curDuration: 0,
|
|
curDurationStr: "00:00",
|
|
totalDurationStr: "00:00"
|
|
};
|
|
r.push(a);
|
|
}), t.valueList = r;
|
|
break;
|
|
|
|
case "4":
|
|
a = t.value.split(","), r = [];
|
|
for (var s = 0; s < a.length; s++) {
|
|
var i = a[s].split("&"), n = {
|
|
path: e.baseUrls.baseCardUrl + i[0],
|
|
imgPath: e.baseUrls.baseCardUrl + i[1]
|
|
};
|
|
r.push(n);
|
|
}
|
|
t.valueList = r;
|
|
break;
|
|
|
|
case "6":
|
|
a = t.value.split("-"), r = [];
|
|
a.forEach(function(t) {
|
|
var a = t.split(","), e = {
|
|
name: "",
|
|
address: "",
|
|
latitude: a[0],
|
|
longitude: a[1]
|
|
};
|
|
r.push(e);
|
|
}), t.valueList = r;
|
|
break;
|
|
|
|
case "8":
|
|
t.dictionariesList.forEach(function(a) {
|
|
-1 != t.value.indexOf(a.dataId) && (t.selValue = a.dataName);
|
|
});
|
|
break;
|
|
|
|
case "9":
|
|
t.dictionariesList.forEach(function(a) {
|
|
-1 != t.value.indexOf(a.dataId) ? a.isSel = !0 : a.isSel = !1;
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}), this.setData({
|
|
curIndex: 0,
|
|
dataList: this.data.dataList
|
|
});
|
|
},
|
|
includedCard: function() {
|
|
e.http.post(e.urls.includedCard, {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {
|
|
cardTemplateUseBagId: "",
|
|
cardTemplateUseId: this.data.cardInfo.cardTemplateUseId,
|
|
cardTemplateUseStar: "",
|
|
cardTemplateUseTag: "",
|
|
cardTemplateUseTop: ""
|
|
}
|
|
}).then(function(t) {
|
|
"200" == t.statusCode && wx.showToast({
|
|
title: "加入卡包成功!"
|
|
});
|
|
});
|
|
},
|
|
getCardId: function() {
|
|
var t = this;
|
|
e.http.get(e.urls.getCardUseId.format({
|
|
cardTemplateDispatchId: t.data.cardTemplateDispatchId
|
|
}), {
|
|
header: {
|
|
token: e.globalData.token
|
|
}
|
|
}).then(function(a) {
|
|
t.setData({
|
|
cardTemplateUseId: a.data.cardTemplateUseDTO.cardTemplateUseId
|
|
}), t.getCard(), t.saveCheckRecord();
|
|
});
|
|
},
|
|
onLoad: function(t) {
|
|
this.setData({
|
|
cardTemplateDispatchId: t.cardTemplateDispatchId
|
|
}), this.doLogin();
|
|
},
|
|
makeCall: function() {
|
|
var t = this.data.phoneTxt;
|
|
t && wx.makePhoneCall({
|
|
phoneNumber: t
|
|
});
|
|
},
|
|
copyText: function(t) {
|
|
var a = t.currentTarget.dataset.text;
|
|
a && wx.setClipboardData({
|
|
data: a,
|
|
success: function() {}
|
|
});
|
|
},
|
|
showBarCode: function() {
|
|
this.setData({
|
|
isShowBarCode: !0
|
|
});
|
|
},
|
|
hideBarCode: function() {
|
|
this.setData({
|
|
isShowBarCode: !1
|
|
});
|
|
},
|
|
onShareAppMessage: function(t) {
|
|
if (wx.showShareMenu({
|
|
withShareTicket: !0,
|
|
success: function(t) {
|
|
console.log(t);
|
|
}
|
|
}), "button" == t.from) {
|
|
var a = this.buildId();
|
|
return this.shareRecord(a), {
|
|
title: "名片分享",
|
|
path: "/pages/sharePage/sharePage?cardTemplateDispatchId=" + a,
|
|
imageUrl: this.data.shareImgUrl
|
|
};
|
|
}
|
|
},
|
|
getBrowCardUserList: function(t) {
|
|
var a = this;
|
|
e.http.get(e.urls.getCardBrowUserList, {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {
|
|
page: "1",
|
|
rows: "7",
|
|
cardTemplateUseId: t
|
|
}
|
|
}).then(function(t) {
|
|
t.data && a.setData({
|
|
browUserList: t.data.rows
|
|
});
|
|
}).catch(function(t) {
|
|
console.log(t);
|
|
});
|
|
},
|
|
shareRecord: function(t) {
|
|
var a = this;
|
|
e.http.post(e.urls.shareRecord, {
|
|
header: {
|
|
token: e.globalData.token
|
|
},
|
|
data: {
|
|
cardTemplateUseId: a.data.cardInfo.cardTemplateUseId,
|
|
cardTemplateDispatchParentId: a.data.cardTemplateDispatchId,
|
|
cardTemplateDispatchId: t
|
|
}
|
|
}).then(function(t) {
|
|
console.log(t.data), a.setData({
|
|
shareRecordId: t.data.data
|
|
});
|
|
});
|
|
},
|
|
buildId: function() {
|
|
for (var t = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ], a = "", e = 0; e < 36; e++) {
|
|
a += t[parseInt(61 * Math.random())];
|
|
}
|
|
return a;
|
|
},
|
|
viewImg: function(t) {
|
|
wx.previewImage({
|
|
urls: [ t.currentTarget.dataset.url ]
|
|
});
|
|
},
|
|
viewVideo: function(t) {
|
|
var a = t.currentTarget.dataset.url;
|
|
wx.previewMedia({
|
|
sources: [ {
|
|
url: a,
|
|
type: "video"
|
|
} ]
|
|
});
|
|
},
|
|
play: function(t) {
|
|
var a = this, e = t.currentTarget.dataset.index, s = t.currentTarget.dataset.idx, i = t.currentTarget.dataset.i, n = t.currentTarget.dataset.a, d = t.currentTarget.dataset.item;
|
|
a.data.dataList.forEach(function(t) {
|
|
t.list.forEach(function(t) {
|
|
t.list.forEach(function(t) {
|
|
"3" == t.dataType && t.valueList && t.valueList.forEach(function(t) {
|
|
t.isPlay && r.stop(), t.isPlay = !1, t.curDuration = 0, t.curDuationStr = "00:00";
|
|
});
|
|
});
|
|
});
|
|
}), d.isPlay ? r.stop() : ((r = wx.createInnerAudioContext()).src = a.data.dataList[e].list[s].list[i].valueList[n].path + ".mp3",
|
|
r.autoplay = !0, console.log(a.data.dataList[e].list[s].list[i].valueList[n].path)),
|
|
r.onPlay(function() {
|
|
console.log("onPlay"), a.data.dataList[e].list[s].list[i].valueList[n].isPlay = !0,
|
|
a.setData({
|
|
dataList: a.data.dataList
|
|
});
|
|
}), r.onCanplay(function(t) {}), r.onStop(function(t) {
|
|
console.log("停止播放"), a.data.dataList[e].list[s].list[i].valueList[n].isPlay = !1,
|
|
a.data.dataList[e].list[s].list[i].valueList[n].curDuration = 0, a.data.dataList[e].list[s].list[i].valueList[n].curDurationStr = "00:00",
|
|
a.setData({
|
|
dataList: a.data.dataList
|
|
}), r.destroy();
|
|
}), r.onEnded(function(t) {
|
|
console.log(t), console.log("播放完毕"), a.data.dataList[e].list[s].list[i].valueList[n].isPlay = !1,
|
|
a.data.dataList[e].list[s].list[i].valueList[n].curDuration = 0, a.data.dataList[e].list[s].list[i].valueList[n].curDurationStr = "00:00",
|
|
a.setData({
|
|
dataList: a.data.dataList
|
|
}), r.destroy();
|
|
}), r.onError(function(t) {
|
|
console.log("播放错误"), console.log(t), a.data.dataList[e].list[s].list[i].valueList[n].isPlay = !1,
|
|
a.data.dataList[e].list[s].list[i].valueList[n].curDuration = 0, a.data.dataList[e].list[s].list[i].valueList[n].curDurationStr = "00:00",
|
|
a.setData({
|
|
dataList: a.data.dataList
|
|
}), r.destroy();
|
|
}), r.onSeeking(function() {}), r.onWaiting(function() {}), r.onTimeUpdate(function() {
|
|
if (r.duration != 1 / 0) {
|
|
a.data.dataList[e].list[s].list[i].valueList[n].curDuration = parseInt(r.currentTime),
|
|
a.data.dataList[e].list[s].list[i].valueList[n].duration = parseInt(r.duration);
|
|
var t = parseInt(r.currentTime / 60), d = parseInt(r.currentTime % 60), o = parseInt(r.duration / 60), l = parseInt(r.duration % 60), c = t > 9 ? t : "0" + t, u = d > 9 ? d : "0" + d, h = o > 9 ? o : "0" + o, p = +l > 9 ? l : "0" + l;
|
|
a.data.dataList[e].list[s].list[i].valueList[n].curDurationStr = c + ":" + u, a.data.dataList[e].list[s].list[i].valueList[n].totalDurationStr = h + ":" + p,
|
|
a.setData({
|
|
dataList: a.data.dataList
|
|
});
|
|
}
|
|
});
|
|
},
|
|
rewind: function(t) {
|
|
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.item, s = t.currentTarget.dataset.idx, i = t.currentTarget.dataset.a, n = t.currentTarget.dataset.i;
|
|
e.isPlay && (this.data.dataList[a].list[s].list[n].valueList[i].curDuration = this.data.dataList[a].list[s].list[n].valueList[i].curDuration - this.data.speedStep,
|
|
r.seek(this.data.dataList[a].list[s].list[n].valueList[i].curDuration), this.setData({
|
|
dataList: this.data.dataList
|
|
}));
|
|
},
|
|
speed: function(t) {
|
|
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.item, s = t.currentTarget.dataset.idx, i = t.currentTarget.dataset.a, n = t.currentTarget.dataset.i;
|
|
e.isPlay && (this.data.dataList[a].list[s].list[n].valueList[i].curDuration = this.data.dataList[a].list[s].list[n].valueList[i].curDuration + this.data.speedStep,
|
|
r.seek(this.data.dataList[a].list[s].list[n].valueList[i].curDuration), this.setData({
|
|
dataList: this.data.dataList
|
|
}));
|
|
},
|
|
slider4change: function(t) {
|
|
t.currentTarget.dataset.index;
|
|
t.currentTarget.dataset.item.isPlay && r.seek(t.detail.value);
|
|
},
|
|
toSaveLocalImg: function(t) {
|
|
var a = t, e = wx.env.USER_DATA_PATH + "/indexshare.png", r = a.replace(/^data:image\/\w+;base64,/, "");
|
|
wx.getFileSystemManager().writeFileSync(e, r, "base64"), this.setData({
|
|
shareImgUrl: e
|
|
});
|
|
},
|
|
goHome: function() {
|
|
wx.switchTab({
|
|
url: "/pages/index/index"
|
|
});
|
|
},
|
|
showDetail: function(t) {
|
|
if (-1 != t.currentTarget.dataset.ctype.indexOf("dda5007c-5fb7-48f2-8537-3cb8ea298242")) {
|
|
var a = t.currentTarget.dataset.cid, e = t.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: "../moments/momentsdetail/momentsdetail?uId=" + e + "&cId=" + a
|
|
});
|
|
}
|
|
},
|
|
showMore: function(t) {
|
|
var a = t.currentTarget.dataset.item;
|
|
if ("2" == a.mode) {
|
|
var e = t.currentTarget.dataset.userid, r = t.currentTarget.dataset.idx;
|
|
wx.navigateTo({
|
|
url: "../../pages/moments/showlist/showlist?id=" + a.cId + "&userId=" + e + "&index=" + r
|
|
});
|
|
}
|
|
},
|
|
onChange: function(t) {
|
|
this.setData({
|
|
active: t.detail
|
|
});
|
|
}
|
|
}); |