1.17(发现,广场

This commit is contained in:
Hong
2024-01-17 19:41:55 +08:00
parent 2e6da228b8
commit 59f38fae17
6 changed files with 185 additions and 50 deletions

22
api/discover/discover.js Normal file
View File

@@ -0,0 +1,22 @@
import request from '@/utils/request'
/**
* 发现,广场列表
*/
export function getPlazaList(params) {
return request({
url: '/api/front/community/note/discover/list',
method: 'get',
params
})
}
/**
* 发现,广场列表
*/
export function plazaNoteAdd(data) {
return request({
url: '/api/front/community/note/add',
method: 'post',
data
})
}

View File

@@ -118,11 +118,11 @@ export const indexTabList = [{
type:'true' type:'true'
}, { }, {
name: '关注', name: '关注',
value: 2, value: 3,
type:'true' type:'true'
}, { }, {
name: '转租', name: '转租',
value: 3, value: 2,
type:'true' type:'true'
}, { }, {
name: '此地', name: '此地',

View File

@@ -4,7 +4,7 @@ import { HMAC } from './hmac.js'
import { SHA1 } from './sha1.js' import { SHA1 } from './sha1.js'
// 下面这3个信息必填 // 下面这3个信息必填
const url = 'https://jimte.oss-cn-hangzhou.aliyuncs.com/' const url = 'https://qicheoss.oss-cn-shanghai.aliyuncs.com/'
const OSSAccessKeyId = 'LTAI5tFZzfAMHw3WJNQtrhBZ' const OSSAccessKeyId = 'LTAI5tFZzfAMHw3WJNQtrhBZ'
const OssAccesskeySercet= 'rqZUht8RhrAfxDltWeGs1Yzpqzmu8W'; const OssAccesskeySercet= 'rqZUht8RhrAfxDltWeGs1Yzpqzmu8W';
let date = new Date(); let date = new Date();

View File

@@ -468,7 +468,8 @@
}, { }, {
"path" : "pages/index/post", "path" : "pages/index/post",
"style" : { "style" : {
"navigationBarTitleText" : "" "navigationBarTitleText" : "",
"navigationStyle": "custom"
} }
}, { }, {
"path" : "pages/welfare/rightsInterests/rightsInterests", "path" : "pages/welfare/rightsInterests/rightsInterests",

View File

@@ -1,5 +1,5 @@
<template> <template>
<view class="content"> <view class="content">
<view class="navbar-box fixed-top bg-white"> <view class="navbar-box fixed-top bg-white">
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<view :style="{height: `${$u.sys().statusBarHeight}px;`}" /> <view :style="{height: `${$u.sys().statusBarHeight}px;`}" />
@@ -17,17 +17,18 @@
<view class="search-box flex align-center"> <view class="search-box flex align-center">
<!-- #ifdef APP --> <!-- #ifdef APP -->
<image src="@/static/images/app/icon/search.png" mode=""></image> <image src="@/static/images/app/icon/search.png" mode=""></image>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<image :src="`${config.aliyunOssUrl}/static/images/app/icon/search.png`" mode=""></image> <image :src="`${config.aliyunOssUrl}/static/images/app/icon/search.png`" mode=""></image>
<!-- #endif --> <!-- #endif -->
<text>搜索</text> <text>搜索</text>
</view> </view>
<u-icon name="plus" size="22" @click="$tab.navigateTo('./post')" /> <u-icon name="plus" size="22" @click="$tab.navigateTo(`./post?type=${actTabType}`)" />
</view> </view>
<!-- tab蓝 --> <!-- tab蓝 -->
<view class="tab-box"> <view class="tab-box">
<u-tabs inactiveStyle="color:#666;" :scrollable="false" :current="current" lineColor="#13AFA8" lineWidth="32" :list="indexTabList"></u-tabs> <u-tabs inactiveStyle="color:#666;" :scrollable="false" :current="current" lineColor="#13AFA8"
lineWidth="32" :list="indexTabList" @click="tabClick"></u-tabs>
</view> </view>
</view> </view>
<view class=""> <view class="">
@@ -39,22 +40,23 @@
<!-- #endif --> <!-- #endif -->
</view> </view>
<view style="height: 200rpx;" /> <view style="height: 200rpx;" />
<view class="swiper-box"> <view class="swiper-box">
<u-swiper keyName="image" :list="brannerList" height="560rpx" @change="brannerChange" @click="brannerClick"></u-swiper> <u-swiper keyName="image" :list="brannerList" height="560rpx" @change="brannerChange"
@click="brannerClick"></u-swiper>
</view> </view>
<view class="list-box"> <view class="list-box">
<z-paging use-page-scroll> <z-paging use-page-scroll ref="paging" v-model="dataList" @query="queryList()">
<view class="user-item border-bottom border-eee"> <view class="user-item border-bottom border-eee" v-for="(item,index) in dataList" :key="index">
<view class="user-info flex align-center justify-between"> <view class="user-info flex align-center justify-between">
<view class="left flex align-center"> <view class="left flex align-center">
<image src="" mode=""></image> <image :src="item.authorAvatar" mode=""></image>
<view class=""> <view class="">
<view class="f-28 c666"> <view class="f-28 c666">
nickName {{item.authorName}}
</view> </view>
<view class="f-24 c666"> <view class="f-24 c666">
IP 杭州 1天前 IP 杭州 {{item.diffDays}}天前
</view> </view>
</view> </view>
</view> </view>
@@ -68,12 +70,14 @@
</view> </view>
</view> </view>
<view class="content-title line-two"> <view class="content-title line-two">
路上的风景拉萨解放拉萨解放拉萨弗兰克是 的首发式地方啊手动阀撒打发会卡死东海防空收到回复快速导航反抗精神的发 {{item.content}}
</view> </view>
<view class="image-list-box" :class="[]"> <view class="image-list-box flex-wrap flex">
<image class="image-one" src="" mode=""></image> <view v-for="(itemImage,index) in item.image">
<image class="image-two" src="" mode=""></image> <image v-show="item.image.length==1" class="image-one" :src="itemImage" mode=""></image>
<image class="image-three" src="" mode=""></image> <image v-show="item.image.length==2" class="image-two" :src="itemImage" mode=""></image>
<image v-show="item.image.length>2" class="image-three" :src="itemImage" mode=""></image>
</view>
</view> </view>
<view class="faceback-box flex align-center justify-end"> <view class="faceback-box flex align-center justify-end">
<view class="faceback-box-item flex align-center"> <view class="faceback-box-item flex align-center">
@@ -81,60 +85,108 @@
<image src="@/static/images/app/mine/share.png" mode="heightFix"></image> <image src="@/static/images/app/mine/share.png" mode="heightFix"></image>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<image :src="`${config.aliyunOssUrl}/static/images/app/mine/share.png`" mode="heightFix"></image> <image :src="`${config.aliyunOssUrl}/static/images/app/mine/share.png`" mode="heightFix">
</image>
<!-- #endif --> <!-- #endif -->
165 {{item.shareNum}}
</view> </view>
<view class="faceback-box-item flex align-center"> <view class="faceback-box-item flex align-center">
<!-- #ifdef APP --> <!-- #ifdef APP -->
<image src="@/static/images/app/mine/information.png" mode="heightFix"></image> <image src="@/static/images/app/mine/information.png" mode="heightFix"></image>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<image :src="`${config.aliyunOssUrl}/static/images/app/mine/information.png`" mode="heightFix"></image> <image :src="`${config.aliyunOssUrl}/static/images/app/mine/information.png`"
mode="heightFix"></image>
<!-- #endif --> <!-- #endif -->
165 {{item.replyNum}}
</view> </view>
<view class="faceback-box-item flex align-center"> <view class="faceback-box-item flex align-center">
<!-- #ifdef APP --> <!-- #ifdef APP -->
<image src="@/static/images/app/mine/like.png" mode="heightFix"></image> <image src="@/static/images/app/mine/like.png" mode="heightFix"></image>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<image :src="`${config.aliyunOssUrl}/static/images/app/mine/like.png`" mode="heightFix"></image> <image :src="`${config.aliyunOssUrl}/static/images/app/mine/like.png`" mode="heightFix">
</image>
<!-- #endif --> <!-- #endif -->
165 {{item.likeNum}}
</view> </view>
</view> </view>
</view> </view>
</z-paging> </z-paging>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { indexTabList } from '@/data/tabsData' import {
import { brannerList } from '@/api/system/config' indexTabList
export default { } from '@/data/tabsData'
import {
brannerList
} from '@/api/system/config'
import {
getPlazaList
} from "@/api/discover/discover.js"
import {
data
} from '../../uni_modules/uview-ui/libs/mixin/mixin'
export default {
data() { data() {
return { return {
current: 0, current: 0,
config: getApp().globalData.config, config: getApp().globalData.config,
indexTabList, indexTabList,
brannerList: [] brannerList: [],
//当前tab
actTabType: 1,
dataList: []
} }
}, },
onShow() { onShow() {
this.init() this.init()
}, },
methods: { methods: {
//tab
tabClick(e) {
console.log(e);
this.actTabType = e.value
},
// 初始化 // 初始化
init() { init() {
this.getBrannerList() this.getBrannerList()
this.getPlazaListFn()
}, },
// 获取轮播图 // 获取轮播图
getBrannerList() { getBrannerList() {
brannerList({type: 6}).then(res => { brannerList({
type: 6
}).then(res => {
this.brannerList = res.data.list this.brannerList = res.data.list
}) })
},
queryList(pageNo, pageSize) {
// 此处请求仅为演示,请替换为自己项目中的请求
let obj = {
page: pageNo,
limit: pageSize,
}
getPlazaList(obj).then(res => {
res.data.list.forEach(item => {
item.image = item.image.split(",")
const date1 = new Date();
const date2 = new Date(item.createTime);
// 计算相差的毫秒数
const diffTime = Math.abs(date2 - date1);
// 将毫秒数转换为天数
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
item.diffDays = diffDays
})
this.$refs.paging.complete(res.data.list);
})
},
//获取广场列表
getPlazaListFn() {
}, },
// 点击轮播图 // 点击轮播图
brannerClick(e) { brannerClick(e) {
@@ -143,7 +195,7 @@
}, },
brannerChange() {}, brannerChange() {},
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -155,6 +207,7 @@
width: 550rpx; width: 550rpx;
// #endif // #endif
height: 88rpx; height: 88rpx;
.messgage-icon { .messgage-icon {
.num { .num {
top: -8rpx; top: -8rpx;
@@ -166,12 +219,14 @@
text-align: center; text-align: center;
line-height: 32rpx; line-height: 32rpx;
} }
image { image {
margin-left: 12rpx; margin-left: 12rpx;
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
} }
} }
.search-box { .search-box {
margin: 0 20rpx; margin: 0 20rpx;
padding: 0 24rpx; padding: 0 24rpx;
@@ -179,23 +234,29 @@
height: 64rpx; height: 64rpx;
background: #F5F5F5; background: #F5F5F5;
border-radius: 32rpx; border-radius: 32rpx;
image { image {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
} }
} }
} }
.tab-box { .tab-box {
width: 750rpx; width: 750rpx;
} }
} }
.swiper-box { .swiper-box {
padding: 0 32rpx; padding: 0 32rpx;
} }
.list-box { .list-box {
padding: 0 32rpx; padding: 0 32rpx;
.user-item { .user-item {
padding-top: 48rpx; padding-top: 48rpx;
.user-info { .user-info {
.left { .left {
image { image {
@@ -206,6 +267,7 @@
background-color: red; background-color: red;
} }
} }
.image-box { .image-box {
image { image {
width: 32rpx; width: 32rpx;
@@ -213,6 +275,7 @@
} }
} }
} }
.content-title { .content-title {
margin-top: 16rpx; margin-top: 16rpx;
height: 86rpx; height: 86rpx;
@@ -222,34 +285,42 @@
color: #111111; color: #111111;
line-height: 43rpx; line-height: 43rpx;
} }
.image-list-box { .image-list-box {
width: 100%;
margin-top: 24rpx; margin-top: 24rpx;
.image-one { .image-one {
width: 686rpx; width: 686rpx;
height: 386rpx; height: 386rpx;
border-radius: 8rpx; border-radius: 8rpx;
background-color: red; background-color: red;
} }
.image-two { .image-two {
width: 330rpx; width: 330rpx;
height: 206rpx; height: 206rpx;
box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(0,0,0,0.09); box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.09);
border-radius: 8rpx; border-radius: 8rpx;
background-color: red; background-color: red;
} }
.image-three { .image-three {
width: 218rpx; width: 218rpx;
height: 218rpx; height: 218rpx;
box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(0,0,0,0.09); box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.09);
border-radius: 8rpx; border-radius: 8rpx;
background-color: red; background-color: red;
} }
} }
.faceback-box { .faceback-box {
padding: 34rpx 0; padding: 34rpx 0;
.faceback-box-item { .faceback-box-item {
margin-left: 48rpx; margin-left: 48rpx;
} }
image { image {
margin: 0 16rpx; margin: 0 16rpx;
height: 30rpx; height: 30rpx;
@@ -258,4 +329,4 @@
} }
} }
} }
</style> </style>

View File

@@ -13,7 +13,8 @@
</view> </view>
发帖子 发帖子
<view class="btn abs nav-item"> <view class="btn abs nav-item">
<u-button :customStyle="{margin: 0, width: '144rpx', height: '56rpx'}" color="#13AFA8" >发布</u-button> <u-button @click="issueFn" :customStyle="{margin: 0, width: '144rpx', height: '56rpx'}"
color="#13AFA8">发布</u-button>
</view> </view>
</view> </view>
</view> </view>
@@ -28,12 +29,14 @@
<view class="" style="height: 88rpx;" /> <view class="" style="height: 88rpx;" />
</view> </view>
<view class="textarea-box"> <view class="textarea-box">
<u-textarea border="none" placeholder="请输入你的内容"></u-textarea> <u-textarea border="none" v-model="content" placeholder="请输入你的内容"></u-textarea>
</view> </view>
<view class="upload-image-box flex-wrap align-center"> <view class="upload-image-box flex-wrap align-center">
<view class="upload-image-item rel" :style="{marginRight: index%3==2 ? '0' : '24rpx'}" v-for="(item,index) in picList" :key="index"> <view class="upload-image-item rel" :style="{marginRight: index%3==2 ? '0' : '24rpx'}"
v-for="(item,index) in picList" :key="index">
<image class="upload-image" :src="item" mode=""></image> <image class="upload-image" :src="item" mode=""></image>
<image class="clear abs" src="@/static/images/app/serve/realname_clea.png" @click="DelPic('faultImage')" mode=""></image> <image class="clear abs" src="@/static/images/app/serve/realname_clea.png" @click="DelPic('faultImage')"
mode=""></image>
</view> </view>
<view class="upload-image-item" @click="getImage"> <view class="upload-image-item" @click="getImage">
<image class="upload-image" src="@/static/images/app/serve/realname_upload.png" mode=""></image> <image class="upload-image" src="@/static/images/app/serve/realname_upload.png" mode=""></image>
@@ -43,28 +46,57 @@
</template> </template>
<script> <script>
import {
plazaNoteAdd
} from "@/api/discover/discover.js"
export default { export default {
data() { data() {
return { return {
picList: [] picList: [],
content: '',
//分类id
categoryId:1,
}; };
}, },
methods: { methods: {
//发布
issueFn() {
console.log(this.content, '文本');
console.log(this.picList, '图片');
uni.showLoading({
title: '发布中...'
});
plazaNoteAdd({
content:this.content,
image:this.picList.join(','),
replyStatus:1,
type:1,
categoryId:this.categoryId
}).then(res=>{
console.log('发布成功');
uni.hideLoading();
uni.navigateBack()
})
},
//传图片 //传图片
getImage() { getImage() {
this.$util.uploadImageOne({ this.$util.uploadImageOne({
count: 1, count: 9,
sizeType: ['original'], sizeType: ['original'],
sourceType:['album', 'camera'], sourceType: ['album', 'camera'],
dir:'crmebimage/public/product/' dir: 'crmebimage/public/product/'
},null,res=>{ }, null, res => {
this.picList.push(res) this.picList.push(res.data)
uni.hideLoading(); uni.hideLoading();
}); });
}, },
DelPic(index) { DelPic(index) {
this.picList.splice(index,1) this.picList.splice(index, 1)
}, },
},
onLoad(options) {
console.log(options);
this.categoryId=options.type
} }
} }
</script> </script>
@@ -72,39 +104,48 @@
<style lang="scss"> <style lang="scss">
.navbar-box { .navbar-box {
border-bottom: 1rpx solid #eee; border-bottom: 1rpx solid #eee;
.navbar-title { .navbar-title {
width: 750rpx; width: 750rpx;
line-height: 88rpx; line-height: 88rpx;
.back { .back {
left: 24rpx; left: 24rpx;
} }
.btn { .btn {
right: 24rpx; right: 24rpx;
} }
.nav-item { .nav-item {
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
} }
} }
.textarea-box { .textarea-box {
padding: 48rpx; padding: 48rpx;
width: 750rpx; width: 750rpx;
height: 434rpx; height: 434rpx;
} }
.upload-image-box { .upload-image-box {
padding: 0 48rpx; padding: 0 48rpx;
width: 750rpx; width: 750rpx;
.upload-image-item { .upload-image-item {
margin-bottom: 24rpx; margin-bottom: 24rpx;
width: 202rpx; width: 202rpx;
height: 202rpx; height: 202rpx;
} }
.upload-image { .upload-image {
width: 202rpx; width: 202rpx;
height: 202rpx; height: 202rpx;
border-radius: 8rpx; border-radius: 8rpx;
} }
.clear { .clear {
top: -16rpx; top: -16rpx;
right: -16rpx; right: -16rpx;
@@ -112,4 +153,4 @@
height: 32rpx; height: 32rpx;
} }
} }
</style> </style>