Commit 40bad449 authored by yuwenwen's avatar yuwenwen

移动端调整

parent 28d41209
.DS_Store
node_modules/
unpackage/
dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
**/*.log
tests/**/coverage/
tests/e2e/reports
selenium-debug.log
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.local
package-lock.json
yarn.lock
......@@ -2,8 +2,8 @@
<view>
<view class="dynamic-item" @click="toDynamicDetailPage">
<view class="user-info-box" style="position: relative;">
<image class="avatar" v-if="form.avatar" :src="form.avatar"></image>
<image class="avatar" v-else src="/static/images/default-avatar.png"></image>
<image class="avatar" v-if="form.faceImg" :src="form.faceImg" @error="imgLoadFail"></image>
<!-- <image class="avatar" v-else src="/static/images/default-avatar.png"></image> -->
<view class="user-name">{{form.nickName}}</view>
<image v-if="deleteable || userInfo.bbsAdmin || form.isSelf==1" class="more-icon"
@click.stop="handleDelDynamics" src="/static/images/more-icon.png"></image>
......@@ -35,6 +35,7 @@
</view>
<view class="datetime-box">{{form.createTime}}</view>
<view class="operation-box">
<view class="flex-layout">
<view class="favorite-box">
<image src="/static/images/favorite.png" v-if="form.isLike==0" class="icon"
@click.stop="handleUpdateLikeStatus(1)"></image>
......@@ -42,7 +43,12 @@
@click.stop="handleUpdateLikeStatus(0)" class="icon"></image>
<view class="num">{{form.likeCount}}</view>
</view>
<view class="comment-box" @click.stop="handleOpenComment">
<view class="favorite-box ml-10">
<image src="/static/images/comment.png" class="icon"></image>
<view class="num">{{form.commentCount}}</view>
</view>
</view>
<view class="comment-box" v-if="displayComment" @click.stop="handleOpenComment">
<image class="icon" src="/static/images/comment-icon.png"></image>
<view class="text">评论</view>
</view>
......@@ -53,14 +59,14 @@
<image src="/static/images/pk-icon.png" class="pk-icon"></image>
<view class="pk-title-text">{{form.voteTitle}}</view>
</view>
<view class="pk-imgs" v-if="form.voteOptionType=='IMAGE' && form.voteOptions.length>0 ">
<view class="pk-imgs" v-if="form.voteOptionType=='IMAGE'&&form.voteOptions&&form.voteOptions.length>0 ">
<template v-for="(item,index) in form.voteOptions">
<image :src="item.imageUrl" @click.stop="preview(form.voteOptions,index)" class="img"></image>
</template>
</view>
<!-- 未投票 -->
<view v-if="form.isVote==0">
<view class="pk-btns" v-if="form.voteOptions.length>0 ">
<view class="pk-btns" v-if="form.voteOptions&&form.voteOptions&&form.voteOptions.length>0 ">
<view class="btns red-btn" @click.stop="handleVote(form.voteOptions[0])">
{{form.voteOptions[0].name}}
</view>
......@@ -77,17 +83,18 @@
<view class="left" @click.stop="toPKDetailPage(0)">
<view class="left-num">{{form.voteOptions[0].name}} {{form.voteOptions[0].voteCount}}</view>
</view>
<view class="right" @click.stop="toPKDetailPage(1)">
<view class="right-num">{{form.voteOptions[1].name}} {{form.voteOptions[1].voteCount}}
</view>
<view class="left" :style="'width:' + ((form.voteOptions[0].voteCount/(form.voteOptions[0].voteCount+form.voteOptions[1].voteCount))*100)+'%'"
@click.stop="toPKDetailPage(0)">
<view class="results-item left-item"></view>
</view>
</view>
<view class="pk-results">
<view class="left" :style="'flex:' + form.voteOptions[0].voteCount"
@click.stop="toPKDetailPage(0)">
<view class="results-item left-item"></view>
<view class="right" @click.stop="toPKDetailPage(1)">
<view class="right-num">{{form.voteOptions[1].name}} {{form.voteOptions[1].voteCount}}
</view>
</view>
<view class="right" :style="'flex:' + form.voteOptions[1].voteCount"
<view class="right" :style="'width:' + ((form.voteOptions[1].voteCount/(form.voteOptions[0].voteCount+form.voteOptions[1].voteCount))*100)+'%'"
@click.stop="toPKDetailPage(1)">
<view class="results-item right-item"></view>
</view>
......@@ -99,7 +106,7 @@
</view>
</view>
<!-- 评论区 -->
<view class="comment-box" v-if="form.isEnableComment==1">
<!-- <view class="comment-box" v-if="form.isEnableComment==1">
<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">
......@@ -124,7 +131,7 @@
</view>
</view>
</view>
</view>
</view> -->
</view>
<!-- 发布评论区 -->
<publish-comment :form="form" ref="publishCommentRef" @refresh="$emit('refresh')"></publish-comment>
......@@ -143,9 +150,11 @@
import PublishComment from './PublishComment.vue';
import VideoPreview from './VideoPreview.vue';
import emotions from '@/utils/emjo';
import defalutAvatar from '/static/images/default-avatar.png'
import {
getUserInfo
} from '@/utils/auth';
import {generateSignature} from '@/utils/common.js';
export default {
name: "Dynamic-Item",
data() {
......@@ -173,6 +182,10 @@
deleteable: {
type: Boolean,
default: false
},
displayComment:{
type: Boolean,
default: true
}
},
watch: {
......@@ -184,6 +197,7 @@
return;
}
this.userInfo = JSON.parse(JSON.parse(getUserInfo()))
this.form.faceImg = generateSignature(this.userInfo.userName)
this.preNodes = this.formatContent(val)
}
}
......@@ -282,7 +296,24 @@
// 打开评论区
handleOpenComment() {
// this.showComment = true
const {isEnableVote,isVote} = this.form;
// 如果开启pk,则必须先已经投票才可以评论
if(isEnableVote == 1){
if(isVote == 1){
this.$refs.publishCommentRef.openModal()
}else{
uni.showToast({
title: '请先点击上方PK按钮,选择你的观点后才可进行评论',
icon:'none',
duration:3000
})
return;
}
}else{
this.$refs.publishCommentRef.openModal()
}
},
// 回复评论
handleReplayComment(item) {
......@@ -330,6 +361,7 @@
uni.showToast({
title: '投票成功'
})
uni.$emit('hanldeDynamicRefresh')
this.$emit('refreshCurrent', this.form.id)
}
})
......@@ -369,6 +401,9 @@
});
}
},
imgLoadFail() {
this.userInfo.faceImg = defalutAvatar
},
//预览视频
videoPreview(url) {
this.$refs.videoPreviewRef.openModal(url)
......
......@@ -4,14 +4,20 @@ const CONFIG = {
debug: true,
platformName: '社区',
requestUrl: 'http://192.168.5.177:8089',
videoLimitSize:10
videoLimitSize: 10,
secret: '775d4e98-49d8-86d7-48c9-c93b5f7c0c16',
appId: 'jfsq',
faceBaseUrl: 'https://photo.jift.edu.cn/preview/main/'
},
//生产环境配置
production: {
debug: false,
platformName: '社区',
requestUrl: '/bbs/prod-api',
videoLimitSize:10
videoLimitSize: 10,
secret: '775d4e98-49d8-86d7-48c9-c93b5f7c0c16',
appId: 'jfsq',
faceBaseUrl: 'https://photo.jift.edu.cn/preview/main/'
}
}
......
<template>
<view class="detail-page-container">
<dynamic-item :form="form" @refresh="handleRefresh" @deleteSuccess="deleteSuccess"></dynamic-item>
<dynamic-item :form="form" @refresh="handleRefresh" @refreshCurrent="handleRefresh" @deleteSuccess="deleteSuccess"></dynamic-item>
<!-- 评论管理区 -->
<comment-item :form="form" ></comment-item>
</view>
......
......@@ -11,20 +11,13 @@
<scroll-view class="scroll-view-index" scroll-y :show-scrollbar="false" v-if="list.length>0"
@scrolltolower="loadMore">
<template v-for="(item,index) in list">
<dynamic-item :form="item" @refresh="refreshContentList"
<dynamic-item :form="item" :displayComment="false" @refresh="refreshContentList"
@refreshCurrent="refreshCurrent"></dynamic-item>
</template>
</scroll-view>
<scroll-view class="scroll-view-index" scroll-y :show-scrollbar="false" v-else>
<list-empty></list-empty>
</scroll-view>
<!-- 发布按钮 -->
<!-- <movable-area class="movable-area">
<movable-view class="add-dynamic-box move-button" :x="area.x+'rpx'" :y="area.y + 'rpx'" direction="all"
@change="onChange" damping="30" @click="toPublishPage">
<image class="icon" src="/static/images/publish-icon.png"></image>
</movable-view>
</movable-area> -->
<!-- 发布按钮 -->
<view class="add-dynamic-box" @click="toPublishPage" :style="{ left: iconLeft + 'px', top: iconTop + 'px' }"
......
......@@ -6,8 +6,8 @@
</view>
</view>
<view class="publish-box">
<textarea class="textarea" v-model="form.content" placeholder="分享有趣事~"
placeholder-class="placeholder-class" @focus="handleFocus" />
<textarea class="textarea" v-model="form.content" placeholder="分享有趣事~" placeholder-class="placeholder-class"
@focus="handleFocus" />
<image-upload v-model="form.attachments" ref="uploadRef" :limit="9" :showEmjo="showEmjo" :showIcons="true"
@componentsType="handleSetComponentsType" @handleTopic="handleOpenTopicSelection"
@handleEmjo="handleAddEmjo"></image-upload>
......@@ -33,7 +33,7 @@
<!-- pk数据编辑 -->
<view class="pk-edit-box" v-if="form.isEnableVote==1">
<view class="textarea-box">
<textarea class="textarea" v-model="form.voteTitle" maxlength="12" placeholder="请输入PK标题~(0/12)"
<textarea class="textarea" v-model="form.voteTitle" maxlength="50" placeholder="请输入PK标题~(0/50)"
placeholder-class="placeholder-class" />
</view>
<view class="pk-type-box">
......@@ -41,7 +41,7 @@
<label class="radio" style="margin-right: 40rpx;">
<radio value="TEXT" :checked="form.voteOptionType=='TEXT'" />文字PK
</label>
<label class="radio" >
<label class="radio">
<radio value="IMAGE" :checked="form.voteOptionType=='IMAGE'" />图片PK
</label>
</radio-group>
......@@ -50,24 +50,26 @@
<view class="choice-item">
<image-upload v-model="voteOptionsAffirmative" :limit="1" :width="120" :height="120"
:showIcons="false"></image-upload>
<input class="text" v-model="form.voteOptions[0].name" placeholder="请输入选项1(4字以内)" />
<input class="text" maxlength="16" v-model="form.voteOptions[0].name"
placeholder="请输入选项1(16字以内)" />
</view>
<view class="choice-item">
<image-upload v-model="voteOptionsOpposing" :limit="1" :width="120" :height="120"
:showIcons="false"></image-upload>
<input class="text" v-model="form.voteOptions[1].name" placeholder="请输入选项2(4字以内)" />
<input class="text" maxlength="16" v-model="form.voteOptions[1].name"
placeholder="请输入选项2(16字以内)" />
</view>
</view>
<view class="choice-box" v-if="form.voteOptionType=='TEXT'">
<view class="choice-item text-item">
<view class="label">选项1</view>
<input class="text" maxlength="4" v-model="form.voteOptions[0].name"
placeholder="请输入选项1(4字以内)" />
<input class="text" maxlength="16" v-model="form.voteOptions[0].name"
placeholder="请输入选项1(16字以内)" />
</view>
<view class="choice-item text-item">
<view class="label">选项2</view>
<input class="text" maxlength="4" v-model="form.voteOptions[1].name"
placeholder="请输入选项2(4字以内)" />
<input class="text" maxlength="16" v-model="form.voteOptions[1].name"
placeholder="请输入选项2(16字以内)" />
</view>
</view>
</view>
......@@ -155,7 +157,7 @@
voteOptionsAffirmative: [],
voteOptionsOpposing: [],
emotions,
showEmjo:false
showEmjo: false
}
},
components: {
......@@ -274,6 +276,7 @@
handleCloseTopicSelection() {
this.showTopicSelection = false,
this.topicResultList = undefined
this.topicParams.name = ''
},
// 搜索话题
handleSearchTopic() {
......@@ -306,12 +309,13 @@
},
// 删除话题
handleDeleteTopic(index) {
let _this = this;
uni.showModal({
title: '提示',
content: '是否取消选择话题',
success: function(res) {
if (res.confirm) {
this.topicList.splice(index, 1)
_this.topicList.splice(index, 1)
} else if (res.cancel) {
console.log('用户点击取消');
}
......@@ -320,7 +324,7 @@
},
// textarea聚焦时关闭表情窗口
handleFocus(){
handleFocus() {
this.$refs.uploadRef.closeEmjo()
},
// 添加表情
......
......@@ -31,16 +31,17 @@ $common-width:94vw;
// 话题容器样式
.topic-box-common {
height: 52rpx;
padding: 0 20rpx;
// height: 52rpx;
background-color: rgba(0, 123, 255, 0.1);
color: $color-main-blue;
border-radius: 26rpx;
line-height: 52rpx;
margin-right: 20rpx;
font-size: 26rpx; /* 基准字体大小 */
padding: 10rpx 16px; /* 只左右内边距,高度由line-height决定 */
border-radius: 2em; /* 1em = 16px = 高度32px的50% */
height: fit-content;
margin-bottom: 10rpx;
}
.search-box-common{
height: 76rpx;
width: $common-width;
......
......@@ -70,6 +70,10 @@
display: flex;
align-items: center;
justify-content: space-between;
.flex-layout{
display: flex;
align-items: center;
}
.favorite-box{
width: 112rpx;
height: 60rpx;
......@@ -90,6 +94,9 @@
color: rgba(245, 166, 35, 1);
}
}
.ml-10{
margin-left: 20rpx;
}
.comment-box{
display: flex;
......@@ -122,6 +129,7 @@
.pk-title-text{
color: rgba(16, 16, 16, 1);
font-size: 24rpx;
width: calc(100% - 50rpx);
}
}
......@@ -139,10 +147,11 @@
.pk-btns{
margin: 20rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.btns{
width: 208rpx;
width: 520rpx;
height: 76rpx;
line-height: 76rpx;
color: rgba(255, 255, 255, 1);
......@@ -150,11 +159,11 @@
text-align: center;
}
.red-btn{
border-radius: 38rpx 6rpx 6rpx 38rpx;
border-radius: 38rpx;
background-color: rgba(255, 100, 95, 1);
}
.blue-btn{
border-radius: 6rpx 38rpx 38rpx 6rpx;
border-radius: 38rpx;
background-color: rgba(52, 132, 253, 1);
}
......@@ -175,43 +184,39 @@
.pk-results{
margin-top: 20rpx;
margin-bottom: 10rpx;
display: flex;
align-items: center;
justify-content: space-between;
// display: flex;
// align-items: center;
// justify-content: space-between;
font-size: 24rpx;
.left{
width: 100%;
flex: 1;
.left-num{
color: rgba(255, 100, 95, 1);
margin-bottom: 10rpx;
}
}
.right{
width: 100%;
flex: 1;
text-align: right;
.right-num{
color: rgba(52, 132, 253, 1);
margin-bottom: 10rpx;
}
}
.results-item{
width: 100%;
height: 12rpx;
color: rgba(255, 255, 255, 1);
font-size: 28rpx;
}
.left-item{
border-radius: 6rpx 0 0 6rpx;
margin-right: 10rpx;
border-radius: 6rpx;
min-width: 10rpx;
background-color: rgba(255, 100, 95, 1);
}
.right-item{
border-radius: 0 6rpx 6rpx 0;
margin-left: 10rpx;
border-radius: 6rpx;
min-width: 10rpx;
background-color: rgba(52, 132, 253, 1);
}
......
......@@ -95,6 +95,7 @@
color: rgba(187, 187, 187, 1);
font-size: 32rpx;
margin-left: 32rpx;
width: calc(100% - 140rpx);
}
.label{
color: rgba(16, 16, 16, 1);
......@@ -176,6 +177,7 @@
}
.input{
margin-left: 20rpx;
width: calc(100% - 50rpx);
}
.input-class{
font-size: 14px;
......@@ -185,11 +187,13 @@
.topic-result-list{
margin-top: 32rpx;
.list-item{
height: 64rpx;
padding: 10rpx 16rpx;
border-radius: 32rpx;
background-color: rgba(245, 248, 250, 1);
font-size: 26rpx;
padding: 0 20rpx;
font-size: 26rpx; /* 基准字体大小 */
border-radius: 2em; /* 1em = 16px = 高度32px的50% */
box-sizing: border-box;
display: flex;
align-items: center;
......
......@@ -171,3 +171,22 @@ export function getQuery(name) {
}
return null;
}
import md5 from 'js-md5';
import config from '@/config/index.config.js'
export function generateSignature(userName) {
if (!userName || typeof userName !== 'string') {
throw new Error('用户名/学工号不能为空,且必须是字符串类型');
}
const timestamp = Date.now();
const appSecret = config.secret;
const appId = config.appId;
const baseUrl = config.faceBaseUrl;
const rawStr = userName + timestamp.toString() + appSecret;
const signature = md5(rawStr);
return baseUrl + userName + "?appid=" + appId + "&timestamp=" + timestamp.toString() + "&signature=" + signature;
}
\ No newline at end of file
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