This commit is contained in:
唐明明
2021-10-29 16:54:35 +08:00
13 changed files with 1040 additions and 429 deletions

29
App.vue
View File

@@ -25,24 +25,36 @@
// 获取系统版本号 // 获取系统版本号
console.log(plus.runtime.versionCode) console.log(plus.runtime.versionCode)
console.log(plus.runtime.uniVersion) console.log(plus.runtime.uniVersion)
// 请求一个接口 // 请求一个接口
// 是否需要更新 // 是否需要更新
// 弹出更新提示 // 弹出更新提示
// 下载文件安装 // 下载文件安装
console.log('检查更新')
//#endif //#endif
}, },
onShow() { onShow() {
uni.getClipboardData({ uni.getClipboardData({
success: res=> { success: res=> {
// 包含分享邀请码
if(res.data.indexOf('$InviTaTiOn$CoDe/$-?') === 2){ if(res.data.indexOf('$InviTaTiOn$CoDe/$-?') === 2){
this.globalData.parentId = res.data.replace('$InviTaTiOn$CoDe/$-?', '') let parentId = res.data.replace('$InviTaTiOn$CoDe/$-?', '')
this.globalData.parentId = parentId.substr(0, 10)
if(res.data.indexOf('^GoodsId/$-?') === 30){
let goodsId = res.data.substr(42, res.data.length - 1)
setTimeout(() => {
if(this.$Route.name === 'goodsDetails' && this.$Route.query.id === goodsId) return
this.$Router.push({name: 'goodsDetails', params: {id: goodsId}})
}, 1000)
}
return
}
// 不包含用户信息
if(res.data.indexOf('^GoodsId/$-?') > -1){
let goodsId = res.data.substr(12, res.data.length - 1)
setTimeout(() => {
if(this.$Route.name === 'goodsDetails' && this.$Route.query.id === goodsId) return
this.$Router.push({name: 'goodsDetails', params: {id: goodsId}})
}, 1000)
} }
},
fail(err) {
console.log(err)
} }
}) })
}, },
@@ -50,7 +62,8 @@
console.log('App Hide'); console.log('App Hide');
}, },
globalData: { globalData: {
mainColor: 'white' mainColor: 'white',
parentId:''
} }
}; };
</script> </script>

View File

@@ -20,7 +20,6 @@
}, { }, {
"path": "pages/equity/index", "path": "pages/equity/index",
"name": "equity", "name": "equity",
"auth": true,
"style": { "style": {
"navigationBarTitleText": "通证商城", "navigationBarTitleText": "通证商城",
"navigationStyle": "custom", "navigationStyle": "custom",
@@ -283,13 +282,14 @@
"path": "pages/goods/details", "path": "pages/goods/details",
"name": "goodsDetails", "name": "goodsDetails",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "商品详情",
"navigationBarTextStyle":"white",
"titleNView": { "titleNView": {
"backgroundColor": "#FFFFFF", "backgroundColor": "#8b64fd",
"type": "transparent", "type": "transparent",
"buttons": [{ "buttons": [{
"text": "分享", "text": "分享",
"fontSize": "12", "fontSize": "14",
"color": "#555555" "color": "#555555"
}] }]
} }

View File

@@ -28,7 +28,9 @@
</view> </view>
</view> </view>
<view class="title"> <view class="title">
<view class="title-hot" v-if="goodsObj.specal_tags.is_allow_values">{{goodsObj.specal_tags.is_allow_values}}</view> <view class="title-hot" v-if="goodsObj.specal_tags.is_allow_values">
{{goodsObj.specal_tags.is_allow_values}}
</view>
<view class="title-hot" v-if="goodsObj.specal_tags.is_self">{{goodsObj.specal_tags.is_self}}</view> <view class="title-hot" v-if="goodsObj.specal_tags.is_self">{{goodsObj.specal_tags.is_self}}</view>
{{goodsObj.name}} {{goodsObj.name}}
</view> </view>
@@ -175,9 +177,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="coupons-true" @click="serveClose"> <view class="coupons-true" @click="serveClose">确定</view>
确定
</view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
@@ -189,6 +189,9 @@
managesCoupons managesCoupons
} from '@/apis/interfaces/goods' } from '@/apis/interfaces/goods'
import userAuth from '@/public/userAuth' import userAuth from '@/public/userAuth'
import UniShare from 'uni_modules/uni-share/js_sdk/uni-share.js'
const uniShare = new UniShare()
import {config} from '@/apis/index.js'
export default { export default {
data() { data() {
return { return {
@@ -210,6 +213,17 @@
this.coupons = res.coupons this.coupons = res.coupons
}) })
}, },
onBackPress({
from
}) {
console.log(from);
if (from == 'backbutton') {
this.$nextTick(function() {
uniShare.hide()
})
return uniShare.isShow;
}
},
methods: { methods: {
// 提交购买单 // 提交购买单
buyGoods() { buyGoods() {
@@ -298,6 +312,43 @@
// 查看保障服务-隐藏 // 查看保障服务-隐藏
serveClose() { serveClose() {
this.$refs.servePopup.close() this.$refs.servePopup.close()
},
// 顶部菜单点击了分享功能
onNavigationBarButtonTap() {
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
uniShare.show({
content: {
type: 0,
href: 'https://www.lianshang.vip/app?invite=' + shareCode,
title: '链商星球 共创未来,一起搭建 链商经济的世界~',
summary: '链商星球APP你值得拥有~每日签到领贡献值~',
imageUrl: config.apiUrls+'images/top_logo.png'
},
menus: [{
"img": "/static/icons/payWay_icon_00.png",
"text": "微信好友",
"share": { //当前项的分享参数配置。可覆盖公共的配置如下分享到微信小程序配置了type=5
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/icons/share-pyq.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
}
}
],
cancelText: "取消分享",
}, e => {
if(uniShare.isShow){
console.log('shareCode',shareCode)
}
})
} }
} }
} }

View File

@@ -57,6 +57,8 @@
}, },
onShow(){ onShow(){
this.parentId = getApp().globalData.parentId this.parentId = getApp().globalData.parentId
}, },
methods: { methods: {
// 用户登录 // 用户登录

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;
} }

