[商品分享微信好友和朋友圈处理邀请码和商品id]

This commit is contained in:
2021-10-29 16:17:05 +08:00
parent 18fc1f2239
commit 0682a04664
3 changed files with 492 additions and 424 deletions

View File

@@ -315,13 +315,16 @@
},
// 顶部菜单点击了分享功能
onNavigationBarButtonTap() {
console.log('点击了分享功能。。。')
let invite = this.goodsObj.user_invite || ''
let goods ='&GoodsId/$-?' + this.goodsObj.goods_id
let shareCode = invite === '' ?goods:invite.slice(0,2) + '$InviTaTiOn$CoDe/$-?' + invite.substring(2)+goods
console.log(shareCode)
uniShare.show({
content: { //公共的分享参数配置 类型type、链接herf、标题title、summary描述、imageUrl缩略图
content: {
type: 0,
href: 'https://www.lianshang.vip/app?',
title: '链商星球共创未来,一起搭建链商经济的世界~',
summary: '链商星球app你值得拥有~天天签到领福利~',
href: 'https://www.lianshang.vip/app?parent_id=' + shareCode,
title: '链商星球 共创未来,一起搭建 链商经济的世界~',
summary: '链商星球APP你值得拥有~每日签到领贡献值~',
imageUrl: config.apiUrls+'images/top_logo.png'
},
menus: [{
@@ -342,9 +345,10 @@
}
],
cancelText: "取消分享",
}, e => { //callback
console.log(uniShare.isShow);
console.log(e);
}, e => {
if(uniShare.isShow){
console.log('shareCode',shareCode)
}
})
}
}

View File

