Commit fc3df2f0 authored by Facius's avatar Facius

feat: 分享

parent 9c280e6b
Pipeline #3344 canceled with stages
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
settingPush() { settingPush() {
uni.getPushClientId({ uni.getPushClientId({
success: (res) => { success: (res) => {
console.log('--------getPushClientId--------', res.cid);
uni.setStorageSync('pushClientId', res.cid) uni.setStorageSync('pushClientId', res.cid)
}, },
fail(err) { fail(err) {
...@@ -79,18 +78,22 @@ ...@@ -79,18 +78,22 @@
} }
}) })
//监听push推送通知 //监听push推送通知
uni.onPushMessage('receive', ({type,data})=>{ //console.log(type,title,content,payload); uni.onPushMessage((res)=>{
console.log('-------receive----------', type,title,content,payload); if (res.type == 'receive') {
if(type=='receive' || uni.getSystemInfoSync().platform != "ios"){ //如果type!='receive'是自己本地插件的push消息栏,“拦截”避免死循环',安卓系统没有这个问题 console.log('-------receive----------', res);
uni.createPushMessage(data); 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)
uni.onPushMessage('click', ({type,data}) => { setTimeout(()=> {
console.log('-------click----------',data)
uni.switchTab({ uni.switchTab({
url: '/pages/index/schedule/schedule' url: '/pages/index/schedule/schedule'
}); });
}, 500)
}
}); });
} }
} }
......
<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 @@ ...@@ -61,8 +61,11 @@
</u-button> </u-button>
</view> </view>
</view> </view>
<view v-if="isShare" class="bottom-tip">
<view class="tip-view">{{ bottomTip }}</view>
</view>
<view <view
v-if="bottomTip" v-else-if="bottomTip"
:class="['bottom-tip', { select: select }]" :class="['bottom-tip', { select: select }]"
:hover-class="isSelect ? 'u-hover-class' : ''" :hover-class="isSelect ? 'u-hover-class' : ''"
@click="$u.throttle(handleSelect, 500)" @click="$u.throttle(handleSelect, 500)"
...@@ -141,9 +144,6 @@ export default { ...@@ -141,9 +144,6 @@ export default {
isSelect() { isSelect() {
return this.type == 'select' return this.type == 'select'
}, },
isShare() {
return this.type == 'share'
},
isRenew() { isRenew() {
return this.type == 'renew' return this.type == 'renew'
}, },
...@@ -186,10 +186,12 @@ export default { ...@@ -186,10 +186,12 @@ export default {
}, },
handleClickCancel() { handleClickCancel() {
this.changeVisibleValue(false) this.changeVisibleValue(false)
this.$emit('cancel')
if (this.isShare) { if (this.isShare) {
// 分享领会员 // 分享领会员
this.$emit('share') this.$emit('share')
} else {
this.$emit('cancel')
} }
}, },
handleSelect() { handleSelect() {
......
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
"Maps" : {}, "Maps" : {},
"Push" : {} "Push" : {}
}, },
"safearea": { "safearea" : {
"bottom": { "bottom" : {
"offset": "none" "offset" : "none"
} }
}, },
/* 应用发布信息 */ /* 应用发布信息 */
...@@ -120,11 +120,7 @@ ...@@ -120,11 +120,7 @@
"version" : "2", "version" : "2",
"offline" : true, "offline" : true,
"hms" : {}, "hms" : {},
"oppo" : {}, "oppo" : {}
"vivo" : {},
"mi" : {},
"meizu" : {},
"fcm" : {}
} }
} }
}, },
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
</scroll-view> </scroll-view>
</view> </view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<BottomShare :visible.sync="showShare" @click="handleClickShare"/>
</view> </view>
</template> </template>
...@@ -116,6 +117,7 @@ import NavbarRight from '@/components/navbar-right' ...@@ -116,6 +117,7 @@ import NavbarRight from '@/components/navbar-right'
import NoData from '@/components/no-data' import NoData from '@/components/no-data'
import CardSwiper from '@/components/cell-card-swiper' import CardSwiper from '@/components/cell-card-swiper'
import CellRelation from '@/components/cell-relation' import CellRelation from '@/components/cell-relation'
import BottomShare from '@/components/bottom-share/index.vue'
import { import {
getBusinessCardSelf, getBusinessCardSelf,
getBusinessCardRecord, getBusinessCardRecord,
...@@ -130,6 +132,7 @@ export default { ...@@ -130,6 +132,7 @@ export default {
NoData, NoData,
CardSwiper, CardSwiper,
CellRelation, CellRelation,
BottomShare
}, },
data() { data() {
return { return {
...@@ -146,7 +149,8 @@ export default { ...@@ -146,7 +149,8 @@ export default {
_freshing: false, _freshing: false,
loadingCard: false, loadingCard: false,
currentIndex: 0, currentIndex: 0,
shareImage: '' shareImage: '',
showShare: false,
} }
}, },
computed: { computed: {
...@@ -344,6 +348,9 @@ export default { ...@@ -344,6 +348,9 @@ export default {
}) })
// #endif // #endif
} else if (index == 2) { } else if (index == 2) {
// #ifdef APP-PLUS
this.showShare = true
// #endif
} }
}, },
handleClickAdd() { handleClickAdd() {
...@@ -369,6 +376,28 @@ export default { ...@@ -369,6 +376,28 @@ export default {
handleUpdate(url) { handleUpdate(url) {
this.shareImage = 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) { onShareTimeline(res) {
return { return {
......
...@@ -102,9 +102,8 @@ ...@@ -102,9 +102,8 @@
:params="params" :params="params"
confirm-color="#02A074" confirm-color="#02A074"
@confirm="handleComfirmDate" @confirm="handleComfirmDate"
bottomTip="※ 体验会员,仅非会员用户领取,每个ID限领1次"
></u-picker> ></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" /> <u-toast ref="uToast" />
<mid-popup ref="midPopup"></mid-popup> <mid-popup ref="midPopup"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar> <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'; ...@@ -116,7 +115,7 @@ import MidPopup from '@/components/mid-popup/mid-popup.vue';
import BillList from '@/components/bill-list'; import BillList from '@/components/bill-list';
import PopNormal from '@/components/pop-normal'; import PopNormal from '@/components/pop-normal';
import { tabbar } from '@/utils/settings.js'; 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 { getWeather, bookRecord, monthRecord } from '@/api/maintain/index.js';
import { checkVip, checkToken, getSetting, formatCount } from '@/utils/common.js'; import { checkVip, checkToken, getSetting, formatCount } from '@/utils/common.js';
import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js'; import { checkOpenPermission, checkOpenService } from '@/utils/app-plus-auth.js';
...@@ -367,6 +366,8 @@ export default { ...@@ -367,6 +366,8 @@ export default {
return true; return true;
}, },
handleSelectDate() { handleSelectDate() {
this.visible = true
return
this.showDatePicker = true; this.showDatePicker = true;
}, },
handleComfirmDate(date) { handleComfirmDate(date) {
...@@ -494,16 +495,50 @@ export default { ...@@ -494,16 +495,50 @@ export default {
}); });
}, },
handleClickShare() { handleClickShare() {
var block = ()=> {
if (this.userInfo.vip.code == 'NO') { if (this.userInfo.vip.code == 'NO') {
this.isVipShare = true; this.isVipShare = true;
experienceVip() experienceVip()
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
this.shareSuccess = true; this.shareSuccess = true;
// #ifdef APP-PLUS
this.shareSuccessTip()
// #endif
} }
}) })
.catch(res => {}); .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) { onShareTimeline(res) {
......
...@@ -26,6 +26,7 @@ import MidPopup from '@/components/mid-popup/mid-popup.vue'; ...@@ -26,6 +26,7 @@ import MidPopup from '@/components/mid-popup/mid-popup.vue';
import PlanView from './components/plan-view.vue'; import PlanView from './components/plan-view.vue';
import { tabbar } from '@/utils/settings.js'; import { tabbar } from '@/utils/settings.js';
import { getSign } from '@/api/schedule/index.js'; import { getSign } from '@/api/schedule/index.js';
export default { export default {
components: { components: {
MidPopup, MidPopup,
...@@ -59,6 +60,8 @@ export default { ...@@ -59,6 +60,8 @@ export default {
this.getList(); this.getList();
this.getSignList() this.getSignList()
} }
plus.runtime.setBadgeNumber(0)
}, },
methods: { methods: {
beforeSwitch(index) { beforeSwitch(index) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
@refresherrestore="onRestore" @refresherrestore="onRestore"
enable-back-to-top enable-back-to-top
> >
<view class="scroll-view">
<view class="status-view" <view class="status-view"
><text ><text
:style="'color:' + statusSetting[info.settleState.code].color" :style="'color:' + statusSetting[info.settleState.code].color"
...@@ -113,6 +114,7 @@ ...@@ -113,6 +114,7 @@
</template> </template>
</u-time-line-item> </u-time-line-item>
</u-time-line> </u-time-line>
</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
...@@ -379,7 +381,7 @@ export default { ...@@ -379,7 +381,7 @@ export default {
'border-radius': '16rpx', 'border-radius': '16rpx',
width: this.isSure ? '372rpx' : '260rpx', width: this.isSure ? '372rpx' : '260rpx',
background: this.isSure background: this.isSure
? '' ? '#02a074'
: 'linear-gradient(100deg, transparent 32rpx, #02a074 0)', : 'linear-gradient(100deg, transparent 32rpx, #02a074 0)',
} }
}, },
...@@ -627,7 +629,10 @@ export default { ...@@ -627,7 +629,10 @@ export default {
.content-view { .content-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding: 16rpx 24rpx 44rpx 24rpx; padding: 16rpx 24rpx 0rpx 24rpx;
.scroll-view {
padding-bottom: 44rpx;
}
.status-view { .status-view {
font-weight: bold; font-weight: bold;
font-size: 40rpx; font-size: 40rpx;
......
...@@ -246,7 +246,7 @@ import QRCodeView from '@/components/qr-code-view' ...@@ -246,7 +246,7 @@ import QRCodeView from '@/components/qr-code-view'
import { formatCount } from '@/utils/common.js' import { formatCount } from '@/utils/common.js'
import { repairDetail, repairSign, repairSend } from '@/api/maintain/index.js' import { repairDetail, repairSign, repairSend } from '@/api/maintain/index.js'
import { mapGetters } from 'vuex' 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 { getSetting } from '@/utils/common.js'
import { checkToken } from '@/utils/common.js' import { checkToken } from '@/utils/common.js'
...@@ -544,6 +544,36 @@ export default { ...@@ -544,6 +544,36 @@ export default {
}, },
handleClickShare() { handleClickShare() {
this.repairSend() 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() { handleClickSign() {
this.repairSign() this.repairSign()
...@@ -633,9 +663,9 @@ export default { ...@@ -633,9 +663,9 @@ export default {
}) })
// #endif // #endif
}, },
saveBillImage() { saveBillImage(tip = '保存中') {
uni.showLoading({ uni.showLoading({
title: '保存中', title: tip,
}) })
if (this.billImageUrl) { if (this.billImageUrl) {
......
...@@ -18,6 +18,8 @@ export const billBaseUrl = process.uniEnv.qn_base_url + 'bill/'; // 七牛云对 ...@@ -18,6 +18,8 @@ export const billBaseUrl = process.uniEnv.qn_base_url + 'bill/'; // 七牛云对
export const planBaseUrl = process.uniEnv.qn_base_url + 'plan/'; // 七牛云对象存储图片地址-行程 export const planBaseUrl = process.uniEnv.qn_base_url + 'plan/'; // 七牛云对象存储图片地址-行程
export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户上传文件地址 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/'; // 七牛云对象存储图片地址-账单 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