12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- Page({
- data: {
- contacts: [],
- form1: [],
- form2: [],
- show: false,
- actions: [{
- name: "呼叫"
- }, {
- name: "复制"
- }]
- },
- onLoad(options) {
- this.handleData(JSON.parse(options.item))
- },
- handleData(item) {
- const form1 = [{
- label: "性别",
- content: item.sex
- }, {
- label: "生日",
- content: item.birthday
- }, {
- label: "家庭住址",
- content: item.homeaddress
- }, {
- label: "邮箱",
- content: item.email
- }],
- form2 = [{
- label: "单位",
- content: item.company
- }, {
- label: "部门",
- content: item.depname
- }, {
- label: "职位",
- content: item.position
- }]
- this.setData({
- contacts: item,
- form1,
- form2
- })
- },
- changeShow() {
- this.setData({
- show: !this.data.show
- })
- },
- /* 处理选择 */
- handleSelect(e) {
- let phone = this.data.contacts.phonenumber;
- if (e.detail.name == '复制') {
- wx.setClipboardData({
- data: phone
- });
- } else {
- wx.makePhoneCall({
- phoneNumber: phone,
- })
- };
- this.changeShow()
- },
- /* 拷贝内容 */
- copyContents(e) {
- const {
- data
- } = e.currentTarget.dataset;
- if (data) wx.setClipboardData({
- data,
- });
- },
- /* 去编辑 */
- toEdit() {
- let data = JSON.stringify(this.data.contacts);
- wx.navigateTo({
- url: '../contacts/edit?data=' + data,
- })
- },
- onShareAppMessage() {}
- })
|