Commit 3b60d7cd by 胡悦

Merge branch 'kuangyq_v2.10.0' of http://192.168.3.233:8090/saas/mini-program/ai…

…-card into kuangyq_v2.10.0
2 parents 640286d8 39470ec2
// components/UserInfo/UserInfo.js
import {
componentsMixin
} from '../../mixins/index'
import { componentsMixin } from "../../mixins/index";
import util from "../../utils/util";
Component({
behaviors: [componentsMixin],
/**
* 组件的属性列表
*/
properties: {},
properties: {
cardInfo: {
type: Object,
observer(n) {
this.setData({
cardInfo: n,
});
},
},
},
/**
* 组件的初始数据
*/
data: {
showWechant: false
showWechant: false,
},
/**
......@@ -22,60 +30,66 @@ Component({
methods: {
// 添加微信
addWechat() {
console.log(112, this.data.showWechant)
console.log(112, this.data.showWechant);
this.setData({
showWechant: !this.data.showWechant
})
console.log(this.data.showWechant)
showWechant: !this.data.showWechant,
});
console.log(this.data.showWechant);
},
// 保存名片
addPhone() {
let _this = this,
{
clickCount
} = this.data
{ clickCount } = this.data;
const { staffName, phoneNumber, operation, address, agentName } =
this.data.cardInfo;
wx.addPhoneContact({
firstName: '石文',
mobilePhoneNumber: '13274150220',
title: '市场总监',
organization: '广联数科',
workAddressCountry: '中国',
workAddressState: '广东省',
workAddressCity: '深圳市',
workAddressStreet: '留仙大道3370号',
fail({
errMsg
}) {
if (clickCount) _this.setData({
showAuth: errMsg == 'addPhoneContact:fail auth deny'
})
else _this.setData({
clickCount: 1
})
}
})
firstName: staffName,
mobilePhoneNumber: phoneNumber,
title: operation,
organization: agentName,
workAddressCountry: "中国",
workAddressState: "广东省",
workAddressCity: "深圳市",
workAddressStreet: address,
fail({ errMsg }) {
if (clickCount)
_this.setData({
showAuth: errMsg == "addPhoneContact:fail auth deny",
});
else
_this.setData({
clickCount: 1,
});
},
});
},
/**授权通讯录成功 */
authSuccess() {
this.setData({
flag: true,
unauthorized: false
})
this.addPhone()
unauthorized: false,
});
this.addPhone();
},
/**授权失败 */
authFail() {
this.setData({
unauthorized: true,
flag: true
})
flag: true,
});
},
/** 拨打电话 */
callPhone() {
console.log(this.data.cardInfo);
const { phoneNumber } = this.data.cardInfo;
if (!phoneNumber) {
util.showToast("手机号不存在");
return;
}
wx.makePhoneCall({
phoneNumber: '18925261040',
})
}
}
})
\ No newline at end of file
phoneNumber: phoneNumber,
});
},
},
});
<view class="user-wrapper">
<view class="user-box">
<view class="user-info">
<view class="user-info" data-item="{{cardInfo}}">
<block wx:if="{{!showWechant}}">
<view class="user-company">
<image class="company-logo" src="{{IMGURL}}home/logo.png"></image>
<text>汽车流通行业数字化运营服务商</text>
</view>
<view class="user-name">
<view class="name">石文</view>
<view class="position">市场总监</view>
<view class="name">{{cardInfo.staffName}}</view>
<view class="position">{{cardInfo.operation}}</view>
</view>
<view class="user-phone">
<image class="user-icon" webp src="{{IMGURL}}home/icon-phone.png"></image>
<view>13274150220</view>
<view>{{cardInfo.agentPhone}}</view>
</view>
<view class="user-address">
<image class="user-icon" webp src="{{IMGURL}}home/icon-address.png"></image>
<view class="address">深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层</view>
</view>
<image class="user-avatar" src="https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg"></image>
<image class="user-avatar" src="{{cardInfo.image}}" lazy-load></image>
<image bindtap="addWechat" class="add-wechat" webp src="{{IMGURL}}home/add-wechat.png"></image>
</block>
<view class="scrm" wx:else>
<image class="srcm-img" src="https://img.zcool.cn/community/01e47e60ab5b4011013eaf70962e3f.jpg@520w_390h_1c_1e_2o_100sh.jpg"></image>
<image class="srcm-img" webp src="{{cardInfo.wechatCode}}" lazy-load></image>
<view class="scrm-text">长按识别二维码,免费体验嘀加SCRM</view>
<image bindtap="addWechat" class="add-wechat" webp src="{{IMGURL}}home/back-user.png"></image>
</view>
......@@ -38,5 +38,4 @@
<button class="btn-primary btn" open-type="share">分享名片</button>
</view>
</view>
<authorize buttonType="openSetting" show="{{showAuth}}" isShowCheck="{{false}}">
</authorize>
\ No newline at end of file
<authorize buttonType="openSetting" show="{{showAuth}}" isShowCheck="{{false}}"></authorize>
\ No newline at end of file
......@@ -10,7 +10,7 @@ import { menuMixin } from "../../../mixins/index";
import Draw from "../../../utils/Draw";
import { ssoApi, entmicroApi } from "../../../api/api";
import util from "../../../utils/util";
import {trackData} from '../../../utils/data'
import { trackData } from "../../../utils/data";
Page({
behaviors: [menuMixin],
/**
......@@ -49,7 +49,7 @@ Page({
hasPhoneNumber: false,
curTab: [trackData.COMPANY, trackData.CUBE],
// 员工名片信息
cardInfo: []
cardInfo: {},
},
introduce(e) {
const curTabIndex = e.currentTarget.dataset.index;
......@@ -59,13 +59,13 @@ Page({
switch (curTabIndex) {
case 2:
console.log("跳转直播");
wx.$Track.sendTrack(trackData.VIDEO)
wx.$Track.sendTrack(trackData.VIDEO);
break;
default:
this.setData({
curTabIndex: curTabIndex,
});
wx.$Track.sendTrack(this.data.curTab[this.data.curTabIndex])
wx.$Track.sendTrack(this.data.curTab[this.data.curTabIndex]);
}
},
......@@ -78,44 +78,45 @@ Page({
getPhoneNumber() {
console.log(11111111);
this.setData({
hasPhoneNumber: true
})
hasPhoneNumber: true,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(this.data.hasUserInfo);
getApp().login().then(({data}) => {
console.log(data);
if (data) {
this.setData({
hasUserInfo: true
})
}
if (data.phone) {
this.setData({
hasPhoneNumber: true
})
} else {
this.getCardDetail()
}
})
getApp()
.login()
.then(({ data }) => {
console.log(data);
if (data) {
this.setData({
hasUserInfo: true,
});
}
if (data.phone) {
this.setData({
hasPhoneNumber: true,
});
} else {
this.getCardDetail();
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.setShareInfo();
console.log(wx.$util.getUserInfo())
wx.$Track.sendTrack(this.data.curTab[this.data.curTabIndex])
console.log(wx.$util.getUserInfo());
wx.$Track.sendTrack(this.data.curTab[this.data.curTabIndex]);
},
/**
......@@ -269,48 +270,46 @@ Page({
},
// 获取用户昵称
getUserProfile(e) {
console.log(e)
console.log(e);
this.setData({
hasUserInfo: true
})
hasUserInfo: true,
});
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(this.data.hasUserInfo)
ssoApi.authUserInfo({
...res
}).then(({
code
}) => {
if (code == '0') {
getApp().login().then(({
data
}) => {
this.setData({
userInfo: data,
// hasUserInfo: true
})
})
}
})
}
})
console.log(this.data.hasUserInfo);
ssoApi
.authUserInfo({
...res,
})
.then(({ code }) => {
if (code == "0") {
getApp()
.login()
.then(({ data }) => {
this.setData({
userInfo: data,
// hasUserInfo: true
});
});
}
});
},
});
},
// 获取员工名片信息
getCardDetail() {
// 获取员工名片信息
getCardDetail() {
const sessionId = util.getSessionId();
let params = {};
params.cardId = 21;
params.sessionId = sessionId;
console.log(params, "+++");
entmicroApi.getCardDetail(params).then((res) => {
console.log(res);
if (res.data) {
}
});
}
})
let params = {};
params.cardId = 21;
params.sessionId = sessionId;
console.log(params, "+++");
entmicroApi.getCardDetail(params).then((res) => {
console.log(res);
if (res.data) {
}
});
},
});
......@@ -6,7 +6,7 @@
<import src="../../template/equity/equity" />
<import src="../../template/clue/clue" /> -->
<view class="main-box">
<user-info data="{{cardInfo}}"></user-info>
<user-info cardInfo="{{cardInfo}}"></user-info>
<view class="main-bottom">
<!-- 面向渠道 -->
<template is="channel"></template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!