BIN
static/icons/share-pyq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
static/icons/share-wx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,14 @@
## 2.0.02021-10-14
支持监听返回操作(如:物理返回,全面屏手机侧滑)关闭分享弹窗
## 1.0.62021-08-25
兼容vue3
## 1.0.52021-08-05
优化代码实现,修改原来用`eval()`函数实现的逻辑
## 1.0.42021-06-07
为符合苹果应用市场的审核,只显示存在对应的分享客户端的选项。如:配置包含微信分享,但是用户手机上并没有安装微信,就不显示微信分享。
## 1.0.22021-05-06
修复错误的提示“打包时未添加oauth模块”
## 1.0.12021-04-30
新增完整示例
## 1.0.02021-04-28
第1版发布

View File

@@ -0,0 +1,203 @@
var nvMask, nvImageMenu;
class NvImageMenu {
constructor(arg) {
this.isShow = false
}
show({
list,
cancelText
}, callback) {
if (!list) {
list = [{
"img": "/static/sharemenu/wechatfriend.png",
"text": "图标文字"
}]
}
//以下为计算菜单的nview绘制布局为固定算法使用者无关关心
var screenWidth = plus.screen.resolutionWidth
//以360px宽度屏幕为例上下左右边距及2排按钮边距留25像素图标宽度55像素同行图标间的间距在360宽的屏幕是30px但需要动态计算以此原则计算4列图标分别的left位置
//图标下的按钮文字距离图标5像素文字大小12像素
//底部取消按钮高度固定为44px
//TODO 未处理横屏和pad这些情况6个图标应该一排即可
var margin = 20,
iconWidth = 60,
icontextSpace = 5,
textHeight = 12
var left1 = margin / 360 * screenWidth
var iconSpace = (screenWidth - (left1 * 2) - (iconWidth * 4)) / 3 //屏幕宽度减去左右留白间距再减去4个图标的宽度就是3个同行图标的间距
if (iconSpace <= 5) { //屏幕过窄时,缩小边距和图标大小,再算一次
margin = 15
iconWidth = 40
left1 = margin / 360 * screenWidth
iconSpace = (screenWidth - (left1 * 2) - (iconWidth * 4)) / 3 //屏幕宽度减去左右留白间距再减去4个图标的宽度就是3个同行图标的间距
}
var left2 = left1 + iconWidth + iconSpace
var left3 = left1 + (iconWidth + iconSpace) * 2
var left4 = left1 + (iconWidth + iconSpace) * 3
var top1 = left1
var top2 = top1 + iconWidth + icontextSpace + textHeight + left1
const TOP = {
top1,
top2
},
LEFT = {
left1,
left2,
left3,
left4
};
nvMask = new plus.nativeObj.View("nvMask", { //先创建遮罩层
top: '0px',
left: '0px',
height: '100%',
width: '100%',
backgroundColor: 'rgba(0,0,0,0.2)'
});
nvImageMenu = new plus.nativeObj.View("nvImageMenu", { //创建底部图标菜单
bottom: '0px',
left: '0px',
height: (iconWidth + textHeight + 2 * margin) * Math.ceil(list.length / 4) + 44 +
'px', //'264px',
width: '100%',
backgroundColor: 'rgb(255,255,255)'
});
nvMask.addEventListener("click", () => { //处理遮罩层点击
// console.log('处理遮罩层点击');
this.hide()
callback({
event: "clickMask"
})
})
let myList = []
list.forEach((item, i) => {
myList.push({
tag: 'img',
src: item.img,
position: {
top: TOP['top' + (parseInt(i / 4) + 1)],
left: LEFT['left' + (1 + i % 4)],
width: iconWidth,
height: iconWidth
}
})
myList.push({
tag: 'font',
text: item.text,
textStyles: {
size: textHeight
},
position: {
top: TOP['top' + (parseInt(i / 4) + 1)] + iconWidth + icontextSpace,
left: LEFT['left' + (1 + i % 4)],
width: iconWidth,
height: textHeight
}
})
})
//绘制底部图标菜单的内容
nvImageMenu.draw([{
tag: 'rect', //菜单顶部的分割灰线
color: '#e7e7e7',
position: {
top: '0px',
height: '1px'
}
},
{
tag: 'font',
text: cancelText, //底部取消按钮的文字
textStyles: {
size: '14px'
},
position: {
bottom: '0px',
height: '44px'
}
},
{
tag: 'rect', //底部取消按钮的顶部边线
color: '#e7e7e7',
position: {
bottom: '45px',
height: '1px'
}
},
...myList
])
nvMask.show()
nvImageMenu.show()
// 开始动画
/*
plus.nativeObj.View.startAnimation({
type: 'slide-in-bottom',
duration: 300
}, nvImageMenu, {}, function() {
console.log('plus.nativeObj.View.startAnimation动画结束');
// 关闭原生动画
plus.nativeObj.View.clearAnimation();
nvImageMenu.show()
});
*/
this.isShow = true
nvImageMenu.addEventListener("click", e => { //处理底部图标菜单的点击事件,根据点击位置触发不同的逻辑
// console.log("click menu"+JSON.stringify(e));
if (e.screenY > plus.screen.resolutionHeight - 44) { //点击了底部取消按钮
// callback({event:"clickCancelButton"})
this.hide()
} else if (e.clientX < 5 || e.clientX > screenWidth - 5 || e.clientY < 5) {
//屏幕左右边缘5像素及菜单顶部5像素不处理点击
} else { //点击了图标按钮
var iClickIndex = -1 //点击的图标按钮序号第一个图标按钮的index为0
var iRow = e.clientY < (top2 - (left1 / 2)) ? 0 : 1
var iCol = -1
if (e.clientX < (left2 - (iconSpace / 2))) {
iCol = 0
} else if (e.clientX < (left3 - (iconSpace / 2))) {
iCol = 1
} else if (e.clientX < (left4 - (iconSpace / 2))) {
iCol = 2
} else {
iCol = 3
}
if (iRow == 0) {
iClickIndex = iCol
} else {
iClickIndex = iCol + 4
}
// console.log("点击按钮的序号: " + iClickIndex);
// if (iClickIndex >= 0 && iClickIndex <= 5) { //处理具体的点击逻辑,此处也可以自行定义逻辑。如果增减了按钮,此处也需要跟着修改
// }
callback({
event: "clickMenu",
index: iClickIndex
})
}
})
/* nvImageMenu.addEventListener("touchstart", function(e) {
if (e.screenY > (plus.screen.resolutionHeight - 44)) {
//TODO 这里可以处理按下背景变灰的效果
}
})
nvImageMenu.addEventListener("touchmove", function(e) {
//TODO 这里可以处理按下背景变灰的效果
if (e.screenY > plus.screen.resolutionHeight - 44) {}
})
nvImageMenu.addEventListener("touchend", function(e) {
//TODO 这里可以处理释放背景恢复的效果
})
*/
}
hide() {
nvMask.hide()
nvImageMenu.hide()
this.isShow = false
}
}
export default NvImageMenu

