Commit d728f587 by 赵雅纹

Merge branch 'feature-zyw-sc' into 'dev_7.1.0'

Feature zyw sc

See merge request !82
parents cf95c099 85525c4f
......@@ -62,5 +62,6 @@
"wx358b56af62edbde1",
"wxc3b64b09b1d3dfc2",
"wx857ea77f4f7f4f34"
]
],
"sitemapLocation": "sitemap81.json"
}
\ No newline at end of file
// component/cardModal/cardModal.js
const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
Component({
/**
* 组件的属性列表
*/
properties: {
showCardModal:{
type: Boolean,
value: ''
},
cardTitle: {
type: String,
value: ''
},
cardUrl: {
type: String,
value: ''
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
gotoPoster(){
this.setData({
showCardModal:false
})
this.selectComponent('#getPoster').getAvaterInfo()
},
_showMiniCard(e){
console.log(e)
this.setData({
showCardModal: true
})
}
}
})
{
"component": true,
"usingComponents": {
"share-poster": "/component/sharePoster/sharePoster"
}
}
\ No newline at end of file
<!--component/cardModal/cardModal.wxml-->
<view class="commodity_screen2" bindtap='closeCardModal' style='opacity: 0.5;' hidden="{{!showCardModal}}"></view>
<view class="card-modal" hidden="{{!showCardModal}}">
<view class="card-modal-content">
<view class="modal-header">
<image class="brand-img"></image>
<view class="brand-title">{{cardTitle}}</view>
</view>
<view class="card-img-wrap">
<image class="card-img" src="{{cardUrl}}"></image>
</view>
</view>
<view class="save-card">
<button class="save-btn" open-type="share">分享小程序卡片</button>
<view class="save-btn-desc">适用于发给小伙伴或聊天群</view>
</view>
</view>
<view class="quick-share" bindtap="gotoPoster" hidden='{{!showCardModal}}'>
生成朋友圈海报
</view>
<share-poster id="getPoster" bindmyevent="myEventListener" avater="{{cardUrl}}" productDesc="{{cardTitle}}" userAvatar="http://t2.hddhhn.com/uploads/tu/201806/9999/91480c0c87.jpg" bind:showMiniCard="_showMiniCard"></share-poster>
/* component/cardModal/cardModal.wxss */
.commodity_screen2 {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
opacity: 0.65;
overflow: hidden;
z-index: 9999;
color: #fff;
}
.commodity_attr_box2 {
width: 90%;
overflow: hidden;
position: fixed;
left: 50%;
top: 50%;
z-index: 9999;
background: #fff;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: #fff;
padding-top: 20rpx;
padding-bottom: 30rpx;
}
.card-modal{
position: fixed;
top: 240rpx;
left: 170rpx;
z-index: 9999;
}
.card-modal-content{
width: 410rpx;
height: 618rpx;
background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 4rpx 17rpx 0px rgba(0, 0, 0, 0.12);
}
.modal-header{
padding: 34rpx 34rpx 0;
}
.brand-img{
width: 50rpx;
height: 50rpx;
background-color: rgba(216, 216, 216, 1);
border-radius: 50%;
}
.brand-title{
width: 342rpx;
color: #333333;
font-size: 18rpx;
margin-top: 10rpx;
}
.card-img-wrap{
margin-top: 23rpx;
}
.card-img{
width: 410rpx;
height: 410rpx;
}
/* 海报 */
.save-card{
margin-top: 51rpx;
text-align: center;
}
.save-btn{
width: 340rpx;
height: 80rpx;
border-radius: 40rpx;
line-height: 80rpx;
background-color: rgba(255, 51, 51, 1);
box-shadow: 0px 2rpx 9rpx 0px rgba(255, 51, 51, 0.6);
color: #ffffff;
font-size: 32rpx;
}
.save-btn-desc{
color: #ffffff;
font-size: 22rpx;
margin-top: 12rpx;
}
.quick-share{
position: fixed;
bottom: 0;
height: 88rpx;
line-height: 88rpx;
width: 750rpx;
text-align: center;
color: #ffffff;
font-size: 26rpx;
z-index: 9999;
background-color: rgba(255, 255, 255, 0.2);
}
.card_content{
width: 410rpx;
height: 618rpx;
background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 4rpx 17rpx 0px rgba(0, 0, 0, 0.12);
z-index: 9999;
}
\ No newline at end of file
const app = getApp();
const utils = require('../../utils/util')
const wxService = require('../../utils/wxService')
Component({
/**
* 组件的属性列表
......@@ -15,10 +18,6 @@ Component({
userAvatar: { // 头像
type: String,
value: ''
},
codeimg: { // 二维码
type: String,
value: ''
}
},
......@@ -32,8 +31,9 @@ Component({
productCode: "" //二维码
},
ready: function () {
attached() {
this.getMiniCode()
},
/**
......@@ -82,6 +82,54 @@ Component({
}
},
//获取二维码
getMiniCode() {
const urls = utils.getCurrentPageUrlWithArgs()
const page = urls && urls.split("?")[0]
let data = {
"autoColor": true,
"page": 'pages/index/index',
"scene": 'qwe',
"width": 100
}
wxService.post(`/merchant/contentMobileTerminal/getAppletQrCode`, data).then(res => {
const { result, data } = res.data
if (result == 0) {
const fsm = wx.getFileSystemManager();
const FILE_BASE_NAME = 'tmp_base64src';
const base64src = function (data) {
return new Promise((resolve, reject) => {
const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.png`;
const buffer = wx.base64ToArrayBuffer(data);
fsm.writeFile({
filePath,
data: buffer,
encoding: 'binary',
success() {
resolve(filePath);
},
fail() {
reject(new Error('ERROR_BASE64SRC_WRITE'));
},
});
});
};
base64src(data).then(res => {
console.log(res)
this.setData({
codeImg: res
})
})
}
})
},
//下载二维码
getQrCode: function (productSrc, imgInfo = "") {
wx.showLoading({
......@@ -89,7 +137,7 @@ Component({
mask: true,
});
var that = this;
var productCode = that.data.codeimg;
var productCode = that.data.codeImg;
if (productCode) {
wx.downloadFile({
url: productCode,
......@@ -181,7 +229,7 @@ Component({
// 绘制二维码
if (codeSrc) {
ctx.drawImage(codeSrc, 143.5, 281, 50, 50)
ctx.drawImage(codeSrc, 170, 281, 50, 50)
ctx.setFontSize(10);
ctx.setFillStyle('#000');
// ctx.fillText("微信扫码或长按保存图片", left + 165, imgheght + 110);
......@@ -192,6 +240,8 @@ Component({
wx.hideLoading();
}, 1000)
},
textByteLength(text, num) { // text为传入的文本 num为单行显示的字节长度
......@@ -286,12 +336,19 @@ Component({
})
}
})
},
//快速分享到朋友圈
quickShare() {
console.log('222')
this.setData({
showpost: false
})
wxService.nextTick(() => {
this.triggerEvent('showMiniCard', true)
})
}
},
//快速分享到朋友圈
quickShare(){
}
})
\ No newline at end of file
......@@ -11,6 +11,7 @@
<view class="quick-share" bindtap="quickShare" hidden='{{!showpost}}'>
快速分享
</view>
<!-- <image src="{{codeImg}}"></image> -->
......@@ -33,6 +33,16 @@ Component({
}
this.triggerEvent('updataLike', params)
},
onTapShare(e){
console.log(e)
let params = {
url: e.currentTarget.dataset.url,
title: e.currentTarget.dataset.title
}
wxService.nextTick(() => {
this.triggerEvent('_onTapShare',params)
})
},
//详情
gotoDetail(e){
......
......@@ -22,7 +22,7 @@
<view class="share-oprate" catchtap="onTapLike" data-id="{{id}}" data-type="{{type}}">
<image class="share-img" src="{{type ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<text class="share-number">{{enjoySum || 0}}</text>
</view> <view class="share-oprate">
</view> <view class="share-oprate" catchtap="onTapShare" data-title="{{headline}}" data-url="{{url}}">
<image class="share-img" src="/assets/imgs/share.png"></image>
<text class="share-number">{{transmitSum || 0}}</text>
</view>
......
......@@ -76,7 +76,9 @@ wxService.page({
// 通过地址id查询
getAddressInfo(){
wxService.post(`/member/addressManage/getbyid?id=${this.data.id}`).then(res => {
wxService.post(`/member/addressManage/getbyid`,{
id: this.data.id
}).then(res => {
const { result, data } = res.data
if (result == 0) {
this.setData({
......
......@@ -31,4 +31,6 @@
<button class="address-btn theme-color">新增收货地址</button>
</navigator>
</view>
</view>
\ No newline at end of file
</view>
<share-poster id="getPoster" bindmyevent="myEventListener" avater="http://t2.hddhhn.com/uploads/tu/201806/9999/91480c0c87.jpg" codeimg="http://i4.hexun.com/2018-07-05/193365388.jpg" productDesc="1111" userAvatar="http://t2.hddhhn.com/uploads/tu/201806/9999/91480c0c87.jpg"></share-poster>
\ No newline at end of file
......@@ -16,7 +16,15 @@ wxService.page({
totalPages: 0,
totalElements: 0,
currentTab: 0,
contentList:[]
showCardModal:false,
cardTitle:'',
cardUrl:'',
contentList:[
{
url:'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=222247294,2919493301&fm=26&gp=0.jpg',
headline:'好好爱好好好爱护哦啊哈哦啊'
}
]
},
// 点击切换
......@@ -126,6 +134,16 @@ wxService.page({
})
}
},
// 分享
_onTapShare(e){
console.log(e)
this.setData({
showCardModal: true,
cardTitle: e.detail.title,
cardUrl: e.detail.url,
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
......
......@@ -2,6 +2,7 @@
"navigationBarTitleText": "发现",
"enablePullDownRefresh": true,
"usingComponents": {
"water-flow-layout": "/component/waterFlowLayout/waterFlowLayout"
"water-flow-layout": "/component/waterFlowLayout/waterFlowLayout",
"card-modal": "/component/cardModal/cardModal"
}
}
\ No newline at end of file
......@@ -8,13 +8,14 @@
</view>
<scroll-view scroll-y >
<view class="main-content" wx:if="{{contentList.length > 0}}">
<water-flow-layout image-data="{{contentList}}" bind:updataLike="gotoLike"/>
<water-flow-layout image-data="{{contentList}}" bind:updataLike="gotoLike" bind:_onTapShare="_onTapShare"/>
</view>
<view class="empty" wx:if="{{!contentList || contentList.length < 1}}">
暂无内容哦~
</view>
</scroll-view>
</view>
<card-modal show-card-modal="{{showCardModal}}" card-title="{{cardTitle}}" card-url="{{cardUrl}}"/>
......
......@@ -36,7 +36,9 @@ wxService.page({
// 获取内容详情
getContentDetail(){
wxService.post(`/merchant/contentMobileTerminal/getContentParticulars?id=${this.data.id}`).then(res => {
wxService.post(`/merchant/contentMobileTerminal/getContentParticulars`,{
id: this.data.id
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
......@@ -110,7 +112,4 @@ wxService.page({
}
}
})
\ No newline at end of file
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment