Commit 27c6e336 authored by yuwenwen's avatar yuwenwen

修改移动端起始页面,图片预览问题

parent d4ea2053
......@@ -12,25 +12,28 @@
<view class="comment-display-box" v-else>
<view class="comment-item" v-for="(item,index) in commentList">
<view class="user-info">
<view class="username">{{item.nickName}}</view>
<view style="display: flex;align-items: center;">
<view class="username">{{item.nickName}}</view>
<view class="datetime">{{item.createTime}}</view>
</view>
<view class="content">
<view class="text" v-if="!item.replyNickName" @click.stop="handleReplayComment(item)">{{item.content}}</view>
<view class="text" v-else @click.stop="handleReplayComment(item)">
回复<span style="color: #0058B6;">{{item.replyNickName}}</span>{{item.content}}
</view>
<view class="operation-text">
<view class="add-text mr10" v-if="form.isSelf==1&&activeIndex==1 &&item.isFeatured==0 &&form.isEnableFeaturedComment==1"
@click="handleFeatured(item)">加入精选</view>
<view class="mr10" v-if="form.isSelf==1&&activeIndex==1 &&item.isFeatured==1&&form.isEnableFeaturedComment==1" @click="handleFeatured(item)">
取消精选</view>
<view v-if="activeIndex==0&&item.isFeatured==1" style="color: #F2AC39;margin-right: 10rpx;">精选</view>
<view v-if="item.isSelf==1" @click.stop="handleDelete(item)">删除</view>
<view style="color: #bbb;" v-if="item.isSelf==1 || userInfo.bbsAdmin" @click.stop="handleDelete(item)">删除</view>
</view>
</view>
<view class="content">
<view class="text" v-if="!item.replyNickName" @click.stop="handleReplayComment(item)">{{item.content}}</view>
<view class="text" v-else @click.stop="handleReplayComment(item)">
回复<span style="color: #0058B6;">{{item.replyNickName}}</span>{{item.content}}
</view>
</view>
</view>
<view class="show-more-box" v-if="commentList.length < total" @click="loadMore">
加载更多
......@@ -50,6 +53,7 @@
delComment,
dynamicDetailComments
} from '@/api/api.js'
import { getUserInfo } from '@/utils/auth';
export default {
name: "Comment-Item",
data() {
......@@ -61,7 +65,8 @@
pageSize: 10,
momentId: ''
},
total:0
total:0,
userInfo:{}
};
},
components: {
......@@ -81,6 +86,7 @@
if(newVal.id){
this.queryParams.momentId = newVal.id;
this.commentList = [];
this.userInfo = JSON.parse(getUserInfo())
this.getCommentList()
}
}
......@@ -220,19 +226,22 @@
.user-info {
display: flex;
justify-content: space-between;
font-size: 24rpx;
.username {
width: calc(100% - 300rpx);
color: black;
color: #0058B6;
}
.datetime {
width: 290rpx;
text-align: right;
margin-left: 16rpx;
color: #999999;
}
.operation-text {
width: 180rpx;
text-align: right;
display: flex;
align-items: center;
justify-content: flex-end;
}
}
.content {
......@@ -244,14 +253,7 @@
width: calc(100% - 180rpx);
}
.operation-text {
width: 180rpx;
text-align: right;
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.mr10{
margin-right: 12rpx;
}
......
......@@ -22,7 +22,7 @@
<rich-text v-if="preNodes.length > 0" :nodes="preNodes"></rich-text>
<view class="imgs" v-if="form.type=='IMAGE'&&form.attachments && form.attachments.length > 0">
<template v-for="(item,index) in form.attachments">
<image class="item" :src="item.url" @click.stop="preview(item.url)"></image>
<image class="item" :src="item.url" @click.stop="preview(form.attachments,index)"></image>
</template>
</view>
<view class="imgs" v-if="form.type=='VIDEO'&&form.attachments && form.attachments.length > 0">
......@@ -54,7 +54,7 @@
</view>
<view class="pk-imgs" v-if="form.voteOptionType=='IMAGE' && form.voteOptions.length>0 ">
<template v-for="(item,index) in form.voteOptions">
<image :src="item.imageUrl" @click.stop="preview(item.imageUrl)" class="img"></image>
<image :src="item.imageUrl" @click.stop="preview(form.voteOptions,index)" class="img"></image>
</template>
</view>
<!-- 未投票 -->
......@@ -102,20 +102,22 @@
<view class="comment-display-box" v-if="form.comments&& form.comments.length>0">
<view class="comment-item" v-for="(item,index) in form.comments">
<view class="user-info">
<view class="username">{{item.nickName}}:</view>
<view style="display: flex;align-items: center;">
<view class="username">{{item.nickName}}</view>
<view class="datetime">{{item.createTime}}</view>
</view>
<view class="operation-text">
<view v-if="item.isFeatured==1" style="color: #F2AC39;margin-right: 10rpx;">精选</view>
<view style="color: #bbb;" v-if="item.isSelf==1 || userInfo.bbsAdmin" @click.stop="handleDelete(item)">删除</view>
</view>
</view>
<view class="content">
<view class="text" v-if="!item.replyNickName" @click.stop="handleReplayComment(item)">
{{item.content}}
</view>
<view class="text" v-else @click.stop="handleReplayComment(item)">
回复<span style="color: #0058B6;">{{item.replyNickName}}:</span>{{item.content}}
</view>
<view class="operation-text">
<view v-if="item.isFeatured==1" style="color: #F2AC39;margin-right: 10rpx;">精选</view>
<view v-if="item.isSelf==1" @click.stop="handleDelete(item)">删除</view>
回复<span style="color: #0058B6;">{{item.replyNickName}}</span>{{item.content}}
</view>
</view>
</view>
......@@ -139,6 +141,7 @@
import PublishComment from './PublishComment.vue';
import VideoPreview from './VideoPreview.vue';
import emotions from '@/utils/emjo';
import { getUserInfo } from '@/utils/auth';
export default {
name: "Dynamic-Item",
data() {
......@@ -150,7 +153,8 @@
clientY: 0,
showDelBtn: false,
preNodes: [],
emotions
emotions,
userInfo:{}
};
},
components: {
......@@ -175,6 +179,7 @@
if (val === oldVal) {
return;
}
this.userInfo = JSON.parse(getUserInfo())
this.preNodes = this.formatContent(val)
}
}
......@@ -335,10 +340,16 @@
});
},
// 预览图片
preview(url) {
preview(list,index) {
let urls = list.map((item)=>{
return item.url;
})
if(urls.length > 0){
uni.previewImage({
urls: [url]
urls: urls,
current:index
});
}
},
//预览视频
videoPreview(url) {
......
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path" : "pages/login/login",
"style" :
{
"navigationBarTitleText" : ""
}
},
{
"path": "pages/index/index",
"style": {
......@@ -15,47 +8,48 @@
}
},
{
"path" : "pages/topics/topics",
"style" :
"path": "pages/login/login",
"style": {
"navigationBarTitleText": ""
}
},
{
"navigationBarTitleText" : "话题",
"path": "pages/topics/topics",
"style": {
"navigationBarTitleText": "话题",
"enablePullDownRefresh": true
}
},
{
"path" : "pages/mine/mine",
"style" :
{
"navigationBarTitleText" : "我的"
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path" : "pages/publish/publish",
"style" :
{
"navigationBarTitleText" : "发布"
"path": "pages/publish/publish",
"style": {
"navigationBarTitleText": "发布"
}
},
{
"path" : "pages/dynamic-detail/dynamic-detail",
"style" :
{
"navigationBarTitleText" : "动态详情"
"path": "pages/dynamic-detail/dynamic-detail",
"style": {
"navigationBarTitleText": "动态详情"
}
},
{
"path" : "pages/topic-detail/topic-detail",
"style" :
{
"navigationBarTitleText" : "话题详情",
"path": "pages/topic-detail/topic-detail",
"style": {
"navigationBarTitleText": "话题详情",
"enablePullDownRefresh": true
}
},
{
"path" : "pages/pk-detail/pk-detail",
"style" :
{
"navigationBarTitleText" : "PK详情"
"path": "pages/pk-detail/pk-detail",
"style": {
"navigationBarTitleText": "PK详情"
}
}
],
......
......@@ -52,6 +52,7 @@
ListEmpty
},
onLoad() {
this.$store.dispatch('GetInfo')
this.getList()
let _this = this;
uni.$on('hanldeDynamicRefresh', function() {
......
......@@ -40,7 +40,6 @@
login(params).then(res => {
if (res.code == 200 && res.data) {
setToken(res.data)
this.$store.dispatch('GetInfo')
uni.switchTab({
url: '/pages/index/index'
})
......@@ -51,7 +50,6 @@
})
}
if(res.code == 401){
// removeToken()
window.location = res.data
}
})
......
......@@ -50,6 +50,7 @@
grid-template-rows: auto;
row-gap: 6rpx;
column-gap: 6rpx;
margin-top: 12rpx;
.item{
width: 100%;
height: 224rpx;
......@@ -237,34 +238,34 @@
.user-info{
display: flex;
justify-content: space-between;
font-size: 24rpx;
.username{
width: calc(100% - 300rpx);
color: black;
color:#0058B6;
}
.datetime{
width: 290rpx;
text-align: right;
color: #999999;
}
}
.content{
color: black;
margin: 10rpx 0;
display: flex;
.text {
width: calc(100% - 180rpx);
margin-left: 16rpx;
}
.operation-text {
width: 180rpx;
text-align: right;
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
}
.content{
color: black;
margin: 10rpx 0;
display: flex;
.text {
width: 100%;
}
.mr10{
margin-right: 12rpx;
}
......
......@@ -55,9 +55,14 @@ const user = {
}) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
if(res.code == 200){
const user = res.data
commit('SET_USER_INFO', JSON.stringify(user))
resolve(res)
}
if(res.code == 401){
window.location = res.data
}
}).catch(error => {
reject(error)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment