更换版本
This commit is contained in:
188
pages/home/poster/index.js
Normal file
188
pages/home/poster/index.js
Normal file
@@ -0,0 +1,188 @@
|
||||
var a;
|
||||
(a = getApp()),
|
||||
Page({
|
||||
data: {
|
||||
cvtype: !1,
|
||||
headimg: "",
|
||||
headtemp: "",
|
||||
carsimg: "",
|
||||
carstemp: "",
|
||||
qrcodeimg: "",
|
||||
qrcodetemp: "",
|
||||
nickname: "",
|
||||
propaganda1: "",
|
||||
propaganda11: "平台交易车",
|
||||
propaganda2: "",
|
||||
qrstr: "识别上方二维码,进入小程序查看车辆详情",
|
||||
makeinnum: 1,
|
||||
enddelimg: [],
|
||||
loaddata: "",
|
||||
isShow: !1,
|
||||
carid: "",
|
||||
tupianjiazai: 0,
|
||||
},
|
||||
hideDialog: function () {
|
||||
this.setData({ isShow: !this.data.isShow });
|
||||
},
|
||||
updateUserInfo: function (t) {
|
||||
var i = this;
|
||||
a.util.getUserInfo(function (a) {
|
||||
wx.setStorageSync("uid", a.memberInfo.uid), i.hideDialog(), i.reload();
|
||||
}, t.detail);
|
||||
},
|
||||
onLoad: function (t) {
|
||||
var i = this;
|
||||
i.setData({ carid: t.carid }),
|
||||
a.util.getUserInfo(function (a) {
|
||||
a.memberInfo ? i.reload() : i.setData({ isShow: !0 });
|
||||
});
|
||||
},
|
||||
onShow: function () {},
|
||||
reload: function () {
|
||||
var t = this,
|
||||
i = t.data.carid;
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
carid: i,
|
||||
uid: wx.getStorageSync("uid"),
|
||||
r: "sale.index.getcarimg111",
|
||||
},
|
||||
cachetime: "0",
|
||||
success: function (a) {
|
||||
"" != a.data.data.carimg
|
||||
? wx.downloadFile({
|
||||
url: t.backimg(a.data.data.carimg),
|
||||
success: function (a) {
|
||||
console.log(a),
|
||||
(t.data.carstemp = a.tempFilePath),
|
||||
t.setData({ tupianjiazai: t.data.tupianjiazai + 1 }),
|
||||
console.log(t.data.tupianjiazai);
|
||||
},
|
||||
fail: function () {
|
||||
(t.data.carstemp = "/pages/image/store_bg.png"),
|
||||
t.setData({ tupianjiazai: t.data.tupianjiazai + 1 }),
|
||||
console.log(t.data.tupianjiazai);
|
||||
},
|
||||
})
|
||||
: (t.data.carstemp = "/pages/image/store_bg.png"),
|
||||
wx.downloadFile({
|
||||
url: t.backimg(a.data.data.qrcode),
|
||||
success: function (a) {
|
||||
console.log(a),
|
||||
t.setData({ tupianjiazai: t.data.tupianjiazai + 1 }),
|
||||
console.log(t.data.tupianjiazai),
|
||||
(t.data.qrcodetemp = a.tempFilePath);
|
||||
},
|
||||
fail: function () {
|
||||
t.setData({ tupianjiazai: t.data.tupianjiazai + 1 }),
|
||||
console.log(t.data.tupianjiazai),
|
||||
(t.data.qrcodetemp = a.data.data.qrcode);
|
||||
},
|
||||
}),
|
||||
console.log(a.data.data.info),
|
||||
t.setData({
|
||||
propaganda1: a.data.data.info.one,
|
||||
propaganda2: a.data.data.info.two,
|
||||
headimg: a.data.data.headimg,
|
||||
carsimg: a.data.data.carimg
|
||||
? a.data.data.carimg
|
||||
: "/pages/image/store_bg.png",
|
||||
qrcodeimg: a.data.data.qrcode,
|
||||
});
|
||||
},
|
||||
fail: function (a) {
|
||||
wx.showModal({
|
||||
content: a.data.message,
|
||||
success: function () {
|
||||
5e3 == a.data.error && t.setData({ isShow: !0 }),
|
||||
wx.navigateBack({});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
backimg: function (t) {
|
||||
return a.util.url("entry/wxapp/Api", {
|
||||
m: "monai_market",
|
||||
img: t,
|
||||
r: "sale.index.getthecarimg",
|
||||
});
|
||||
},
|
||||
makeinimg: function () {
|
||||
wx.showLoading({ title: "正在保存图片..." });
|
||||
var a = this;
|
||||
a.data.makeinnum > 1 ||
|
||||
((a.data.makeinnum = 2),
|
||||
wx.canvasToTempFilePath({
|
||||
canvasId: "show",
|
||||
success: function (t) {
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: t.tempFilePath,
|
||||
success: function () {
|
||||
(a.data.makeinnum = 1), console.log("成功");
|
||||
},
|
||||
fail: function () {
|
||||
(a.data.makeinnum = 1), console.log("shibai ");
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
setTimeout(function () {
|
||||
wx.hideLoading();
|
||||
}, 1e3));
|
||||
},
|
||||
makeimg: function (a) {
|
||||
var t = this,
|
||||
i = wx.createCanvasContext("show", t);
|
||||
wx.canvasPutImageData({
|
||||
canvasId: "show",
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 375,
|
||||
height: 560,
|
||||
success: function (a) {},
|
||||
}),
|
||||
i.setFillStyle("#DDDDDD"),
|
||||
i.fillRect(0, 0, 375, 560),
|
||||
i.rect(15, 15, 340, 530),
|
||||
i.setFillStyle("#FFFFFF"),
|
||||
i.fill();
|
||||
var e = t.data.carstemp;
|
||||
i.drawImage(e, 15, 15, 340, 240);
|
||||
var n = t.data.qrcodetemp;
|
||||
i.drawImage(n, 110, 310, 150, 150),
|
||||
(i.font = "normal bold 14px Microsoft YaHei"),
|
||||
i.setFillStyle("#000000"),
|
||||
i.setTextAlign("center"),
|
||||
i.fillText(t.data.propaganda1, 185, 280),
|
||||
(i.font = "normal normal 14px Microsoft YaHei"),
|
||||
i.fillText(t.data.propaganda2, 185, 310),
|
||||
(i.font = "normal normal 13px Microsoft YaHei"),
|
||||
i.setFillStyle("#666666"),
|
||||
i.fillText(t.data.qrstr, 185, 510),
|
||||
i.save(),
|
||||
i.beginPath(),
|
||||
i.arc(15, 254, 12, 0, 2 * Math.PI),
|
||||
i.setFillStyle("#DDDDDD"),
|
||||
i.fill(),
|
||||
i.clip(),
|
||||
i.restore(),
|
||||
i.save(),
|
||||
i.beginPath(),
|
||||
i.arc(355, 254, 12, 0, 2 * Math.PI),
|
||||
i.setFillStyle("#DDDDDD"),
|
||||
i.fill(),
|
||||
i.clip(),
|
||||
i.restore(),
|
||||
t.setData({ cvtype: !0 }),
|
||||
wx.drawCanvas({ canvasId: "show", actions: i.getActions() });
|
||||
},
|
||||
onReady: function () {},
|
||||
onHide: function () {},
|
||||
onUnload: function () {},
|
||||
onPullDownRefresh: function () {},
|
||||
onReachBottom: function () {},
|
||||
onShareAppMessage: function () {},
|
||||
});
|
1
pages/home/poster/index.json
Normal file
1
pages/home/poster/index.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "navigationBarTitleText": " 车辆推广海报", "usingComponents": {} }
|
20
pages/home/poster/index.wxml
Normal file
20
pages/home/poster/index.wxml
Normal file
@@ -0,0 +1,20 @@
|
||||
<form bindreset="formReset" bindsubmit="makeimg" reportSubmit="true" wx:if="{{!cvtype}}">
|
||||
<view class="page_modle">
|
||||
<view class="page_modle_top">
|
||||
<view class="page_modle_topview"></view>
|
||||
<image class="page_modle_topImg" src="{{carsimg}}"></image>
|
||||
</view>
|
||||
<view style=" font-size:28rpx;Text-Align:center">{{propaganda1}}</view>
|
||||
<view style=" font-size:28rpx;Text-Align:center">{{propaganda2}}</view>
|
||||
<image class="erweima" src="{{qrcodeimg}}"></image>
|
||||
<view class="tishi">{{qrstr}}</view>
|
||||
<button class="btn" formType="submit" wx:if="{{tupianjiazai==2}}">立即查看</button>
|
||||
<button class="btn" wx:if="{{tupianjiazai!=2}}">正在生成海报...</button>
|
||||
</view>
|
||||
<view class="left_dian"></view>
|
||||
<view class="left_dian_sec"></view>
|
||||
</form>
|
||||
<view wx:if="{{cvtype}}">
|
||||
<canvas canvasId="show" style="margin:0 auto;width: 370px; height: 560px;background-color:#fff;"></canvas>
|
||||
<button bindtap="makeinimg" class="btn">保存推广图片</button>
|
||||
</view>
|
137
pages/home/poster/index.wxss
Normal file
137
pages/home/poster/index.wxss
Normal file
@@ -0,0 +1,137 @@
|
||||
page {
|
||||
background: #f9f9f9;
|
||||
height: 100%;
|
||||
}
|
||||
.button_imgsed {
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
height: 85rpx;
|
||||
width: 80%;
|
||||
}
|
||||
.page_modle {
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0 9rpx 16rpx 0 rgba(0, 0, 0, 0.1);
|
||||
display: block;
|
||||
height: 96%;
|
||||
margin: 5%auto 0;
|
||||
overflow: hidden;
|
||||
width: 690rpx;
|
||||
}
|
||||
.page_modle_top,
|
||||
.page_modle_topImg {
|
||||
height: 510rpx;
|
||||
width: 100%;
|
||||
}
|
||||
.page_modle_topview {
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
height: 410rpx;
|
||||
position: absolute;
|
||||
width: 690rpx;
|
||||
}
|
||||
.page_modle_topview_headImg {
|
||||
border: 2rpx solid #fff;
|
||||
border-radius: 100%;
|
||||
display: block;
|
||||
height: 90rpx;
|
||||
margin: 40rpx auto 0;
|
||||
width: 90rpx;
|
||||
}
|
||||
.page_modle_toptitle {
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
margin-top: 15rpx;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
.page_modle_radius {
|
||||
border: 1px solid #fff;
|
||||
border-radius: 10rpx;
|
||||
display: block;
|
||||
margin: 40rpx auto 0;
|
||||
padding-bottom: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
width: 600rpx;
|
||||
}
|
||||
.page_modle_radius_top {
|
||||
font-size: 35rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.page_modle_radius_btm,
|
||||
.page_modle_radius_top {
|
||||
color: #fff;
|
||||
margin-left: 5%;
|
||||
text-align: center;
|
||||
width: 90%;
|
||||
}
|
||||
.page_modle_radius_btm {
|
||||
font-size: 25rpx;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.phone_view {
|
||||
background: #f8f8f8;
|
||||
border: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10rpx;
|
||||
display: block;
|
||||
height: 72rpx;
|
||||
margin: 70rpx auto 0;
|
||||
width: 630rpx;
|
||||
}
|
||||
.phone_view_img {
|
||||
border-right: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
float: left;
|
||||
height: 43rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-top: 16.5rpx;
|
||||
padding-right: 15rpx;
|
||||
width: 42rpx;
|
||||
}
|
||||
.phone_input {
|
||||
color: #333;
|
||||
font-size: 24rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.erweima {
|
||||
display: block;
|
||||
height: 300rpx;
|
||||
margin: 63rpx auto 0;
|
||||
width: 300rpx;
|
||||
}
|
||||
.tishi {
|
||||
color: #666;
|
||||
font-size: 26rpx;
|
||||
margin-top: 50rpx;
|
||||
width: 100%;
|
||||
}
|
||||
.btn,
|
||||
.tishi {
|
||||
text-align: center;
|
||||
}
|
||||
.btn {
|
||||
background: #3d61f0;
|
||||
border-radius: 15rpx;
|
||||
color: #fff;
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
margin: 40rpx auto 0;
|
||||
width: 630rpx;
|
||||
}
|
||||
.left_dian {
|
||||
left: 15rpx;
|
||||
}
|
||||
.left_dian,
|
||||
.left_dian_sec {
|
||||
background: #f9f9f9;
|
||||
border-radius: 100%;
|
||||
height: 35rpx;
|
||||
position: absolute;
|
||||
top: 530rpx;
|
||||
width: 35rpx;
|
||||
}
|
||||
.left_dian_sec {
|
||||
right: 15rpx;
|
||||
}
|
Reference in New Issue
Block a user