Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
techbook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
front-end-dev
techbook
Commits
47beca07
Commit
47beca07
authored
Jan 13, 2021
by
zhangyanni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
试一下分享
parent
4908d31a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
221 additions
and
9 deletions
+221
-9
phone.scss
public/css/phone.scss
+1
-1
mineFollowCmpt.vue
src/components/mobile/mineFollowCmpt.vue
+20
-4
live.vue
src/views/mobile/live.vue
+200
-4
No files found.
public/css/phone.scss
View file @
47beca07
...
...
@@ -1849,7 +1849,7 @@ i, em {
border-bottom-right-radius
:
0
;
}
.noticeError
{
z-index
:
5000
!
important
;
z-index
:
9999
!
important
;
}
.dialogTips
{
position
:
fixed
;
...
...
src/components/mobile/mineFollowCmpt.vue
View file @
47beca07
...
...
@@ -953,14 +953,22 @@
// queryState 0积分不够 1无联系方式 2查看联系方式 3不是好友 4已添加
if
(
res
.
result
.
queryState
==
0
)
this
.
integralVisible
=
true
;
else
if
(
res
.
result
.
queryState
==
1
||
res
.
result
.
queryState
==
3
||
res
.
result
.
queryState
==
4
)
{
if
(
res
.
result
.
queryValue
)
this
.
$toast
(
res
.
result
.
queryValue
)
if
(
res
.
result
.
queryValue
)
this
.
$toast
({
message
:
res
.
result
.
queryValue
,
duration
:
2000
,
className
:
'noticeError'
})
}
else
if
(
res
.
result
.
queryState
==
2
)
{
this
.
contactObj
=
res
.
result
.
baseEmpInformation
;
this
.
contactVisible
=
true
;
}
else
{
if
(
res
.
result
.
queryValue
)
this
.
$toast
(
res
.
result
.
queryValue
)
if
(
res
.
result
.
queryValue
)
this
.
$toast
({
message
:
res
.
result
.
queryValue
,
duration
:
2000
,
className
:
'noticeError'
})
}
}
else
this
.
$toast
(
res
.
msg
);
}).
catch
((
err
)
=>
{
...
...
@@ -1112,10 +1120,18 @@
if
(
res
.
result
.
addValue
)
this
.
$toast
(
res
.
result
.
addValue
)
if
(
res
.
result
.
addValue
)
this
.
$toast
({
message
:
res
.
result
.
addValue
,
duration
:
2000
,
className
:
'noticeError'
})
}
else
if
(
res
.
result
.
addState
==
1
)
{
this
.
$toast
(
res
.
result
.
addValue
)
this
.
$toast
({
message
:
res
.
result
.
addValue
,
duration
:
2000
,
className
:
'noticeError'
})
}
else
if
(
res
.
result
.
addState
==
4
)
{
this
.
completeTitle
=
res
.
result
.
addValue
;
...
...
src/views/mobile/live.vue
View file @
47beca07
...
...
@@ -24,12 +24,15 @@
</div>
<div
class=
"tabContent"
ref=
"tabContent"
v-show=
"isShowUser"
>
<userCmpt
ref=
"userCmpt"
:visible=
"type==1"
:isShowCount=
"false"
v-if=
"type==1"
:circleType=
"circleType"
:fixed=
"true"
></userCmpt>
:circleType=
"circleType"
:fixed=
"true"
@
handleShare=
"handleShare"
></userCmpt>
<msgCmpt
v-show=
"type==2"
:showType=
"type"
ref=
"msgCmpt"
:visible=
"isShowUser"
:type=
"1"
@
handleMessage=
"handleMessage"
></msgCmpt>
</div>
</div>
</div>
<div
class=
"dialogTips"
v-if=
"dialogVisible"
@
click=
"dialogVisible = false"
style=
"z-index: 9999"
>
<img
src=
"../../assets/jiantou.png"
alt=
""
>
</div>
</div>
</
template
>
...
...
@@ -83,13 +86,18 @@
$
(
"#changeAnimated"
).
removeClass
(
"animate__animated animate__fadeInRight animate__fadeOutRight"
);
$
(
"#changeAnimated"
).
addClass
(
"animate__animated animate__fadeOutRight"
)
});
})
})
;
import
api
from
'../mobile/personaluser/api/api'
;
import
userCmpt
from
'../../components/mobile/mineFollowCmpt'
;
import
msgCmpt
from
'./mine/message'
;
import
$
from
'jquery'
;
//非必要
import
Clickoutside
from
'../../assets/js/clickoutside'
import
setApi
from
'./api'
;
import
commonApi
from
'../../common/commonApi'
const
nativeshare
=
()
=>
import
(
'nativeshare'
)
//这种引入方式nativeshare是Promise对象
//https://github.com/backToNature/m-share
const
m_share
=
()
=>
import
(
'm-share'
)
var
NativeShare
,
mShare
;
export
default
{
name
:
"live"
,
components
:
{
...
...
@@ -108,6 +116,9 @@
timerPopover
:
null
,
popoverVisible
:
false
,
lang
:
this
.
$i18n
.
locale
==
"zh-CN"
?
1
:
2
,
documentFront
:
""
,
frontImgUrl
:
""
,
dialogVisible
:
false
}
},
...
...
@@ -198,12 +209,197 @@
//滑动
getScroll
(
e
)
{
},
//分享
handleShare
(
command
)
{
let
query
=
this
.
$route
.
query
,
resultTitle
=
"科创人脉拓展必备"
;
var
urlData
=
this
.
documentFront
+
"/inviteRegister"
;
query
.
rDeviceId
=
this
.
publicFun
.
getCookie
(
"getGuid32"
);
// this.maiDianFunc(2, command, data.id);
if
(
this
.
userInfo
)
{
query
.
rEmpId
=
this
.
userInfo
.
empId
}
query
.
rTargetType
=
1
;
var
ua
=
navigator
.
userAgent
.
toLowerCase
(),
that
=
this
;
if
(
ua
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
)
{
that
.
shareFunc
(
command
,
query
,
resultTitle
);
}
else
{
let
shareData
=
{
//nativeShare的参数模型
title
:
resultTitle
,
//that.subjectInfo.subjectTitle
desc
:
"与智者同行,与高人为伍,一起加入太库科创人脉圈!"
,
//that.subjectInfo.subjectTitle
// 如果是微信该link的域名必须要在微信后台配置的安全域名之内的。
link
:
urlData
+
"?rDeviceId="
+
this
.
publicFun
.
getCookie
(
"getGuid32"
)
+
"&rEmpId="
+
(
this
.
userInfo
?
this
.
userInfo
.
empId
:
undefined
)
+
"&rTargetType="
+
query
.
rTargetType
,
// icon: this.config.url,
// 不要过于依赖以下两个回调,很多浏览器是不支持的
success
:
function
()
{
alert
(
'success'
)
},
fail
:
function
()
{
alert
(
'fail'
)
}
}
let
mShareData
=
{
//m-share的参数模型
title
:
resultTitle
,
//that.subjectInfo.subjectTitle
desc
:
"与智者同行,与高人为伍,一起加入太库科创人脉圈!"
,
//that.subjectInfo.subjectTitle
// 如果是微信该link的域名必须要在微信后台配置的安全域名之内的。
link
:
urlData
+
"?rDeviceId="
+
this
.
publicFun
.
getCookie
(
"getGuid32"
)
+
"&rEmpId="
+
(
this
.
userInfo
?
this
.
userInfo
.
empId
:
undefined
)
+
"&rTargetType="
+
query
.
rTargetType
,
imgUrl
:
this
.
frontImgUrl
+
"/public/shareCircleFriend.png"
,
// 图片, 默认取网页中第一个img标签
fnDoShare
(
type
)
{
}
}
let
nativeShare
=
new
NativeShare
()
nativeShare
.
setShareData
(
shareData
)
try
{
nativeShare
.
call
(
command
==
1
?
'wechatFriend'
:
'wechatTimeline'
)
}
catch
(
e
)
{
//iphone的qq浏览器调用此api
//除iphone的qq浏览器外其他浏览器调用的api
//在iphone的qq浏览器中比较奇葩,第一次调用nativeShare.call()会报错,第二次之后不报,这里是让每次调用nativeShare.call()之后都报错,然后统一去调m-share.to()方法
mShare
.
to
(
command
==
1
?
'wx'
:
'wxline'
,
mShareData
)
}
}
},
//获取浏览器前缀
getDocumentFunc
()
{
commonApi
.
getDocumentAxios
().
then
(
response
=>
{
if
(
response
.
code
==
0
)
{
this
.
documentFront
=
response
.
result
.
websitePrefix
+
"#"
;
this
.
frontImgUrl
=
response
.
result
.
ossPrefix
;
if
(
navigator
.
userAgent
.
toLowerCase
().
match
(
/MicroMessenger/i
)
==
"micromessenger"
)
{
this
.
configFunc
();
}
}
else
{
this
.
$toast
(
response
.
msgCode
)
}
}).
catch
(
error
=>
{
this
.
$toast
(
error
);
});
},
configFunc
(
data
)
{
let
params
=
{
appUrl
:
window
.
location
.
href
//document.location.href.split("#")[0]+"/?#"+document.location.href.split("#")[1]
},
that
=
this
;
commonApi
.
getConfigAxios
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
0
)
{
wx
.
config
({
debug
:
false
,
// 是否开启调试模式
appId
:
res
.
result
.
appId
,
//appid
timestamp
:
res
.
result
.
timestamp
,
// 时间戳
nonceStr
:
res
.
result
.
nonceStr
,
// 随机字符串
signature
:
res
.
result
.
signature
,
// 签名
jsApiList
:
[
'onMenuShareAppMessage'
,
'onMenuShareTimeline'
]
// 需要使用的JS接口列表
});
let
dataVal
=
{
title
:
"科创人脉拓展必备"
,
// 分享标题
desc
:
"与智者同行,与高人为伍,一起加入太库科创人脉圈!"
,
// 分享描述
link
:
this
.
documentFront
+
"/inviteRegister"
+
"?rDeviceId="
+
that
.
publicFun
.
getCookie
(
"getGuid32"
)
+
"&rEmpId="
+
(
that
.
userInfo
?
that
.
userInfo
.
empId
:
undefined
)
+
"&rTargetType=1"
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl
:
that
.
frontImgUrl
+
"/public/shareCircleFriend.png"
,
// 分享图标
trigger
:
function
()
{
},
success
:
function
()
{
// 用户确认分享后执行的回调函数
// _this.$router.push({path:'/me',query:{}})
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
// _this.wxShare()
}
};
setTimeout
(
function
()
{
wx
.
ready
(
function
()
{
wx
.
onMenuShareAppMessage
(
dataVal
)
wx
.
onMenuShareTimeline
(
dataVal
)
})
},
1000
)
}
else
{
this
.
$toast
(
res
.
msg
);
}
}).
catch
((
err
)
=>
{
this
.
$toast
(
err
);
})
},
shareFunc
(
data
,
query
,
title
)
{
var
that
=
this
;
// alert("hahahahah 来分享")
//
// // 是否是微信小程序
//
var
userAgent
=
navigator
.
userAgent
,
shareUrl
;
var
isMini
=
/miniProgram/i
.
test
(
userAgent
);
var
urlData
=
this
.
documentFront
+
"/inviteRegister"
;
if
(
isMini
)
{
that
.
dialogVisible
=
true
;
let
dataVal
=
{
title
:
title
,
//that.subjectInfo.subjectTitle
desc
:
"与智者同行,与高人为伍,一起加入太库科创人脉圈!"
,
//that.subjectInfo.subjectTitle
imageUrl
:
this
.
frontImgUrl
+
"/public/shareCircleFriend.png"
,
isShare
:
data
,
path
:
'/pages/sharepage/sharepage?shareUrl='
+
JSON
.
stringify
({
url
:
encodeURIComponent
(
urlData
+
"?rDeviceId="
+
that
.
publicFun
.
getCookie
(
"getGuid32"
)
+
"&rEmpId="
+
(
that
.
userInfo
?
that
.
userInfo
.
empId
:
undefined
)
+
"&rTargetType=1"
)})
//重点,share.js是小程序的页面中,从分享进入的h5的落地页
};
wx
.
miniProgram
.
postMessage
({
data
:
dataVal
});
wx
.
miniProgram
.
navigateBack
({
delta
:
1
})
setTimeout
(
function
()
{
that
.
dialogVisible
=
false
;
},
3000
)
}
else
{
this
.
configVal
=
{
title
:
title
,
desc
:
"与智者同行,与高人为伍,一起加入太库科创人脉圈!"
,
img
:
this
.
frontImgUrl
+
"/public/shareCircleFriend.png"
,
link
:
urlData
+
"?rDeviceId="
+
this
.
publicFun
.
getCookie
(
"getGuid32"
)
+
"&rEmpId="
+
(
this
.
userInfo
?
this
.
userInfo
.
empId
:
undefined
)
+
"&rTargetType="
}
this
.
configFunc
(
this
.
configVal
);
this
.
dialogVisible
=
true
;
setTimeout
(
function
()
{
that
.
dialogVisible
=
false
;
},
3000
)
}
},
},
created
()
{
this
.
getNickName
();
},
mounted
(){
this
.
getDocumentFunc
();
// ES6 标准
nativeshare
().
then
(
res
=>
{
NativeShare
=
res
.
default
})
// CommonJS 标准
m_share
().
then
(
res
=>
{
mShare
=
res
});
},
beforeRouteEnter
(
to
,
from
,
next
)
{
next
(
vm
=>
{
// 这里的vm指的就是vue实例,可以用来当做this使用
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment