新增轮播贴图
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 712 B |
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 811 B |
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.7 KiB |
|
@ -33,7 +33,45 @@ Page({
|
|||
closeTime: null,
|
||||
titleVal:'',
|
||||
showTitle:false,
|
||||
times:0
|
||||
times:0,
|
||||
haveData:true,
|
||||
worksImg:false,
|
||||
creat_close:true,
|
||||
currentIndex:0,
|
||||
worksBox:false
|
||||
},
|
||||
// 下一个
|
||||
nextEv(){
|
||||
if(this.data.allList.length-5 >= this.data.currentIndex) {
|
||||
this.setData({
|
||||
currentIndex:this.data.currentIndex + 1
|
||||
})
|
||||
}
|
||||
},
|
||||
// 上一个
|
||||
preEv(){
|
||||
if(this.data.currentIndex!=0) {
|
||||
this.setData({
|
||||
currentIndex:this.data.currentIndex - 1
|
||||
})
|
||||
}
|
||||
},
|
||||
changeCurrent(e){
|
||||
this.setData({
|
||||
currentIndex:e.detail.current
|
||||
})
|
||||
},
|
||||
// 创建作品按钮
|
||||
creatWorks(){
|
||||
this.setData({
|
||||
funBox:false,
|
||||
worksBox:true,
|
||||
creat_close:false
|
||||
})
|
||||
},
|
||||
// 收起创作
|
||||
closeWorks(){
|
||||
this.setData({funBox:true,worksBox:false,creat_close:true})
|
||||
},
|
||||
chooseTitle(e) {
|
||||
let that = this;
|
||||
|
@ -44,7 +82,9 @@ Page({
|
|||
}
|
||||
this.setData({
|
||||
titleIndex: e.currentTarget.dataset.index,
|
||||
showBtn: true
|
||||
showBtn: true,
|
||||
worksImg:true,
|
||||
currentIndex:0
|
||||
})
|
||||
this.getBottleWidgets(that.data.titlelist[that.data.titleIndex].id);
|
||||
},
|
||||
|
@ -101,6 +141,7 @@ Page({
|
|||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
let that = this;
|
||||
items = this.data.itemList;
|
||||
wx.getSystemInfo({ // 获取系统信息
|
||||
success: sysData => {
|
||||
|
@ -115,10 +156,6 @@ Page({
|
|||
})
|
||||
}
|
||||
})
|
||||
this.setBackGroundImg({
|
||||
url: '../../img/background/1.png'
|
||||
});
|
||||
this.getBottleCategories();
|
||||
// 换取token
|
||||
wx.login({
|
||||
success: res => {
|
||||
|
@ -127,11 +164,13 @@ Page({
|
|||
method: 'post',
|
||||
data: {code: res.code},
|
||||
success(res) {
|
||||
console.log(res);
|
||||
if (res.data.code == 0) {
|
||||
wx.setStorageSync('token', res.data.data.token);
|
||||
wx.setStorageSync('username', res.data.data.user.wx_name);
|
||||
console.log(wx.getStorageSync('username'));
|
||||
that.setBackGroundImg({
|
||||
url: '../../img/background/1.png'
|
||||
});
|
||||
that.getBottleCategories();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -223,7 +262,6 @@ Page({
|
|||
data.rotate = 1; // 旋转角度
|
||||
data.active = false; // 选中状态
|
||||
data.angle = 0;
|
||||
console.log(data, 123);
|
||||
items[items.length] = data; // 每增加一张图片数据增加一条信息
|
||||
this.setData({
|
||||
itemList: items
|
||||
|
@ -249,10 +287,25 @@ Page({
|
|||
items[index].lx = e.touches[0].clientX;
|
||||
items[index].ly = e.touches[0].clientY;
|
||||
}
|
||||
if(this.data.funBox){
|
||||
if(!this.data.worksBox) {
|
||||
this.setData({
|
||||
showBox: false,
|
||||
funBox: false
|
||||
funBox: false,
|
||||
creat_close:true
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
funBox: false,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if(!this.data.creat_close){
|
||||
this.setData({
|
||||
worksBox:false,
|
||||
creat_close:false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
// 拖动图片
|
||||
WraptouchMove(e) {
|
||||
|
@ -267,23 +320,29 @@ Page({
|
|||
|
||||
items[index].lx = e.touches[0].clientX;
|
||||
items[index].ly = e.touches[0].clientY;
|
||||
|
||||
this.setData({
|
||||
itemList: items,
|
||||
showBtn: true,
|
||||
funBox: false
|
||||
worksBox:false
|
||||
})
|
||||
this.showWorksBtn();
|
||||
}
|
||||
},
|
||||
// 放开图片
|
||||
WraptouchEnd() {
|
||||
this.synthesis(); // 调用合成图方法
|
||||
this.showWorksBtn();
|
||||
},
|
||||
// 显示创作按钮
|
||||
showWorksBtn(){
|
||||
clearTimeout(this.data.closeTime);
|
||||
this.data.closeTime = setTimeout(() => {
|
||||
this.setData({
|
||||
showBtn: false,
|
||||
funBox: true
|
||||
})
|
||||
this.setData({showBtn: false})
|
||||
if(this.data.creat_close){
|
||||
this.setData({funBox:true})
|
||||
} else {
|
||||
this.setData({worksBox:true})
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
// 点击伸缩图标
|
||||
|
@ -309,27 +368,23 @@ Page({
|
|||
items[index]._tx = e.touches[0].clientX;
|
||||
items[index]._ty = e.touches[0].clientY;
|
||||
//移动的点到圆心的距离
|
||||
items[index].disPtoO = this.getDistancs(items[index].x, items[index].y, items[index]._tx, items[
|
||||
index]._ty - 10)
|
||||
|
||||
items[index].disPtoO = this.getDistancs(items[index].x, items[index].y, items[index]._tx, items[index]._ty - 10)
|
||||
console.log(items[index].disPtoO);
|
||||
if(items[index].disPtoO > 80 && items[index].disPtoO <200 ){//设置贴图最小值和最大值
|
||||
items[index].scale = items[index].disPtoO / items[index].r;
|
||||
|
||||
}
|
||||
//移动后位置的角度
|
||||
items[index].angleNext = this.countDeg(items[index].x, items[index].y, items[index]._tx, items[
|
||||
index]._ty)
|
||||
items[index].angleNext = this.countDeg(items[index].x, items[index].y, items[index]._tx, items[index]._ty)
|
||||
//角度差
|
||||
items[index].new_rotate = items[index].angleNext - items[index].anglePre;
|
||||
|
||||
//叠加的角度差
|
||||
items[index].rotate += items[index].new_rotate;
|
||||
items[index].angle = items[index].rotate; //赋值
|
||||
|
||||
//用过移动后的坐标赋值为移动前坐标
|
||||
items[index].tx = e.touches[0].clientX;
|
||||
items[index].ty = e.touches[0].clientY;
|
||||
items[index].anglePre = this.countDeg(items[index].x, items[index].y, items[index].tx, items[index]
|
||||
.ty)
|
||||
|
||||
items[index].anglePre = this.countDeg(items[index].x, items[index].y, items[index].tx, items[index].ty)
|
||||
//赋值setData渲染
|
||||
this.setData({
|
||||
itemList: items
|
||||
|
@ -392,10 +447,8 @@ Page({
|
|||
openMask() {
|
||||
if (wx.getStorageSync('username')!='' && wx.getStorageSync('username')!=undefined ) {
|
||||
this.synthesis();
|
||||
this.setData({
|
||||
showCanvas: true,
|
||||
showTitle:true
|
||||
})
|
||||
// this.setData({showCanvas: true,showTitle:true})
|
||||
this.setData({showCanvas: true})
|
||||
} else {
|
||||
this.setData({
|
||||
isLogin: true
|
||||
|
@ -414,7 +467,7 @@ Page({
|
|||
}
|
||||
})
|
||||
},
|
||||
synthesis() { // 合成图片
|
||||
synthesis(whereIndex=0) { // 合成图片
|
||||
maskCanvas.save();
|
||||
maskCanvas.beginPath();
|
||||
// 画背景色(白色)
|
||||
|
@ -440,6 +493,40 @@ Page({
|
|||
this.setData({
|
||||
canvasTemImg: res.tempFilePath
|
||||
})
|
||||
if(whereIndex==1){
|
||||
wx.showToast({title:'正在调起分享',duration:5000})
|
||||
console.log(this.data.canvasTemImg);
|
||||
wx.uploadFile({
|
||||
url: urlPath.composeBottle,
|
||||
filePath: this.data.canvasTemImg,
|
||||
name: 'image',
|
||||
formData: {
|
||||
'name': this.data.titleVal
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
'Content-Type': 'application/json',
|
||||
'token': wx.getStorageSync('token')
|
||||
},
|
||||
success: (res)=> {
|
||||
let newRes = JSON.parse(res.data);
|
||||
if(newRes.code==0){
|
||||
wx.downloadFile({
|
||||
url: 'https://fenggu.scdxtc.cn' + newRes.data.src,
|
||||
success: (res) => {
|
||||
wx.showShareImageMenu({
|
||||
path: res.tempFilePath,
|
||||
success:(res)=>{}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function(data) {
|
||||
console.log(data);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
})
|
||||
|
@ -514,16 +601,20 @@ Page({
|
|||
}
|
||||
})
|
||||
},
|
||||
// 首页左下角分享
|
||||
homeShare(){
|
||||
this.synthesis(1);
|
||||
},
|
||||
// 分享图片
|
||||
shareImg() {
|
||||
shareImg(e) {
|
||||
let newIndex = e.currentTarget.dataset.index;
|
||||
if(this.data.times==0){
|
||||
wx.showToast({
|
||||
title:'正在调起分享',
|
||||
duration:5000
|
||||
})
|
||||
this.setData({
|
||||
times:this.data.times++
|
||||
})
|
||||
if(newIndex==0){
|
||||
wx.showToast({title:'正在调起分享',duration:5000})
|
||||
}
|
||||
wx.uploadFile({
|
||||
url: urlPath.composeBottle,
|
||||
filePath: this.data.canvasTemImg,
|
||||
|
@ -539,17 +630,20 @@ Page({
|
|||
success: (res)=> {
|
||||
let newRes = JSON.parse(res.data);
|
||||
if(newRes.code==0){
|
||||
if(newIndex==0){
|
||||
console.log(newIndex);
|
||||
wx.downloadFile({
|
||||
url: 'https://fenggu.scdxtc.cn' + newRes.data.src,
|
||||
success: (res) => {
|
||||
wx.showShareImageMenu({
|
||||
path: res.tempFilePath,
|
||||
success:(res)=>{
|
||||
success:(res)=>{}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.shareEv(newRes.data.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function(data) {
|
||||
|
@ -567,7 +661,10 @@ Page({
|
|||
method: 'post',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
wx.showToast({title: '分享作品成功'})
|
||||
wx.showToast({title: '参加活动成功'});
|
||||
this.setData({
|
||||
showCanvas:false
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -636,6 +733,7 @@ Page({
|
|||
}
|
||||
})
|
||||
},
|
||||
// 获取标题
|
||||
getBottleCategories() {
|
||||
wx.request({
|
||||
url: urlPath.getBottleCategories,
|
||||
|
@ -645,11 +743,13 @@ Page({
|
|||
this.setData({
|
||||
titlelist: res.data.data
|
||||
})
|
||||
this.getBottleWidgets(res.data.data[0].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取标题下的图片
|
||||
getBottleWidgets(id) {
|
||||
wx.request({
|
||||
url: urlPath.getBottleWidgets,
|
||||
|
@ -661,6 +761,9 @@ Page({
|
|||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.length) {
|
||||
this.setData({
|
||||
haveData: true
|
||||
})
|
||||
let newArr = [];
|
||||
res.data.data.forEach(item => {
|
||||
let url = 'https://fenggu.scdxtc.cn' + item.img;
|
||||
|
@ -668,21 +771,21 @@ Page({
|
|||
let obj = {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
img: 'https://fenggu.scdxtc.cn' + item.img
|
||||
img: 'https://fenggu.scdxtc.cn' + item.img,
|
||||
img_thumb:'https://fenggu.scdxtc.cn' + item.img_thumb,
|
||||
}
|
||||
newArr.push(obj)
|
||||
})
|
||||
this.setData({
|
||||
allList: newArr,
|
||||
showBox: true
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title:'无内容',
|
||||
icon:'none'
|
||||
})
|
||||
// wx.showToast({
|
||||
// title:'无内容',
|
||||
// icon:'none'
|
||||
// })
|
||||
this.setData({
|
||||
showBox: false
|
||||
haveData: false
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -690,6 +793,7 @@ Page({
|
|||
}
|
||||
});
|
||||
},
|
||||
// 查看我的作品
|
||||
checkWorkEv() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/works/works'
|
||||
|
|
|
@ -20,31 +20,43 @@
|
|||
</view>
|
||||
<!-- 保存显示效果图 -->
|
||||
<view class='canvasWrap' hidden="{{!showCanvas}}">
|
||||
<image class="resImg" bindlongtap="saveImg" src="{{canvasTemImg}}" mode="widthFix"></image>
|
||||
<!-- <image class="resImg" src="{{canvasTemImg}}" mode="widthFix"></image> -->
|
||||
<image class="resImg" src="{{canvasTemImg}}" mode="aspectFill"></image>
|
||||
<view class='btn_view'>
|
||||
<button bindtap='saveImg'>保存到手机</button>
|
||||
<button bindtap='shareImg'>分享</button>
|
||||
<button bindtap='disappearCanvas'>关闭</button>
|
||||
<button bindtap='shareImg' data-index="0">分享</button>
|
||||
<button bindtap='shareImg' data-index="1">参加活动</button>
|
||||
<!-- <button bindtap='disappearCanvas'>关闭</button> -->
|
||||
</view>
|
||||
<image bindtap='disappearCanvas' class="close-effect" src="../../img/close-icon.png"></image>
|
||||
</view>
|
||||
<!-- 输入框 -->
|
||||
<view wx:if="{{showTitle}}" class="content-box">
|
||||
<!-- <view wx:if="{{showTitle}}" class="content-box">
|
||||
<view class="input-box">
|
||||
<text>请为作品添加标题</text>
|
||||
<input type="text" value="{{titleVal}}" bind:input="titleInput" placeholder="请收入作品标题" />
|
||||
<view bindtap='submit'>确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 画布 -->
|
||||
<canvas class='maskCanvas' canvas-id="maskCanvas" style='width:{{canvasWidth}}px; height:{{canvasHeight}}px;'></canvas>
|
||||
<!-- 创建作品按钮 -->
|
||||
<view wx:if="{{funBox}}" bindtap="creatWorks" class="creat-works-btn">创建作品</view>
|
||||
<!-- 右下角操作按钮 -->
|
||||
<view class="operation-buttons {{showBtn?'closeSave':''}}">
|
||||
<!-- <image src="../../img/share-icon.png" bindtap="shareEv"></image> -->
|
||||
<image src="../../img/download-icon.png" bindtap="openMask"></image>
|
||||
<view wx:if="{{funBox}}" class="operation-buttons">
|
||||
<view><navigator url="/pages/works/works" hover-class="none">作品</navigator></view>
|
||||
<view><navigator url="/pages/rule/rule" hover-class="none">规则</navigator></view>
|
||||
<view style="background-color: #33d301;" bindtap='homeShare'>
|
||||
<image src="../../img/share-icon.png"></image>
|
||||
</view>
|
||||
<view style="background-color: #2a7be9;" bindtap="openMask">
|
||||
<image src="../../img/download-icon.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 我的作品 -->
|
||||
<navigator wx:if="{{funBox}}" url="/pages/works/works" hover-class="" class="works-btn">我的作品</navigator>
|
||||
<view wx:if="{{funBox}}" class="choose-box {{showBox?'showBox':''}}">
|
||||
<view wx:if="{{worksBox}}" class="works-box {{worksImg?'works-boxAc':''}}">
|
||||
<view bindtap="closeWorks" class="close-works-btn">收起创作</view>
|
||||
<view class="works-content">
|
||||
<view>
|
||||
<scroll-view scroll-x="true">
|
||||
<view class="scrollView title-box">
|
||||
|
@ -52,14 +64,41 @@
|
|||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view hidden="{{!worksImg}}">
|
||||
<swiper current="{{currentIndex}}" wx:if="{{haveData}}" bindchange="changeCurrent">
|
||||
<block wx:for="{{allList}}" wx:key="*this">
|
||||
<swiper-item class="scrollView img-box">
|
||||
<view>
|
||||
<scroll-view scroll-x="true">
|
||||
<view class="scrollView img-box">
|
||||
<image class="{{allIndex==index?'allActive':''}}" data-index="{{index}}" bindtap="chooseImg" mode="widthFix" src="{{item.img_thumb}}" lazy-load></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view wx:else class="scrollView"><view style="width: 100%;height: 320rpx; color: rgba(255,255,255,.5);display: flex;justify-content: center;align-items: center;">无内容</view></view>
|
||||
<view wx:if="{{haveData}}" style="position: fixed;z-index: 0;bottom: 280rpx;left: 0;right: 0;display: flex;justify-content: space-between;">
|
||||
<image src="../../img/next-icon.png" bindtap="preEv" class="arrowBtn pre" style="transform: rotate(180deg);"></image>
|
||||
<image bindtap="nextEv" src="../../img/next-icon.png" class="arrowBtn next"></image>
|
||||
</view>
|
||||
<!-- <scroll-view scroll-x="true">
|
||||
<view wx:if="{{haveData}}" class="scrollView img-box">
|
||||
<view wx:for="{{allList}}" data-index="{{index}}" bindtap="chooseImg" wx:key="index"><image class="{{allIndex==index?'allActive':''}}" mode="widthFix" src="{{item.img}}" lazy-load></image></view>
|
||||
</view>
|
||||
<view wx:else class="scrollView img-box"><view style="width: 100%;color: rgba(255,255,255,.5);display: flex;justify-content: center;">无内容</view></view>
|
||||
</scroll-view>
|
||||
<view style="position: fixed;z-index: 0;bottom: 305rpx;left: 0;right: 0;display: flex;justify-content: space-between;">
|
||||
<image src="../../img/next-icon.png" class="arrowBtn pre" style="transform: rotate(180deg);"></image>
|
||||
<image bindtap="nextEv" src="../../img/next-icon.png" class="arrowBtn next"></image>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 活动规则 -->
|
||||
<!-- <view style="position: fixed;background-color: rgba(0,0,0,.6);z-index: 102;top: 0;left: 0;right: 0;bottom: 0;display: flex;justify-content: center;align-items: center;padding: 20rpx;80rpx">
|
||||
<view style="background-color: rgba(255,255,255,1);border-radius: 20rpx;padding: 20rpx;width: 100%;font-size: 24rpx;">
|
||||
<view style="font-size: 28rpx;">活动规则:</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 登录授权弹框 -->
|
||||
<view wx:if="{{isLogin}}" class="{{isAnimation==2?'card-box-userinfo':''}} auth-box">
|
||||
<view class="{{isAnimation==1?'card-box-userinfo':''}}">
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
.operation-buttons {
|
||||
position: absolute;
|
||||
bottom: 220rpx;
|
||||
bottom: 110rpx;
|
||||
right: 15rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -85,10 +85,11 @@
|
|||
transition: all .5s ease-in-out;
|
||||
}
|
||||
|
||||
.operation-buttons view {
|
||||
width: 51px;height: 51px;background-color: #2a7be9;border-radius: 50%;color: #fff;display: flex;justify-content: center;align-items: center;margin-top: 40rpx;
|
||||
}
|
||||
.operation-buttons image {
|
||||
width: 74rpx;
|
||||
height: 80rpx;
|
||||
margin-top: 20rpx;
|
||||
width: 27px;height: 25px;margin-top: 0px;
|
||||
}
|
||||
.closeSave {
|
||||
transform: scale(0);
|
||||
|
@ -103,7 +104,13 @@
|
|||
z-index: 999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.close-effect {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
top: 25rpx;
|
||||
left: 50rpx;
|
||||
}
|
||||
.maskCanvas {
|
||||
position: absolute;
|
||||
left: -200%;
|
||||
|
@ -147,7 +154,8 @@
|
|||
/* 点击下载按钮时的图片样式 */
|
||||
.resImg {
|
||||
width: 80%;
|
||||
margin-top: 20rpx;
|
||||
height: 80%;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
/* 特效样式 */
|
||||
|
@ -187,37 +195,64 @@
|
|||
padding: 20rpx;
|
||||
transition: all .5s ease-in-out;
|
||||
}
|
||||
|
||||
scroll-view {
|
||||
position: relative;
|
||||
}
|
||||
.showBox {
|
||||
bottom: 88rpx;
|
||||
}
|
||||
|
||||
.scrollView {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.arrowBtn {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
width: 70rpx!important;
|
||||
height: 70rpx!important;
|
||||
}
|
||||
.pre {
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.next {
|
||||
top: 50%;
|
||||
right: 0;
|
||||
}
|
||||
swiper {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.creat-works-btn {position: fixed;bottom: 110rpx;left: 77px;right: 77px; height: 51px;line-height: 51px;text-align: center;color: #fff;background-color: #287be9;border-radius: 51px;z-index: 101;box-sizing: border-box;font-weight: bold;}
|
||||
.works-box {position: fixed;bottom: 110rpx;z-index: 101;}
|
||||
.works-boxAc {bottom: 86rpx;}
|
||||
.close-works-btn {background-color: #2a7be9;color: #fff;border-radius: 20px 20px 0 0;padding: 50rpx 20rpx 30rpx 20rpx;display: inline-block;}
|
||||
.works-content {background-color: #2a7be9;}
|
||||
.title-box view {
|
||||
background-color: rgba(0, 0, 0, 1);
|
||||
background-color: rgba(42, 123, 233, 1);
|
||||
display: inline-block;
|
||||
padding: 15rpx 30rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 10rpx;
|
||||
/* margin-right: 20rpx; */
|
||||
margin-top: 10rpx;
|
||||
flex-shrink: 0;
|
||||
color: #fff;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.title-box .titleActive {
|
||||
color: #000;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
box-shadow: 0rpx 0rpx 20rpx rgba(255, 255, 255, .5);
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
.img-box {
|
||||
width: 25%!important;
|
||||
}
|
||||
|
||||
.img-box view {
|
||||
width: 25%;
|
||||
width: 96%;
|
||||
height: 320rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
background-color: rgba(0,0,0,.8);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -232,7 +267,6 @@
|
|||
height: 320rpx;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.img-box .allActive {
|
||||
transform: scale(.9);
|
||||
border: 4rpx dashed rgba(255, 255, 255, .4);
|
||||
|
@ -243,7 +277,7 @@
|
|||
position: fixed;
|
||||
right: 20rpx;
|
||||
top: 20rpx;
|
||||
z-index: 10000;
|
||||
z-index: 998;
|
||||
background-color: rgba(0,0,0,.3);
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
|
|
|
@ -57,15 +57,11 @@
|
|||
<view class="id">{{item.ids}}<text>号</text></view>
|
||||
<image mode="aspectFill" src="{{item.img}}"></image>
|
||||
</view>
|
||||
<view class="text">
|
||||
简介:{{item.text}}
|
||||
<view class="text">简介:{{item.text}}</view>
|
||||
<view class="name " bindtap="personal" data-uid="{{item.uid}}" style="display: flex;justify-content: space-between;">
|
||||
<view class="clips1">{{item.name}}</view> <text>{{item.number}}</text>
|
||||
</view>
|
||||
<view class="name" bindtap="personal" data-uid="{{item.uid}}">
|
||||
{{item.name}} <text>{{item.number}}</text>
|
||||
</view>
|
||||
<button class="add" bindtap='vote' data-id="{{item.ids}}" data-index="{{index}}">
|
||||
投票
|
||||
</button>
|
||||
<button class="add" bindtap='vote' data-id="{{item.ids}}" data-index="{{index}}">投票</button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
|
|
@ -134,3 +134,5 @@
|
|||
padding-left: 30rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.clips1{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|
|
@ -85,7 +85,6 @@ Page({
|
|||
if(res.data.data.length > 0){
|
||||
var ranking_list = [];
|
||||
res.data.data.forEach(function(item, index){
|
||||
console.log(index);
|
||||
ranking_list.push({
|
||||
ranks: index + 1,
|
||||
name: item.user_name,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<view class="page-section page-section-spacing swiper">
|
||||
<swiper autoplay="true" interval="{{interval}}" duration="{{duration}}"
|
||||
circular="true" current="{{swiperCurrent}}" bindchange="swiperChange">
|
||||
<block wx:for="{{img_url}}" >
|
||||
<block wx:for="{{img_url}}" wx:key="index">
|
||||
<swiper-item>
|
||||
<view class="swiper-item">
|
||||
<image src="{{item}}" ></image>
|
||||
|
|
|
@ -48,6 +48,7 @@ Page({
|
|||
name: item.name,
|
||||
id: item.id,
|
||||
imgSrc: 'https://fenggu.scdxtc.cn' + item.release_img,
|
||||
img_thumb: 'https://fenggu.scdxtc.cn' + item.img_thumb,
|
||||
userId: item.user_id,
|
||||
time: item.create_time,
|
||||
isShare: item.production_id //0未分享
|
||||
|
@ -82,7 +83,9 @@ Page({
|
|||
wx.showShareImageMenu({
|
||||
path: res.tempFilePath,
|
||||
success:(res)=>{
|
||||
this.shareImg(e.currentTarget.dataset.id,e.currentTarget.dataset.index);
|
||||
this.setData({
|
||||
times:0
|
||||
})
|
||||
},
|
||||
fail:(err)=>{
|
||||
console.log(err);
|
||||
|
@ -92,11 +95,12 @@ Page({
|
|||
})
|
||||
}
|
||||
},
|
||||
shareImg(id,index){
|
||||
// 立即参与活动
|
||||
partEv(e){
|
||||
wx.request({
|
||||
url: urlPath.publishMyBottle,
|
||||
data: {
|
||||
id: id
|
||||
id: e.currentTarget.dataset.id
|
||||
},
|
||||
header: {
|
||||
'token': wx.getStorageSync('token')
|
||||
|
@ -104,17 +108,30 @@ Page({
|
|||
method: 'post',
|
||||
success: (res) => {
|
||||
if (res.data.code == 0) {
|
||||
this.data.imgArr[index].isShare=1;
|
||||
this.data.imgArr[e.currentTarget.dataset.index].isShare=1;
|
||||
this.setData({
|
||||
imgArr:this.data.imgArr
|
||||
})
|
||||
wx.showToast({
|
||||
title: '分享作品成功'
|
||||
title: '参加活动成功'
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 预览图片
|
||||
preImg(e){
|
||||
let newIndex = e.currentTarget.dataset.index;
|
||||
let newImg = [];
|
||||
this.data.imgArr.forEach(item=>{
|
||||
newImg.push(item.imgSrc);
|
||||
})
|
||||
wx.previewImage({
|
||||
current:this.data.imgArr[newIndex].imgSrc,
|
||||
urls:newImg,
|
||||
success: () => {}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
|
|
|
@ -6,11 +6,13 @@
|
|||
<!-- 列表 -->
|
||||
<view class="img-list">
|
||||
<view class="item-box" wx:for="{{imgArr}}" wx:key="index">
|
||||
<image src="{{item.imgSrc}}" mode="widthFix" lazy-load></image>
|
||||
<text class="clips2">{{item.name}}</text>
|
||||
<image bindtap="preImg" data-index="{{index}}" src="{{item.img_thumb}}" mode="widthFix" lazy-load></image>
|
||||
<!-- <text class="clips2">{{item.name}}</text> -->
|
||||
<view class="time">{{item.time}}</view>
|
||||
<view wx:if="{{item.isShare==0}}" class="share-box" bindtap="shareEv" data-id="{{item.id}}" data-index="{{index}}">
|
||||
<image src="../../img/share-icon.png"></image>
|
||||
</view>
|
||||
<image src="../../img/share-lisit-icon.png"></image>
|
||||
</view>
|
||||
<view wx:else class="activeBtn" style="background-color: #ccc;color: #fff;">正在参与活动</view>
|
||||
<view wx:if="{{item.isShare==0}}" bindtap="partEv" class="activeBtn" data-id="{{item.id}}" data-index="{{index}}">参与活动</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -64,6 +64,12 @@ page {
|
|||
font-size: 24rpx;
|
||||
color: #999;
|
||||
text-align: left;
|
||||
padding: 0 20rpx 10rpx 20rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.activeIng {
|
||||
width: auto;height: auto;padding: 6rpx 10rpx;color: #2a7be9; font-size: 24rpx;
|
||||
}
|
||||
.activeBtn {
|
||||
background-color: #2a7be9; width: 100%;height: auto;padding: 20rpx; text-align: center; color: #fff; font-size: 28rpx;
|
||||
}
|
||||
.clips2{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|