活动按钮状态流转
This commit is contained in:
449
pagesCard/card/details.vue
Normal file
449
pagesCard/card/details.vue
Normal file
@@ -0,0 +1,449 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 名片详情 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container" :style="{'--theme-color': themeColor}">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar :showBack="true" title="名片详情"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-card">
|
||||
<card-item :show-data="cardDetails"></card-item>
|
||||
</view>
|
||||
<view class="main-visitor">
|
||||
<view class="visitor-record" v-if="cardDetails.visitor_count > 0">
|
||||
<view class="record-list">
|
||||
<view class="list-item" v-for="(item, index) in cardDetails.visitor_list" :key="index" v-if="index < 5">
|
||||
<image class="item-avatar" :src="item.avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="list-item" v-if="cardDetails.visitor_count > 5">
|
||||
<view class="item-more">
|
||||
<view class="point"></view>
|
||||
<view class="point"></view>
|
||||
<view class="point"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="record-label">已有{{cardDetails.visitor_count || 0}}人访问</view>
|
||||
<view class="record-btn" :class="{active: cardDetails.reliable_status == 1}" @click="setCardReliable()">
|
||||
<uni-icons type="hand-up-filled" size="16" color="#FFFFFF" v-if="cardDetails.reliable_status == 1"></uni-icons>
|
||||
<uni-icons type="hand-up" size="16" :color="themeColor" v-else></uni-icons>
|
||||
<text class="text">靠谱</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="visitor-contact" v-if="cardDetails.mobile || cardDetails.wechat_number">
|
||||
<view class="contact-item" @click="handleContact" v-if="cardDetails.mobile">
|
||||
<view class="item-icon" :style="{background: themeColor, padding: '4rpx'}">
|
||||
<image src="/static/card/phone.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<text class="item-text">打电话</text>
|
||||
</view>
|
||||
<view class="contact-line" v-if="cardDetails.mobile && cardDetails.wechat_number"></view>
|
||||
<view class="contact-item" @click="handleCopy" v-if="cardDetails.is_wechat_number_public == 1 && cardDetails.wechat_number">
|
||||
<view class="item-icon" style="background: #FFFFFF;">
|
||||
<image src="/static/card/wechat.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<text class="item-text">加微信</text>
|
||||
</view>
|
||||
<view class="contact-bg"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-introduce">
|
||||
<view class="introduce-title">公司介绍</view>
|
||||
<view class="introduce-content">
|
||||
<mp-html :content="cardDetails.company_introduction || '暂未完善'"></mp-html>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="container-footer">
|
||||
<view class="footer-btn" @click="toCardList">
|
||||
<image class="btn-icon" src="/static/card/make.png" mode="aspectFit"></image>
|
||||
<view class="btn-text">制作同款名片</view>
|
||||
</view>
|
||||
<view class="safe-padding"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import cardItem from "../component/card/item.vue"
|
||||
// #ifdef H5
|
||||
import wx from 'weixin-js-sdk';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
cardItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 名片id
|
||||
cardId: null,
|
||||
// 名片信息
|
||||
cardDetails: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
onLoad(option) {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.cardId = option.id
|
||||
this.getCardDetails(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
// #ifdef H5
|
||||
this.initConfig()
|
||||
// #endif
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.cardDetails.share_title,
|
||||
path: "/pagesCard/card/details?id=" + this.cardDetails.id,
|
||||
imageUrl: this.cardDetails.image,
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.cardDetails.share_title,
|
||||
path: "/pagesCard/card/details?id=" + this.cardDetails.id,
|
||||
imageUrl: this.cardDetails.image,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// #ifdef H5
|
||||
// 微信公众号初始化方法
|
||||
initConfig() {
|
||||
this.$util.request("main.WeChatConfig", {
|
||||
url: location.href.split('#')[0]
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: res.data.appId,
|
||||
timestamp: Number(res.data.timestamp),
|
||||
nonceStr: res.data.nonceStr,
|
||||
signature: res.data.signature,
|
||||
jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
openTagList: ["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
})
|
||||
wx.ready(() => {
|
||||
wx.updateAppMessageShareData({
|
||||
title: this.shareTitle,
|
||||
desc: "",
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
wx.updateTimelineShareData({
|
||||
title: this.shareTitle,
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('通过config接口注入权限验证配置 ', error)
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
// 获取名片详情
|
||||
getCardDetails(fn) {
|
||||
this.$util.request("card.details", {
|
||||
id: this.cardId
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.cardDetails = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取名片详情 ', error)
|
||||
})
|
||||
},
|
||||
// 拨打电话
|
||||
handleContact() {
|
||||
if (this.cardDetails.mobile) {
|
||||
this.$util.toPage({
|
||||
mode: 6,
|
||||
phone: this.cardDetails.mobile,
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "该用户暂未完善该信息"
|
||||
})
|
||||
}
|
||||
},
|
||||
// 复制文本
|
||||
handleCopy() {
|
||||
if (this.cardDetails.wechat_number) {
|
||||
this.$util.toPage({
|
||||
mode: 8,
|
||||
content: this.cardDetails.wechat_number,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "已复制微信号",
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "该用户暂未完善该信息"
|
||||
})
|
||||
}
|
||||
},
|
||||
// 设置靠谱
|
||||
setCardReliable() {
|
||||
this.$util.request(this.cardDetails.reliable_status == 1 ? "card.cancelReliable" : "card.setReliable", {
|
||||
card_id: this.cardId
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
this.getCardDetails()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('设置靠谱 ', error)
|
||||
})
|
||||
},
|
||||
// 跳转名片列表
|
||||
toCardList() {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pagesCard/mine/index"
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding-bottom: 144rpx;
|
||||
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-visitor {
|
||||
margin-top: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
|
||||
.visitor-record {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 32rpx;
|
||||
|
||||
.record-list {
|
||||
display: flex;
|
||||
|
||||
.list-item {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
margin-left: -4rpx;
|
||||
background: #eee;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.item-avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.item-more {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--theme-color);
|
||||
padding: 0 6rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
|
||||
.point {
|
||||
width: 6rpx;
|
||||
height: 6rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.record-label {
|
||||
flex: 1;
|
||||
margin-left: 16rpx;
|
||||
color: var(--theme-color);
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.record-btn {
|
||||
margin-left: 16rpx;
|
||||
border-radius: 8rpx;
|
||||
border: 1px solid var(--theme-color);
|
||||
padding: 0 12rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.text {
|
||||
margin-left: 8rpx;
|
||||
color: var(--theme-color);
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: var(--theme-color);
|
||||
|
||||
.text {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.visitor-contact {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
.contact-item {
|
||||
width: 100%;
|
||||
padding: 32rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.item-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.item-text {
|
||||
margin-left: 16rpx;
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.contact-line {
|
||||
background: var(--theme-color);
|
||||
opacity: 0.3;
|
||||
width: 1px;
|
||||
height: 72rpx;
|
||||
}
|
||||
|
||||
.contact-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
background: var(--theme-color);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-introduce {
|
||||
padding: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #ffffff;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.introduce-title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.introduce-content {
|
||||
margin-top: 24rpx;
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.container-footer {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 32rpx;
|
||||
transform: translateX(-50%);
|
||||
z-index: 99;
|
||||
|
||||
.footer-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 32rpx 44rpx;
|
||||
border-radius: 56rpx;
|
||||
background: var(--theme-color);
|
||||
|
||||
.btn-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
margin-left: 8rpx;
|
||||
color: #FFF;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.safe-padding {
|
||||
width: 100%;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
221
pagesCard/component/card/index.vue
Normal file
221
pagesCard/component/card/index.vue
Normal file
@@ -0,0 +1,221 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 组件-名片列表 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="component-card" :style="{'--theme-color': themeColor}">
|
||||
<view class="card-item" v-for="item in showData" :key="item.id" @click="toDetails(item.id)">
|
||||
<view class="item-image">
|
||||
<card-item :show-data="item"></card-item>
|
||||
<view class="image-btn" @click.stop="handleEdit(item.id)">
|
||||
<image class="icon" src="/static/card/edit.png" mode="aspectFit"></image>
|
||||
<text class="text">编辑名片</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-bottom">
|
||||
<view class="bottom-default" @click.stop="setDefaultCard(item.id, item.is_default)">
|
||||
<view class="default-label">默认名片</view>
|
||||
<view class="default-switch" :class="{'active': item.is_default == 1}">
|
||||
<view class="switch-round"></view>
|
||||
</view>
|
||||
</view>
|
||||
<button open-type="share" class="bottom-render" @click.stop="setShareData(item)">
|
||||
<view class="render-icon">
|
||||
<image src="/static/card/render.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="render-text">递交名片</view>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import cardItem from "./item.vue"
|
||||
export default {
|
||||
name: "componentCard",
|
||||
props: ["showData"],
|
||||
components: {
|
||||
cardItem,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 前往详情
|
||||
toDetails(id) {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pagesCard/mine/details?id=" + id
|
||||
})
|
||||
},
|
||||
// 前往编辑
|
||||
handleEdit(id) {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pagesCard/mine/edit?id=" + id
|
||||
})
|
||||
},
|
||||
// 设置分享数据
|
||||
setShareData(item) {
|
||||
this.$emit('setShareData', {
|
||||
id: item.id,
|
||||
share_title: item.share_title,
|
||||
image: item.image,
|
||||
})
|
||||
},
|
||||
// 设置默认名片
|
||||
setDefaultCard(id, status) {
|
||||
if (status == 1) return
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: "加载中",
|
||||
})
|
||||
this.$util.request("card.setDefault", {
|
||||
id: id,
|
||||
is_default: 1,
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 1) {
|
||||
this.$emit('getList', () => { uni.hideLoading() })
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('设置默认名片 ', error)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.component-card {
|
||||
.card-item {
|
||||
background: #FFF;
|
||||
margin-top: 32rpx;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item-image {
|
||||
position: relative;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.image-btn {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 14rpx 16rpx;
|
||||
border-radius: 16rpx 0;
|
||||
background: var(--theme-color);
|
||||
|
||||
.icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 8rpx;
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-bottom {
|
||||
padding: 20rpx 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.bottom-default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.default-label {
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.default-switch {
|
||||
width: 80rpx;
|
||||
height: 40rpx;
|
||||
padding: 3rpx;
|
||||
background: #D9D9D9;
|
||||
border-radius: 20rpx;
|
||||
transition: all .3s;
|
||||
|
||||
.switch-round {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
margin-left: 0;
|
||||
transition: all .3s;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: var(--theme-color);
|
||||
|
||||
.switch-round {
|
||||
margin-left: calc(100% - 34rpx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-render {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
line-height: 1.3;
|
||||
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.render-icon {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
background: var(--theme-color);
|
||||
}
|
||||
|
||||
.render-text {
|
||||
margin-left: 8rpx;
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
195
pagesCard/component/card/item.vue
Normal file
195
pagesCard/component/card/item.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 组件-名片项目 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="component-card-item" v-if="showData">
|
||||
<image class="card-image" :src="showData.card_background_image" mode="aspectFill" v-if="showData.card_background_image"></image>
|
||||
<image class="card-avatar" :src="showData.avatar" mode="aspectFill" v-if="showData.avatar && showData.is_hide_avatar != 1"></image>
|
||||
<view class="card-name">
|
||||
<view class="name" :style="{color: showData.font_color}" v-if="showData.name">{{showData.name}}</view>
|
||||
<view class="position" :style="{color: showData.font_color}" v-if="showData.company_position">{{showData.company_position}}</view>
|
||||
</view>
|
||||
<view class="card-company" :style="{color: showData.font_color}" v-if="showData.company_name">{{showData.company_name}}</view>
|
||||
<view class="card-business" :style="{color: showData.font_color}" v-if="showData.main_business">
|
||||
<text class="label" :style="{color: showData.font_color}" v-for="(item, index) in stringToArray(showData.main_business)" :key="index">{{item}}</text>
|
||||
</view>
|
||||
<view class="card-mobile" v-if="showData.mobile">
|
||||
<image class="icon" src="/static/card/mobile_w.png" mode="aspectFit" v-if="showData.font_color == '#FFFFFF'"></image>
|
||||
<image class="icon" src="/static/card/mobile.png" mode="aspectFit" v-else></image>
|
||||
<text class="text" :style="{color: showData.font_color}">{{showData.mobile}}</text>
|
||||
</view>
|
||||
<view class="card-address" v-if="showData.company_address">
|
||||
<image class="icon" src="/static/card/location_w.png" mode="aspectFit" v-if="showData.font_color == '#FFFFFF'"></image>
|
||||
<image class="icon" src="/static/card/location.png" mode="aspectFit" v-else></image>
|
||||
<text class="text" :style="{color: showData.font_color}">{{showData.company_address}}</text>
|
||||
</view>
|
||||
<view class="card-association">
|
||||
<image class="logo" :src="showData.association.logo" mode="aspectFill"></image>
|
||||
<text class="text" :style="{color: showData.font_color}">{{showData.association.name}}</text>
|
||||
<text class="text" :style="{color: showData.font_color}">{{showData.member_level_name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "componentCardItem",
|
||||
props: ["showData"],
|
||||
methods: {
|
||||
// 字符串转数组
|
||||
stringToArray(value) {
|
||||
try {
|
||||
if (value) return value.split(',');
|
||||
else return []
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.component-card-item {
|
||||
position: relative;
|
||||
height: 400rpx;
|
||||
|
||||
.card-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.card-avatar {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
border-radius: 16rpx;
|
||||
position: absolute;
|
||||
top: 32rpx;
|
||||
right: 32rpx;
|
||||
}
|
||||
|
||||
.card-name {
|
||||
position: absolute;
|
||||
top: 32rpx;
|
||||
left: 32rpx;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.name {
|
||||
color: #FFF;
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
line-height: 56rpx;
|
||||
}
|
||||
|
||||
.position {
|
||||
margin-left: 18rpx;
|
||||
padding-bottom: 4rpx;
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-company {
|
||||
position: absolute;
|
||||
top: 100rpx;
|
||||
left: 32rpx;
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.card-business {
|
||||
position: absolute;
|
||||
top: 158rpx;
|
||||
left: 32rpx;
|
||||
display: flex;
|
||||
|
||||
.label {
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
margin-left: 16rpx;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-mobile {
|
||||
position: absolute;
|
||||
top: 216rpx;
|
||||
left: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 16rpx;
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-address {
|
||||
position: absolute;
|
||||
top: 262rpx;
|
||||
left: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 16rpx;
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-association {
|
||||
position: absolute;
|
||||
bottom: 12rpx;
|
||||
left: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.logo {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 16rpx;
|
||||
color: #FFF;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
323
pagesCard/component/card/poster.vue
Normal file
323
pagesCard/component/card/poster.vue
Normal file
@@ -0,0 +1,323 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.maiwd.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 组件-电子名片 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="component-card-poster">
|
||||
<canvas class="poster-canvas" :style="{width: posterWidth + 'px', height: posterHeight + 'px'}" canvas-id="myCanvas" id="myCanvas"></canvas>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import { loadImage, createPoster, canvasToTempFilePath } from "@/common/poster.js";
|
||||
export default {
|
||||
name: "cardPoster",
|
||||
data() {
|
||||
return {
|
||||
// 名片数据
|
||||
showData: {},
|
||||
// 电子名片宽度
|
||||
posterWidth: 343,
|
||||
// 电子名片高度
|
||||
posterHeight: 276,
|
||||
// 图片资源是否准备完成
|
||||
posterReady: false,
|
||||
// 电子名片背景图
|
||||
posterBackground: "",
|
||||
// 电子名片用户头像
|
||||
posterAvatar: "",
|
||||
// 电子名片商协会logo
|
||||
posterLogo: "",
|
||||
// 电话图标-白
|
||||
mobileIcon1: "/static/card/mobile_w.png",
|
||||
// 电话图标-黑
|
||||
mobileIcon2: "/static/card/mobile.png",
|
||||
// 地址图标-白
|
||||
addressIcon1: "/static/card/location_w.png",
|
||||
// 地址图标-黑
|
||||
addressIcon2: "/static/card/location.png",
|
||||
// 回调方法
|
||||
posterCallback: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
appletName: state => state.app.appletName,
|
||||
appletLogo: state => state.app.appletLogo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取电子名片路径
|
||||
getPosterPath(data, fn) {
|
||||
this.showData = data
|
||||
this.posterCallback = fn
|
||||
this.showNucleus()
|
||||
},
|
||||
// 获取图片资源
|
||||
async showNucleus() {
|
||||
this.loadingResources().then((state) => {
|
||||
if (state) {
|
||||
this.posterReady = true
|
||||
this.createImage()
|
||||
}
|
||||
});
|
||||
},
|
||||
// 加载图片资源
|
||||
async loadingResources() {
|
||||
if (this.showData.card_background_image) this.posterBackground = await loadImage(this.showData.card_background_image);
|
||||
if (this.showData.avatar) this.posterAvatar = await loadImage(this.showData.avatar);
|
||||
if (this.appletLogo) this.posterLogo = await loadImage(this.appletLogo);
|
||||
return true;
|
||||
},
|
||||
// 生成电子名片
|
||||
async createImage() {
|
||||
if (!this.posterReady) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '电子名片部分图片资源加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
};
|
||||
// 获取上下文对象
|
||||
const ctx = uni.createCanvasContext("myCanvas", this);
|
||||
// 获取姓名占用长度
|
||||
ctx.font = "bold 20px sans-serif"
|
||||
let nameWidth = parseFloat(ctx.measureText(this.showData.name).width);
|
||||
// 设置按钮背景色
|
||||
const x1 = 51.5;
|
||||
const y1 = 216;
|
||||
const width1 = 240;
|
||||
const height1 = 48;
|
||||
const radius1 = 24;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x1 + radius1, y1);
|
||||
ctx.lineTo(x1 + width1 - radius1, y1);
|
||||
ctx.arc(x1 + width1 - radius1, y1 + radius1, radius1, -Math.PI / 2, 0);
|
||||
ctx.lineTo(x1 + width1, y1 + height1 - radius1);
|
||||
ctx.arc(x1 + width1 - radius1, y1 + height1 - radius1, radius1, 0, Math.PI / 2);
|
||||
ctx.lineTo(x1 + radius1, y1 + height1);
|
||||
ctx.arc(x1 + radius1, y1 + height1 - radius1, radius1, Math.PI / 2, Math.PI);
|
||||
ctx.lineTo(x1, y1 + radius1);
|
||||
ctx.arc(x1 + radius1, y1 + radius1, radius1, Math.PI, -Math.PI / 2);
|
||||
ctx.closePath();
|
||||
ctx.setFillStyle(this.themeColor)
|
||||
ctx.fill();
|
||||
ctx.setStrokeStyle(this.themeColor)
|
||||
ctx.stroke();
|
||||
// 创建电子名片
|
||||
let posterData = [{
|
||||
type: "image",
|
||||
url: this.posterBackground || "",
|
||||
config: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: this.posterWidth,
|
||||
h: 200,
|
||||
r: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "text",
|
||||
text: "查看名片",
|
||||
config: {
|
||||
x: parseInt(this.posterWidth / 2),
|
||||
y: 240,
|
||||
color: "#FFF",
|
||||
fontSize: "16",
|
||||
textAlign: "center",
|
||||
},
|
||||
},
|
||||
]
|
||||
if (this.showData.avatar && this.showData.is_hide_avatar != 1) {
|
||||
posterData.push({
|
||||
type: "image",
|
||||
url: this.posterAvatar || "",
|
||||
config: {
|
||||
x: 271,
|
||||
y: 16,
|
||||
w: 56,
|
||||
h: 56,
|
||||
r: 8,
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.showData.name) {
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: this.showData.name || "",
|
||||
config: {
|
||||
x: 16,
|
||||
y: 30,
|
||||
color: this.showData.font_color,
|
||||
font: `bold 20px sans-serif`,
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.showData.company_position) {
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: this.showData.company_position || "",
|
||||
config: {
|
||||
x: parseInt(nameWidth + 24),
|
||||
y: 33,
|
||||
color: this.showData.font_color,
|
||||
fontSize: "12",
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.showData.company_name) {
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: this.showData.company_name || "",
|
||||
config: {
|
||||
x: 16,
|
||||
y: 58,
|
||||
color: this.showData.font_color,
|
||||
fontSize: "12",
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.showData.main_business) {
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: this.getMainBusiness(this.showData.main_business) || "",
|
||||
config: {
|
||||
x: 16,
|
||||
y: 88,
|
||||
color: this.showData.font_color,
|
||||
fontSize: "12",
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.showData.mobile) {
|
||||
posterData.push({
|
||||
type: "image",
|
||||
url: this.showData.font_color == "#FFFFFF" ? this.mobileIcon1 : this.mobileIcon2,
|
||||
config: {
|
||||
x: 16,
|
||||
y: 110,
|
||||
w: 12,
|
||||
h: 12,
|
||||
},
|
||||
})
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: this.showData.mobile || "",
|
||||
config: {
|
||||
x: 36,
|
||||
y: 117,
|
||||
color: this.showData.font_color,
|
||||
fontSize: "12",
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.showData.company_address) {
|
||||
posterData.push({
|
||||
type: "image",
|
||||
url: this.showData.font_color == "#FFFFFF" ? this.addressIcon1 : this.addressIcon2,
|
||||
config: {
|
||||
x: 16,
|
||||
y: 132,
|
||||
w: 12,
|
||||
h: 12,
|
||||
},
|
||||
})
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: this.showData.company_address || "",
|
||||
config: {
|
||||
x: 36,
|
||||
y: 140,
|
||||
color: this.showData.font_color,
|
||||
fontSize: "12",
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.posterLogo) {
|
||||
posterData.push({
|
||||
type: "image",
|
||||
url: this.posterLogo || "",
|
||||
config: {
|
||||
x: 16,
|
||||
y: 174,
|
||||
w: 20,
|
||||
h: 20,
|
||||
r: 10,
|
||||
},
|
||||
})
|
||||
}
|
||||
if (this.appletName) {
|
||||
var showText = this.appletName
|
||||
if (this.userInfo && this.userInfo.member_level_name) showText += ` ${this.userInfo.member_level_name}`
|
||||
posterData.push({
|
||||
type: "text",
|
||||
text: showText || "",
|
||||
config: {
|
||||
x: 44,
|
||||
y: 185,
|
||||
color: this.showData.font_color,
|
||||
fontSize: "12",
|
||||
textAlign: "left",
|
||||
},
|
||||
})
|
||||
}
|
||||
await createPoster(ctx, posterData)
|
||||
const imagePath = await canvasToTempFilePath("myCanvas", this);
|
||||
this.$util.uploadFile(imagePath).then(result => {
|
||||
if (result.code == 1) {
|
||||
this.posterCallback(result.data.url)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result?.msg || "上传失败",
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('上传图片 ', error)
|
||||
})
|
||||
},
|
||||
// 获取主营业务
|
||||
getMainBusiness(value) {
|
||||
try {
|
||||
if (value) return value.replaceAll(",", " ")
|
||||
else return ""
|
||||
} catch (error) {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.component-card-poster {
|
||||
position: relative;
|
||||
z-index: 999;
|
||||
|
||||
.poster-canvas {
|
||||
position: fixed;
|
||||
top: 100vw;
|
||||
left: 100vh;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
166
pagesCard/component/picker/select.vue
Normal file
166
pagesCard/component/picker/select.vue
Normal file
@@ -0,0 +1,166 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 组件-单项选择框 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="component-picker-select" @click.stop>
|
||||
<uni-popup ref="popupModal" type="bottom" :safe-area="false" @change="onChange">
|
||||
<view class="modal-box" :style="{'--theme-color': themeColor}">
|
||||
<view class="modal-head">
|
||||
<view class="head-title text-ellipsis">{{title}}</view>
|
||||
<view class="head-btn" @click="handleConfirm">确认</view>
|
||||
</view>
|
||||
<view class="modal-content flex align-items-center" v-if="loadEnd">
|
||||
<picker-view class="content-picker" indicator-style="height: 50px;" :immediate-change="true" :value="selectValue" @change="handleChange">
|
||||
<picker-view-column>
|
||||
<view class="picker-column" v-for="(item, index) in selectList" :key="index">{{item.name || item}}</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
<view class="modal-btn" @click="onClose">取消</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
export default {
|
||||
name: "selectPicker",
|
||||
props: ["title"],
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 参数
|
||||
parameter: null,
|
||||
// 数据列表
|
||||
selectList: [],
|
||||
// 已选数据
|
||||
selectValue: [0],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 打开模态框
|
||||
open(list, value, parameter) {
|
||||
this.selectList = list
|
||||
this.parameter = parameter
|
||||
if (value) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (typeof(list[i]) == "object") {
|
||||
if (list[i].value == value) {
|
||||
this.selectValue = [i]
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (list[i] == value) {
|
||||
this.selectValue = [i]
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.selectValue = [0]
|
||||
}
|
||||
this.selectValue = [...this.selectValue]
|
||||
this.loadEnd = true
|
||||
this.$refs.popupModal.open()
|
||||
},
|
||||
// 关闭弹窗
|
||||
onClose() {
|
||||
this.loadEnd = false
|
||||
this.$refs.popupModal.close()
|
||||
},
|
||||
// 改变事件
|
||||
onChange(e) {
|
||||
this.$emit("onChange", e.show)
|
||||
},
|
||||
// 改变值
|
||||
handleChange(e) {
|
||||
this.selectValue = [...e.target.value]
|
||||
},
|
||||
// 确认
|
||||
handleConfirm() {
|
||||
this.$emit("confirm", this.selectList[this.selectValue[0]], this.parameter)
|
||||
this.onClose()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.component-picker-select {
|
||||
position: relative;
|
||||
z-index: 999;
|
||||
|
||||
.modal-box {
|
||||
background: #FFFFFF;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
width: 100vw;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
.modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 32rpx;
|
||||
|
||||
.head-title {
|
||||
flex: 1;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
padding-left: 128rpx;
|
||||
padding: 0 32rpx 0 160rpx;
|
||||
}
|
||||
|
||||
.head-btn {
|
||||
color: #FFF;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
padding: 12rpx 36rpx;
|
||||
border-radius: 10rpx;
|
||||
background: var(--theme-color);
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
padding-bottom: 32rpx;
|
||||
|
||||
.content-picker {
|
||||
height: 400rpx;
|
||||
flex: 1;
|
||||
|
||||
.picker-column {
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-btn {
|
||||
color: #E10602;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
162
pagesCard/mine/custom.vue
Normal file
162
pagesCard/mine/custom.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 自定义背景图 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container" :style="{'--theme-color': themeColor}">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar :showBack="true" title="自定义背景"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main">
|
||||
<view class="main-upload" @click="chooseImage()">
|
||||
<image class="upload-icon" src="/static/card/image.png" mode="aspectFit"></image>
|
||||
<view class="upload-text">点击上传背景</view>
|
||||
<view class="upload-text">(建议上传尺寸686*400,上传格式JPG/JPEG/PNG)</view>
|
||||
</view>
|
||||
<view class="main-tips">
|
||||
<view class="tips-title">温馨提示</view>
|
||||
<view class="tips-content">自定义图片只能上传一张,后续可点击进行重新上传</view>
|
||||
<view class="tips-bg"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
export default {
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 选择图片
|
||||
chooseImage() {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
sizeType: ['compressed'],
|
||||
success: (res) => {
|
||||
const imagePath = res.tempFiles[0].tempFilePath
|
||||
this.uploadImage(imagePath)
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['album', 'camera'],
|
||||
sizeType: ['compressed'],
|
||||
success: (res) => {
|
||||
const imagePath = res.tempFilePaths[0]
|
||||
this.uploadImage(imagePath)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
// 上传图片
|
||||
uploadImage(image) {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: "上传中"
|
||||
})
|
||||
this.$util.uploadFile(image).then(result => {
|
||||
if (result.code == 1) {
|
||||
uni.hideLoading()
|
||||
let pages = getCurrentPages()
|
||||
let prevPage = pages[pages.length - 2]
|
||||
prevPage.$vm.selectBackground = result.data
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result?.msg || "上传失败",
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('上传图片 ', error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-upload {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
border-radius: 16rpx;
|
||||
border: 1px dashed #8D929C;
|
||||
padding: 92rpx 32rpx;
|
||||
|
||||
.upload-icon {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
}
|
||||
|
||||
.upload-text {
|
||||
margin-top: 16rpx;
|
||||
color: #8D929C;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.main-tips {
|
||||
margin-top: 32rpx;
|
||||
padding: 32rpx;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.tips-title {
|
||||
color: var(--theme-color);
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.tips-content {
|
||||
margin-top: 24rpx;
|
||||
color: var(--theme-color);
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.tips-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
background: var(--theme-color);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
268
pagesCard/mine/details.vue
Normal file
268
pagesCard/mine/details.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 名片详情 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container" :style="{'--theme-color': themeColor}">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar :showBack="true" title="名片详情"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-card">
|
||||
<card-item :show-data="cardDetails"></card-item>
|
||||
</view>
|
||||
<view class="main-record" v-if="cardDetails.visitor_count > 0">
|
||||
<view class="record-title">
|
||||
<view class="title">访客记录</view>
|
||||
<view class="label">已有{{cardDetails.visitor_count}}人访问</view>
|
||||
</view>
|
||||
<view class="record-list">
|
||||
<view class="list-item" v-for="(item, index) in cardDetails.visitor_list" :key="index">
|
||||
<image class="item-avatar" :src="item.avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="list-item" v-if="cardDetails.visitor_count > 23">
|
||||
<view class="item-more">
|
||||
<view class="point"></view>
|
||||
<view class="point"></view>
|
||||
<view class="point"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-introduce">
|
||||
<view class="introduce-title">公司介绍</view>
|
||||
<view class="introduce-content">
|
||||
<mp-html :content="cardDetails.company_introduction || '暂未完善'"></mp-html>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import cardItem from "../component/card/item.vue"
|
||||
// #ifdef H5
|
||||
import wx from 'weixin-js-sdk';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
cardItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 名片id
|
||||
cardId: null,
|
||||
// 名片信息
|
||||
cardDetails: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
onLoad(option) {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.cardId = option.id
|
||||
this.getCardDetails(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
// #ifdef H5
|
||||
this.initConfig()
|
||||
// #endif
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.cardDetails.share_title,
|
||||
path: "/pagesCard/card/details?id=" + this.cardDetails.id,
|
||||
imageUrl: this.cardDetails.image,
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.cardDetails.share_title,
|
||||
path: "/pagesCard/card/details?id=" + this.cardDetails.id,
|
||||
imageUrl: this.cardDetails.image,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// #ifdef H5
|
||||
// 微信公众号初始化方法
|
||||
initConfig() {
|
||||
this.$util.request("main.WeChatConfig", {
|
||||
url: location.href.split('#')[0]
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: res.data.appId,
|
||||
timestamp: Number(res.data.timestamp),
|
||||
nonceStr: res.data.nonceStr,
|
||||
signature: res.data.signature,
|
||||
jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
openTagList: ["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
})
|
||||
wx.ready(() => {
|
||||
wx.updateAppMessageShareData({
|
||||
title: this.shareTitle,
|
||||
desc: "",
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
wx.updateTimelineShareData({
|
||||
title: this.shareTitle,
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('通过config接口注入权限验证配置 ', error)
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
// 获取名片详情
|
||||
getCardDetails(fn) {
|
||||
this.$util.request("card.details", {
|
||||
id: this.cardId
|
||||
}).then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.cardDetails = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取名片详情 ', error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx;
|
||||
|
||||
.main-record {
|
||||
padding: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #ffffff;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.record-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: var(--theme-color);
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.record-list {
|
||||
padding-top: 8rpx;
|
||||
margin-left: -2rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.list-item {
|
||||
width: calc((100% / 12) - 4rpx);
|
||||
height: 0;
|
||||
padding-top: calc((100% / 12) - 4rpx);
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
margin-left: 4rpx;
|
||||
margin-top: 16rpx;
|
||||
background: #eee;
|
||||
|
||||
.item-avatar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.item-more {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: var(--theme-color);
|
||||
padding: 0 6rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
|
||||
.point {
|
||||
width: 6rpx;
|
||||
height: 6rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-introduce {
|
||||
padding: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #ffffff;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.introduce-title {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.introduce-content {
|
||||
margin-top: 24rpx;
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1088
pagesCard/mine/edit.vue
Normal file
1088
pagesCard/mine/edit.vue
Normal file
File diff suppressed because it is too large
Load Diff
112
pagesCard/mine/editor.vue
Normal file
112
pagesCard/mine/editor.vue
Normal file
@@ -0,0 +1,112 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 编辑器 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar :showBack="true" :title="cardId ? '编辑名片' : '新建名片'"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main">
|
||||
<sp-editor :toolbar-config="toolbarConfig" @init="initEditor" @upinImage="upinImage" @overMax="overMax" @exportHtml="exportHtml"></sp-editor>
|
||||
</view>
|
||||
<view class="safe-padding"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 编辑器实例
|
||||
editorIns: null,
|
||||
// 编辑器配置
|
||||
toolbarConfig: {
|
||||
excludeKeys: ['direction', 'date', 'lineHeight', 'letterSpacing', 'listCheck'],
|
||||
iconSize: '18px'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
editorContent: state => state.app.editorContent,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 超出最大内容限制
|
||||
overMax(e) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "输入内容已超过最大字数限制"
|
||||
})
|
||||
},
|
||||
// 初始化编辑器
|
||||
initEditor(editor) {
|
||||
this.editorIns = editor
|
||||
this.editorIns.setContents({
|
||||
html: this.editorContent || ""
|
||||
})
|
||||
},
|
||||
// 上传图片
|
||||
upinImage(tempFiles, editorCtx) {
|
||||
let imageList = []
|
||||
// #ifdef MP-WEIXIN
|
||||
imageList = tempFiles.map(item => item.tempFilePath)
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
imageList = tempFiles.map(item => item.path)
|
||||
// #endif
|
||||
uni.showLoading({
|
||||
title: '上传中请稍后',
|
||||
mask: true
|
||||
})
|
||||
this.$util.uploadFileMultiple(imageList, [], 2).then(result => {
|
||||
result.forEach((item) => {
|
||||
editorCtx.insertImage({
|
||||
src: item,
|
||||
width: '80%',
|
||||
success: () => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
});
|
||||
}).catch(error => {
|
||||
console.error('上传图片 ', error)
|
||||
})
|
||||
},
|
||||
// 完成编辑
|
||||
exportHtml(e) {
|
||||
let pages = getCurrentPages()
|
||||
let prevPage = pages[pages.length - 2]
|
||||
prevPage.$vm.editorContent = e
|
||||
uni.navigateBack()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.container-main {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
486
pagesCard/mine/index.vue
Normal file
486
pagesCard/mine/index.vue
Normal file
@@ -0,0 +1,486 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 我的名片 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container" :style="{'--theme-color': themeColor}">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="我的名片"></title-bar>
|
||||
<!-- 统计数据 -->
|
||||
<view class="container-statistics" :style="{top: titleBarHeight + 'px'}">
|
||||
<view class="statistics-item">
|
||||
<view class="item-name">访客数据</view>
|
||||
</view>
|
||||
<view class="statistics-line"></view>
|
||||
<view class="statistics-item">
|
||||
<view class="item-value">{{cardStatistics.total_count || 0}}</view>
|
||||
<view class="item-title">总访问人数</view>
|
||||
</view>
|
||||
<view class="statistics-line"></view>
|
||||
<view class="statistics-item">
|
||||
<view class="item-value">{{cardStatistics.today_count || 0}}</view>
|
||||
<view class="item-title">今日访问人数</view>
|
||||
</view>
|
||||
<view class="statistics-bg"></view>
|
||||
</view>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-list" v-if="cardList.length">
|
||||
<card-item :show-data="cardList" @setShareData="setShareData" @getList="resetCardList"></card-item>
|
||||
</view>
|
||||
<view class="main-empty" v-else>
|
||||
<image class="empty-image" src="/static/empty.png" mode="widthFix"></image>
|
||||
<view class="empty-text">暂无相关内容~</view>
|
||||
</view>
|
||||
<view class="main-footer">
|
||||
<view class="footer-box">
|
||||
<view class="box-create" @click="handleAdd()">
|
||||
<view class="create-icon">
|
||||
<image class="icon" src="/static/card/create.png" mode="aspectFit"></image>
|
||||
<view class="add">
|
||||
<image src="/static/card/add.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="create-text">新建</view>
|
||||
</view>
|
||||
<view class="box-manage" @click="toCardManage()">
|
||||
<view class="manage-bg"></view>
|
||||
<view class="manage-text">名片管理</view>
|
||||
</view>
|
||||
<button open-type="share" class="box-btn" @click="setShareData(defaultCard)" v-if="defaultCard && defaultCard.id">
|
||||
递交名片<text>(默认名片)</text>
|
||||
</button>
|
||||
<view class="box-btn" @click="setShareTips()" v-else>
|
||||
递交名片<text>(默认名片)</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="safe-padding"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<tab-bar></tab-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import cardItem from "../component/card/index.vue"
|
||||
// #ifdef H5
|
||||
import wx from 'weixin-js-sdk';
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
cardItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 标题栏高度
|
||||
titleBarHeight: 0,
|
||||
// 统计数据
|
||||
cardStatistics: {},
|
||||
// 名片列表
|
||||
cardList: [],
|
||||
// 默认名片
|
||||
defaultCard: {},
|
||||
// 分享数据
|
||||
shareData: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
shareImage: state => state.app.shareImage,
|
||||
shareTitle: state => state.app.shareTitle,
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
// #ifdef MP-WEIXIN
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
|
||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
||||
this.titleBarHeight = statusBarHeight + (menuButtonInfo.top - statusBarHeight) * 2 + menuButtonInfo.height
|
||||
// #endif
|
||||
},
|
||||
onLoad() {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.getCardStatistics()
|
||||
this.getDefaultCard()
|
||||
this.getCardList(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
// #ifdef H5
|
||||
this.initConfig()
|
||||
// #endif
|
||||
},
|
||||
onShow() {
|
||||
if (this.loadEnd) {
|
||||
this.getCardStatistics()
|
||||
this.getDefaultCard()
|
||||
this.getCardList()
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getCardStatistics()
|
||||
this.getDefaultCard()
|
||||
this.getCardList(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
if (res.from == "button") {
|
||||
return {
|
||||
title: this.shareData.share_title,
|
||||
path: "/pagesCard/card/details?id=" + this.shareData.id,
|
||||
imageUrl: this.shareData.image,
|
||||
}
|
||||
} else if (res.from == "menu") {
|
||||
return {
|
||||
title: this.shareTitle,
|
||||
imageUrl: this.shareImage,
|
||||
}
|
||||
}
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: this.shareTitle,
|
||||
imageUrl: this.shareImage,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// #ifdef H5
|
||||
// 微信公众号初始化方法
|
||||
initConfig() {
|
||||
this.$util.request("main.WeChatConfig", {
|
||||
url: location.href.split('#')[0]
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: res.data.appId,
|
||||
timestamp: Number(res.data.timestamp),
|
||||
nonceStr: res.data.nonceStr,
|
||||
signature: res.data.signature,
|
||||
jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
openTagList: ["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
})
|
||||
wx.ready(() => {
|
||||
wx.updateAppMessageShareData({
|
||||
title: this.shareTitle,
|
||||
desc: "",
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
wx.updateTimelineShareData({
|
||||
title: this.shareTitle,
|
||||
link: window.location.href,
|
||||
imgUrl: this.shareImage,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('通过config接口注入权限验证配置 ', error)
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
// 获取名片统计
|
||||
getCardStatistics() {
|
||||
this.$util.request("card.statistics").then(res => {
|
||||
if (res.code == 1) {
|
||||
this.cardStatistics = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取名片统计 ', error)
|
||||
})
|
||||
},
|
||||
// 获取名片列表
|
||||
getCardList(fn) {
|
||||
this.$util.request("card.list").then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.cardList = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取名片列表 ', error)
|
||||
})
|
||||
},
|
||||
// 获取默认名片
|
||||
getDefaultCard() {
|
||||
this.$util.request("card.getDefault").then(res => {
|
||||
if (res.code == 1) {
|
||||
this.defaultCard = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取默认名片 ', error)
|
||||
})
|
||||
},
|
||||
// 新建名片
|
||||
handleAdd() {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pagesCard/mine/edit"
|
||||
})
|
||||
},
|
||||
// 设置分享数据
|
||||
setShareData(data) {
|
||||
this.shareData = data
|
||||
},
|
||||
// 重新获取名片列表
|
||||
resetCardList() {
|
||||
this.getDefaultCard()
|
||||
this.getCardList()
|
||||
},
|
||||
// 设置分享提示
|
||||
setShareTips() {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请先设置默认名片后操作",
|
||||
})
|
||||
},
|
||||
// 前往卡片管理
|
||||
toCardManage() {
|
||||
this.$util.toPage({
|
||||
mode: 1,
|
||||
path: "/pagesCard/mine/manage"
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-statistics {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 99;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #FFF;
|
||||
|
||||
.statistics-item {
|
||||
width: 100%;
|
||||
padding: 30rpx 20rpx 28rpx;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.item-name {
|
||||
color: #5A5B6E;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
color: #5A5B6E;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
margin-top: 8rpx;
|
||||
color: #8D929C;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.statistics-line {
|
||||
background: var(--theme-color);
|
||||
opacity: 0.3;
|
||||
width: 1px;
|
||||
height: 72rpx;
|
||||
}
|
||||
|
||||
.statistics-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
background: var(--theme-color);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
.container-main {
|
||||
padding: 32rpx 32rpx 144rpx;
|
||||
|
||||
.main-empty {
|
||||
text-align: center;
|
||||
padding: 32rpx;
|
||||
margin-top: 25%;
|
||||
|
||||
.empty-image {
|
||||
width: 260rpx;
|
||||
height: 100%;
|
||||
display: block;
|
||||
margin: 0 auto 32rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: #888;
|
||||
font-size: 32rpx;
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.main-footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 99;
|
||||
padding: 12rpx 32rpx;
|
||||
background: #ffffff;
|
||||
border-top: 1rpx solid #F6F7FB;
|
||||
|
||||
.footer-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.box-create {
|
||||
border-radius: 16rpx;
|
||||
background: #F4F4F4;
|
||||
margin-right: 16rpx;
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.create-icon {
|
||||
position: relative;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.add {
|
||||
position: absolute;
|
||||
right: 2rpx;
|
||||
bottom: 2rpx;
|
||||
border-radius: 50%;
|
||||
background: var(--theme-color);
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
line-height: 16rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.create-text {
|
||||
color: #5A5B6E;
|
||||
text-align: center;
|
||||
font-size: 20rpx;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.box-manage {
|
||||
width: 240rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-right: 16rpx;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
.manage-text {
|
||||
color: var(--theme-color);
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.manage-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
background: var(--theme-color);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
.box-btn {
|
||||
flex: 1;
|
||||
color: #ffffff;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background: var(--theme-color);
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
border: none;
|
||||
|
||||
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.safe-padding {
|
||||
width: 100%;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
251
pagesCard/mine/manage.vue
Normal file
251
pagesCard/mine/manage.vue
Normal file
@@ -0,0 +1,251 @@
|
||||
<!-- +----------------------------------------------------------------------
|
||||
| 麦沃德科技赋能开发者,助力商协会发展
|
||||
+----------------------------------------------------------------------
|
||||
| Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
+----------------------------------------------------------------------
|
||||
| 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
+----------------------------------------------------------------------
|
||||
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
+----------------------------------------------------------------------
|
||||
| 名片管理 开发者: 麦沃德科技-半夏
|
||||
+---------------------------------------------------------------------- -->
|
||||
|
||||
<template>
|
||||
<view class="container" :style="{'--theme-color': themeColor}">
|
||||
<!-- 标题栏 -->
|
||||
<title-bar title="名片管理"></title-bar>
|
||||
<!-- 内容区 -->
|
||||
<view class="container-main" v-if="loadEnd">
|
||||
<view class="main-list" v-if="cardList.length">
|
||||
<view class="list-item" v-for="item in cardList" :key="item.id" @click="changeSelectCard(item.id)">
|
||||
<view class="item-radio" :class="{select: selectCard.includes(item.id)}">
|
||||
<image class="icon" src="/static/card/tick.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="item-image">
|
||||
<image class="image" :src="item.image" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-empty" v-else>
|
||||
<image class="empty-image" src="/static/empty.png" mode="widthFix"></image>
|
||||
<view class="empty-text">暂无相关内容~</view>
|
||||
</view>
|
||||
<view class="main-footer">
|
||||
<view class="footer-btn" @click="handleDelete()">删除名片</view>
|
||||
<view class="safe-padding"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex"
|
||||
import cardItem from "../component/card/index.vue"
|
||||
export default {
|
||||
components: {
|
||||
cardItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 加载完成
|
||||
loadEnd: false,
|
||||
// 名片列表
|
||||
cardList: [],
|
||||
// 已选名片
|
||||
selectCard: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
themeColor: state => state.app.themeColor,
|
||||
})
|
||||
},
|
||||
onLoad() {
|
||||
uni.showLoading({
|
||||
title: "加载中"
|
||||
})
|
||||
this.getCardList(() => {
|
||||
uni.hideLoading()
|
||||
this.loadEnd = true
|
||||
})
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getCardList(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 获取名片列表
|
||||
getCardList(fn) {
|
||||
this.$util.request("card.list").then(res => {
|
||||
if (fn) fn()
|
||||
if (res.code == 1) {
|
||||
this.cardList = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
if (fn) fn()
|
||||
console.error('获取名片列表 ', error)
|
||||
})
|
||||
},
|
||||
// 改变已选名片
|
||||
changeSelectCard(id) {
|
||||
if (this.selectCard.includes(id)) {
|
||||
const index = this.selectCard.findIndex(item => item == id)
|
||||
this.$delete(this.selectCard, index)
|
||||
} else {
|
||||
this.selectCard.push(id)
|
||||
}
|
||||
},
|
||||
// 删除名片
|
||||
handleDelete() {
|
||||
if (!this.selectCard.length) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择要删除的名片"
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确认删除所选名片?删除后无法恢复",
|
||||
confirmText: "确认删除",
|
||||
cancelText: "我再想想",
|
||||
confirmColor: "#FF626E",
|
||||
cancelColor: "#999999",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
mask: true,
|
||||
title: "加载中"
|
||||
})
|
||||
this.$util.request("card.delete", { ids: this.selectCard.join() }).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 1) {
|
||||
uni.showToast({
|
||||
icon: "success",
|
||||
title: "删除成功",
|
||||
duration: 2000
|
||||
})
|
||||
this.getCardList()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
uni.hideLoading()
|
||||
console.error('删除名片 ', error)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
.container-main {
|
||||
padding: 32rpx 32rpx 144rpx;
|
||||
|
||||
.main-list {
|
||||
.list-item {
|
||||
margin-top: 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.item-radio {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: #D6DBDE;
|
||||
border-radius: 50%;
|
||||
|
||||
.icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.select {
|
||||
background: var(--theme-color);
|
||||
|
||||
.icon {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-image {
|
||||
width: 624rpx;
|
||||
height: 364rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.main-empty {
|
||||
text-align: center;
|
||||
padding: 32rpx;
|
||||
margin-top: 25%;
|
||||
|
||||
.empty-image {
|
||||
width: 260rpx;
|
||||
height: 100%;
|
||||
display: block;
|
||||
margin: 0 auto 32rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: #888;
|
||||
font-size: 32rpx;
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.main-footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 99;
|
||||
padding: 12rpx 32rpx;
|
||||
background: #ffffff;
|
||||
|
||||
.footer-btn {
|
||||
color: #ffffff;
|
||||
font-size: 32rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #FF5360;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.safe-padding {
|
||||
width: 100%;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user