Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shop_mobile_uni
Project
Project
Details
Activity
Releases
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
郑秀明
shop_mobile_uni
Commits
9034a2a3
Commit
9034a2a3
authored
5 years ago
by
郑秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信分享增加postData,企点客服增加兼容判断
parent
04829869
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
161 additions
and
16 deletions
+161
-16
wechat.js
common/wechat.js
+28
-7
index.html
index.html
+36
-3
main.js
main.js
+5
-4
manifest.json
manifest.json
+2
-2
category.vue
pages/category/category.vue
+15
-0
detail.vue
pages/detail/detail.vue
+15
-0
financialstage.vue
pages/financial/financialstage.vue
+15
-0
home.vue
pages/home/home.vue
+15
-0
index.vue
pages/index/index.vue
+15
-0
search.vue
pages/search/search.vue
+15
-0
No files found.
common/wechat.js
View file @
9034a2a3
// 微信分享 公共方法
var
jweixin
=
require
(
'jweixin-module'
);
//
var jweixin = require('jweixin-module');
export
default
{
// 是否在微信中
...
...
@@ -22,7 +22,7 @@ export default {
success
:
(
res
)
=>
{
const
{
data
}
=
res
;
if
(
data
.
code
===
0
){
j
w
eixin
.
config
({
j
W
eixin
.
config
({
debug
:
false
,
appId
:
data
.
data
.
appId
,
timestamp
:
data
.
data
.
timestamp
,
...
...
@@ -59,7 +59,7 @@ export default {
}
//每次都需要重新初始化配置,才可以进行分享
this
.
initJssdkShare
(
function
(){
j
w
eixin
.
ready
(
function
()
{
j
W
eixin
.
ready
(
function
()
{
var
shareData
=
{
title
:
data
&&
data
.
title
?
data
.
title
:
'谛宝多多商城'
,
desc
:
data
&&
data
.
desc
?
data
.
desc
:
'宠物行业一站式B2B采购平台'
,
...
...
@@ -72,14 +72,35 @@ export default {
cancel
:
function
(
res
)
{}
};
//分享给朋友接口
j
w
eixin
.
onMenuShareAppMessage
(
shareData
);
j
W
eixin
.
onMenuShareAppMessage
(
shareData
);
//分享到朋友圈接口
j
w
eixin
.
onMenuShareTimeline
(
shareData
);
j
W
eixin
.
onMenuShareTimeline
(
shareData
);
// 分享到QQ
j
w
eixin
.
onMenuShareQQ
(
shareData
);
j
W
eixin
.
onMenuShareQQ
(
shareData
);
// 分享到微博
j
w
eixin
.
onMenuShareWeibo
(
shareData
);
j
W
eixin
.
onMenuShareWeibo
(
shareData
);
});
},
url
);
},
// 向小程序发送分享的数据
postData
:
function
(
t
){
// imgUrl: image || 'https://dbc-static.oss-cn-beijing.aliyuncs.com/wx/logo.jpg'
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
t
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
});
},
isMini
:
function
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// true 在微信小程序中
return
true
;
}
else
{
// false 在微信公众号里
return
false
;
}
});
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
index.html
View file @
9034a2a3
...
...
@@ -22,8 +22,9 @@
<link
rel=
"stylesheet"
href=
"<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css"
/>
<script
src=
"https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"
></script>
<script
src=
"https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/lib/draggabilly.min.js"
></script>
<script
src=
"https://res.wx.qq.com/open/js/jweixin-1.4.0.js"
></script>
<!-- WPA start -->
<
script
id=
"qd28857712162361a518c852fc82fde1e5eab730ba68"
src=
"https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68"
charset=
"utf-8"
async
defer
></script
>
<
!-- <script id="qd28857712162361a518c852fc82fde1e5eab730ba68" src="https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68" charset="utf-8" async defer ></script> --
>
<!-- WPA end -->
</head>
<body>
...
...
@@ -31,7 +32,7 @@
<strong>
Please enable JavaScript to continue.
</strong>
</noscript>
<div
id=
"app"
></div>
<div
class=
'draggable is-pointer-down is-dragging'
id=
'qidian_dom'
><span></span></div>
<div
class=
"draggable is-pointer-down is-dragging"
id=
"qidian_dom"
style=
"display: none;"
><span></span></div>
<script>
var
_hmt
=
_hmt
||
[];
(
function
()
{
...
...
@@ -40,6 +41,38 @@
var
s
=
document
.
getElementsByTagName
(
"script"
)[
0
];
s
.
parentNode
.
insertBefore
(
hm
,
s
);
})();
const
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
if
(
ua
.
match
(
/micromessenger/i
)
==
'micromessenger'
)
{
isMiniProgram
();
}
else
{
const
dom
=
document
.
getElementById
(
'qidian_dom'
);
dom
.
style
.
display
=
'block'
;
const
script_dom
=
document
.
createElement
(
'script'
);
script_dom
.
src
=
"https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68"
;
script_dom
.
language
=
'javascript'
;
script_dom
.
id
=
'qd28857712162361a518c852fc82fde1e5eab730ba68'
;
script_dom
.
type
=
'text/javascript'
;
const
head
=
document
.
getElementsByTagName
(
'head'
).
item
(
0
);
//这个是往本页面动态加载js脚本
head
.
appendChild
(
script_dom
);
}
function
isMiniProgram
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
const
dom
=
document
.
getElementById
(
'qidian_dom'
);
if
(
res
.
miniprogram
){
dom
.
style
.
display
=
'none'
;
}
else
{
dom
.
style
.
display
=
'block'
;
const
script_dom
=
document
.
createElement
(
'script'
);
script_dom
.
src
=
"https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68"
;
script_dom
.
language
=
'javascript'
;
script_dom
.
id
=
'qd28857712162361a518c852fc82fde1e5eab730ba68'
;
script_dom
.
type
=
'text/javascript'
;
const
head
=
document
.
getElementsByTagName
(
'head'
).
item
(
0
);
//这个是往本页面动态加载js脚本
head
.
appendChild
(
script_dom
);
}
});
}
var
$draggable
=
$
(
'.draggable'
).
draggabilly
({
containment
:
true
...
...
This diff is collapsed.
Click to expand it.
main.js
View file @
9034a2a3
...
...
@@ -13,9 +13,10 @@ import {
// 微信分享公共接口
// #ifdef H5
import
wechat
from
'./common/wechat.js'
;
if
(
wechat
.
isWechat
())
{
Vue
.
prototype
.
$wechat
=
wechat
;
}
Vue
.
prototype
.
$wechat
=
wechat
;
// if (wechat.isWechat() || wechat.isMini()) {
// Vue.prototype.$wechat = wechat;
// }
// #endif
Vue
.
config
.
productionTip
=
false
;
...
...
This diff is collapsed.
Click to expand it.
manifest.json
View file @
9034a2a3
...
...
@@ -2,7 +2,7 @@
"name"
:
"shop_mobile_uni"
,
"appid"
:
"__UNI__F904656"
,
"description"
:
""
,
"versionName"
:
"1.0.1
3
"
,
"versionName"
:
"1.0.1
5
"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:
{
...
...
@@ -51,7 +51,7 @@
"mode"
:
"history"
,
"base"
:
"/uni"
},
"publicPath"
:
"https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/
prod/1.0.13
/"
,
"publicPath"
:
"https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/
test/1.0.15
/"
,
"optimization"
:
{
"treeShaking"
:
{
"enable"
:
true
...
...
This diff is collapsed.
Click to expand it.
pages/category/category.vue
View file @
9034a2a3
...
...
@@ -75,6 +75,7 @@
if
(
this
.
$wechat
&&
this
.
$wechat
.
isWechat
())
{
this
.
$wechat
.
share
({
titie
:
this
.
$getNavigationBarTitle
()});
}
this
.
postData
();
// #endif
},
onPullDownRefresh
()
{
...
...
@@ -97,6 +98,20 @@
goBack
()
{
this
.
$backup
();
},
// 向小程序发送数据
postData
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// this.$wechat.postData('谛宝多多商城-首页');
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
'谛宝多多商城-首页'
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
});
}
});
},
getData
(
params
)
{
uni
.
request
({
url
:
'/uni/api/credit_goods/get_credit_second_goods'
,
...
...
This diff is collapsed.
Click to expand it.
pages/detail/detail.vue
View file @
9034a2a3
...
...
@@ -75,6 +75,7 @@
if
(
this
.
$wechat
&&
this
.
$wechat
.
isWechat
())
{
this
.
$wechat
.
share
({
titie
:
this
.
$getNavigationBarTitle
()});
}
this
.
postData
();
// #endif
},
onPullDownRefresh
()
{
...
...
@@ -97,6 +98,20 @@
goBack
()
{
this
.
$backup
();
},
// 向小程序发送数据
postData
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// this.$wechat.postData('谛宝多多商城-首页');
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
'谛宝多多商城'
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
});
}
});
},
getData
(
params
)
{
uni
.
request
({
url
:
'/uni/api/credit_goods/get_credit_all_goods'
,
...
...
This diff is collapsed.
Click to expand it.
pages/financial/financialstage.vue
View file @
9034a2a3
...
...
@@ -98,6 +98,7 @@
if
(
this
.
$wechat
&&
this
.
$wechat
.
isWechat
())
{
this
.
$wechat
.
share
({
titie
:
this
.
$getNavigationBarTitle
()});
}
this
.
postData
();
// #endif
},
methods
:
{
...
...
@@ -161,6 +162,20 @@
backHome
(){
this
.
$jump
(
'/pages/home/home'
,
2
);
},
// 向小程序发送数据
postData
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// this.$wechat.postData('谛宝多多商城-首页');
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
'谛宝多多商城'
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
});
}
});
},
navigate
(
url
)
{
uni
.
navigateTo
({
url
:
url
...
...
This diff is collapsed.
Click to expand it.
pages/home/home.vue
View file @
9034a2a3
...
...
@@ -70,6 +70,7 @@
if
(
this
.
$wechat
&&
this
.
$wechat
.
isWechat
())
{
this
.
$wechat
.
share
({
titie
:
this
.
$getNavigationBarTitle
()});
}
this
.
postData
();
// #endif
},
onPageScroll
()
{
...
...
@@ -120,6 +121,20 @@
this
.
$jump
(
`
${
origin
}
/mobile/index.php?app=coupon&act=view&id=
${
this
.
COUPON_ID
}
`
);
this
.
$refs
.
popup
.
close
();
},
// 向小程序发送数据
postData
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// this.$wechat.postData('谛宝多多商城-首页');
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
'谛宝多多商城-首页'
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
});
}
});
},
get_coupon
(
reg_time
){
// 打开广告弹窗
const
timestamp
=
new
Date
(
'2020/05/19 00:00:00'
).
getTime
()
/
1000
;
...
...
This diff is collapsed.
Click to expand it.
pages/index/index.vue
View file @
9034a2a3
...
...
@@ -122,6 +122,7 @@
if
(
this
.
$wechat
&&
this
.
$wechat
.
isWechat
())
{
this
.
$wechat
.
share
({
titie
:
this
.
$getNavigationBarTitle
()
}
);
}
this
.
postData
();
// #endif
}
,
components
:
{
...
...
@@ -136,6 +137,20 @@
search
()
{
window
.
location
.
href
=
`${php
}
app=search&act=index&keyword=${this.keyword
}
`
}
,
// 向小程序发送数据
postData
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// this.$wechat.postData('谛宝多多商城-首页');
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
'谛宝多多商城'
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
}
);
}
}
);
}
,
changeCurrent
(
index
)
{
this
.
current
=
index
;
}
,
...
...
This diff is collapsed.
Click to expand it.
pages/search/search.vue
View file @
9034a2a3
...
...
@@ -111,6 +111,7 @@
if
(
this
.
$wechat
&&
this
.
$wechat
.
isWechat
())
{
this
.
$wechat
.
share
({
titie
:
this
.
$getNavigationBarTitle
()});
}
this
.
postData
();
// #endif
this
.
param
=
{...
this
.
param
,
...
option
};
this
.
searchVal
=
option
.
keyword
;
...
...
@@ -138,6 +139,20 @@
url
:
'/pages/home/home'
})
},
// 向小程序发送数据
postData
(){
jWeixin
.
miniProgram
.
getEnv
(
function
(
res
)
{
//获取当前环境
if
(
res
.
miniprogram
){
// this.$wechat.postData('谛宝多多商城-首页');
const
postData
=
{
link
:
window
.
location
.
href
,
title
:
'谛宝多多商城'
}
jWeixin
.
miniProgram
.
postMessage
({
data
:
JSON
.
stringify
(
postData
)
});
}
});
},
// 加入购物车
addCart
(
spec_id
,
quantity
)
{
this
.
$addCart
(
spec_id
,
quantity
,
this
.
isLogin
);
...
...
This diff is collapsed.
Click to expand it.
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