Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
Harvey
/
ydu-lottery-shop-app
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2f7067dd
由
Harvey
编写于
2022-04-25 16:12:25 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
代码优化
1 个父辈
c49c2ec4
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
36 行增加
和
40 行删除
src/common/request.js
src/pages/center/share.vue
src/pages/tv/info.vue
src/pages/tv/list.vue
src/static/js/h5-utils.js
src/common/request.js
查看文件 @
2f7067d
//const baseUrl = 'https://app.ydniu.com/graphql'
//const baseUrl = 'https://app.ydniu.com/graphql'
const
baseUrl
=
'/test_graphql'
//
const baseUrl = '/test_graphql'
//
const baseUrl = '/graphql'
const
baseUrl
=
'/graphql'
function
request
(
options
=
{})
{
function
request
(
options
=
{})
{
...
@@ -35,15 +35,13 @@ function post(options = {}) {
...
@@ -35,15 +35,13 @@ function post(options = {}) {
}
}
async
function
graphql
(
options
=
{})
{
async
function
graphql
(
options
=
{})
{
let
header
=
{}
let
header
=
{}
try
{
if
(
Android
)
{
//#ifdef H5
header
[
"ydn-cookie"
]
=
`connect.sid=
${
JSON
.
parse
(
Android
.
getSystemInfo
())[
'Cookie'
][
'connect.sid'
]}
`
if
(
window
.
Android
)
{
}
header
[
"ydn-cookie"
]
=
`connect.sid=
${
JSON
.
parse
(
window
.
Android
.
getSystemInfo
())[
'Cookie'
][
'connect.sid'
]}
`
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
}
}
//#endif
let
opts
=
Object
.
assign
({
let
opts
=
Object
.
assign
({
type
:
'query'
type
:
'query'
...
@@ -74,13 +72,18 @@ async function graphql(options = {}) {
...
@@ -74,13 +72,18 @@ async function graphql(options = {}) {
res
=
res
.
data
.
data
[
opts
.
name
]
res
=
res
.
data
.
data
[
opts
.
name
]
if
(
res
.
Error
==
'未登录'
)
{
if
(
res
.
Error
==
'未登录'
)
{
try
{
if
(
Android
)
window
.
location
.
href
=
'ydncp://www.ydniu.com?type=7'
//#ifdef H5
}
catch
(
e
)
{
if
(
window
.
Android
)
{
window
.
location
.
href
=
'ydncp://www.ydniu.com?type=7'
return
}
//#endif
uni
.
redirectTo
({
uni
.
redirectTo
({
url
:
`/login?from=
${
encodeURIComponent
(
getCurrentPages
()[
0
].
__page__
.
fullPath
)}
`
url
:
`/login?from=
${
encodeURIComponent
(
getCurrentPages
()[
0
].
__page__
.
fullPath
)}
`
})
})
}
return
return
}
}
...
...
src/pages/center/share.vue
查看文件 @
2f7067d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<image
mode=
"widthFix"
:src=
"src"
></image>
<image
mode=
"widthFix"
:src=
"src"
></image>
</view>
</view>
<view
class=
"page-tabbar"
>
<view
class=
"page-tabbar"
>
<view
class=
"page-tabbar-tip
red
"
@
click=
"save"
>
保存海报去分享
</view>
<view
class=
"page-tabbar-tip"
@
click=
"save"
>
保存海报去分享
</view>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -20,14 +20,7 @@
...
@@ -20,14 +20,7 @@
methods
:
{
methods
:
{
save
()
{
save
()
{
//#ifdef H5
//#ifdef H5
try
{
require
(
'@/static/js/h5-utils.js'
).
downloadIamge
(
this
.
src
)
if
(
Android
)
{
Android
.
save2Album
(
this
.
src
)
}
}
catch
(
e
)
{
const
$h5
=
require
(
'@/static/js/h5-utils.js'
)
$h5
.
downloadIamge
(
this
.
src
)
}
//#endif
//#endif
}
}
}
}
...
...
src/pages/tv/info.vue
查看文件 @
2f7067d
...
@@ -40,14 +40,10 @@
...
@@ -40,14 +40,10 @@
}
}
//#ifdef H5
//#ifdef H5
try
{
if
(
window
.
Android
)
{
if
(
Android
)
{
const
$h5
=
require
(
'@/static/js/h5-utils.js'
)
const
$h5
=
require
(
'@/static/js/h5-utils.js'
)
$h5
.
head_tv
(
this
.
src
)
$h5
.
head_tv
(
this
.
src
)
}
}
}
catch
(
e
)
{
}
//#endif
//#endif
},
},
methods
:
{
methods
:
{
...
@@ -67,14 +63,7 @@
...
@@ -67,14 +63,7 @@
},
},
save
()
{
save
()
{
//#ifdef H5
//#ifdef H5
try
{
require
(
'@/static/js/h5-utils.js'
).
downloadIamge
(
this
.
src
)
if
(
Android
)
{
Android
.
save2Album
(
this
.
src
)
}
}
catch
(
e
)
{
const
$h5
=
require
(
'@/static/js/h5-utils.js'
)
$h5
.
downloadIamge
(
this
.
src
)
}
//#endif
//#endif
}
}
}
}
...
...
src/pages/tv/list.vue
查看文件 @
2f7067d
...
@@ -60,12 +60,10 @@
...
@@ -60,12 +60,10 @@
},
},
async
onLoad
()
{
async
onLoad
()
{
//#ifdef H5
//#ifdef H5
try
{
if
(
window
.
Android
)
{
if
(
Android
)
{
const
$h5
=
require
(
'@/static/js/h5-utils.js'
)
const
$h5
=
require
(
'@/static/js/h5-utils.js'
)
$h5
.
remove_uni_page_head
()
$h5
.
remove_uni_page_head
()
}
}
}
catch
(
e
)
{}
//#endif
//#endif
this
.
bindData
()
this
.
bindData
()
},
},
...
...
src/static/js/h5-utils.js
查看文件 @
2f7067d
...
@@ -24,7 +24,20 @@ export function head_tv(url) {
...
@@ -24,7 +24,20 @@ export function head_tv(url) {
});
});
}
}
export
function
downloadIamge
(
imgsrc
){
export
function
downloadIamge
(
imgsrc
)
{
if
(
window
.
Android
)
{
window
.
Android
.
save2Album
(
imgsrc
)
return
}
if
(
window
.
WeixinJSBridge
)
{
uni
.
showToast
({
title
:
'长按图片保存'
})
return
}
const
image
=
new
Image
()
const
image
=
new
Image
()
// 允许资源跨域使用
// 允许资源跨域使用
image
.
setAttribute
(
'crossOrigin'
,
'anonymous'
)
image
.
setAttribute
(
'crossOrigin'
,
'anonymous'
)
...
@@ -46,4 +59,4 @@ export function downloadIamge(imgsrc){
...
@@ -46,4 +59,4 @@ export function downloadIamge(imgsrc){
a
.
href
=
url
a
.
href
=
url
a
.
dispatchEvent
(
event
)
a
.
dispatchEvent
(
event
)
}
}
}
\ No newline at end of file
\ No newline at end of file
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论