[商品分享微信好友和朋友圈处理邀请码和商品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() { 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({ uniShare.show({
content: { //公共的分享参数配置 类型type、链接herf、标题title、summary描述、imageUrl缩略图 content: {
type: 0, type: 0,
href: 'https://www.lianshang.vip/app?', href: 'https://www.lianshang.vip/app?parent_id=' + shareCode,
title: '链商星球共创未来,一起搭建链商经济的世界~', title: '链商星球 共创未来,一起搭建 链商经济的世界~',
summary: '链商星球app你值得拥有~天天签到领福利~', summary: '链商星球APP你值得拥有~每日签到领贡献值~',
imageUrl: config.apiUrls+'images/top_logo.png' imageUrl: config.apiUrls+'images/top_logo.png'
}, },
menus: [{ menus: [{
@@ -342,9 +345,10 @@
} }
], ],
cancelText: "取消分享", cancelText: "取消分享",
}, e => { //callback }, e => {
console.log(uniShare.isShow); if(uniShare.isShow){
console.log(e); console.log('shareCode',shareCode)
}
}) })
} }
} }

View File

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

View File

@@ -31063,7 +31063,9 @@ __webpack_require__.r(__webpack_exports__);
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "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 _user = __webpack_require__(/*! @/apis/interfaces/user */ 59);
var _util = __webpack_require__(/*! @/uni_modules/sakura-canvas/js_sdk/util */ 270); 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 = _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 = var draw = null;var _default =
{ {
@@ -31178,8 +31186,13 @@ var draw = null;var _default =
h: 667 } });_context2.next = 9;return ( h: 667 } });_context2.next = 9;return (
draw.createdSharePoster(function (_ref) {var bgObj = _ref.bgObj;var draw.createdSharePoster(function (_ref)
width = bgObj.width,height = bgObj.height;
{var bgObj = _ref.bgObj;var
width =
bgObj.width,height = bgObj.height;
_this2.Popinvite = bgObj; _this2.Popinvite = bgObj;
// 绘制内容 // 绘制内容
return [ 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: 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 ( (0, _util.saveImageToPhotosAlbum)(posterImg));case 3:res = _context3.sent;if (
res.success) {_context3.next = 6;break;}return _context3.abrupt("return");case 6: res.success) {_context3.next = 6;break;}return _context3.abrupt("return");case 6:
(0, _util.showToast)('保存成功,去相册分享给朋友吧'); (0, _util.showToast)('保存成功,去相册分享给朋友吧');
@@ -31334,6 +31349,7 @@ var draw = null;var _default =
// 复制邀请码 // 复制邀请码
copyCenter: function copyCenter(e) { copyCenter: function copyCenter(e) {
__f__("log", e, " at pages/user/code.vue:287");
// e.slice(0,2) + '$InviTaTiOn$CoDe/$-?' + e.substring(2) // e.slice(0,2) + '$InviTaTiOn$CoDe/$-?' + e.substring(2)
uni.setClipboardData({ uni.setClipboardData({
data: e, data: e,
@@ -31350,6 +31366,7 @@ var draw = null;var _default =
swiperChange: function swiperChange(e) { swiperChange: function swiperChange(e) {
this.codeIndex = e.detail.current; this.codeIndex = e.detail.current;
} } };exports.default = _default; } } };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/lib/format-log.js */ 39)["default"]))
/***/ }), /***/ }),
/* 270 */ /* 270 */
@@ -42450,13 +42467,16 @@ var _index = __webpack_require__(/*! @/apis/index.js */ 25);function _interopReq
}, },
// 顶部菜单点击了分享功能 // 顶部菜单点击了分享功能
onNavigationBarButtonTap: function onNavigationBarButtonTap() { 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({ uniShare.show({
content: { //公共的分享参数配置 类型type、链接herf、标题title、summary描述、imageUrl缩略图 content: {
type: 0, type: 0,
href: 'https://www.lianshang.vip/app?', href: 'https://www.lianshang.vip/app?parent_id=' + shareCode,
title: '链商星球共创未来,一起搭建链商经济的世界~', title: '链商星球 共创未来,一起搭建 链商经济的世界~',
summary: '链商星球app你值得拥有~天天签到领福利~', summary: '链商星球APP你值得拥有~每日签到领贡献值~',
imageUrl: _index.config.apiUrls + 'images/top_logo.png' }, imageUrl: _index.config.apiUrls + 'images/top_logo.png' },
menus: [{ menus: [{
@@ -42477,9 +42497,10 @@ var _index = __webpack_require__(/*! @/apis/index.js */ 25);function _interopReq
cancelText: "取消分享" }, cancelText: "取消分享" },
function (e) {//callback function (e) {
__f__("log", uniShare.isShow, " at pages/goods/details.vue:346"); if (uniShare.isShow) {
__f__("log", e, " at pages/goods/details.vue:347"); __f__("log", 'shareCode', shareCode, " at pages/goods/details.vue:350");
}
}); });
} } };exports.default = _default; } } };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/lib/format-log.js */ 39)["default"])) /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/lib/format-log.js */ 39)["default"]))