Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 62e87100
authored
Sep 06, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交保存名片
1 parent
a4333240
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
245 additions
and
102 deletions
app.json
components/Authorize/Authorize.js
components/Authorize/Authorize.wxml
components/Authorize/Authorize.wxss
components/UserInfo/UserInfo.js
components/UserInfo/UserInfo.wxml
components/UserInfo/UserInfo.wxss
pages/tab/index/index.wxml
app.json
View file @
62e8710
...
...
@@ -12,7 +12,9 @@
"navigationBarTitleText"
:
"Weixin"
,
"navigationBarTextStyle"
:
"black"
},
"usingComponents"
:
{},
"usingComponents"
:
{
"authorize"
:
"components/Authorize/Authorize"
},
"sitemapLocation"
:
"sitemap.json"
,
"permission"
:
{
"scope.userLocation"
:
{
...
...
components/Authorize/Authorize.js
View file @
62e8710
// components/Authorize/Authorize.js
import
{
componentsMixin
}
from
'../../mixins/index'
Component
({
behaviors
:
[
componentsMixin
],
/**
* 组件的属性列表
*/
properties
:
{
scopeType
:
String
,
checkSetting
:
{
/**是否自动打开 */
autoOpen
:
Boolean
,
show
:
Boolean
,
title
:
{
type
:
String
,
value
:
'是否打开授权设置?'
},
confirmText
:
{
type
:
String
,
value
:
'确定'
},
cancelText
:
{
type
:
String
,
value
:
'取消'
},
buttonType
:
String
,
confirmColor
:
String
,
cancelColor
:
String
,
isShowCheck
:
{
type
:
Boolean
,
value
:
false
,
observer
:
function
(
newVal
,
oldVal
)
{
this
.
check
()
value
:
true
},
init
:
{
type
:
Boolean
,
observer
(
n
)
{
if
(
n
)
this
.
check
()
}
}
},
observers
:
{
'show'
:
function
(
newVal
)
{
this
.
setData
({
openSet
:
newVal
})
}
},
/**
* 组件的初始数据
*/
...
...
@@ -28,45 +59,90 @@ Component({
* 禁止滑动
*/
noScroll
:
wx
.
$util
.
noScroll
(),
cancel
()
{
cancel
(
e
)
{
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
buttonType
,
title
}
=
this
.
data
let
_this
=
this
if
(
buttonType
==
'getUserInfo'
&&
confirm
)
{
wx
.
getUserProfile
({
desc
:
title
,
success
(
res
)
{
_this
.
triggerEvent
(
'success'
,
{
message
:
'授权成功'
,
data
:
res
})
}
})
}
this
.
setData
({
openSet
:
false
})
this
.
triggerEvent
(
'cancel'
)
},
/**检验是否已授权位置 */
check
()
{
const
_this
=
this
let
{
scopeType
buttonType
,
scopeType
,
autoOpen
}
=
this
.
properties
let
type
=
`scope.
${
scopeType
}
`
let
buttonType
=
'openSetting'
if
(
type
===
'scope.userInfo'
)
buttonType
=
'getUserInfo'
this
.
setData
({
buttonType
})
wx
.
getSetting
({
success
(
res
)
{
if
(
!
res
.
authSetting
[
type
])
{
wx
.
authorize
({
scope
:
type
,
success
()
{
_this
.
triggerEvent
(
'success'
,{
message
:
'授权成功'
})
},
fail
()
{
_this
.
setData
({
openSet
:
true
})
}
})
}
else
{
_this
.
triggerEvent
(
'success'
,{
message
:
'已授权'
})
if
(
buttonType
!=
'getPhoneNumber'
)
{
let
type
=
`scope.
${
scopeType
}
`
buttonType
=
'openSetting'
if
(
type
===
'scope.userInfo'
)
buttonType
=
'getUserInfo'
this
.
setData
({
buttonType
})
wx
.
getSetting
({
success
(
res
)
{
console
.
log
(
res
)
if
(
!
res
.
authSetting
[
type
])
{
wx
.
authorize
({
scope
:
type
,
success
()
{
_this
.
triggerEvent
(
'success'
,
{
message
:
'授权成功'
})
},
fail
()
{
_this
.
triggerEvent
(
'fail'
,
{
message
:
'未授权'
})
if
(
autoOpen
)
{
_this
.
setData
({
openSet
:
true
})
}
}
})
}
else
{
_this
.
triggerEvent
(
'success'
,
{
message
:
'已授权'
})
}
}
}
})
})
}
},
/**授权手机号 */
getPhoneNumber
({
detail
})
{
console
.
log
(
detail
)
this
.
triggerEvent
(
'getphonenumber'
,
detail
)
}
},
pageLifetimes
:
{
show
:
function
()
{
if
(
this
.
data
.
isShowCheck
||
this
.
data
.
init
)
this
.
check
()
},
hide
:
function
()
{}
}
})
\ No newline at end of file
components/Authorize/Authorize.wxml
View file @
62e8710
<view class='open-seting-bg' wx:if='{{openSet}}' catchtap='cancel' catchtouchmove='noScroll'>
<view class='open-set-inner'>
<view class='set-title'>是否打开授权设置?</view>
<view class='btn-openset'>
<view catchtap='cancel' class='btn'>取消</view>
<view class='btn'>
确定
<button open-type='{{buttonType}}' class='button-style ' catchtap='cancel'></button>
<view class="open-seting-bg text-center" wx:if="{{openSet}}" catchtap="cancel" catchtouchmove="noScroll">
<view class="open-set-inner">
<view class="set-title"><text>{{title}}</text></view>
<view class="btn-openset">
<view catchtap="cancel" class="btn text-center" style="color:{{cancelColor}};">{{cancelText}}</view>
<view class="btn text-center" style="color:{{confirmColor}};">
{{confirmText}}
<block wx:if="{{buttonType == 'getPhoneNumber'}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="button-style"></button>
</block>
<block wx:else>
<button open-type="{{buttonType}}" class="button-style" catchtap="cancel" data-confirm></button>
</block>
</view>
</view>
</view>
...
...
components/Authorize/Authorize.wxss
View file @
62e8710
...
...
@@ -6,48 +6,66 @@
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 99
99999999
;
z-index: 99
8
;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.open-set-inner {
width: 400rpx;
height: 220rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
background: #fff;
z-index: 9999999999;
width: 564rpx;
height: 400rpx;
background: #FFFFFF;
border-radius: 16px;
}
.btn-openset {
display: flex;
font-size: 30rpx;
height: 100rpx;
@keyframes show-auth-box {
0% {
opacity: 0;
transform: scale(2);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.set-title {
font-size: 3
0
rpx;
height: 120
rpx;
font-size: 3
6
rpx;
min-height: 286
rpx;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
flex-direction: column;
}
.btn-openset {
display: flex;
font-size: 36rpx;
height: 112rpx;
border-top: 2rpx solid #E5E5E5;
font-weight: 500;
letter-spacing: 1rpx;
}
.btn{
.btn {
flex: 1;
height: 100%;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.button-style {
position: absolute;
width: 100%;
width: 100%
!important
;
height: 100%;
box-sizing: border-box;
opacity: 0;
top: 0;
left: 0;
}
}
\ No newline at end of file
components/UserInfo/UserInfo.js
View file @
62e8710
...
...
@@ -25,6 +25,39 @@ Component({
showWechant
:
!
this
.
data
.
showWechant
})
console
.
log
(
this
.
data
.
showWechant
)
}
},
addPhone
()
{
wx
.
addPhoneContact
({
firstName
:
'石文'
,
mobilePhoneNumber
:
'13274150220'
,
title
:
'市场总监'
,
organization
:
'广联数科'
,
workAddressCountry
:
'中国'
,
workAddressState
:
'广东省'
,
workAddressCity
:
'深圳市'
,
workAddressStreet
:
'留仙大道3370号'
})
},
/**打开授权设置 */
authAddress
()
{
this
.
setData
({
showAuth
:
true
})
},
/**授权位置成功 */
authSuccess
()
{
this
.
setData
({
flag
:
true
,
unauthorized
:
false
})
this
.
addPhone
()
},
/**授权失败 */
authFail
()
{
this
.
setData
({
unauthorized
:
true
,
flag
:
true
})
},
}
})
\ No newline at end of file
components/UserInfo/UserInfo.wxml
View file @
62e8710
...
...
@@ -34,9 +34,14 @@
<image class="icon-dial" webp src="{{IMGURL}}home/icon-dial.png"></image>
<view class="phone-text">拨打电话</view>
</view>
<view class="btn-plain btn">
保存名片
</view>
<block wx:if="{{unauthorized}}">
<button class="btn-plain btn" bindtap="authAddress">保存名片</button>
</block>
<block wx:else>
<button class="btn-plain btn" bindtap="addPhone">保存名片</button>
</block>
<button class="btn-primary btn" open-type="share">分享名片</button>
</view>
</view>
\ No newline at end of file
</view>
<authorize scopeType="addPhoneContact" bindsuccess="authSuccess" bindfail="authFail" show="{{showAuth}}" isShowCheck="{{false}}">
</authorize>
\ No newline at end of file
components/UserInfo/UserInfo.wxss
View file @
62e8710
...
...
@@ -116,6 +116,7 @@
margin-top: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.phone-btn {
width: 136rpx;
...
...
@@ -144,6 +145,9 @@
line-height: 48rpx;
border-radius: 8rpx;
float: right;
margin: 0;
height: 48rpx;
box-sizing: content-box;
}
.btn-plain {
color: #5850ff;
...
...
pages/tab/index/index.wxml
View file @
62e8710
<!-- pages/tab/index/index.wxml -->
<view class="main-box">
<user-info></user-info>
<view class="main-bottom">
<!-- 面向渠道 -->
<import src="../../template/channel/channel.wxml" />
<template is="channel"></template>
<!-- tab介绍 -->
<view class="tab-list">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{curTabIndex === index ? 'tab-item-active' : '' }} {{index === 3 ? 'tab-apply' : ''}}" data-name="{{item}}" data-index="{{index}}" bindtap="introduce">
<image wx:if="{{curTabIndex !== index}}" class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon1}}.png"></image>
<image wx:else class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon}}.png"></image>
<view>{{item.name}}</view>
<!-- 合作申请hot -->
<image wx:if="{{index === 3}}" class="icon-hot" webp src="{{IMGURL}}home/icon-hot.png"></image>
<view class="main-bottom">
<!-- 面向渠道 -->
<import src="../../template/channel/channel.wxml" />
<template is="channel"></template>
<!-- tab介绍 -->
<view class="tab-list">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item {{curTabIndex === index ? 'tab-item-active' : '' }} {{index === 3 ? 'tab-apply' : ''}}" data-name="{{item}}" data-index="{{index}}" bindtap="introduce">
<image wx:if="{{curTabIndex !== index}}" class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon1}}.png"></image>
<image wx:else class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon}}.png"></image>
<view>{{item.name}}</view>
<!-- 合作申请hot -->
<image wx:if="{{index === 3}}" class="icon-hot" webp src="{{IMGURL}}home/icon-hot.png"></image>
</view>
</block>
</view>
</block>
<import src="../../template/company/company.wxml" />
<!-- 公司介绍 -->
<block wx:if="{{curTabIndex === 0 }}">
<template is="company"></template>
</block>
<!-- 方案介绍 -->
<import src="../../template/menu/menu.wxml" />
<block wx:if="{{curTabIndex === 1 }}">
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType}}"></template>
</block>
</view>
<!-- 服务咨询 -->
<view bindtap="goConsult">
<image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image>
</view>
</view>
<import src="../../template/company/company.wxml" />
<!-- 公司介绍 -->
<block wx:if="{{curTabIndex === 0 }}">
<template is="company"></template>
</block>
<!-- 方案介绍 -->
<import src="../../template/menu/menu.wxml" />
<block wx:if="{{curTabIndex === 1 }}">
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType}}"></template>
</block>
</view>
<!-- 服务咨询 -->
<view bindtap="goConsult">
<image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image>
</view>
</view>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment