更换版本
This commit is contained in:
169
pages/publicity/index.js
Normal file
169
pages/publicity/index.js
Normal file
@@ -0,0 +1,169 @@
|
||||
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,
|
||||
},
|
||||
hideDialog: function () {
|
||||
this.setData({ isShow: !this.data.isShow });
|
||||
},
|
||||
updateUserInfo: function (t) {
|
||||
var e = this;
|
||||
a.util.getUserInfo(function (a) {
|
||||
wx.setStorageSync("uid", a.memberInfo.uid), e.hideDialog(), e.reload();
|
||||
}, t.detail);
|
||||
},
|
||||
onLoad: function (t) {
|
||||
var e = this;
|
||||
a.util.getUserInfo(function (a) {
|
||||
a.memberInfo ? e.reload() : e.setData({ isShow: !0 });
|
||||
});
|
||||
},
|
||||
onShow: function () {},
|
||||
reload: function () {
|
||||
var t = this,
|
||||
e = t.data.loaddata;
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
carid: e.id,
|
||||
uid: wx.getStorageSync("uid"),
|
||||
r: "sale.index.getcarimgindex",
|
||||
},
|
||||
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);
|
||||
},
|
||||
fail: function () {
|
||||
t.data.carstemp = "/pages/image/store_bg.png";
|
||||
},
|
||||
})
|
||||
: (t.data.carstemp = "/pages/image/store_bg.png"),
|
||||
wx.downloadFile({
|
||||
url: t.backimg(a.data.data.qrcode),
|
||||
success: function (a) {
|
||||
console.log(a), (t.data.qrcodetemp = a.tempFilePath);
|
||||
},
|
||||
fail: function () {
|
||||
t.data.qrcodetemp = a.data.data.qrcode;
|
||||
},
|
||||
}),
|
||||
t.setData({
|
||||
propaganda1: "我正在使用“" + a.data.data.info.name,
|
||||
propaganda11: "小程序”平台交易车",
|
||||
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,
|
||||
e = wx.createCanvasContext("show", t);
|
||||
wx.canvasPutImageData({
|
||||
canvasId: "show",
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 375,
|
||||
height: 530,
|
||||
success: function (a) {},
|
||||
}),
|
||||
e.setFillStyle("#DDDDDD"),
|
||||
e.fillRect(0, 0, 370, 530),
|
||||
e.rect(15, 25, 340, 490),
|
||||
e.setFillStyle("#FFFFFF"),
|
||||
e.fill();
|
||||
var i = t.data.carstemp;
|
||||
e.drawImage(i, 15, 25, 340, 200);
|
||||
var n = t.data.qrcodetemp;
|
||||
e.drawImage(n, 110, 270, 150, 150),
|
||||
(e.font = "normal normal 13px SimHei"),
|
||||
e.setFillStyle("#666666"),
|
||||
e.setTextAlign("center"),
|
||||
e.fillText(t.data.qrstr, 185, 450),
|
||||
e.save(),
|
||||
e.beginPath(),
|
||||
e.arc(15, 224, 12, 0, 2 * Math.PI),
|
||||
e.setFillStyle("#DDDDDD"),
|
||||
e.fill(),
|
||||
e.clip(),
|
||||
e.restore(),
|
||||
e.save(),
|
||||
e.beginPath(),
|
||||
e.arc(355, 224, 12, 0, 2 * Math.PI),
|
||||
e.setFillStyle("#DDDDDD"),
|
||||
e.fill(),
|
||||
e.clip(),
|
||||
e.restore(),
|
||||
t.setData({ cvtype: !0 }),
|
||||
wx.drawCanvas({ canvasId: "show", actions: e.getActions() });
|
||||
},
|
||||
onReady: function () {},
|
||||
onHide: function () {},
|
||||
onUnload: function () {},
|
||||
onPullDownRefresh: function () {},
|
||||
onReachBottom: function () {},
|
||||
onShareAppMessage: function () {},
|
||||
});
|
1
pages/publicity/index.json
Normal file
1
pages/publicity/index.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "navigationBarTitleText": " 我的推广码", "usingComponents": {} }
|
17
pages/publicity/index.wxml
Normal file
17
pages/publicity/index.wxml
Normal file
@@ -0,0 +1,17 @@
|
||||
<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>
|
||||
<image class="erweima" src="{{qrcodeimg}}"></image>
|
||||
<view class="tishi">{{qrstr}}</view>
|
||||
<button class="btn" formType="submit">立即生成</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: 530px;background-color:#fff;"></canvas>
|
||||
<button bindtap="makeinimg" class="btn">保存推广图片</button>
|
||||
</view>
|
137
pages/publicity/index.wxss
Normal file
137
pages/publicity/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: 88%;
|
||||
margin: 5%auto 0;
|
||||
overflow: hidden;
|
||||
width: 690rpx;
|
||||
}
|
||||
.page_modle_top,
|
||||
.page_modle_topImg {
|
||||
height: 410rpx;
|
||||
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: 100rpx 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: 430rpx;
|
||||
width: 35rpx;
|
||||
}
|
||||
.left_dian_sec {
|
||||
right: 15rpx;
|
||||
}
|
Reference in New Issue
Block a user