card.vue
8.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<template>
<view class="card_wrap">
<!-- 无名片 -->
<view class="layer_center no_card" v-if="!isHave">
<view class="no_card_pic">
<image src="../../static/no_card.png" mode=""></image>
</view>
<view class="add_card">
<view class="add_card_btn" @click="addCard()">
发布我的名片
</view>
</view>
</view>
<!-- 有名片 -->
<view class="content" v-else>
<view class="detail_top">
<!-- 公司名称 -->
<view class="company_name">{{cardDetail.company_name}}</view>
<!-- 名片正反面 -->
<view>
<image class="card_pic" :src="cardDetail.front_image" mode=""></image>
<view class="card_tips">名片正面</view>
</view>
<view>
<image class="card_pic" :src="cardDetail.reverse_image" mode=""></image>
<view class="card_tips">名片反面</view>
</view>
</view>
<!-- 公司简介 -->
<view class="company_intro">
<view class="company_title_wrap"><view class="company_title">公司简介</view></view>
<view class="company_detail">
<view class="company_detail_box">
<view class="">
{{cardDetail.brief}}
</view>
<view class="company_pic_wrap flex_wrap_no">
<view class="company_pic_single" @click="showImg(item)" v-for="(item, index) in cardDetail.brief_images" :key="index"><image :src="item" mode=""></image></view>
</view>
</view>
</view>
</view>
<!-- 经营范围 -->
<view class="company_intro">
<view class="company_title_wrap"><view class="company_title">经营范围</view></view>
<view class="company_detail">
<view class="company_detail_box">
<view class="">
{{cardDetail.scope}}
</view>
<view class="company_pic_wrap flex_wrap_no">
<view class="company_pic_single" @click="showImg(item)" v-for="(item, index) in cardDetail.scope_images" :key="index"><image :src="item" mode=""></image></view>
</view>
<!-- 刷新名片 -->
<view class="refresh_card flex_column_nojustify" @click="refreshCard()">
<image class="refresh_icon" src="../../static/refresh.png" mode=""></image>
<view class="refresh_tips">刷新名片</view>
</view>
</view>
</view>
</view>
<!-- 联系方式 -->
<view class="company_intro">
<view class="company_title_wrap"><view class="company_title">联系方式</view></view>
<!-- 地址 -->
<view class="contact_code">
<view class="layer_nobetween">
<!-- 二维码 -->
<view class="qr_code" @click="showImg(cardDetail.wechat_image)"><image :src="cardDetail.wechat_image" mode=""></image></view>
<!-- 姓名 地址 -->
<view class="contact_r flex_star_between">
<view class="">联系人:{{cardDetail.name}}</view>
<view class="" @click="callPhone()" v-if="cardDetail.phone">电话:{{cardDetail.phone}}</view>
<view class="" v-if="cardDetail.site">地址:{{cardDetail.site}}</view>
</view>
</view>
</view>
<!-- 各种联系方式 -->
<view class="contact_single layer_between" v-if="cardDetail.fax">
<view class="layer_between">
<image class="contact_icon" src="../../static/phone.png" mode=""></image>
传真
</view>
<view class="" @click="copyEmail()">{{cardDetail.fax}}</view>
</view>
<view class="contact_single layer_between" v-if="cardDetail.mobile">
<view class="layer_between">
<image class="contact_icon" src="../../static/tel.png" mode=""></image>
手机号
</view>
<view class="" @click="callTel()">{{cardDetail.mobile}}</view>
</view>
<view class="contact_single layer_between" v-if="cardDetail.qq">
<view class="layer_between">
<image class="contact_icon" src="../../static/qq.png" mode=""></image>
QQ
</view>
<view class="" @click="copyQQ()">{{cardDetail.qq}}</view>
</view>
<view class="contact_single no_bottom layer_between" v-if="cardDetail.wechat">
<view class="layer_between">
<image class="contact_icon" src="../../static/weixin.png" mode=""></image>
微信
</view>
<view class="" @click="copyWx()">{{cardDetail.wechat}}</view>
</view>
</view>
<!-- 图片放大 -->
<view class="tx_mask" v-if="isShowImg" @click="closDialog()"></view>
<view class="mask_content" v-if="isShowImg" @click="closDialog()" @longpress="saveImg()">
<image :src="img" mode="widthFix"></image>
</view>
<!-- 编辑名片 -->
<view class="layer_between editor_btn">
<view class="refresh_time">
上次刷新时间:{{cardDetail.refresh_time}}
</view>
<view class="editor_card" @click="toEditor()">编辑我的名片</view>
</view>
</view>
</view>
</template>
<script>
import App from "../../App.vue";
export default {
data() {
return {
// 是否有名片
isHave:false,
// 我的名片详情
cardDetail:"",
token:"",
// 图片放大
isShowImg:false,
img:"",
}
},
methods: {
// 图片放大
showImg(img){
console.log(111)
this.isShowImg = true
this.img = img
},
closDialog(){
this.isShowImg = false
},
saveImg(){
let t = this ;
uni.downloadFile({
url: t.img,
success: function(res) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function() {
uni.showToast({
title: '保存成功',
icon: 'none',
duration: 1500
});
t.isShowImg = false
},
fail: function(err) {
if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg ===
"saveImageToPhotosAlbum:fail:auth denied") {
uni.showToast({
title: '需要您授权保存相册',
icon:none,
duration: 1500,
success: modalSuccess => {
uni.openSetting({
success(settingdata) {
if (settingdata.authSetting['scope.writePhotosAlbum']) {
uni.showToast({
title: '获取权限成功',
icon: 'none',
duration: 1500
});
} else {
uni.showToast({
title: '获取权限失败',
icon: 'none',
duration: 1500
});
}
},
fail(failData) {
console.log("failData", failData)
},
complete(finishData) {
console.log("finishData", finishData)
}
})
}
})
}
},
});
}
});
},
// 刷新名片
refreshCard(){
let url = "/api/goods/refresh";
App.post(url)
.then(res=>{
this.getMyCard()
})
},
// 发布我的名片
addCard() {
if(this.token){
uni.navigateTo({
url:"/pages/card/addCard"
})
}else{
uni.navigateTo({
url:"/pages/start/start"
})
}
},
// 获取我的名片详情
getMyCard(){
let url = "/api/goods/my_goods";
App.post(url)
.then(res=>{
this.cardDetail = res;
if(this.cardDetail){
this.isHave = true
}
})
},
// 去编辑页
toEditor(){
uni.navigateTo({
url:"/pages/card/editorCard"
})
},
// 拨打电话
callPhone(){
uni.makePhoneCall({
phoneNumber:this.cardDetail.mobile
})
},
// 拨打手机号
callTel(){
uni.makePhoneCall({
phoneNumber:this.cardDetail.mobile
})
},
// 复制传真号
copyEmail(){
uni.setClipboardData({
data: this.cardDetail.fax,
success: function () {
uni.showToast({
title:"复制成功",
icon:'success'
})
}
});
},
// 复制qq号
copyQQ(){
uni.setClipboardData({
data: this.cardDetail.qq,
success: function () {
uni.showToast({
title:"复制成功",
icon:'success'
})
}
});
},
// 复制微信号
copyWx(){
uni.setClipboardData({
data: this.cardDetail.wechat,
success: function () {
uni.showToast({
title:"复制成功",
icon:'success'
})
}
});
},
},
onShow() {
this.token = uni.getStorageSync("token");
// 获取我的名片详情
if(this.token){
this.getMyCard();
}
},
onLoad() {
},
onShareAppMessage: function (res) {
var that = this;
// 来自页面内转发按钮
return {
title: '分享',
path: "/pages/card/card"
}
}
}
</script>
<style>
@import url("../../style/card");
@import url('../../style/cardDetail');
</style>