dengjie ;拨打电话功能

This commit is contained in:
邓洁
2023-02-04 20:01:53 +08:00
parent 08ebc6574d
commit 4b40658fb5
6 changed files with 59 additions and 23 deletions

View File

@@ -10,14 +10,14 @@
</u--image> </u--image>
</view> </view>
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<text @click="changeAvatar()">{{nickname}}</text> <text @click="changeAvatar()" style="color: #fff;font-size: 26rpx;">{{nickname}}</text>
<u--image v-if="showEdit==true" src="/static/my/wd_icon_bj.png" width="22rpx" height="22rpx" <u--image v-if="showEdit==true" src="/static/my/wd_icon_bj.png" width="22rpx" height="22rpx"
@click="changeAvatar()"> @click="changeAvatar()">
</u--image> </u--image>
</view> </view>
<view style="margin:0 20rpx;"> <view style="margin:0 20rpx;">
<u-overlay :show="!isLoad"> <u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login> <login :timoutText="timoutText" @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay> </u-overlay>
</view> </view>
</view> </view>
@@ -44,7 +44,8 @@
nickname: '用户', nickname: '用户',
normal: '/static/my/wo_icon_pthy.png', normal: '/static/my/wo_icon_pthy.png',
VIP: '/static/my/wo_icon_vip.png', VIP: '/static/my/wo_icon_vip.png',
isLoad: true isLoad: true,
timoutText: 1
}; };
}, },
created() { created() {
@@ -66,14 +67,10 @@
//获取头像昵称和普通会员和VIP会员 //获取头像昵称和普通会员和VIP会员
getUser() { getUser() {
this.$apiServe.getUser().then(res => { this.$apiServe.getUser().then(res => {
console.log('个人信息==', res.data); // console.log('个人信息==', res.data);
// if (res.data.msg === "登录超时,请重新登录") { if (res.data.msg === "登录超时,请重新登录") {
// this.$toast.warn('登录超时,请重新登录') this.isLoad = false
// this.isLoad = false }
// // uni.navigateTo({
// // url: '/pages/my/login/login'
// // })
// }
var data = res.data.data var data = res.data.data
this.avatar = uni.getStorageSync('img_url') + data.avatar this.avatar = uni.getStorageSync('img_url') + data.avatar
this.nickname = data.nickname this.nickname = data.nickname
@@ -89,7 +86,7 @@
return return
} }
this.isLoad = true this.isLoad = true
this.$refs.myavatar.getUser() this.getUser()
}, },
failToLoad() { failToLoad() {
uni.navigateBack({ uni.navigateBack({

View File

@@ -28,7 +28,7 @@
<u-modal :show="showCall" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否" <u-modal :show="showCall" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
@confirm="confirmCall" @cancel="cancelCall"> @confirm="confirmCall" @cancel="cancelCall">
<view> <view>
<view>{{phone}}</view> <view style="text-indent: 25rpx;">{{mobile}}</view>
<text>是否拨打客服电话</text> <text>是否拨打客服电话</text>
</view> </view>
</u-modal> </u-modal>
@@ -53,12 +53,13 @@
imgUrl: '', imgUrl: '',
isLoad: true, isLoad: true,
showCall: false, showCall: false,
phone: '138 1222 222', mobile: '',
} }
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getCertifiedCjDetail() this.getCertifiedCjDetail()
this.getCsTel()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false this.isLoad = false
@@ -67,6 +68,12 @@
this.isLoad = true this.isLoad = true
}, },
methods: { methods: {
//获取客服电话
getCsTel() {
this.$apiServe.getCsTel().then(res => {
this.mobile = res.data.data.cs_tel
}).finally(_ => {})
},
//获取认证厂家详情 //获取认证厂家详情
getCertifiedCjDetail() { getCertifiedCjDetail() {
this.$apiServe.getCertifiedCjDetail(this.id).then(res => { this.$apiServe.getCertifiedCjDetail(this.id).then(res => {
@@ -100,7 +107,8 @@
}, },
confirmCall() { confirmCall() {
this.showCall = false this.showCall = false
let phone = '1381222222' let phone = this.mobile
phone = phone.toString()
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: phone, phoneNumber: phone,
success: function() { success: function() {
@@ -119,6 +127,11 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.u-modal__content {
padding: 43rpx 104rpx !important;
text-indent: 25rpx;
}
.feature { .feature {
padding: 20rpx 16rpx; padding: 20rpx 16rpx;
background-color: #fff; background-color: #fff;

View File

@@ -79,7 +79,7 @@
<u-modal :show="showCall" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否" <u-modal :show="showCall" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
@confirm="confirmCall" @cancel="cancelCall"> @confirm="confirmCall" @cancel="cancelCall">
<view> <view>
<view>{{phone}}</view> <view style="text-indent: 25rpx;">{{mobile}}</view>
<text>是否拨打客服电话</text> <text>是否拨打客服电话</text>
</view> </view>
</u-modal> </u-modal>
@@ -114,13 +114,14 @@
isLoad: true, isLoad: true,
showM: false, showM: false,
showCall: false, showCall: false,
phone: '138 1222 222', mobile: '',
content: '您暂无权限访问请升级VIP访问' content: '您暂无权限访问请升级VIP访问'
} }
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getProductDetail() this.getProductDetail()
this.getCsTel()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false this.isLoad = false
@@ -129,6 +130,12 @@
this.isLoad = true this.isLoad = true
}, },
methods: { methods: {
//获取客服电话
getCsTel() {
this.$apiServe.getCsTel().then(res => {
this.mobile = res.data.data.cs_tel
}).finally(_ => {})
},
//获取详情信息 //获取详情信息
getProductDetail() { getProductDetail() {
this.$apiServe.getProductDetail(this.id).then(res => { this.$apiServe.getProductDetail(this.id).then(res => {
@@ -229,7 +236,8 @@
}, },
confirmCall() { confirmCall() {
this.showCall = false this.showCall = false
let phone = '1381222222' let phone = this.mobile
phone = phone.toString()
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: phone, phoneNumber: phone,
success: function() { success: function() {
@@ -248,6 +256,11 @@
</script> </script>
<style lang="scss"> <style lang="scss">
// .u-modal__content {
// padding: 43rpx 104rpx !important;
// text-indent: 25rpx;
// }
.collect { .collect {
display: flex; display: flex;
position: absolute; position: absolute;

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class="login-content"> <view class="login-content">
<view style="text-align: center;margin-bottom:30rpx;"> <view style="text-align: center;margin-bottom:30rpx;">
<text>请登录后查看</text> <text>{{loginText}}</text>
</view> </view>
<view style="padding-left: 30rpx;padding-right: 30rpx;display: flex;"> <view style="padding-left: 30rpx;padding-right: 30rpx;display: flex;">
<u-button type="info" :plain="true" size="nomal" @click="$emit('fail')">取消</u-button> <u-button type="info" :plain="true" size="nomal" @click="$emit('fail')">取消</u-button>
@@ -18,7 +18,20 @@
} from '@/service/request.js' } from '@/service/request.js'
export default { export default {
data() { data() {
return {} return {
loginText: '请登录后查看'
}
},
props: {
timoutText: {
type: String,
default: ''
}
},
created() {
if (this.timoutText == 1) {
this.loginText = "登录超时,请重新登录"
}
}, },
methods: { methods: {
getphonenumber(e) { getphonenumber(e) {

View File

@@ -111,7 +111,8 @@
}, },
confirm() { confirm() {
this.showM = false this.showM = false
let phone = '' let phone = this.mobile
phone = phone.toString()
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: phone, phoneNumber: phone,
success: function() { success: function() {

View File

@@ -22,10 +22,9 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text { text {
font-size: 26rpx;
font-family: PingFangSC-Medium, PingFang SC; font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #FFFFFF;
line-height: 37rpx; line-height: 37rpx;
} }
} }