Commit fc3df2f0 authored by Facius's avatar Facius

feat: 分享

parent 9c280e6b
Pipeline #3344 canceled with stages
......@@ -68,10 +68,9 @@
});
}
},
settingPush() {
settingPush() {
uni.getPushClientId({
success: (res) => {
console.log('--------getPushClientId--------', res.cid);
uni.setStorageSync('pushClientId', res.cid)
},
fail(err) {
......@@ -79,18 +78,22 @@
}
})
//监听push推送通知
uni.onPushMessage('receive', ({type,data})=>{ //console.log(type,title,content,payload);
console.log('-------receive----------', type,title,content,payload);
if(type=='receive' || uni.getSystemInfoSync().platform != "ios"){ //如果type!='receive'是自己本地插件的push消息栏,“拦截”避免死循环',安卓系统没有这个问题
uni.createPushMessage(data);
uni.onPushMessage((res)=>{
if (res.type == 'receive') {
console.log('-------receive----------', res);
if(res.type=='receive' || uni.getSystemInfoSync().platform != "ios"){ //如果type!='receive'是自己本地插件的push消息栏,“拦截”避免死循环',安卓系统没有这个问题
uni.createPushMessage(res.data);
}
} else if (res.type == 'click'){
console.log('-------click----------',res.data)
setTimeout(()=> {
uni.switchTab({
url: '/pages/index/schedule/schedule'
});
}, 500)
}
});
//监听点击通知栏
uni.onPushMessage('click', ({type,data}) => {
console.log('-------click----------',data)
uni.switchTab({
url: '/pages/index/schedule/schedule'
});
});
}
}
......
<template>
<u-popup v-model="show" mode="bottom" @close="handleClose" length="auto">
<view class="pop-view">
<view class="bottom-view">
<u-button
v-for="(item, index) in list"
:key="index"
@click="handleClick(index)"
:customStyle="buttonStyle"
>
<view class="button-view">
<image :src="item.image" class="image-view"></image>
<view class="title-view">{{ item.title }}</view>
</view>
</u-button>
</view>
</view>
</u-popup>
</template>
<script>
const app = getApp()
import { wxMiniId, webUrl } from '@/utils/config.js';
export default {
props: {
visible: {
type: Boolean,
default: false,
},
},
data() {
return {
show: false,
}
},
computed: {
baseUrl() {
return process.uniEnv.qn_base_url
},
list() {
return [
{
image: this.baseUrl + 'share_weixin.png',
title: '分享好友',
scene: 'WXSceneSession',
type: 5, // 小程序
wxMiniId: wxMiniId,
wxMiniUrl: 'https://system.banshouhui.com/shareqrcode',
},
{
image: this.baseUrl + 'share_pengyouquan.png',
title: '朋友圈',
scene: 'WXSceneTimeline',
type: 0, // 图文
wxMiniId: wxMiniId,
wxMiniUrl: webUrl,
},
]
},
buttonStyle() {
return {
with: '140rpx',
height: '200rpx',
backgroundColor: 'transparent',
color: '#F6F7FA !important',
}
},
},
watch: {
visible(val) {
this.changeTab(val)
this.show = val
},
},
methods: {
handleClick(index) {
var item = this.list[index]
this.$emit('click', item)
this.changeVisibleValue(false)
},
changeVisibleValue(val) {
this.$emit('update:visible', val)
},
handleClose() {
this.changeVisibleValue(false)
},
changeTab(val) {
var pages = getCurrentPages()
var array = [
'pages/index/index',
'pages/mine/mine',
'pages/pilot-lamp/index',
'pages/datum/index',
]
var current = pages[pages.length - 1].route
var isTab = current.indexOf('pages/index') != -1
if (isTab) {
if (val) {
uni.hideTabBar({
complete: () => {},
})
} else {
uni.showTabBar({
complete: () => {},
})
}
}
},
},
}
</script>
<style lang="scss" scoped>
.pop-view {
overflow: hidden;
background-color: #f6f7fa;
padding-bottom: 36rpx;
padding-top: 36rpx;
position: relative;
width: 100%;
height: 100%;
.bottom-view {
display: flex;
justify-content: space-around;
align-items: center;
.button-view {
display: flex;
flex-direction: column;
align-items: center;
.image-view {
width: 104rpx;
height: 104rpx;
}
.title-view {
color: #333;
font-size: 28rpx;
}
}
}
}
</style>
......@@ -61,8 +61,11 @@
</u-button>
</view>
</view>
<view v-if="isShare" class="bottom-tip">
<view class="tip-view">{{ bottomTip }}</view>
</view>
<view
v-if="bottomTip"
v-else-if="bottomTip"
:class="['bottom-tip', { select: select }]"
:hover-class="isSelect ? 'u-hover-class' : ''"
@click="$u.throttle(handleSelect, 500)"
......@@ -141,9 +144,6 @@ export default {
isSelect() {
return this.type == 'select'
},
isShare() {
return this.type == 'share'
},
isRenew() {
return this.type == 'renew'
},
......@@ -186,10 +186,12 @@ export default {
},
handleClickCancel() {
this.changeVisibleValue(false)
this.$emit('cancel')
if (this.isShare) {
// 分享领会员
this.$emit('share')
} else {
this.$emit('cancel')
}
},
handleSelect() {
......
......@@ -32,11 +32,11 @@
"Maps" : {},
"Push" : {}
},
"safearea": {
"bottom": {
"offset": "none"
}
},
"safearea" : {
"bottom" : {
"offset" : "none"
}
},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
......@@ -120,11 +120,7 @@
"version" : "2",
"offline" : true,
"hms" : {},
"oppo" : {},
"vivo" : {},
"mi" : {},
"meizu" : {},
"fcm" : {}
"oppo" : {}
}
}
},
......
......@@ -108,6 +108,7 @@
</scroll-view>
</view>
<u-toast ref="uToast" />
<BottomShare :visible.sync="showShare" @click="handleClickShare"/>
</view>
</template>
......@@ -116,6 +117,7 @@ import NavbarRight from '@/components/navbar-right'
import NoData from '@/components/no-data'
import CardSwiper from '@/components/cell-card-swiper'
import CellRelation from '@/components/cell-relation'
import BottomShare from '@/components/bottom-share/index.vue'
import {
getBusinessCardSelf,
getBusinessCardRecord,
......@@ -130,6 +132,7 @@ export default {
NoData,
CardSwiper,
CellRelation,
BottomShare
},
data() {
return {
......@@ -146,7 +149,8 @@ export default {
_freshing: false,
loadingCard: false,
currentIndex: 0,
shareImage: ''
shareImage: '',
showShare: false,
}
},
computed: {
......@@ -344,6 +348,9 @@ export default {
})
// #endif
} else if (index == 2) {
// #ifdef APP-PLUS
this.showShare = true
// #endif
}
},
handleClickAdd() {
......@@ -369,6 +376,28 @@ export default {
handleUpdate(url) {
this.shareImage = url
},
handleClickShare(item) {
uni.share({
provider: 'weixin',
scene: item.scene,
type: item.type,
href: item.wxMiniUrl,
imageUrl: this.shareImage,
title: this.shareTitle,
miniProgram: {
id: item.wxMiniId,
path: 'pages/card/share' + this.shareParams,
type: 0,
webUrl: item.wxMiniUrl
},
success: ret => {
console.log(JSON.stringify(ret));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
})
},
// 朋友圈
onShareTimeline(res) {
return {
......
......@@ -102,9 +102,8 @@
:params="params"
confirm-color="#02A074"
@confirm="handleComfirmDate"
bottomTip="※ 体验会员,仅非会员用户领取,每个ID限领1次"
></u-picker>
<PopNormal :visible.sync="visible" :type="currentPop.type" :confirmText="currentPop.confirmText" :cancelText="currentPop.cancelText" @share="handleClickShare" />
<PopNormal :visible.sync="visible" :type="currentPop.type" :confirmText="currentPop.confirmText" :cancelText="currentPop.cancelText" @share="handleClickShare" bottomTip="※ 体验会员,仅非会员用户领取,每个ID限领1次"/>
<u-toast ref="uToast" />
<mid-popup ref="midPopup"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
......@@ -116,7 +115,7 @@ import MidPopup from '@/components/mid-popup/mid-popup.vue';
import BillList from '@/components/bill-list';
import PopNormal from '@/components/pop-normal';
import { tabbar } from '@/utils/settings.js';
import { indexBaseUrl, mineBaseUrl, baseUrl } from '@/utils/config.js';
import { indexBaseUrl, mineBaseUrl, baseUrl,wxMiniId, webUrl } from '@/utils/config.js';
import { getWeather, bookRecord, monthRecord } from '@/api/maintain/index.js';
import { checkVip, checkToken, getSetting, formatCount } from '@/utils/common.js';
import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js';
......@@ -367,6 +366,8 @@ export default {
return true;
},
handleSelectDate() {
this.visible = true
return
this.showDatePicker = true;
},
handleComfirmDate(date) {
......@@ -494,16 +495,50 @@ export default {
});
},
handleClickShare() {
if (this.userInfo.vip.code == 'NO') {
this.isVipShare = true;
experienceVip()
.then(res => {
if (res.code == 0) {
this.shareSuccess = true;
}
})
.catch(res => {});
var block = ()=> {
if (this.userInfo.vip.code == 'NO') {
this.isVipShare = true;
experienceVip()
.then(res => {
if (res.code == 0) {
this.shareSuccess = true;
// #ifdef APP-PLUS
this.shareSuccessTip()
// #endif
}
})
.catch(res => {});
}
}
// #ifdef MP
block()
// #endif
// #ifdef APP-PLUS
uni.share({
provider: 'weixin',
scene: 'WXSceneSession',
type: 5,
href: webUrl,
imageUrl: this.shareImage,
title: '扳手记账',
miniProgram: {
id: wxMiniId,
path: `/pages/index/index?shareUserId=${this.userInfo.id}`,
type: 0,
webUrl: webUrl
},
success: ret => {
console.log(JSON.stringify(ret));
block()
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
})
// #endif
},
handleShare() {
},
// 朋友圈
onShareTimeline(res) {
......
......@@ -26,6 +26,7 @@ import MidPopup from '@/components/mid-popup/mid-popup.vue';
import PlanView from './components/plan-view.vue';
import { tabbar } from '@/utils/settings.js';
import { getSign } from '@/api/schedule/index.js';
export default {
components: {
MidPopup,
......@@ -59,6 +60,8 @@ export default {
this.getList();
this.getSignList()
}
plus.runtime.setBadgeNumber(0)
},
methods: {
beforeSwitch(index) {
......
......@@ -20,6 +20,7 @@
@refresherrestore="onRestore"
enable-back-to-top
>
<view class="scroll-view">
<view class="status-view"
><text
:style="'color:' + statusSetting[info.settleState.code].color"
......@@ -114,7 +115,8 @@
</u-time-line-item>
</u-time-line>
</view>
</scroll-view>
</view>
</scroll-view>
</view>
<view class="bottom-view" v-if="info.id">
<view class="left-view">
......@@ -379,7 +381,7 @@ export default {
'border-radius': '16rpx',
width: this.isSure ? '372rpx' : '260rpx',
background: this.isSure
? ''
? '#02a074'
: 'linear-gradient(100deg, transparent 32rpx, #02a074 0)',
}
},
......@@ -627,7 +629,10 @@ export default {
.content-view {
height: 100%;
overflow: auto;
padding: 16rpx 24rpx 44rpx 24rpx;
padding: 16rpx 24rpx 0rpx 24rpx;
.scroll-view {
padding-bottom: 44rpx;
}
.status-view {
font-weight: bold;
font-size: 40rpx;
......
......@@ -246,7 +246,7 @@ import QRCodeView from '@/components/qr-code-view'
import { formatCount } from '@/utils/common.js'
import { repairDetail, repairSign, repairSend } from '@/api/maintain/index.js'
import { mapGetters } from 'vuex'
import { maintain_share_url } from '@/utils/config.js'
import { maintain_share_url,wxMiniId, webUrl } from '@/utils/config.js'
import { getSetting } from '@/utils/common.js'
import { checkToken } from '@/utils/common.js'
......@@ -544,7 +544,37 @@ export default {
},
handleClickShare() {
this.repairSend()
// #ifdef APP-PLUS
this.handleShare()
// #endif
},
handleShare() {
this.currentBlock = (url) => {
uni.hideLoading()
uni.share({
provider: 'weixin',
scene: 'WXSceneSession',
type: 5,
href: webUrl,
imageUrl: url,
title: '发送账单',
miniProgram: {
id: wxMiniId,
path: 'pages/maintain-bill/show' + this.shareParams,
type: 0,
webUrl: webUrl
},
success: ret => {
console.log(JSON.stringify(ret));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
})
}
this.saveBillImage('加载中')
},
handleClickSign() {
this.repairSign()
},
......@@ -633,9 +663,9 @@ export default {
})
// #endif
},
saveBillImage() {
saveBillImage(tip = '保存中') {
uni.showLoading({
title: '保存中',
title: tip,
})
if (this.billImageUrl) {
......
......@@ -18,6 +18,8 @@ export const billBaseUrl = process.uniEnv.qn_base_url + 'bill/'; // 七牛云对
export const planBaseUrl = process.uniEnv.qn_base_url + 'plan/'; // 七牛云对象存储图片地址-行程
export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户上传文件地址
export const wxMiniId = 'gh_7add974cc08f'
export const webUrl = 'http://kaying.cc/banshoujizhangjieshao/index.html'
export const billStaticBaseUrl = '/static/image/bill/'; // 七牛云对象存储图片地址-账单
......
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