175 lines
4.2 KiB
Plaintext
175 lines
4.2 KiB
Plaintext
<template>
|
|
<view class="page-user">
|
|
<web-view src="{{url}}"></web-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import wepy from '@wepy/core'
|
|
import https from '../../mixins/https'
|
|
import base from '../../mixins/base'
|
|
|
|
import { service } from '../../config.js'
|
|
|
|
wepy.page({
|
|
mixins: [base, https],
|
|
|
|
data: {
|
|
libraries: {},
|
|
user: {},
|
|
nickName: '加载中...',
|
|
from_openid: '',
|
|
url: ''
|
|
},
|
|
|
|
computed: {
|
|
nickName() {
|
|
// return (user && user.wechat && user.wechat.nickname) ? user.wechat.nickname : '未授权用户'
|
|
}
|
|
},
|
|
|
|
onShow() {
|
|
// 初始化页面数据
|
|
// this.initPageData()
|
|
// this.$parent.getTracker(this.$root.$name, this.config.navigationBarTitleText)
|
|
},
|
|
onShareAppMessage(res) {
|
|
let that = this
|
|
let fromUserID = wx.getStorageSync('user_id')
|
|
let url = '/pages/books/bookDetail?url=' + encodeURIComponent(that.url) + '&from_openid=' + that.from_openid + '&from_user_id=' + fromUserID
|
|
return {
|
|
title: '福恋',
|
|
path: url,
|
|
imageUrl: '',
|
|
success: function(res) {
|
|
wx.showToast({
|
|
title: '转发成功',
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
var shareTickets = res.shareTickets
|
|
if (shareTickets.length == 0) {
|
|
return false
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
// 转发失败
|
|
}
|
|
}
|
|
},
|
|
|
|
onLoad(e) {
|
|
console.log(e)
|
|
this.url = decodeURIComponent(e.url)
|
|
console.log(this.url)
|
|
this.from_openid = wx.getStorageSync('openid')
|
|
wx.showShareMenu({
|
|
withShareTicket: true
|
|
})
|
|
},
|
|
|
|
onPullDownRefresh() {
|
|
// this.initPageData()
|
|
},
|
|
|
|
methods: {
|
|
// 初始化页面数据
|
|
initPageData() {
|
|
this.$get({url: service.user}).then(({code, data}) => {
|
|
this.user = data.user
|
|
this.libraries = data.libraries
|
|
this.libraries.forEach((item) => {
|
|
if (item.type == 'SHARE') {
|
|
item.url = '/pages/library/shareLibrary?id=' + item.id
|
|
} else {
|
|
item.url = '/pages/library/library?id=' + item.id
|
|
}
|
|
})
|
|
wx.setStorageSync('openid', data.user.wechat.openid)
|
|
wx.setStorageSync('is_new', data.user.is_news)
|
|
if (data.user.is_news) {
|
|
wepy.showTabBarRedDot({
|
|
index: 4
|
|
})
|
|
} else {
|
|
wepy.hideTabBarRedDot({
|
|
index: 4
|
|
})
|
|
}
|
|
})
|
|
},
|
|
goto(url) {
|
|
wx.navigateTo({url: url})
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style lang="less">
|
|
|
|
page{
|
|
background: #f9f9f9;
|
|
}
|
|
.weui-cells {
|
|
position: inherit;
|
|
box-shadow: 1rpx 1rpx 12rpx #dedede;
|
|
}
|
|
.page-user{
|
|
@userinfoHeight: 100rpx;
|
|
@userinfoSpace: 8rpx;
|
|
|
|
.userinfo{
|
|
padding: 20rpx 0;
|
|
}
|
|
.page__bd_spacing{
|
|
padding: 22rpx;
|
|
}
|
|
|
|
.userinfo-avatar {
|
|
float: left;
|
|
width: @userinfoHeight;
|
|
height: @userinfoHeight;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
// space + space
|
|
.userinfo-info {
|
|
float: left;
|
|
line-height: 1;
|
|
padding: @userinfoSpace 0;
|
|
margin-left: 3 * @userinfoSpace;
|
|
}
|
|
|
|
.userinfo-nickname {
|
|
font-size: (@userinfoHeight - 4 * @userinfoSpace) * (16 / 30);
|
|
margin-bottom: 2 * @userinfoSpace;
|
|
}
|
|
.userinfo-status {
|
|
color: #999;
|
|
font-size: (@userinfoHeight - 4 * @userinfoSpace) * (14 / 30);
|
|
|
|
}
|
|
.lead {
|
|
width: 16rpx;
|
|
height: 16rpx;
|
|
background: red;
|
|
margin-top: -24rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
right: 16rpx;
|
|
top: 40rpx;
|
|
}
|
|
}
|
|
</style>
|
|
<config>
|
|
{
|
|
navigationBarTitleText: '链接网文',
|
|
enablePullDownRefresh: false,
|
|
backgroundColorTop: '#f2f2f2',
|
|
backgroundColorBottom: '#f2f2f2',
|
|
usingComponents: {
|
|
chatEmoji: '~@/components/chatEmojiFile/ChatEmoji'
|
|
}
|
|
}
|
|
</config>
|