@@ -18,7 +18,9 @@
</view>
</view>
<view class="codeCont">
<image class="codeCont-avatar" :src="item.user_info.avatar ? item.user_info.avatar : '/static/user/user-portrait.png'" mode="aspectFill"></image>
<image class="codeCont-avatar"
:src="item.user_info.avatar ? item.user_info.avatar : '/static/user/user-portrait.png'"
mode="aspectFill"></image>
<view class="codeCont-text">
<view class="codeCont-name">
{{item.user_info.nickname}}
@@ -58,8 +60,14 @@
</template>
<script>
import { userInvite } from '@/apis/interfaces/user'
import { saveImageToPhotosAlbum, showToast, downloadFile } from '@/uni_modules/sakura-canvas/js_sdk/util'
import {
userInvite
} from '@/apis/interfaces/user'
import {
saveImageToPhotosAlbum,
showToast,
downloadFile
} from '@/uni_modules/sakura-canvas/js_sdk/util'
import Draw from '@/uni_modules/sakura-canvas/js_sdk/draw'
let draw = null
export default {
@@ -113,8 +121,13 @@
h: 667,
},
})
let res = await draw.createdSharePoster(({ bgObj }) => {
let { width, height } = bgObj
let res = await draw.createdSharePoster(({
bgObj
}) => {
let {
width,
height
} = bgObj
this.Popinvite = bgObj
// 绘制内容
return [
@@ -260,7 +273,9 @@
// 保存图片
async saveImage() {
let { posterImg } = this
let {
posterImg
} = this
let res = await saveImageToPhotosAlbum(posterImg)
if (!res.success) return
showToast('保存成功,去相册分享给朋友吧')
@@ -269,6 +284,7 @@
// 复制邀请码
copyCenter(e) {
console.log(e)
// e.slice(0,2) + '$InviTaTiOn$CoDe/$-?' + e.substring(2)
uni.setClipboardData({
data: e,
@@ -297,27 +313,32 @@
min-height: 100vh;
@extend .vertical;
}
// 轮播
.code {
position: relative;
width: 100%;
padding-top: calc(183% - 280rpx - #{$padding * 2});
.code-swiper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.code-item {
height: 100%;
width: 100%;
padding: 0 $padding/2;
.code-lay {
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
}
.code-back-image {
width: 100%;
height: 100%;
@@ -329,11 +350,13 @@
// 提示信息
.footer {
padding: 0 $padding + 10;
.hith {
color: $text-gray;
font-size: $title-size-sm;
padding-top: $padding + 10;
}
.number {
background-color: $border-color-lg;
padding: $padding - 5;
@@ -341,14 +364,17 @@
font-size: $title-size-lg;
border-radius: 8rpx;
display: flex;
.title {
flex: 1;
}
.value {
font-size: $title-size-m;
color: $text-price;
}
}
.button {
background: $text-price;
border-radius: 0;
@@ -359,6 +385,7 @@
text-align: center;
border-radius: 8rpx;
}
// number
// title
// value
@@ -375,12 +402,14 @@
padding: 16rpx 30rpx 20rpx;
box-sizing: border-box;
z-index: 9;
.codeCont-avatar {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
border: 4rpx solid #FFFFFF;
}
.codeCont-text {
position: absolute;
width: 100%;
@@ -388,17 +417,20 @@
top: 0;
padding: 14rpx 40rpx 0 140rpx;
box-sizing: border-box;
.codeCont-name {
color: #FFFFFF;
font-size: $title-size;
margin-bottom: 10rpx;
}
.codeCont-number {
font-size: $title-size-sm;
display: flex;
color: #c4a1cb;
}
}
.codeCont-img {
width: 120rpx;
height: 120rpx;
@@ -407,6 +439,7 @@
bottom: 10rpx;
}
}
// 日历
.codDate {
position: absolute;
@@ -417,15 +450,18 @@
text-align: center;
font-size: 24rpx;
border: 2rpx solid #fffefc;
.codDate-year {
padding-top: 5rpx;
}
.codDate-day {
padding: 5rpx 0;
font-size: 32rpx;
font-weight: 600;
border-bottom: 2rpx solid #a980c6;
}
.codDate-lunar {
font-size: 24rpx;
transform: scale(.9);
@@ -443,6 +479,7 @@
z-index: -99999999999;
opacity: 0;
}
.posterBack {
width: 100%;
height: 100%;
@@ -451,6 +488,7 @@
left: 0;
top: 0;
}
.poster {
width: 100vw;
height: 100vh;
@@ -462,16 +500,20 @@
top: 0;
left: 0;
z-index: 9;
&-img {
width: 580rpx;
position: relative;
margin: 70rpx auto 20rpx;
.img {
width: 100%;
}
}
&-btn {
padding: 0 $padding * 2;
.operate {
width: 100%;
margin-bottom: 20rpx;
@@ -481,6 +523,7 @@
display: inline-block;
text-align: center;
color: #fff;
&-cancel {
background-color: $text-price;
}

View File

@@ -31063,7 +31063,9 @@ __webpack_require__.r(__webpack_exports__);
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 45));
/* WEBPACK VAR INJECTION */(function(__f__) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 45));
@@ -31124,7 +31126,13 @@ Object.defineProperty(exports, "__esModule", { value: true });exports.default =
var _user = __webpack_require__(/*! @/apis/interfaces/user */ 59);
var _util = __webpack_require__(/*! @/uni_modules/sakura-canvas/js_sdk/util */ 270);
var _draw = _interopRequireDefault(__webpack_require__(/*! @/uni_modules/sakura-canvas/js_sdk/draw */ 272));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
var draw = null;var _default =
{
@@ -31178,8 +31186,13 @@ var draw = null;var _default =
h: 667 } });_context2.next = 9;return (
draw.createdSharePoster(function (_ref) {var bgObj = _ref.bgObj;var
width = bgObj.width,height = bgObj.height;
draw.createdSharePoster(function (_ref)
{var bgObj = _ref.bgObj;var
width =
bgObj.width,height = bgObj.height;
_this2.Popinvite = bgObj;
// 绘制内容
return [
@@ -31325,7 +31338,9 @@ var draw = null;var _default =
// 保存图片
saveImage: function saveImage() {var _this3 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3() {var posterImg, res;return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:
posterImg = _this3.posterImg;_context3.next = 3;return (
posterImg =
_this3.posterImg;_context3.next = 3;return (
(0, _util.saveImageToPhotosAlbum)(posterImg));case 3:res = _context3.sent;if (
res.success) {_context3.next = 6;break;}return _context3.abrupt("return");case 6:
(0, _util.showToast)('保存成功,去相册分享给朋友吧');
@@ -31334,6 +31349,7 @@ var draw = null;var _default =
// 复制邀请码
copyCenter: function copyCenter(e) {
__f__("log", e, " at pages/user/code.vue:287");
// e.slice(0,2) + '$InviTaTiOn$CoDe/$-?' + e.substring(2)
uni.setClipboardData({
data: e,
@@ -31350,6 +31366,7 @@ var draw = null;var _default =
swiperChange: function swiperChange(e) {
this.codeIndex = e.detail.current;
} } };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/lib/format-log.js */ 39)["default"]))
/***/ }),
/* 270 */
@@ -42450,13 +42467,16 @@ var _index = __webpack_require__(/*! @/apis/index.js */ 25);function _interopReq
},
// 顶部菜单点击了分享功能
onNavigationBarButtonTap: function onNavigationBarButtonTap() {
__f__("log", '点击了分享功能。。。', " at pages/goods/details.vue:318");
var invite = this.goodsObj.user_invite || '';
var goods = '&GoodsId/$-?' + this.goodsObj.goods_id;
var shareCode = invite === '' ? goods : invite.slice(0, 2) + '$InviTaTiOn$CoDe/$-?' + invite.substring(2) + goods;
__f__("log", shareCode, " at pages/goods/details.vue:321");
uniShare.show({
content: { //公共的分享参数配置 类型type、链接herf、标题title、summary描述、imageUrl缩略图
content: {
type: 0,
href: 'https://www.lianshang.vip/app?',
title: '链商星球共创未来,一起搭建链商经济的世界~',
summary: '链商星球app你值得拥有~天天签到领福利~',
href: 'https://www.lianshang.vip/app?parent_id=' + shareCode,
title: '链商星球 共创未来,一起搭建 链商经济的世界~',
summary: '链商星球APP你值得拥有~每日签到领贡献值~',
imageUrl: _index.config.apiUrls + 'images/top_logo.png' },
menus: [{
@@ -42477,9 +42497,10 @@ var _index = __webpack_require__(/*! @/apis/index.js */ 25);function _interopReq
cancelText: "取消分享" },
function (e) {//callback
__f__("log", uniShare.isShow, " at pages/goods/details.vue:346");
__f__("log", e, " at pages/goods/details.vue:347");
function (e) {
if (uniShare.isShow) {
__f__("log", 'shareCode', shareCode, " at pages/goods/details.vue:350");
}
});
} } };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/lib/format-log.js */ 39)["default"]))