Commit bd6059cc authored by 刘文虎's avatar 刘文虎
parents 7dbd2d42 1e160f2a
Pipeline #2918 canceled with stages
......@@ -58,4 +58,35 @@ export async function editBusinessCard(data) {
data,
noLoading: true
})
}
\ No newline at end of file
}
// 拨打电话
export async function operateCall(data) {
return request({
url: `/rest/businessCard/call/${data.businessCardId}`,
method: 'GET',
data,
noLoading: true
})
}
// 查看名片
export async function operateView(data) {
return request({
url: `/rest/businessCard/view/${data.businessCardId}`,
method: 'GET',
data,
noLoading: true
})
}
// 加通讯录
export async function operateJoinList(data) {
return request({
url: `/rest/businessCard/joinList/${data.businessCardId}`,
method: 'GET',
data,
noLoading: true
})
}
......@@ -5,8 +5,8 @@
</view>
<view class="content-view">
<view v-if="info.backTitle" class="title-view">{{ info.backTitle }}</view>
<view v-if="info.backContent" class="text-view">
<text>{{ info.backContent }}</text>
<view v-if="info.backContext" class="text-view">
<text>{{ info.backContext }}</text>
</view>
</view>
</view>
......@@ -33,7 +33,7 @@ export default {
},
// green 绿;blue 蓝;black 黑;
image() {
switch (this.info.type) {
switch (this.info.coverUrl) {
case 'green':
return this.baseUrl + 'muban1fanmian@3x.png'
case 'blue':
......@@ -85,6 +85,7 @@ export default {
font-weight: bold;
color: #ffffff;
margin-bottom: 24rpx;
text-align: center;
}
}
}
......
......@@ -6,7 +6,7 @@
</view>
<view class="content-view">
<view class="top-view">
<view class="title-view">{{ info. frontTitle }}</view>
<view class="title-view">{{ info.frontTitle }}</view>
</view>
<view class="name-view">{{ info.name }}</view>
<view class="info-view">
......@@ -20,12 +20,14 @@
<view class="value-view">{{ info.address }}</view>
</view>
</view>
<view
class="right-view"
hover-class="u-hover-class"
@click="$u.throttle(previewQRCode, 500)"
>
<image :src="info.qrCode"></image>
<view class="right-view">
<QRCode
ref="qr-code"
canvas-id="qr-code"
:value="shareUrl"
:size="size"
@complete="complete"
/>
</view>
</view>
</view>
......@@ -33,13 +35,15 @@
<template v-else-if="isBlue">
<view class="content-view">
<view class="top-view top-blue">
<view class="title-view title-blue">{{ info. frontTitle }}</view>
<view
class="right-view"
hover-class="u-hover-class"
@click="$u.throttle(previewQRCode, 500)"
>
<image :src="info.qrCode"></image>
<view class="title-view title-blue">{{ info.frontTitle }}</view>
<view class="right-view">
<QRCode
ref="qr-code"
canvas-id="qr-code"
:value="shareUrl"
:size="size"
@complete="complete"
/>
</view>
</view>
<view class="name-view">{{ info.name }}</view>
......@@ -71,24 +75,32 @@
<view class="value-view">{{ info.address }}</view>
</view>
</view>
<view
class="right-view"
hover-class="u-hover-class"
@click="$u.throttle(previewQRCode, 500)"
>
<image :src="info.qrCode"></image>
<view class="right-view">
<QRCode
ref="qr-code"
canvas-id="qr-code"
:value="shareUrl"
:size="size"
@complete="complete"
/>
</view>
</view>
</view>
<view class="bottom-view">
<view class="title-view">{{ info. frontTitle }}</view>
<view class="title-view">{{ info.frontTitle }}</view>
</view>
</template>
</view>
</template>
<script>
import { card_share_url } from '@/utils/config.js'
import QRCode from '@/components/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue'
export default {
components: {
QRCode,
},
props: {
info: {
type: Object,
......@@ -100,6 +112,7 @@ export default {
data() {
return {
loading: true,
size: 60,
}
},
computed: {
......@@ -110,17 +123,20 @@ export default {
return this.baseUrl + 'muban1zhengmian@3x.png'
},
isGreen() {
return this.info. coverUrl == 'green'
return this.info.coverUrl == 'green'
},
isBlue() {
return this.info. coverUrl == 'blue'
return this.info.coverUrl == 'blue'
},
isBlack() {
return this.info. coverUrl == 'black'
return this.info.coverUrl == 'black'
},
shareUrl() {
return card_share_url + `?cardId=${this.info.id}`
},
// green 绿;blue 蓝;black 黑;
settings() {
switch (this.info. coverUrl) {
switch (this.info.coverUrl) {
case 'green':
return {
color: '#02A074',
......@@ -137,28 +153,26 @@ export default {
}
},
},
watch: {
'info.id'(val) {
if (val) {
this.remake()
}
},
},
methods: {
previewQRCode() {
uni.previewImage({
urls: [this.info.qrCode],
current: 0,
longPressActions: {
success: function (data) {
console.log(
'选中了第' +
(data.tapIndex + 1) +
'个按钮,第' +
(data.index + 1) +
'张图片'
)
},
fail: function (err) {
console.log(err.errMsg)
},
},
remake() {
this.$nextTick(() => {
this.$refs['qr-code'].remake()
})
},
complete(e) {
if (e.success) {
console.log('生成成功')
} else {
console.log('生成失败')
}
},
},
}
</script>
......
......@@ -115,6 +115,9 @@
</view>
</u-form>
</view>
<view class="loading-view" v-if="loading"
><u-loading mode="flower"></u-loading
></view>
<view class="bottom-view">
<u-button
:custom-style="customConFirm"
......@@ -126,13 +129,14 @@
</u-button>
</view>
<PopImage :visible.sync="visible" :images="currentImages" />
<u-toast ref="uToast" />
</view>
</template>
<script>
import NavbarRight from '@/components/navbar-right'
import PopImage from '@/components/pop-image'
import { editbusinessCard } from '@/api/card/index.js'
import { editBusinessCard, getBusinessCard } from '@/api/card/index.js'
export default {
components: {
......@@ -253,7 +257,6 @@ export default {
},
canConfirm() {
for (var item in this.form) {
console.log('------canConfirm------', item)
if (!this.form[item]) {
return false
}
......@@ -281,14 +284,14 @@ export default {
var data = res.data
if (data) {
this.form = {
id: res.id,
address: res.data,
backContext: res.backContext,
backTitle: res.backTitle,
coverUrl: res.coverUrl,
frontTitle: res.frontTitle,
name: res.name,
phone: res.phone,
id: data.id,
address: data.address,
backContext: data.backContext,
backTitle: data.backTitle,
coverUrl: data.coverUrl,
frontTitle: data.frontTitle,
name: data.name,
phone: data.phone,
}
}
this.loading = false
......@@ -297,20 +300,27 @@ export default {
this.loading = false
})
},
editbusinessCard() {
editBusinessCard() {
this.buttonLoading = true
editbusinessCard(this.form)
editBusinessCard(this.form)
.then((res) => {
if (res.data) {
this.buttonLoading = false
uni.$emit('card-refresh')
this.$u.route({
type: 'back',
})
this.buttonLoading = false
uni.$emit('card-refresh')
this.$refs.uToast.show({
title: this.cardId ? '编辑成功' : '创建成功',
type: 'success',
duration: 1500,
callback: () => {
this.$u.route({
type: 'back',
})
},
})
}
})
.catch((res) => {
this.loading = false
this.buttonLoading = false
})
},
previewTemplate(index) {
......@@ -324,7 +334,7 @@ export default {
this.$refs.uForm.validate((valid) => {
if (valid) {
console.log('验证通过')
this.editbusinessCard()
this.editBusinessCard()
} else {
console.log('验证失败')
}
......@@ -458,5 +468,15 @@ export default {
font-size: 32rpx;
}
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
}
</style>
......@@ -106,6 +106,7 @@ import {
getBusinessCardRecord,
operateStatistics,
} from '@/api/card/index.js'
import { mapGetters } from 'vuex'
export default {
components: {
......@@ -130,6 +131,7 @@ export default {
}
},
computed: {
...mapGetters(['userInfo']),
baseUrl() {
return process.uniEnv.qn_base_url
},
......@@ -139,6 +141,12 @@ export default {
noDataImage() {
return this.baseUrl + 'mingpianwuxinxi@3x.png'
},
shareTitle() {
return `"${this.info.name}"的名片`
},
shareParams() {
return `?cardId=${this.info.id}&shareUserId=${this.userInfo.id}`
},
infoKeys() {
// {view:浏览;call:拨打电话;list:通讯录},可用值:VIEW,CALL,LIST
return [
......@@ -291,6 +299,22 @@ export default {
url: 'pages/card/create',
})
},
// 朋友圈
onShareTimeline(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
// 好友
onShareAppMessage(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
},
}
</script>
......
......@@ -7,9 +7,12 @@
</view>
<CardBack :info="info" />
</view>
<view class="loading-view" v-if="loading"
><u-loading mode="flower"></u-loading
></view>
<view class="bottom-view">
<view class="left-view">
<u-button :custom-style="customScan" @click="handleClickScan">
<u-button :custom-style="customCall" @click="handleClickCall">
<view class="image-view">
<image :src="bodadianhuaImage"></image>
</view>
......@@ -19,7 +22,7 @@
<view class="right-view">
<u-button
:custom-style="customConFirm"
@click="handleClickConFirm"
@click="handleClickConfirm"
class="confirm-button"
>
<view class="image-view">
......@@ -29,6 +32,7 @@
</u-button>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
......@@ -36,7 +40,13 @@
import NavbarRight from '@/components/navbar-right'
import Card from '@/components/cell-card'
import CardBack from '@/components/cell-card-back'
import {
getBusinessCard,
operateCall,
operateView,
operateJoinList,
} from '@/api/card/index.js'
import { mapGetters } from 'vuex'
export default {
components: {
NavbarRight,
......@@ -47,9 +57,12 @@ export default {
return {
cardId: '',
info: {},
// shareUserId: '',
loading: false,
}
},
computed: {
...mapGetters(['userInfo']),
baseUrl() {
return process.uniEnv.qn_base_url
},
......@@ -59,7 +72,7 @@ export default {
cunrutongxunluImage() {
return this.baseUrl + 'cunrutongxunlu@3x.png'
},
customScan() {
customCall() {
return {
color: 'transparent',
'background-color': '#ffffff',
......@@ -77,32 +90,137 @@ export default {
width: '332rpx',
}
},
shareTitle() {
return `"${this.info.name}"的名片`
},
shareParams() {
return `?cardId=${this.info.id}&shareUserId=${this.userInfo.id}`
},
},
onLoad(options) {
if (options && options.cardId) {
this.cardId = options.cardId
// 测试数据
// options.cardId = '1551401777033641984'
// if (options && options.shareUserId) {
// this.shareUserId = options.shareUserId
// }
if (options.q) {
// 扫码进的
const q = decodeURIComponent(options.q)
this.initOptions(q)
} else {
if (options && options.cardId) {
this.cardId = options.cardId
}
}
this.init()
this.getBusinessCard()
this.operateView()
},
onShow() {},
methods: {
init() {
this.loading = false
this.info = {
type: 'black',
title: '扳手专业品牌家电维修',
name: '小扳手',
address:
'dfsafdsafdasf发撒范德萨范德萨发的范德萨范大师傅的范德萨范大事发声的范德萨范德萨发撒发',
phone: '131231241314',
qrCode: 'http://static-book.kaying.cc/icon/beijing%403x.png',
backTitle: '范德萨范德萨范德萨范撒地方',
backContent: `家电维修安装、清洗保养服务、二手家电回收\n水电维修服务、家具维保服务、家居清洗美化`,
getCardId(q) {
var array = q.split('?')
if (array.length > 1) {
var arr = array[1].split('&')
for (var item of arr) {
if (item.indexOf('cardId=') != -1) {
this.cardId = item.split('=')[1]
break
}
}
}
},
getBusinessCard() {
this.loading = true
getBusinessCard()
.then((res) => {
if (res.data) {
this.info = res.data
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
operateCall() {
this.loading = true
operateCall({
businessCardId: this.cardId,
})
.then((res) => {
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
operateView() {
this.loading = true
operateView({
businessCardId: this.cardId,
})
.then((res) => {
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
operateJoinList() {
this.loading = true
operateJoinList({
businessCardId: this.cardId,
})
.then((res) => {
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
handleClickCall() {
if (this.info.phone) {
uni.makePhoneCall({
phoneNumber: this.info.phone,
})
}
this.operateCall()
},
handleClickConfirm() {
uni.addPhoneContact({
nickName: this.info.name,
mobilePhoneNumber: this.info.phone,
success: () => {
this.$refs.uToast.show({
title: '保存成功',
type: 'success',
duration: 1500,
callback: () => {},
})
},
fail: () => {
console.log('fail')
},
})
this.operateJoinList()
},
// 朋友圈
onShareTimeline(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
// 好友
onShareAppMessage(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
handleClickScan() {},
handleClickConfirm() {},
},
}
</script>
......@@ -175,5 +293,15 @@ export default {
}
}
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
}
</style>
......@@ -266,7 +266,12 @@ export default {
return this.$u.timeFormat(new Date(string).getTime(), 'yyyy年mm月')
},
},
onLoad() {},
onLoad(options) {
if (options.q) {
const q = decodeURIComponent(options.q) // 获取到二维码原始链接内容
console.log(q)
}
},
onShow() {
console.log('----------------')
this.userInfo
......
......@@ -159,33 +159,29 @@
</view>
</template>
</view>
<PopQRCode
:visible.sync="visible"
:title="shareTitle"
:url="shareUrl"
/>
<u-toast ref="uToast" />
<PopQRCode :visible.sync="visible" :title="shareTitle" :url="shareUrl" />
<u-toast ref="uToast" />
</view>
</template>
<script>
import NavbarRight from '@/components/navbar-right'
import PopQRCode from '@/components/pop-qrCode'
import { repairDetail,repairSign } from '@/api/maintain/index.js'
import { repairDetail, repairSign } from '@/api/maintain/index.js'
import { mapGetters } from 'vuex'
import { maintain_share_url } from '@/utils/config.js';
import { maintain_share_url } from '@/utils/config.js'
export default {
components: {
NavbarRight,
PopQRCode
PopQRCode,
},
data() {
return {
billId: '',
info: {
settleState: {},
sendStatus: {}
sendStatus: {},
},
visible: false,
shareUserId: '',
......@@ -207,7 +203,7 @@ export default {
return maintain_share_url + this.shareParams
},
receive() {
return this.shareUserId && (this.shareUserId != this.userInfo.id)
return this.shareUserId && this.shareUserId != this.userInfo.id
},
isOver() {
return this.info.settleState.code == 'YES'
......@@ -322,8 +318,19 @@ export default {
if (options && options.billId) {
this.billId = options.billId
}
if (options && options.shareUserId) {
this.shareUserId = options.shareUserId
if (options.q) {
// 扫码进的
const q = decodeURIComponent(options.q)
this.initOptions(q)
} else {
if (options && options.billId) {
this.billId = options.billId
}
if (options && options.shareUserId) {
this.shareUserId = options.shareUserId
}
}
// 测试数据
......@@ -333,6 +340,20 @@ export default {
},
onShow() {},
methods: {
initOptions(q) {
var array = q.split('?')
if (array.length > 1) {
var arr = array[1].split('&')
for (var item of arr) {
if (item.indexOf('billId=') != -1) {
this.billId = item.split('=')[1]
}
if (item.indexOf('shareUserId=') != -1) {
this.shareUserId = item.split('=')[1]
}
}
}
},
toMainIndex() {
this.$u.route({
url: 'pages/index/index',
......@@ -377,7 +398,7 @@ export default {
},
repairSign() {
this.buttonLoading = true
repairSign({id: this.billId})
repairSign({ id: this.billId })
.then((res) => {
if (res.code == 0) {
this.repairDetail()
......@@ -385,8 +406,7 @@ export default {
title: '签收成功',
type: 'success',
duration: 1500,
callback: () => {
},
callback: () => {},
})
this.buttonLoading = false
}
......@@ -401,7 +421,7 @@ export default {
type: 'switchTab',
})
},
handleClickScan(){
handleClickScan() {
this.visible = true
},
handleClickPreview(index) {
......
......@@ -19,6 +19,7 @@ export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户
export const maintain_share_url = 'https://system.banshouhui.com/maintainqrcode' // pages/maintain-bill/show二维码地址
export const index_share_url = 'https://system.banshouhui.com/indexqrcode' // pages/index/index二维码地址
export const card_share_url = 'https://system.banshouhui.com/shareqrcode' // pages/card/share二维码地址
export const whiteList = ['/pages/index/index', '/pages/index/schedule/schedule', '/pages/index/bill/bill',
'/pages/index/mine/mine', '/pages/login/login', '/pages/login/quick-login/quick-login',
......
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