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
522b4ae7
Commit
522b4ae7
authored
Jun 30, 2020
by
王建威
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序登录 支付
parent
3eaa2429
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2865 additions
and
52 deletions
+2865
-52
index.html
index.html
+0
-38
main.js
main.js
+54
-11
wxpay.vue
pages/wxpay/wxpay.vue
+3
-3
yarn.lock
yarn.lock
+2808
-0
No files found.
index.html
View file @
522b4ae7
...
...
@@ -81,44 +81,6 @@
$draggable
.
on
(
'staticClick'
,
function
(
event
,
pointer
)
{
$
(
'#qidian_dom'
).
click
();
})
const
{
origin
}
=
window
.
location
;
let
url
=
''
;
// 测试环境
if
(
origin
.
indexOf
(
'local'
)
>
-
1
||
origin
.
indexOf
(
'test'
)
>
-
1
){
if
(
origin
.
indexOf
(
'test'
)
>
-
1
){
url
=
`
${
origin
}
/mobile/index.php?`
;
}
else
{
url
=
'https://test.pet-dbc.cn/mobile/index.php?'
;
}
}
else
if
(
origin
.
indexOf
(
'jingxiang'
)
>
-
1
){
url
=
'https://jingxiang.pet-dbc.cn/mobile/index.php?'
;
}
else
{
url
=
'https://shop.pet-dbc.cn/mobile/index.php?'
;
}
var
search
=
window
.
location
.
href
.
split
(
'?'
);
if
(
search
[
1
])
{
var
arr
=
search
[
1
].
split
(
'&'
);
arr
.
every
((
item
,
index
)
=>
{
var
kv
=
item
.
split
(
'='
);
if
(
kv
[
0
]
===
'openId'
)
{
localStorage
.
openId
=
kv
[
1
];
$
.
ajax
({
url
:
url
+
'app=weixin&act=autoLogin'
,
type
:
'get'
,
data
:
{
openid
:
kv
[
1
]
},
dataType
:
'json'
,
success
:
function
(
res
)
{
alert
(
JSON
.
stringify
(
res
))
}
})
}
if
(
kv
[
0
]
===
'inionid'
)
{
localStorage
.
unionid
=
kv
[
1
];
}
});
}
</script>
<!-- built files will be auto injected -->
</body>
...
...
main.js
View file @
522b4ae7
...
...
@@ -6,13 +6,13 @@ import {
go
}
from
'@/common/host.js'
;
import
{
getNavigationBarTitle
,
getNavigationBarTitle
,
getCache
}
from
'./common/util.js'
;
// 微信分享公共接口
// #ifdef H5
import
wechat
from
'./common/wechat.js'
;
import
wechat
from
'./common/wechat.js'
;
Vue
.
prototype
.
$wechat
=
wechat
;
// if (wechat.isWechat() || wechat.isMini()) {
// Vue.prototype.$wechat = wechat;
...
...
@@ -20,6 +20,49 @@ Vue.prototype.$wechat = wechat;
// #endif
Vue
.
config
.
productionTip
=
false
;
const
{
origin
}
=
window
.
location
;
let
url
=
''
;
// 测试环境
if
(
origin
.
indexOf
(
'local'
)
>
-
1
||
origin
.
indexOf
(
'test'
)
>
-
1
)
{
if
(
origin
.
indexOf
(
'test'
)
>
-
1
)
{
url
=
origin
+
'/mobile/index.php?'
;
}
else
{
url
=
'https://test.pet-dbc.cn/mobile/index.php?'
;
}
}
else
if
(
origin
.
indexOf
(
'jingxiang'
)
>
-
1
)
{
url
=
'https://jingxiang.pet-dbc.cn/mobile/index.php?'
;
}
else
{
url
=
'https://shop.pet-dbc.cn/mobile/index.php?'
;
}
var
search
=
window
.
location
.
href
.
split
(
'?'
);
if
(
search
[
1
])
{
var
arr
=
search
[
1
].
split
(
'&'
);
arr
.
every
((
item
,
index
)
=>
{
var
kv
=
item
.
split
(
'='
);
if
(
kv
[
0
]
===
'openId'
)
{
localStorage
.
openId
=
kv
[
1
];
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
3650
*
24
*
60
*
60
*
1000
);
document
.
cookie
=
'openId='
+
kv
[
1
]
+
';expires='
+
exp
.
toGMTString
();
$
.
ajax
({
url
:
url
+
'app=weixin&act=autoLogin'
,
type
:
'get'
,
data
:
{
openid
:
kv
[
1
]
},
dataType
:
'json'
,
success
:
function
(
res
)
{
alert
(
JSON
.
stringify
(
res
))
}
})
}
if
(
kv
[
0
]
===
'inionid'
)
{
localStorage
.
unionid
=
kv
[
1
];
}
});
}
// 加入购物车
function
addCart
(
spec_id
,
quantity
,
isLogin
)
{
...
...
@@ -62,7 +105,7 @@ function __reloadResource(_this) {
_this
.
_source
.
default_image
=
'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/20190605/goods/5cf78b96601be.png?x-oss-process=image/resize,m_lfit,w_300,h_300/auto-orient,0/quality,Q_85/format,jpg'
;
}
// 毫秒数转时间
// 毫秒数转时间
// 跳转商品详情页,只传一个商品ID,方便以后全局修改
...
...
@@ -82,15 +125,15 @@ function backup() {
// 跳转外部链接,使用webview
function
jump
(
url
,
type
)
{
// #ifdef H5
if
(
type
===
1
)
{
if
(
type
===
1
)
{
// 重定向到指定地址,防止回退
window
.
location
.
replace
(
url
);
}
else
if
(
type
===
2
){
uni
.
navigateTo
({
url
:
url
}
else
if
(
type
===
2
)
{
uni
.
navigateTo
({
url
:
url
})
}
else
{
window
.
location
.
href
=
url
;
}
else
{
window
.
location
.
href
=
url
;
}
// #endif
...
...
@@ -104,7 +147,7 @@ function jump(url, type) {
}
Vue
.
prototype
.
$jumpGoodDetail
=
jumpGoodDetail
;
Vue
.
prototype
.
$jump
=
jump
;
Vue
.
prototype
.
$jump
=
jump
;
Vue
.
prototype
.
$getCache
=
getCache
;
Vue
.
prototype
.
$addCart
=
addCart
;
Vue
.
prototype
.
$backup
=
backup
;
...
...
@@ -122,4 +165,4 @@ const app = new Vue({
...
App
,
store
})
app
.
$mount
()
app
.
$mount
()
pages/wxpay/wxpay.vue
View file @
522b4ae7
...
...
@@ -78,10 +78,10 @@
},
2000
);
return
;
}
wx
.
miniProgram
.
getEnv
(
function
(
res
)
{
if
(
res
.
miniprogram
){
jWeixin
.
miniProgram
.
getEnv
(
function
(
result
)
{
if
(
res
ult
.
miniprogram
){
var
path
=
'/pages/pay/index?payParam='
+
encodeURIComponent
(
JSON
.
stringify
(
res
))
+
'&type=uni'
;
wx
.
miniProgram
.
navigateTo
({
url
:
path
});
jWeixin
.
miniProgram
.
navigateTo
({
url
:
path
});
}
else
{
WeixinJSBridge
.
invoke
(
'getBrandWCPayRequest'
,
{
...
...
yarn.lock
0 → 100644
View file @
522b4ae7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
郑秀明
@zhengxiuming
mentioned in commit
d1ecdebd
·
Sep 07, 2020
mentioned in commit
d1ecdebd
mentioned in commit d1ecdebd6a8da34f70b1c0c72a7b22b48e906c48
Toggle commit list
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