瀏覽代碼

功能优化

guessPrice
sui 5 年之前
父節點
當前提交
609c42df82
共有 7 個文件被更改,包括 48 次插入53 次删除
  1. +1
    -0
      496_dongfengqichen/app.js
  2. +4
    -1
      496_dongfengqichen/pages/index/index.js
  3. +2
    -2
      496_dongfengqichen/pages/index/index.wxml
  4. +4
    -1
      496_dongfengqichen/pages/index/index.wxss
  5. +5
    -5
      496_dongfengqichen/pages/luckyStar/luckyStar.js
  6. +1
    -0
      496_dongfengqichen/pages/moreType/moreType.json
  7. +31
    -44
      496_dongfengqichen/pages/poster/poster.js

+ 1
- 0
496_dongfengqichen/app.js 查看文件

@@ -72,6 +72,7 @@ App({
certificationState:0,//1车主,2合伙人,3同事
mobileData:null,
userPhoneType:null,
kvurl:null
},
// 获取openId
getOpenid: function (code) {

+ 4
- 1
496_dongfengqichen/pages/index/index.js 查看文件

@@ -33,6 +33,7 @@ Page({
mainShow:false,
isOnce:false,
userData:null,
kvurl: app.globalData.kvurl,//顶部大图
},
onLoad: function () {
app.globalData.nowPage = 1;
@@ -336,8 +337,10 @@ Page({
if(res.code==200){
this.setData({
startAdvertisingUrl: res.data.picurl,
mainShow:true
mainShow:true,
kvurl: res.data.kvurl
})
app.globalData.kvurl = res.data.kvurl;
app.globalData.isFirstLogin = false;
setTimeout(() => {
this.setData({

+ 2
- 2
496_dongfengqichen/pages/index/index.wxml 查看文件

@@ -2,11 +2,11 @@
<view class="all" wx:if="{{mainShow}}">
<view class="main" wx:if="{{isStartAdvertising==0 || !isStartAdvertisingShow}}">
<view class="contentFrame">
<image style="width:750rpx;height:1506rpx;" src="{{imgUrl+'/images/indexBg.jpg'}}"></image>
<image style="width:750rpx;height:1506rpx;" src="{{kvurl}}"></image>
<image style="width:750rpx;height:331rpx;" src="{{imgUrl+'/images/indexText.png'}}"></image>
<view class="swiperFrame">
<swiper class="swiperSty" autoplay current="{{swiperCurrent}}" bindchange="swiperChange">
<swiper-item wx:for="{{bannerList}}" wx:key="index"><image src="{{item.bannerUrl}}" style="width:100%;" mode="aspectFill"></image></swiper-item>
<swiper-item wx:for="{{bannerList}}" wx:key="index"><image src="{{item.bannerUrl}}" style="width:750rpx;height:530rpx;" mode="aspectFill"></image></swiper-item>
</swiper>
<image class="leftArrow" bindtap="prevImg" src="{{imgUrl+'/images/leftArrow.png'}}"></image>
<image class="rightArrow" bindtap="nextImg" src="{{imgUrl+'/images/rightArrow.png'}}"></image>

+ 4
- 1
496_dongfengqichen/pages/index/index.wxss 查看文件

@@ -178,16 +178,19 @@ view{
width: 750rpx;
height: 192rpx;
background-color: #ececec;
padding-top: 41rpx;
box-sizing: border-box;
}
.bannerName{
width: 750rpx;
height: 192rpx;
padding-top: 41rpx;
line-height: 30rpx;
font-size:30rpx;
font-family:PingFangSC;
font-weight:300;
color:rgba(0,0,0,1);
text-align: center;
box-sizing: border-box;
}
.videoPoster{
position: absolute;

+ 5
- 5
496_dongfengqichen/pages/luckyStar/luckyStar.js 查看文件

@@ -404,11 +404,11 @@ Page({
}
},
changeScroll:function(){
// this.data.setInt = setInterval(()=>{
// this.setData({
// scrollNum: this.data.scrollNum+=1
// })
// },30);
this.data.setInt = setInterval(()=>{
this.setData({
scrollNum: this.data.scrollNum+=1
})
},30);
},
getMore:function(){
if (!this.data.isMore){

+ 1
- 0
496_dongfengqichen/pages/moreType/moreType.json 查看文件

@@ -1,3 +1,4 @@
{
"navigationBarTitleText": "东风启辰线上展厅,在家选好车!",
"usingComponents": {}
}

+ 31
- 44
496_dongfengqichen/pages/poster/poster.js 查看文件

@@ -8,17 +8,18 @@ Page({
data: {
imgUrl: app.globalData.urlStatic,//图片路径
canvasContron:null,//canvas
posterBg:[],//海报背景
posterBg:[false,false,false],//海报背景
qrCodeUrl:"",//二维码图片
userHead: app.globalData.userInfoData ? app.globalData.userInfoData.avatarUrl : null,//用户头像
rankNum: '0000',//缓存数字
windowScale:0,//屏幕缩放比
windowW: 0,//屏幕宽度
windowH: 0,//屏幕高度
posterUrl:[],//海报图片
posterUrl:[false,false,false],//海报图片
canvasShow: true,//是否渲染canvas
swiperCurrent: 0,//swiper选中的元素下标
userInfoData: app.globalData.userInfoData
userInfoData: app.globalData.userInfoData,
posterState:false,//海报是否合成完毕
},

/**
@@ -45,19 +46,18 @@ Page({
this.data.windowScale = option.windowWidth / 750;
this.data.windowW = option.windowWidth;
this.data.windowH = option.windowHeight;
var countNum = 0;
wx.getImageInfo({//缓存海报背景
src: this.data.imgUrl + '/images/tempImg1.jpg?v=006',
success: res => {
this.data.posterBg.push(res.path);
countNum += 1;
}
})
for (let i = 0; i < 3; i++) {
wx.getImageInfo({//缓存海报背景
src: this.data.imgUrl + '/images/tempImg'+(i+1)+'.jpg?v=006',
success: res => {
this.data.posterBg[i] = res.path;
}
})
}
wx.getImageInfo({//缓存二维码
src: this.data.qrCodeUrl,
success: res => {
this.data.qrCodeUrl = res.path;
countNum += 1;
}
})
if (this.data.userHead) {
@@ -65,7 +65,6 @@ Page({
src: this.data.userHead,
success: res => {
this.data.userHead = res.path;
countNum += 1;
}
})
}
@@ -73,7 +72,6 @@ Page({
src: this.data.imgUrl + '/images/posterNum.png?v=004',
success: res => {
this.data.numBg = res.path;
countNum += 1;
}
})
for (let i = 0; i < this.data.rankNum.length; i++) {
@@ -81,16 +79,9 @@ Page({
src: this.data.imgUrl + '/images/nums/' + this.data.rankNum[i] + '.png',
success: res => {
this.data.rankNum[i] = res.path;
countNum += 1;
}
})
}
let setInt = setInterval(() => {
if (countNum >= 8) {
this.posterDrawing(1);
clearInterval(setInt);
}
}, 500);
}
})
},
@@ -139,7 +130,20 @@ Page({
path: "/pages/coupon/coupon?friendOpenid=" + app.globalData.openid
}
},
saveImg:function(){//保存到手机
saveImg: function () {//保存到手机
console.log(this.data.posterUrl);
if (!this.data.posterUrl[this.data.swiperCurrent]){
wx.showLoading({
title: '海报合成中',
mask:true
})
this.posterDrawing(this.data.swiperCurrent + 1);
}else{
this.savePic();
}
},
savePic: function () {
wx.hideLoading();
wx.saveImageToPhotosAlbum({
filePath: this.data.posterUrl[this.data.swiperCurrent],
success(res) {
@@ -147,13 +151,13 @@ Page({
title: '保存成功'
})
},
fail:res=>{
fail: res => {
wx.getSetting({
success: res => {
if (res.authSetting['scope.writePhotosAlbum']) {
wx.showToast({
title: '保存失败',
icon:"none"
icon: "none"
})
} else {
wx.showModal({
@@ -162,7 +166,7 @@ Page({
success: (opt) => {
if (opt.confirm) {
wx.openSetting({
success:e=>{
success: e => {
if (e.authSetting['scope.writePhotosAlbum']) {
wx.saveImageToPhotosAlbum({
filePath: this.data.posterUrl[this.data.swiperCurrent],
@@ -220,29 +224,13 @@ Page({
ctx.drawImage(this.data.qrCodeUrl, scale * 476, scale * 1134, scale * 176, scale * 176);
//绘制
ctx.draw(false, setTimeout(() => {
console.log();
wx.canvasToTempFilePath({
width:scale*750,
height: scale * 1380,
canvasId: 'myCanvas',
success: res => {
this.data.posterUrl.push(res.tempFilePath);
this.setData({
posterUrl: this.data.posterUrl
})
if (e < 3) {
wx.getImageInfo({
src: this.data.imgUrl + '/images/tempImg'+(e+1)+'.jpg?v=006',
success: res => {
this.data.posterBg.push(res.path);
this.posterDrawing(e + 1);
}
})
}else{
this.setData({
canvasShow:false
})
}
this.data.posterUrl[this.data.swiperCurrent] = res.tempFilePath;
this.savePic();
}
})
}, 300));
@@ -291,7 +279,6 @@ Page({
}else{
this.data.rankNum = "0000".split("");
}
console.log(this.data.rankNum);
this.setData({
rankNum: this.data.rankNum
})

Loading…
取消
儲存