Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
c2d31d62
Unverified
提交
c2d31d62
authored
3月 02, 2022
作者:
fit2cloud-chenyw
提交者:
GitHub
3月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1870 from dataease/pr@v1.8@style_adapt_screen
style: 移动端仪表板自适应屏幕
上级
0df2cbf4
0aea242d
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
60 行增加
和
77 行删除
+60
-77
detail.nvue
mobile/src/pages/tabBar/home/detail.nvue
+60
-77
没有找到文件。
mobile/src/pages/tabBar/home/detail.nvue
浏览文件 @
c2d31d62
...
...
@@ -21,13 +21,21 @@
</block>
</uni-nav-bar>
<view v-if="url">
<web-view
:webview-styles="webViewStyles"
style="height: 100vh;"
>
</web-view>
</view>
<scroll-view
:scroll-top="scrollTop"
scroll-y="true"
class="scroll-Y"
@scrolltoupper="upper"
@scrolltolower="lower"
@scroll="scroll">
<web-view v-if="url" :style="{height: viewHeight}" />
</scroll-view>
...
...
@@ -73,16 +81,15 @@
title: '',
banner: {},
htmlNodes: [],
webViewStyles: {
progress: {
color: '#FF3333'
},
height: '700px'
},
url: '',
hasStar: false,
refreshCount: 0
refreshCount: 0,
scrollTop: 0,
old: {
scrollTop: 0
},
viewHeight: null
}
},
onLoad(event) {
...
...
@@ -101,12 +108,12 @@
uni.setNavigationBarTitle({
title: this.banner.title
});
// this.getDetail();
this.addRecent()
uni.$emit('loadHomeIndex', {
index: 1
})
this.loadStarStatus()
this.caclViewHeight()
},
...
...
@@ -118,68 +125,10 @@
uni.navigateBack()
},
onShareAppMessage() {
return {
title: this.banner.title,
path: DETAIL_PAGE_PATH + '?detailDate=' + JSON.stringify(this.banner)
}
},
onNavigationBarButtonTap(event) {
const buttonIndex = event.index;
if (buttonIndex === 0) {
// 分享 H5 的页面
const shareProviders = [];
uni.getProvider({
service: 'share',
success: (result) => {
// 目前仅考虑分享到微信
if (result.provider && result.provider.length && ~result.provider.indexOf('weixin')) {
const channels = _handleShareChannels(result.provider);
uni.showActionSheet({
itemList: channels.map(channel => {
return channel.text;
}),
success: (result) => {
const tapIndex = result.tapIndex;
uni.share({
provider: 'weixin',
type: 0,
title: this.banner.title,
scene: tapIndex === 0 ? 'WXSceneSession' : 'WXSenceTimeline',
href: 'https://uniapp.dcloud.io/h5' + DETAIL_PAGE_PATH + '?detailDate=' + JSON.stringify(this.banner),
imageUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b6304f00-5168-11eb-bd01-97bc1429a9ff.png'
});
}
});
} else {
uni.showToast({
title: '未检测到可用的微信分享服务'
});
}
},
fail: (error) => {
uni.showToast({
title: '获取分享服务失败'
});
}
});
}
},
methods: {
getDetail() {
uni.request({
url: 'https://unidemo.dcloud.net.cn/api/news/36kr/' + this.banner.post_id,
success: (data) => {
if (data.statusCode == 200) {
var htmlString = data.data.content.replace(/\\/g, "").replace(/<img/g, "<img style=\"display:none;\"");
//this.htmlNodes = htmlParser(htmlString);
}
},
fail: () => {
console.log('fail');
}
});
},
addRecent() {
const item = {id: this.banner.id, title: this.banner.title, index: this.banner.index}
addRecent(item)
...
...
@@ -215,17 +164,31 @@
})
},
loadLinkUrl() {
this.url = process.env.VUE_APP_BASE_API + 'tempMobileLink/' + this.banner.id + "/" + getToken()
const url = this.url
/* uni.hideLoading() */
setTimeout(() => {
const iframe = document.getElementsByTagName("iframe")[0]
// iframe.style.height = (ktxScreentHeight - ktxStatusHeight) + 'px'
iframe.src = url
iframe.onload = e => {
uni.hideLoading()
}
}, 1000);
},
caclViewHeight() {
let systemInfo = uni.getSystemInfoSync()
let pxToRpxScale = 750 / systemInfo.windowWidth;
// 屏幕的高度
let ktxScreentHeight = systemInfo.screenHeight * pxToRpxScale
// 状态栏的高度
let ktxStatusHeight = systemInfo.statusBarHeight * pxToRpxScale
// 导航栏的高度
let navigationHeight = 44 * pxToRpxScale
this.viewHeight = (ktxScreentHeight - ktxStatusHeight) + 'px'
},
back() {
// #ifdef H5
...
...
@@ -245,6 +208,26 @@
return
// #endif
uni.navigateBack(1)
},
upper: function(e) {
console.log(e)
},
lower: function(e) {
console.log(e)
},
scroll: function(e) {
console.log(e)
this.old.scrollTop = e.detail.scrollTop
},
goTop: function(e) {
this.scrollTop = this.old.scrollTop
this.$nextTick(() => {
this.scrollTop = 0
});
uni.showToast({
icon:"none",
title:"纵向滚动 scrollTop 值已被修改为 0"
})
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论