View File

@@ -0,0 +1,98 @@
import UniImageMenu from './uni-image-menu.js';
class UniShare extends UniImageMenu{
constructor(arg) {
super()
this.isShow = super.isShow
}
async show(param, callback){
var menus = []
plus.share.getServices(services => { //只显示有服务的项目
services = services.filter(item => item.nativeClient)
let servicesList = services.map(e => e.id)
param.menus.forEach(item => {
if (servicesList.includes(item.share.provider) || typeof(item.share) == 'string') {
menus.push(item)
}
})
super.show({
list: menus,
cancelText: param.cancelText
}, e => {
callback(e)
if(e.event == 'clickMenu'){
if (typeof(menus[e.index]['share']) == 'string') {
this[menus[e.index]['share']](param)
} else {
uni.share({
...param.content,
...menus[e.index].share,
success: res=> {
console.log("success:" + JSON.stringify(res));
super.hide()
},
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
uni.showModal({
content: JSON.stringify(err),
showCancel: false,
confirmText: "知道了"
});
}
})
}
}
})
}, err => {
uni.showModal({
title: '获取服务供应商失败:' + JSON.stringify(err),
showCancel: false,
confirmText: '知道了'
});
console.error('获取服务供应商失败:' + JSON.stringify(err));
})
}
hide(){
super.hide()
}
copyurl(param) {
console.log('copyurl',param);
uni.setClipboardData({
data: param.content.href,
success: ()=>{
console.log('success');
uni.hideToast() //关闭自带的toast
uni.showToast({
title: '复制成功',
icon: 'none'
});
super.hide();
},
fail: (err) => {
uni.showModal({
content: JSON.stringify(err),
showCancel: false
});
}
});
}
// 使用系统分享发送分享消息
shareSystem(param) {
console.log('shareSystem',param);
plus.share.sendWithSystem({
type: 'text',
content: param.content.title + param.content.summary || '',
href: param.content.href,
}, (e)=> {
console.log('分享成功');
super.hide()
}, (err)=> {
console.log('分享失败:' + JSON.stringify(err));
uni.showModal({
title: '获取服务供应商失败:' + JSON.stringify(err),
showCancel: false,
confirmText: '知道了'
});
});
}
}
export default UniShare

