完成了小程序联系上级的功能(点击手机号跳转拨号页面)
This commit is contained in:
@ -1,66 +1,55 @@
|
|||||||
// pages/personCenter/contactSuper/contactSuper.js
|
const { baseUrl } = require("../../../request");
|
||||||
Page({
|
|
||||||
|
|
||||||
|
Page({
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
nickName: '', // 后端返回的昵称
|
||||||
|
phoneNumber: '' // 后端返回的手机号
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.fetchSupervisorInfo();
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
/**
|
* 请求后端接口,获取上级联系人信息
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
|
||||||
*/
|
*/
|
||||||
onReady() {
|
fetchSupervisorInfo() {
|
||||||
|
const token = wx.getStorageSync('token');
|
||||||
|
wx.request({
|
||||||
|
url: baseUrl + '/userInfo/getSuper',
|
||||||
|
method: 'POST',
|
||||||
|
header: {
|
||||||
|
Authorization: token
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
const { nickName, phoneNumber } = res.data.data;
|
||||||
|
this.setData({ nickName, phoneNumber });
|
||||||
|
} else {
|
||||||
|
wx.showToast({
|
||||||
|
title: res.data.message || '获取信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('fetchSupervisorInfo error:', err);
|
||||||
|
wx.showToast({
|
||||||
|
title: '请求失败,请稍后重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
gotoCall() {
|
||||||
* 生命周期函数--监听页面显示
|
wx.makePhoneCall({
|
||||||
*/
|
phoneNumber: this.data.phoneNumber
|
||||||
onShow() {
|
})
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面隐藏
|
|
||||||
*/
|
|
||||||
onHide() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面卸载
|
|
||||||
*/
|
|
||||||
onUnload() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
|
||||||
*/
|
|
||||||
onPullDownRefresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户点击右上角分享
|
|
||||||
*/
|
|
||||||
onShareAppMessage() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -1,9 +1,11 @@
|
|||||||
<view class="flex-col justify-start page">
|
<view class="flex-col justify-start page">
|
||||||
<view class="flex-row justify-between section">
|
<view class="flex-row justify-between section">
|
||||||
<view class="flex-col self-center">
|
<view class="flex-col self-center">
|
||||||
<text class="self-start text">CHENXINZHI</text>
|
<!-- 绑定昵称 -->
|
||||||
<view class="flex-row items-center self-stretch mt-53">
|
<text class="self-start text">{{nickName}}</text>
|
||||||
<text class="text_2">联系电话 15123967648</text>
|
<view class="flex-row items-center self-stretch mt-53" bind:tap="gotoCall">
|
||||||
|
<!-- 绑定手机号 -->
|
||||||
|
<text class="text_2">联系电话 {{phoneNumber}}</text>
|
||||||
<image
|
<image
|
||||||
class="shrink-0 image_2 ml-6"
|
class="shrink-0 image_2 ml-6"
|
||||||
src="./images/sjh.png"
|
src="./images/sjh.png"
|
||||||
@ -15,4 +17,4 @@
|
|||||||
src="./images/logo.png"
|
src="./images/logo.png"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -177,39 +177,10 @@ Page({
|
|||||||
onShow() {
|
onShow() {
|
||||||
this.getUserMainInfo()
|
this.getUserMainInfo()
|
||||||
},
|
},
|
||||||
|
gotoCall() {
|
||||||
/**
|
wx.makePhoneCall({
|
||||||
* 生命周期函数--监听页面隐藏
|
phoneNumber: this.data.phoneNumber
|
||||||
*/
|
})
|
||||||
onHide() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面卸载
|
|
||||||
*/
|
|
||||||
onUnload() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
|
||||||
*/
|
|
||||||
onPullDownRefresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户点击右上角分享
|
|
||||||
*/
|
|
||||||
onShareAppMessage() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
@ -3,7 +3,7 @@
|
|||||||
<view class="flex-row justify-between items-center group">
|
<view class="flex-row justify-between items-center group">
|
||||||
<view class="flex-col">
|
<view class="flex-col">
|
||||||
<text class="self-start font text">{{ nickName }}</text>
|
<text class="self-start font text">{{ nickName }}</text>
|
||||||
<view class="flex-row items-center self-stretch group_2 mt-9">
|
<view class="flex-row items-center self-stretch group_2 mt-9" bind:tap="gotoCall">
|
||||||
<image
|
<image
|
||||||
class="image_3"
|
class="image_3"
|
||||||
src="./images/dianhua.png"
|
src="./images/dianhua.png"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export const local='http://localhost:9091';
|
export const local='http://localhost:9091';
|
||||||
export const ip = 'http://27.30.77.229:9091';
|
export const ip = 'http://27.30.77.229:9091';
|
||||||
export const test = 'http://27.30.77.229:9092';
|
export const test = 'http://27.30.77.229:9092';
|
||||||
export const baseUrl = test;
|
export const localTest = 'http://localhost:9092';
|
||||||
|
export const baseUrl = localTest;
|
||||||
|
|
||||||
export const globalImgUrl = baseUrl + '/file/download/'
|
export const globalImgUrl = baseUrl + '/file/download/'
|
Reference in New Issue
Block a user