Commit 6cc1d54f authored by yuwenwen's avatar yuwenwen

移动端问题修改

parent cd3c81fd
...@@ -13,11 +13,16 @@ ...@@ -13,11 +13,16 @@
</view> </view>
<view class="dynamic-content-box"> <view class="dynamic-content-box">
<view class="text">{{form.content}}</view> <view class="text">{{form.content}}</view>
<view class="imgs" v-if="form.attachments && form.attachments.length > 0"> <view class="imgs" v-if="form.type=='IMAGE'&&form.attachments && form.attachments.length > 0">
<template v-for="(item,index) in form.attachments"> <template v-for="(item,index) in form.attachments">
<image class="item" :src="item.url"></image> <image class="item" :src="item.url"></image>
</template> </template>
</view> </view>
<view class="imgs" v-if="form.type=='VIDEO'&&form.attachments && form.attachments.length > 0">
<template v-for="(item,index) in form.attachments">
<video class="item" :src="item.url"></video>
</template>
</view>
</view> </view>
<view class="datetime-box">{{form.createTime}}</view> <view class="datetime-box">{{form.createTime}}</view>
<view class="operation-box"> <view class="operation-box">
...@@ -164,7 +169,7 @@ ...@@ -164,7 +169,7 @@
}, },
toDynamicDetailPage() { toDynamicDetailPage() {
let pathName = window.location.pathname let pathName = window.location.pathname
if(pathName == '/pages/dynamic-detail/dynamic-detail'){ if(pathName.indexOf('/pages/dynamic-detail/dynamic-detail') > -1){
return; return;
} }
uni.navigateTo({ uni.navigateTo({
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
const extension = '.' + newlist[0].url.split('.').pop().toLowerCase(); const extension = '.' + newlist[0].url.split('.').pop().toLowerCase();
_this.isVideo = videoExtensions.includes(extension); _this.isVideo = videoExtensions.includes(extension);
} else { } else {
_this.isVideo = false _this.isVideo = false;
} }
if (newlist && newlist.length > 0) { if (newlist && newlist.length > 0) {
const imgExtensions = ['.png', '.jpg', '.jpeg', '.PNG', '.JPG', '.JPEG', '.svg']; const imgExtensions = ['.png', '.jpg', '.jpeg', '.PNG', '.JPG', '.JPEG', '.svg'];
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
} }
_this.fileList = newlist; _this.fileList = newlist;
this.limiData = this.limit - newlist.length this.limiData = this.limit - newlist.length
_this.$emit('componentsType', _this.isVideo ? 'VIDEO':'IMAGE')
}, },
immediate: true immediate: true
} }
......
...@@ -7,41 +7,46 @@ ...@@ -7,41 +7,46 @@
<scroll-view class="scroll-view-index" scroll-y :show-scrollbar="false" @scrolltolower="loadMore"> <scroll-view class="scroll-view-index" scroll-y :show-scrollbar="false" @scrolltolower="loadMore">
<template v-for="(item,index) in list"> <template v-for="(item,index) in list">
<dynamic-item :form="item" @refresh="getList" ></dynamic-item> <dynamic-item :form="item" @refresh="getList"></dynamic-item>
</template> </template>
</scroll-view> </scroll-view>
<!-- 发布按钮 --> <!-- 发布按钮 -->
<view class="add-dynamic-box" @click="toPublishPage"> <movable-area class="movable-area">
<movable-view class="add-dynamic-box move-button" :x="area.x" :y="area.y" direction="all" @change="onChange"
damping="30" @click="toPublishPage">
<image class="icon" src="/static/images/publish-icon.png"></image> <image class="icon" src="/static/images/publish-icon.png"></image>
</view> </movable-view>
</movable-area>
</view> </view>
</template> </template>
<script> <script>
import DynamicItem from '@/components/Dynamic-Item.vue' import DynamicItem from '@/components/Dynamic-Item.vue'
import {dynamicList} from '@/api/api.js' import {
dynamicList
} from '@/api/api.js'
export default { export default {
data() { data() {
return { return {
list: [], list: [],
queryParams:{ queryParams: {
pageNum:1, pageNum: 1,
pageSize:10 pageSize: 10
}, },
total:0, total: 0,
area: {
x: 330,
y: 600
}
} }
}, },
components:{ components: {
DynamicItem DynamicItem
}, },
onLoad() { onLoad() {
this.getList() this.getList()
let _this = this; let _this = this;
uni.$on('hanldeDynamicRefresh',function(){ uni.$on('hanldeDynamicRefresh', function() {
_this.getList() _this.getList()
}) })
}, },
...@@ -49,8 +54,8 @@ ...@@ -49,8 +54,8 @@
uni.$off('hanldeDynamicRefresh') uni.$off('hanldeDynamicRefresh')
}, },
methods: { methods: {
getList(){ getList() {
dynamicList(this.queryParams).then(res=>{ dynamicList(this.queryParams).then(res => {
console.log(res) console.log(res)
this.list = res.rows this.list = res.rows
}) })
...@@ -58,15 +63,19 @@ ...@@ -58,15 +63,19 @@
loadMore() { loadMore() {
}, },
toPublishPage(){ toPublishPage() {
uni.navigateTo({ uni.navigateTo({
url:'/pages/publish/publish' url: '/pages/publish/publish'
}) })
}, },
toPKDetailPage(){ toPKDetailPage() {
uni.navigateTo({ uni.navigateTo({
url:'/pages/pk-detail/pk-detail' url: '/pages/pk-detail/pk-detail'
}) })
},
onChange(e) {
this.area.y = e.detail.y;
this.area.x = e.detail.x
} }
} }
} }
...@@ -74,4 +83,23 @@ ...@@ -74,4 +83,23 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/static/styles/index.scss'; @import '@/static/styles/index.scss';
.movable-area {
position: fixed;
height: 100%;
width: 100%;
z-index: 999;
pointer-events: none;
left: 0;
top: 0;
.move-button {
pointer-events: auto;
display: flex;
justify-content: center;
align-items: center;
pointer-events: auto;
border-radius: 50%;
}
}
</style> </style>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<view class="publish-box"> <view class="publish-box">
<textarea class="textarea" v-model="form.content" placeholder="分享有趣事~" <textarea class="textarea" v-model="form.content" placeholder="分享有趣事~"
placeholder-class="placeholder-class" /> placeholder-class="placeholder-class" />
<image-upload v-model="form.attachments" :limit="9" :showIcons="true" @handleTopic="handleOpenTopicSelection"></image-upload> <image-upload v-model="form.attachments" :limit="9" :showIcons="true" @componentsType="handleSetComponentsType" @handleTopic="handleOpenTopicSelection"></image-upload>
</view> </view>
<view class="permission-box"> <view class="permission-box">
<view class="item"> <view class="item">
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
topicList: [], topicList: [],
form: { form: {
content: '', content: '',
type: 'IMAGE', type: 'TEXT',
topicNames: [], topicNames: [],
topicIds: [], topicIds: [],
linkUrl: '', linkUrl: '',
...@@ -165,6 +165,13 @@ ...@@ -165,6 +165,13 @@
console.log(e) console.log(e)
this.form.voteOptionType = e.detail.value this.form.voteOptionType = e.detail.value
}, },
handleSetComponentsType(type){
if(type && this.form.attachments.length > 0){
this.form.type = type
}else{
this.form.type = 'TEXT'
}
},
// 发布动态 // 发布动态
handleSubmit(){ handleSubmit(){
if(this.topicList.length > 0){ if(this.topicList.length > 0){
......
...@@ -269,9 +269,9 @@ ...@@ -269,9 +269,9 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: fixed; // position: fixed;
right: 34rpx; // right: 34rpx;
top: 700rpx; // top: 700rpx;
.icon{ .icon{
width: 44rpx; width: 44rpx;
height: 44rpx; height: 44rpx;
......
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