View File

@@ -0,0 +1,80 @@
{
"id": "uni-share",
"displayName": "uni-share",
"version": "2.0.0",
"description": "底部弹出宫格图标式的分享菜单,可覆盖原生组件。",
"keywords": [
"分享菜单"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"JS SDK",
"通用 SDK"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "n",
"Android Browser": "n",
"微信浏览器(Android)": "n",
"QQ浏览器(Android)": "n"
},
"H5-pc": {
"Chrome": "n",
"IE": "n",
"Edge": "n",
"Firefox": "n",
"Safari": "n"
},
"小程序": {
"微信": "n",
"阿里": "n",
"百度": "n",
"字节跳动": "n",
"QQ": "n"
},
"快应用": {
"华为": "n",
"联盟": "n"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,85 @@
#### 本功能基于[底部图标菜单](https://ext.dcloud.net.cn/plugin?id=4858)封装而成。
### 示例代码
```
<template>
<button type="default" @click="uniShare">显示</button>
</template>
<script>
import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
export default {
methods: {
uniShare() {
uniShare({
content: { //公共的分享参数配置 类型type、链接herf、标题title、summary描述、imageUrl缩略图
type: 0,
href: 'https://uniapp.dcloud.io/',
title: '标题',
summary: '描述',
imageUrl: 'https://img-cdn-aliyun.dcloud.net.cn/stream/icon/__UNI__HelloUniApp.png'
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"share": { //当前项的分享参数配置。可覆盖公共的配置如下分享到微信小程序配置了type=5
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
}
},
{
"img": "/static/app-plus/sharemenu/mp_weixin.png",
"text": "微信小程序",
"share": {
provider: "weixin",
scene: "WXSceneSession",
type: 5,
miniProgram: {
id: '123',
path: '/pages/list/detail',
webUrl: '/#/pages/list/detail',
type: 0
},
}
},
{
"img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博",
"share": {
"provider": "sinaweibo"
}
},
{
"img": "/static/app-plus/sharemenu/qq.png",
"text": "QQ",
"share": {
"provider": "qq"
}
},
{
"img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制",
"share": "copyurl"
},
{
"img": "/static/app-plus/sharemenu/more.png",
"text": "更多",
"share": "shareSystem"
}
],
cancelText: "取消分享",
}, e => { //callback
console.log(e);
})
}
}
}
</script>
```

File diff suppressed because one or more lines are too long