var t = getApp(), i = null, a = 0;
Page({
data: {
age: "",
height: "",
weight: "",
pickGirl: "",
traitArr: "",
love: "",
loading: !1,
girlName: "",
date: "",
girlHeight: "",
girlWeight: "",
girlCup: "",
girlHair: "",
girlCharacter: "",
professionIncome: "",
wifePhoto: "",
showPhoto: "",
avatar: "",
nickName: "",
canvasHidden: !1,
share: "",
ismotal: !1
},
onLoad: function(e) {
var o = this, r = e.age, n = parseInt(e.height), s = parseInt(e.weight), c = e.pickGirl, l = e.traitArr, g = e.love;
1 == e.share ? (console.log("分享进来的:" + e.share), o.setData({
share: e.share,
avatar: e.avatar,
nickName: e.nickName,
wifePhoto: e.wifePhoto,
girlName: e.girlName,
date: e.date,
girlHeight: e.girlHeight,
girlWeight: e.girlWeight,
girlCup: e.girlCup,
girlHair: e.girlHair,
girlCharacter: e.girlCharacter,
professionIncome: e.professionIncome
}), this.playCanvas()) : (o.setData({
age: r,
height: n,
weight: s,
pickGirl: c,
traitArr: JSON.parse(l),
love: g,
avatar: t.globalData.userInfo.avatarUrl,
nickName: t.globalData.userInfo.nickName
}), this.algorithm(), this.playCanvas()), o.setData({
ismotal: !0
}), wx.createRewardedVideoAd && ((i = wx.createRewardedVideoAd({
adUnitId: "adunit-9f27451723f8ec9e"
})).onLoad(function() {
console.log("createRewardedVideoAd onLoad");
}), i.onError(function(t) {
console.log("createRewardedVideoAd onError");
}), i.onClose(function(t) {
t && t.isEnded ? o.setData({
ismotal: !1
}) : wx.showModal({
title: "提示",
showCancel: !1,
content: "请观看完整视频,才可以查看结果"
});
})), wx.request({
url: "https://xcx.codeagod.com/love/1.json",
method: "GET",
success: function(t) {
console.log(t), a = t.data.ret;
}
});
},
motkBtn: function() {
i && 1 == a ? i.show().catch(function() {
i.load().then(function() {
return i.show();
}).catch(function(t) {
console.log("激励视频 广告显示失败");
});
}) : this.setData({
ismotal: !1
});
},
playCanvas: function() {
var t = this, i = wx.createCanvasContext("wife"), a = t.data.avatar;
i.drawImage("../../images/bg.jpg", 5, 5, 352, 524), i.save(), i.arc(65, 55, 25, 0, 2 * Math.PI),
i.clip(), wx.getImageInfo({
src: a,
success: function(a) {
var e = a.path;
i.drawImage(e, 40, 30, 50, 50), i.restore(), i.beginPath(), i.textAlign = "center",
i.font = "bold 20px Arial", i.lineWidth = 1, i.fillStyle = "rgb(0,0,0)", i.fillText(t.data.nickName + "理想中的老婆", 200, 60),
i.save();
var o = t.data.wifePhoto;
i.drawImage(o, 130, 85, 100, 100), i.lineWidth = 5, i.lineJoin = "round", i.strokeRect(130, 85, 101, 101),
i.beginPath(), i.textAlign = "left", i.font = "bold 18px Arial", i.lineWidth = 1,
i.fillStyle = "rgb(0,0,0)", i.fillText("姓名:" + t.data.girlName, 80, 220), i.fillText("生日:" + t.data.date, 80, 250),
i.fillText("身高:" + t.data.girlHeight + "CM", 80, 280), i.fillText("体重:" + t.data.girlWeight + "KG", 80, 310),
i.fillText("罩杯:" + t.data.girlCup + "罩杯", 80, 340), i.fillText("头发:" + t.data.girlHair, 80, 370),
i.fillText("性格:" + t.data.girlCharacter, 80, 400), i.fillText("职业/收入:" + t.data.professionIncome, 80, 430),
i.save(), i.draw(!1, function() {
wx.canvasToTempFilePath({
canvasId: "wife",
quality: 1,
success: function(i) {
console.log(i.tempFilePath), t.setData({
showPhoto: i.tempFilePath,
canvasHidden: !0
});
},
fail: function(t) {
console.log(t);
}
});
});
}
});
},
saveWifePath: function() {
var t = this.data.showPhoto;
wx.saveImageToPhotosAlbum({
filePath: t,
success: function(t) {
console.log(t), wx.showToast({
title: "图片保存成功",
icon: "success",
duration: 2e3
});
},
fail: function(t) {
console.log(t), wx.showToast({
title: "图片保存失败",
icon: "success",
duration: 2e3
});
}
});
},
getNewWife: function() {
wx.navigateTo({
url: "pages/index/index"
});
},
algorithm: function() {
var t = this, i = [ "周", "李", "何", "范", "尹", "倪", "张", "韩", "粱", "黄", "柏", "戚", "杨", "沈", "刘", "胡", "朱", "林", "袁", "王", "吴", "陈" ], a = [ "思", "雅", "晴", "彦", "婉", "仪", "伊", "琪", "薇", "颖", "倩", "媛", "语", "媛", "晗", "佳", "玲", "嘉", "璐", "俪", "凝", "莉", "茹", "温", "贻", "姗", "美", "琴", "菲", "梦", "雨", "萱", "洁", "妍", "欣", "玉", "悦", "娜", "婷", "熙", "玉", "宁", "爽", "莉", "瑶", "荷", "秋", "蕊", "羽", "希" ], e = i[t.randomNum(0, i.length - 1)] + a[t.randomNum(0, a.length - 1)] + a[t.randomNum(0, a.length - 1)];
console.log("女孩名字:" + e), t.setData({
girlName: e
});
var o = "", r = "", n = "", s = void 0, c = t.data.age, l = t.data.height, g = (t.data.weight,
t.data.pickGirl), f = t.data.traitArr, m = t.data.love;
c > 30 && (c = 28), "a" == m && (s = 2018 - c + 2, "能力" == f[0].trait && (o = s - 2),
"能力" == f[1].trait && (o = s - 1), "能力" == f[2].trait && (o = s), "能力" == f[3].trait && (o = s + 1)),
"b" == m && (s = 2018 - c - 3, "能力" == f[0].trait && (o = s - 2), "能力" == f[1].trait && (o = s - 1),
"能力" == f[2].trait && (o = s), "能力" == f[3].trait && (o = s + 1)), "c" == m && (s = 2018 - c + 1,
"能力" == f[0].trait && (o = s - 2), "能力" == f[1].trait && (o = s - 1), "能力" == f[2].trait && (o = s),
"能力" == f[3].trait && (o = s + 1)), "d" == m && (s = 2018 - c + 4, "能力" == f[0].trait && (o = s - 2),
"能力" == f[1].trait && (o = s - 1), "能力" == f[2].trait && (o = s), "能力" == f[3].trait && (o = s + 1)),
r = t.randomNum(1, 12);
var d = t.getDates(r, o), p = o + "年" + r + "月" + (n = t.randomNum(1, d)) + "日";
t.setData({
date: p
});
var h = "", u = "", w = "", v = "", C = "", x = "", D = void 0, N = l - 10;
1 == g && (D = N + 4, "身材" == f[0].trait && (h = D + 2), "身材" == f[1].trait && (h = D + 1),
"身材" == f[2].trait && (h = D - 1), "身材" == f[3].trait && (h = D - 2)), 2 == g && (D = N + 2,
"身材" == f[0].trait && (h = D + 2), "身材" == f[1].trait && (h = D + 1), "身材" == f[2].trait && (h = D - 1),
"身材" == f[3].trait && (h = D - 2)), 3 == g && (D = N, "身材" == f[0].trait && (h
小正太浩二
- 粉丝: 334
- 资源: 5942
最新资源
- 基于Eclipse Paho Mqtt 的简单封装详细文档+全部资料.zip
- 基于electron-vue,mqtt,借鉴微信体验,支持windows,linux,mac三大平台详细文档+全部资料.zip
- 基于DuerOS的对话式物联网控制示例,采用了百度的物联网IoT Hub MQTT Server详细文档+全部资料.zip
- 基于esp8266 mqtt arduino IDE开发的系列IOT引用项目详细文档+全部资料.zip
- 基于ESP利用MQTT通信、IRext开源库实现万能红外遥控详细文档+全部资料.zip
- 基于golang和gin框架一个快速接入MQTT物联网设备的服务器详细文档+全部资料.zip
- 基于esp32-wifi实现mqtt手持测量仪详细文档+全部资料.zip
- 基于Flask框架使用MQTT进行消息互动详细文档+全部资料.zip
- 基于hyperf建立的mqtt服务端详细文档+全部资料.zip
- 基于Go语言的SiteWhere(物联网平台)服务搭建【+SDK ( JSON、REST、MQTT 通信 ) 】详细文档+全部资料.zip
- 基于Go语言实现:基于Eclipse Paho MQTT Go client、GIN框架实现ThingsBoard提供的MQTT、HTTP API详细文档+全部资料.zip
- 基于linux平台C++编写的高性能异步mqtt协议代理服务详细文档+全部资料.zip
- 基于Kotlin Multiplatform的跨平台socket通信统一接口,在对Kotlin有较好的支持的同时兼容在JAVA中调用。目前支持Android目标
- 基于mqtt.js针对egg封装的插件,可以在agent进程上稳定运行,开箱即用详细文档+全部资料.zip
- 基于Lora的物联网监管系统服务器, SSM+MySQL+MQTT详细文档+全部资料.zip
- 基于micropython可以触控和MQTT控制的按钮开关详细文档+全部资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