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
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
209 additions
and
66 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 @@
...
@@ -12,7 +12,9 @@
"navigationBarTitleText"
:
"Weixin"
,
"navigationBarTitleText"
:
"Weixin"
,
"navigationBarTextStyle"
:
"black"
"navigationBarTextStyle"
:
"black"
},
},
"usingComponents"
:
{},
"usingComponents"
:
{
"authorize"
:
"components/Authorize/Authorize"
},
"sitemapLocation"
:
"sitemap.json"
,
"sitemapLocation"
:
"sitemap.json"
,
"permission"
:
{
"permission"
:
{
"scope.userLocation"
:
{
"scope.userLocation"
:
{
...
...
components/Authorize/Authorize.js
View file @
62e8710
// components/Authorize/Authorize.js
// components/Authorize/Authorize.js
import
{
componentsMixin
}
from
'../../mixins/index'
Component
({
Component
({
behaviors
:
[
componentsMixin
],
/**
/**
* 组件的属性列表
* 组件的属性列表
*/
*/
properties
:
{
properties
:
{
scopeType
:
String
,
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
,
type
:
Boolean
,
value
:
false
,
value
:
true
observer
:
function
(
newVal
,
oldVal
)
{
},
this
.
check
()
init
:
{
type
:
Boolean
,
observer
(
n
)
{
if
(
n
)
this
.
check
()
}
}
}
}
},
},
observers
:
{
'show'
:
function
(
newVal
)
{
this
.
setData
({
openSet
:
newVal
})
}
},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
...
@@ -28,45 +59,90 @@ Component({
...
@@ -28,45 +59,90 @@ Component({
* 禁止滑动
* 禁止滑动
*/
*/
noScroll
:
wx
.
$util
.
noScroll
(),
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
({
this
.
setData
({
openSet
:
false
openSet
:
false
})
})
this
.
triggerEvent
(
'cancel'
)
},
},
/**检验是否已授权位置 */
check
()
{
check
()
{
const
_this
=
this
const
_this
=
this
let
{
let
{
scopeType
buttonType
,
scopeType
,
autoOpen
}
=
this
.
properties
}
=
this
.
properties
if
(
buttonType
!=
'getPhoneNumber'
)
{
let
type
=
`scope.
${
scopeType
}
`
let
type
=
`scope.
${
scopeType
}
`
let
buttonType
=
'openSetting'
buttonType
=
'openSetting'
if
(
type
===
'scope.userInfo'
)
buttonType
=
'getUserInfo'
if
(
type
===
'scope.userInfo'
)
buttonType
=
'getUserInfo'
this
.
setData
({
this
.
setData
({
buttonType
buttonType
})
})
wx
.
getSetting
({
wx
.
getSetting
({
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
)
if
(
!
res
.
authSetting
[
type
])
{
if
(
!
res
.
authSetting
[
type
])
{
wx
.
authorize
({
wx
.
authorize
({
scope
:
type
,
scope
:
type
,
success
()
{
success
()
{
_this
.
triggerEvent
(
'success'
,
{
_this
.
triggerEvent
(
'success'
,
{
message
:
'授权成功'
message
:
'授权成功'
})
})
},
},
fail
()
{
fail
()
{
_this
.
triggerEvent
(
'fail'
,
{
message
:
'未授权'
})
if
(
autoOpen
)
{
_this
.
setData
({
_this
.
setData
({
openSet
:
true
openSet
:
true
})
})
}
}
}
})
})
}
else
{
}
else
{
_this
.
triggerEvent
(
'success'
,
{
_this
.
triggerEvent
(
'success'
,
{
message
:
'已授权'
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
\ 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-seting-bg text-center" wx:if="{{openSet}}" catchtap="cancel" catchtouchmove="noScroll">
<view class='open-set-inner'>
<view class="open-set-inner">
<view class='set-title'>是否打开授权设置?</view>
<view class="set-title"><text>{{title}}</text></view>
<view class='btn-openset'>
<view class="btn-openset">
<view catchtap='cancel' class='btn'>取消</view>
<view catchtap="cancel" class="btn text-center" style="color:{{cancelColor}};">{{cancelText}}</view>
<view class='btn'>
<view class="btn text-center" style="color:{{confirmColor}};">
确定
{{confirmText}}
<button open-type='{{buttonType}}' class='button-style ' catchtap='cancel'></button>
<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>
</view>
</view>
</view>
...
...
components/Authorize/Authorize.wxss
View file @
62e8710
...
@@ -6,48 +6,66 @@
...
@@ -6,48 +6,66 @@
top: 0;
top: 0;
left: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
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 {
.open-set-inner {
width: 400rpx;
width: 564rpx;
height: 220rpx;
height: 400rpx;
position: absolute;
background: #FFFFFF;
top: 50%;
border-radius: 16px;
left: 50%;
transform: translate(-50%,-50%);
background: #fff;
z-index: 9999999999;
}
}
.btn-openset {
@keyframes show-auth-box {
display: flex;
0% {
font-size: 30rpx;
opacity: 0;
height: 100rpx;
transform: scale(2);
}
100% {
opacity: 1;
transform: scale(1);
}
}
}
.set-title {
.set-title {
font-size: 3
0
rpx;
font-size: 3
6
rpx;
height: 120
rpx;
min-height: 286
rpx;
display: flex;
display: flex;
align-items: center;
align-items: center;
justify-content: center;
justify-content: center;
text-align: center;
flex-direction: column;
}
}
.btn{
.btn-openset {
display: flex;
font-size: 36rpx;
height: 112rpx;
border-top: 2rpx solid #E5E5E5;
font-weight: 500;
letter-spacing: 1rpx;
}
.btn {
flex: 1;
flex: 1;
height: 100%;
height: 100%;
position: relative;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
}
.button-style {
.button-style {
position: absolute;
position: absolute;
width: 100%;
width: 100%
!important
;
height: 100%;
height: 100%;
box-sizing: border-box;
box-sizing: border-box;
opacity: 0;
opacity: 0;
top: 0;
top: 0;
left: 0;
left: 0;
}
}
\ No newline at end of file
\ No newline at end of file
components/UserInfo/UserInfo.js
View file @
62e8710
...
@@ -25,6 +25,39 @@ Component({
...
@@ -25,6 +25,39 @@ Component({
showWechant
:
!
this
.
data
.
showWechant
showWechant
:
!
this
.
data
.
showWechant
})
})
console
.
log
(
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
\ No newline at end of file
components/UserInfo/UserInfo.wxml
View file @
62e8710
...
@@ -34,9 +34,14 @@
...
@@ -34,9 +34,14 @@
<image class="icon-dial" webp src="{{IMGURL}}home/icon-dial.png"></image>
<image class="icon-dial" webp src="{{IMGURL}}home/icon-dial.png"></image>
<view class="phone-text">拨打电话</view>
<view class="phone-text">拨打电话</view>
</view>
</view>
<view class="btn-plain btn">
<block wx:if="{{unauthorized}}">
保存名片
<button class="btn-plain btn" bindtap="authAddress">保存名片</button>
</view>
</block>
<block wx:else>
<button class="btn-plain btn" bindtap="addPhone">保存名片</button>
</block>
<button class="btn-primary btn" open-type="share">分享名片</button>
<button class="btn-primary btn" open-type="share">分享名片</button>
</view>
</view>
</view>
</view>
<authorize scopeType="addPhoneContact" bindsuccess="authSuccess" bindfail="authFail" show="{{showAuth}}" isShowCheck="{{false}}">
</authorize>
\ No newline at end of file
\ No newline at end of file
components/UserInfo/UserInfo.wxss
View file @
62e8710
...
@@ -116,6 +116,7 @@
...
@@ -116,6 +116,7 @@
margin-top: 40rpx;
margin-top: 40rpx;
display: flex;
display: flex;
justify-content: space-between;
justify-content: space-between;
align-items: center;
}
}
.phone-btn {
.phone-btn {
width: 136rpx;
width: 136rpx;
...
@@ -144,6 +145,9 @@
...
@@ -144,6 +145,9 @@
line-height: 48rpx;
line-height: 48rpx;
border-radius: 8rpx;
border-radius: 8rpx;
float: right;
float: right;
margin: 0;
height: 48rpx;
box-sizing: content-box;
}
}
.btn-plain {
.btn-plain {
color: #5850ff;
color: #5850ff;
...
...
pages/tab/index/index.wxml
View file @
62e8710
<!-- pages/tab/index/index.wxml -->
<!-- pages/tab/index/index.wxml -->
<view class="main-box">
<view class="main-box">
<user-info></user-info>
<user-info></user-info>
<view class="main-bottom">
<view class="main-bottom">
<!-- 面向渠道 -->
<!-- 面向渠道 -->
<import src="../../template/channel/channel.wxml" />
<import src="../../template/channel/channel.wxml" />
<template is="channel"></template>
<template is="channel"></template>
<!-- tab介绍 -->
<!-- tab介绍 -->
<view class="tab-list">
<view class="tab-list">
<block wx:for="{{tabList}}" wx:key="index">
<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">
<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:if="{{curTabIndex !== index}}" class="tab-img" mode="widthFix" webp src="{{IMGURL}}home/{{item.icon1}}.png"></image>
...
@@ -16,20 +16,20 @@
...
@@ -16,20 +16,20 @@
<image wx:if="{{index === 3}}" class="icon-hot" webp src="{{IMGURL}}home/icon-hot.png"></image>
<image wx:if="{{index === 3}}" class="icon-hot" webp src="{{IMGURL}}home/icon-hot.png"></image>
</view>
</view>
</block>
</block>
</view>
</view>
<import src="../../template/company/company.wxml" />
<import src="../../template/company/company.wxml" />
<!-- 公司介绍 -->
<!-- 公司介绍 -->
<block wx:if="{{curTabIndex === 0 }}">
<block wx:if="{{curTabIndex === 0 }}">
<template is="company"></template>
<template is="company"></template>
</block>
</block>
<!-- 方案介绍 -->
<!-- 方案介绍 -->
<import src="../../template/menu/menu.wxml" />
<import src="../../template/menu/menu.wxml" />
<block wx:if="{{curTabIndex === 1 }}">
<block wx:if="{{curTabIndex === 1 }}">
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType}}"></template>
<template is="menu" data="{{menuList, curIntroduceIndex, templateMethods, customerType}}"></template>
</block>
</block>
</view>
</view>
<!-- 服务咨询 -->
<!-- 服务咨询 -->
<view bindtap="goConsult">
<view bindtap="goConsult">
<image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image>
<image mode="widthFix" class="icon-consult" webp src="{{IMGURL}}home/custom.png"></image>
</view>
</view>
</view>
</view>
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