Authored by htoooth

fix

... ... @@ -5,7 +5,6 @@
"pages/account/chooseArea",
"pages/account/bindMobile",
"pages/product/detail/detail",
"pages/share/share",
"pages/webview/webview",
"pages/snapshootShare/snapshootShare"
],
... ...
import detailModel from '../../../models/product/detail';
import formatImage from '../../../utils/formatImage';
import config from '../../../common/config';
import {
Actionsheet
... ... @@ -85,7 +86,7 @@ Page(Object.assign({
productSourceType: PRODUCT_SOURCE_TYPE.SHARE,
assisStatus: ASSIS_STATUS.UN_ASSIS,
queueStatus: QUEUE_STATUS.UN_QUEUE,
showAssisList: true,
showAssisList: false,
assisLimit: 0,
assisSuccess: ASSIS_SUCCESS.unknown,
queueSuccess: QUEUE_SUCCESS.unknown,
... ... @@ -168,9 +169,15 @@ Page(Object.assign({
'actionSheet.show': false
});
if (index === 1) {
let uid = this.data.originUid || this.data.uid;
if (index === 0) {
detailModel.addShareAction(uid, this.data.limitProductCode);
} else if (index === 1) {
// 生成页面给
router.go('snapShare', this.snapData);
detailModel.addShareAction(uid, this.data.limitProductCode).then(() => {
router.go('snapShare', this.data.snapData);
});
}
},
productInfo: function() {
... ... @@ -196,14 +203,14 @@ Page(Object.assign({
});
}
let default_image = defaultImage;
let product_qrCode = config.domains.api + `/wechat/miniapp/img-check.jpg?param=${res.data.product_skn}&uid=${app.getUid()}&limitProductCode=${this.data.limitProductCode}`; // eslint-disable-line
let default_image = formatImage.image(defaultImage, 460, 400);
let product_qrCode = config.domains.api + `/wechat/miniapp/img-check.jpg?param=${res.data.product_skn}&originUid=${app.getUid()}&limitProductCode=${this.data.limitProductCode}`; // eslint-disable-line
let snapData = {
product_name: res.data.product_name,
product_name: res.data.productName,
default_image,
product_qrCode,
product_skn: this.data.productSkn
product_skn: res.data.productSkn
};
let productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN;
... ... @@ -242,7 +249,7 @@ Page(Object.assign({
let assisStatus = ASSIS_STATUS.SHARE;
if (this.assisLimit === result.data.length) {
if (this.assisLimit === result.data.list.length) {
assisStatus = ASSIS_STATUS.ASSIS_FULL;
} else {
if (this.originUid) {
... ... @@ -252,9 +259,16 @@ Page(Object.assign({
}
}
let showAssisList = false;
if (result.data.isShare === 'Y') {
showAssisList = true;
}
this.setData({
avatarList: result.list || [],
assisStatus
assisStatus,
showAssisList
});
});
... ... @@ -291,10 +305,10 @@ Page(Object.assign({
}
},
assisShare() {
if (!app.getUnionID()) {
this.goLogin();
return;
}
// if (!app.getUnionID()) {
// this.goLogin();
// return;
// }
this.share();
},
... ... @@ -399,7 +413,7 @@ Page(Object.assign({
let refer = encodeURIComponent(`/pages/product/detail/detail?${stringify(data)}`);
router.go('userCenter', {refer});
router.go('userCenter', {refer, login: 0});
}
}, Actionsheet));
\ No newline at end of file
... ...
... ... @@ -280,8 +280,6 @@
<view class="modal-ok" bindtap="cancelError">
确定
</view>
</view>
</view>
</yoho-alert>
... ...
... ... @@ -59,7 +59,7 @@
}
.goodsInfo .intro-image {
width: 690rpx;
width: 100%;
height: 432rpx;
}
... ...
... ... @@ -2,7 +2,8 @@ let app = getApp();
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
const screenHeight = app.globalData.systemInfo.screenHeight;
const scale = windowWidth / 375;
// const scale = windowWidth / 375;
const scale = 0.7
var Point = function(x, y) {
return {
... ... @@ -20,10 +21,28 @@ Page({
windowWidth,
windowHeight,
scale,
product_name: '',
default_image: '',
product_qrCode: ''
},
onLoad(options) {
let product_name = decodeURIComponent(options.product_name ? options.product_name : '');
let default_image = decodeURIComponent(options.default_image ? options.default_image : '');
let product_qrCode = decodeURIComponent(options.product_qrCode ? options.product_qrCode : '');
this.setData({
product_name,
default_image,
product_qrCode
});
this.creatSnapshoot();
},
creatSnapshoot() {
this.creatProductDetailSnapShoot();
},
saveToAlbum() {
... ... @@ -109,17 +128,9 @@ Page({
creatProductDetailSnapShoot() {
let that = this;
let product = that.properties.shareData;
let pCtx = wx.createCanvasContext('productDetailCanvas', this);
pCtx.setFillStyle('white');
pCtx.fillRect(0, 0, windowWidth, screenHeight);
pCtx.drawImage('./images/snapshoot_share_bg@2x.png', 0, 0, windowWidth, 186 * scale);
pCtx.setFillStyle('white');
pCtx.setShadow(-5, -2, 40, 'darkgray');
pCtx.fillRect(27 * scale, 60 * scale, 320 * scale, 430 * scale);
let defaultImage = product.default_image;
let defaultImage = this.data.default_image;
if (defaultImage && defaultImage.indexOf('https://') === -1) {
defaultImage = defaultImage.replace('http://', 'https://');
... ... @@ -129,22 +140,16 @@ Page({
src: defaultImage,
success: function(res) {
pCtx.drawImage(res.path, 27 * scale, 60 * scale, 320 * scale, 430 * scale);
pCtx.setFillStyle('rgba(0,0,0,0.8)');
pCtx.fillRect(27 * scale, 370 * scale, 320 * scale, 120 * scale);
pCtx.setFillStyle('white');
that.drawLongText(product.product_name, pCtx, 187.5 * scale, 402 * scale, 'white', 14, 20);
pCtx.setFillStyle('black');
that.drawLongText(that.data.product_name, pCtx, 187.5 * scale, 402 * scale, 'white', 14, 20);
pCtx.setTextAlign('center');
pCtx.setFontSize(18 * scale);
pCtx.fillText(product.product_price, 187.5 * scale, 458.5 * scale);
pCtx.draw(true);
}
});
pCtx.setShadow(0, 0, 0, 'white');
pCtx.drawImage('./images/share-logo@2x.png', 132 * scale, 505 * scale, 111 * scale, 20 * scale);
wx.getImageInfo({
src: product.product_qrCode,
src: this.data.product_qrCode,
success: function(res) {
pCtx.drawImage(res.path, 148.5 * scale, 539.5 * scale, 78 * scale, 78 * scale);
pCtx.draw(true);
... ... @@ -158,7 +163,7 @@ Page({
pCtx.drawImage('./images/snapshoot_tip_ic@2x.png', 127 * scale, 645.5 * scale, 9 * scale, 9 * scale);
pCtx.setFillStyle('#b0b0b0');
pCtx.setFontSize(9);
pCtx.fillText('实际价格以页面展示为准', 187.5 * scale, 652.5 * scale);
pCtx.fillText('或者在各大应用市场搜索 Yoho!Buy有货 下载App', 187.5 * scale, 652.5 * scale);
pCtx.draw();
},
... ...
<!--pages/snapshootShare/snapshootShare.wxml-->
<view class="snapshoot-container" >
<view class="snapshoot-container">
<view class="snapshoot-content">
<view class="snapshoot">
<view class="snapshoot-title">
<view>你的好友邀你为ta助力,购买限定商品</view>
</view>
<view class="snapshoot-productinfo">
<image class="product-defaultImage" src="{{default_image}}"> </image>
</view>
<view class="product-info-content">
<text class="product-name">{{product_name}}</text>
</view>
<view class="product-miniqr">
<image class="yoho-logo" src="./images/share-logo@2x.png"></image>
<image class="product-qrcode" src="{{product_qrCode}}"></image>
<text class="snapshoot-tips">长按扫码查看详情</text>
<view class='product-tips'>
<image class="product-tips-img" src="./images/snapshoot_tip_ic@2x.png"></image>
<text class="product-tips-text">或者在各大应用市场搜索 Yoho!Buy有货 下载App</text>
</view>
</view>
</view>
</view>
<!--底部按钮 -->
<view class="snapshoot-bottom">
<view class="snapshoot-save" bindtap="saveToAlbum">
<!-- <image class="img" src="./images/down@2x.png"></image> -->
<text class="text">保存到相册</text>
</view>
<view class="snapshoot-cancel" bindtap="hidden">
<text class="cancel-text">取消</text>
</view>
</view>
</view>
<view class="snapshoot-canvas" style="width: {{windowWidth}}px;height:{{screenHeight}}px; background-color: white; margin-top: {{screenHeight}}px" >
<view class="snapshoot-canvas" style="width: {{windowWidth}}px;height:{{screenHeight}}px; background-color: white; " >
<canvas canvas-id="productDetailCanvas" style="width: {{windowWidth}}px;height:{{screenHeight}}px;background-color: white"></canvas>
</view>
</view>
... ...
... ... @@ -186,7 +186,7 @@
.product-name {
width: 80%;
margin-top: 30rpx;
color: white;
color: black;
text-align: center;
font-size: 26rpx;
margin-bottom: 20rpx;
... ...
... ... @@ -33,7 +33,7 @@
"list": []
},
"miniprogram": {
"current": 2,
"current": 3,
"list": [
{
"id": 0,
... ... @@ -54,10 +54,10 @@
"query": "limitProductCode=2018062115403668"
},
{
"id": 2,
"id": 3,
"name": "分享页",
"pathName": "pages/snapshootShare/snapshootShare",
"query": ""
"query": "default_image=http%3A%2F%2Fimg11.static.yhbimg.com%2Fgoodsimg%2F2018%2F06%2F21%2F15%2F015bd107c7681ab77b8f38345aadd1aa85.jpg%3FimageMogr2%2Fthumbnail%2F460x400%2Fextent%2F460x400%2Fbackground%2Fd2hpdGU%3D%2Fposition%2Fcenter%2Fquality%2F80%2Fquality%2F75&product_name=%E5%8A%A9%E5%8A%9B%E5%88%86%E4%BA%AB%E5%BE%97%E9%99%90%E8%B4%AD%E7%A0%81_wss01&product_qrCode=http%3A%2F%2Fapi-test3.dev.yohocorp.com%2Fwechat%2Fminiapp%2Fimg-check.jpg%3Fparam%3Dundefined%26originUid%3D0%26limitProductCode%3D2018062115403668&product_skn=0"
}
]
}
... ...