|
|
@ -1,60 +1,71 @@ |
|
|
|
<template> |
|
|
|
<view class="upload"> |
|
|
|
<!-- <u-icon name="plus" size="24px" class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" @click="handleUpload"> |
|
|
|
<view> |
|
|
|
<view class="upload"> |
|
|
|
<!-- <u-icon name="plus" size="24px" class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" @click="handleUpload"> |
|
|
|
</u-icon> --> |
|
|
|
<template v-if="user.phone"> |
|
|
|
<div |
|
|
|
v-if="btnList.length === 1" |
|
|
|
class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" |
|
|
|
style="line-height: 48px" |
|
|
|
@click="jumpV(btnList[0].url)" |
|
|
|
> |
|
|
|
{{ btnList[0].name }} |
|
|
|
</div> |
|
|
|
<div v-else-if="btnList.length === 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px"> |
|
|
|
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)"> |
|
|
|
{{ btnList[0].name }} |
|
|
|
</div> |
|
|
|
<div class="flex min-w-16 justify-center" @click="jumpV(btnList[1].url)">{{ btnList[1].name }}</div> |
|
|
|
</div> |
|
|
|
<div v-else-if="btnList.length > 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px"> |
|
|
|
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)"> |
|
|
|
<template v-if="user.phone"> |
|
|
|
<div |
|
|
|
v-if="btnList.length === 1" |
|
|
|
class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" |
|
|
|
style="line-height: 48px" |
|
|
|
@click="jumpV(btnList[0].url)" |
|
|
|
> |
|
|
|
{{ btnList[0].name }} |
|
|
|
</div> |
|
|
|
<div class="flex min-w-16 justify-center" @click="isActive = !isActive"> |
|
|
|
<div class="mr-1">其他</div> |
|
|
|
<u-icon |
|
|
|
name="arrow-down" |
|
|
|
color="#0284c7" |
|
|
|
size="28" |
|
|
|
type="down" |
|
|
|
:style="{ transform: `rotate(${isActive ? -180 : 0}deg)` }" |
|
|
|
@click="isActive = !isActive" |
|
|
|
style="transition: transform 0.24s; margin-right: 0px" |
|
|
|
/> |
|
|
|
<div v-else-if="btnList.length === 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px"> |
|
|
|
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)"> |
|
|
|
{{ btnList[0].name }} |
|
|
|
</div> |
|
|
|
<div class="flex min-w-16 justify-center" @click="jumpV(btnList[1].url)">{{ btnList[1].name }}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<u-button |
|
|
|
v-else |
|
|
|
open-type="getPhoneNumber" |
|
|
|
@getphonenumber="getphonenumber" |
|
|
|
:custom-style="customStyle" |
|
|
|
shape="square" |
|
|
|
size="default" |
|
|
|
type="primary" |
|
|
|
> |
|
|
|
授权 |
|
|
|
</u-button> |
|
|
|
<view :style="{ height: isActive ? '200px' : 0 }" style="transition: all 0.24s" class="role-more-box"> |
|
|
|
<template v-for="(item, index) in btnList"> |
|
|
|
<div :class="index === btnList.length - 1 ? '' : 'border-bottom'" class="jump-list-box" v-if="index !== 0" :key="item.url"> |
|
|
|
{{ item.name }} |
|
|
|
<div v-else-if="btnList.length > 2" class="flex h-12 bg-blue-100 rounded-full shadow-md items-center" style="line-height: 48px"> |
|
|
|
<div class="border-gray-300 min-w-16 border-r-2 border-solid flex justify-center h-4 items-center" @click="jumpV(btnList[0].url)"> |
|
|
|
{{ btnList[0].name }} |
|
|
|
</div> |
|
|
|
<div class="flex min-w-16 justify-center" @click="isActive = !isActive"> |
|
|
|
<div class="mr-1">其他</div> |
|
|
|
<u-icon |
|
|
|
name="arrow-down" |
|
|
|
color="#0284c7" |
|
|
|
size="28" |
|
|
|
type="down" |
|
|
|
:style="{ transform: `rotate(${isActive ? -180 : 0}deg)` }" |
|
|
|
@click="isActive = !isActive" |
|
|
|
style="transition: transform 0.24s; margin-right: 0px" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<u-button |
|
|
|
v-else |
|
|
|
open-type="getPhoneNumber" |
|
|
|
@getphonenumber="getphonenumber" |
|
|
|
:custom-style="customStyle" |
|
|
|
shape="square" |
|
|
|
size="default" |
|
|
|
type="primary" |
|
|
|
> |
|
|
|
授权 |
|
|
|
</u-button> |
|
|
|
<view :style="{ height: isActive ? '200px' : 0 }" style="transition: all 0.24s" class="role-more-box"> |
|
|
|
<template v-for="(item, index) in btnList"> |
|
|
|
<div :class="index === btnList.length - 1 ? '' : 'border-bottom'" class="jump-list-box" v-if="index !== 0" :key="item.url"> |
|
|
|
{{ item.name }} |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</view> |
|
|
|
<!-- <u-button @click="jump" size="default" type="primary"> 拍照 </u-button> --> |
|
|
|
<u-top-tips ref="uTips"></u-top-tips> |
|
|
|
</view> |
|
|
|
<!-- <u-button @click="jump" size="default" type="primary"> 拍照 </u-button> --> |
|
|
|
<u-top-tips ref="uTips"></u-top-tips> |
|
|
|
<u-modal |
|
|
|
v-model="showPhoneModal" |
|
|
|
:content="content" |
|
|
|
show-cancel-button |
|
|
|
cancel-text="不合并" |
|
|
|
confirm-text="合并" |
|
|
|
@confirm="bindNowPhone(0)" |
|
|
|
@cancel="bindNowPhone(1)" |
|
|
|
></u-modal> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -76,6 +87,9 @@ export default { |
|
|
|
}, |
|
|
|
btnList: [], |
|
|
|
isActive: false, |
|
|
|
showPhoneModal: false, |
|
|
|
content: '当前手机号已被注册,是否合并信息', |
|
|
|
phone: '', |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -113,14 +127,33 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('error: ', error); |
|
|
|
console.error('error授权失败: ', error); |
|
|
|
this.$refs.uTips.show({ |
|
|
|
title: '授权失败', |
|
|
|
type: 'success', |
|
|
|
duration: '3000', |
|
|
|
}); |
|
|
|
if (error.code === 75) { |
|
|
|
console.log('data.phone', error.data.phone); |
|
|
|
// this.$emit('showModal', error.data.phone); |
|
|
|
this.phone = error.data.phone; |
|
|
|
this.showPhoneModal = true; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 合并手机号接口 isMerge:0 合并, 1 不合并 |
|
|
|
async bindNowPhone(num) { |
|
|
|
const params = { |
|
|
|
phone: this.phone, |
|
|
|
isMerge: num, |
|
|
|
}; |
|
|
|
const data = await this.$u.api.bindNowPhone(params); |
|
|
|
this.setUser(data); |
|
|
|
this.setToken(data.token); |
|
|
|
this.show = false; |
|
|
|
}, |
|
|
|
|
|
|
|
// 导入wbs |
|
|
|
async handleUpload() { |
|
|
|
try { |
|
|
@ -182,6 +215,7 @@ export default { |
|
|
|
transform: translate3d(0, 50%, 0); |
|
|
|
color: $uni-color-primary !important; |
|
|
|
} |
|
|
|
|
|
|
|
.role-more-box { |
|
|
|
box-shadow: 0 6px 6px rgba(0, 0, 0, 0.15); |
|
|
|
overflow: hidden; |
|
|
|