Commit 94215a4d authored by 万成波's avatar 万成波

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	safe-campus-bbs-uniapp/components/Dynamic-Item.vue
parents 1101ff07 4eda70c0
......@@ -17,6 +17,14 @@ export function exchangeUser(params) {
params
})
}
// 兑换商品选择
export function exchangeGoods(params){
return request({
url: '/bbs/points/exchange/select/goods',
method: 'get',
params
})
}
// 兑换列表
export function listData(params) {
......
......@@ -17,6 +17,13 @@ export function detailData(params) {
params
})
}
// 积分详情
export function pointsDetail(userName){
return request({
url:`/bbs/points/user/points/${userName}`,
method: 'get',
})
}
// 导出用户
export function exportUser(data){
......
<template>
<el-dialog :visible.sync="visible" :title="title" width="60%" append-to-body>
<el-form :model="queryParams" ref="formRef" :inline="true" @submit.prevent.stop>
<el-form-item label="商品名称">
<el-input placeholder="请输入" v-model="queryParams.name"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary">搜索</el-button>
<el-button>重置</el-button>
</el-form-item>
</el-form>
<div v-if="selectDataList.length > 0" class="mb20">
<el-tag v-for="tag in selectDataList" :key="tag.code" closable>
{{ tag.name }}
</el-tag>
</div>
<el-table ref="tableRef" row-key="code" :data="list" @selection-change="handleCheckboxChange" v-loading="loading">
<el-table-column type="selection" width="60"></el-table-column>
<el-table-column label="商品名称" prop="name" align="center"></el-table-column>
<el-table-column label="商品图片" align="center">
<template #default="{ row }">
<el-image :src="row.imgsUrl" style="width: 30px;height: 30px;"></el-image>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
import { listData, detailData } from '@/api/pointsMall';
export default {
data() {
return {
visible: false,
title: '选择',
list: [],
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: ''
},
total: 0,
selectDataList: [],
loading:false
}
},
props: {
multiple: {
type: Boolean,
default: false
},
modelValue: {
type: [Object, Array],
default: undefined
},
data: {
type: [String, Number, Array],
default: undefined
},
},
methods: {
openModal(data) {
this.visible = true;
this.getList(data)
},
getList(data) {
this.loading = true
listData(this.queryParams).then(res => {
this.list = res.rows;
this.total = res.total
if (data) {
this.getDetail(data)
}
}).finally(()=>{
this.loading = false
})
},
getDetail(data) {
let _this = this;
detailData(data).then(res => {
_this.selectDataList = [res.data]
})
const users = this.list.filter((item) => {
return data == item.code;
});
if (users.length > 0) {
users.forEach(async (item) => {
await _this.$nextTick(() => {
this.$refs.tableRef.toggleRowSelection(item, true);
});
})
}
},
handleCheckboxChange(selection) {
if (!this.multiple) {
if (selection.length > 1) {
this.$refs.tableRef.clearSelection();
this.$refs.tableRef.toggleRowSelection(selection[selection.length - 1]);
this.selectDataList = [selection[selection.length - 1]]
} else {
this.selectDataList = selection
}
} else {
this.selectDataList = selection
}
},
handleClose() {
this.visible = false
},
handleConfirm() {
this.$emit('update:modelValue', this.selectDataList);
this.$emit('confirmCallBack', this.selectDataList);
this.handleClose()
}
}
}
</script>
\ No newline at end of file
<template>
<div style="width: 100%;">
<el-input v-model="selectName" :readonly="readonly" :placeholder="placeholder">
<el-button slot="append" icon="el-icon-search" @click="openUserSelect"></el-button>
</el-input>
<GoodsSelect ref="userSelectRef" :multiple="multiple" :data="selectData" @confirmCallBack="userSelectCallBack">
</GoodsSelect>
</div>
</template>
<script>
import GoodsSelect from './index.vue'
import { detailData } from '@/api/pointsMall';
export default {
data() {
return {
selectName: '',
selectData: ''
}
},
components: {
GoodsSelect
},
props: {
multiple: {
type: Boolean,
default: false
},
placeholder: {
value: String,
default: '请选择'
},
value: {
value: [String, Number],
default: ''
},
readonly: {
type: Boolean,
default: true
},
},
watch: {
value: {
handler: function (val, oVal) {
if (val) {
this.selectData = val;
this.handleGoodsChange(val)
}
}
},
deep: true,
immediate: true
},
methods: {
openUserSelect() {
this.$refs.userSelectRef.openModal(this.selectData)
},
userSelectCallBack(data) {
if (data.length === 0) {
this.selectName = undefined
this.selectData = ''
} else {
this.selectName = data.map((item) => item.name).join(',');
this.selectData = data.map((item) => item.code).join(',');
}
this.$emit('update:value', this.selectData);
this.$emit('getValue', this.selectData, this.selectName);
},
handleGoodsChange(val) {
detailData(val).then(res => {
if (val) {
this.selectName = res.data.name;
}
})
},
}
}
</script>
\ No newline at end of file
......@@ -87,13 +87,15 @@ export default {
watch: {
value: {
handler(val) {
debugger
if (val) {
// 首先将值转为数组
const list = Array.isArray(val) ? val : this.value.split(',');
// 然后将数组转为对象数组
this.fileList = list.map(item => {
debugger
if (typeof item === "string") {
if (item.indexOf(this.baseUrl) === -1) {
if (item.indexOf('http') === -1) {
item = { name: this.baseUrl + item, url: this.baseUrl + item };
} else {
item = { name: item, url: item };
......@@ -154,6 +156,8 @@ export default {
},
// 上传成功回调
handleUploadSuccess(res, file) {
console.log(res, file)
debugger
if (res.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.url });
this.uploadedSuccessfully();
......
<template>
<el-dialog :visible.sync="visible" :title="title" width="60%" append-to-body>
<el-form :model="queryParams" ref="formRef" :inline="true" @submit.prevent.stop>
<el-form-item label="姓名">
<el-input placeholder="请输入" v-model="queryParams.nickName"></el-input>
</el-form-item>
<el-form-item label="用户名">
<el-input placeholder="请输入" v-model="queryParams.userName"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">搜索</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<div v-if="selectDataList.length > 0" class="mb20">
<el-tag v-for="tag in selectDataList" :key="tag.userName" closable>
{{ tag.nickName }}
</el-tag>
</div>
<el-table ref="tableRef" row-key="userName" :data="list" @selection-change="handleCheckboxChange"
v-loading="loading">
<el-table-column type="selection" width="60"></el-table-column>
<el-table-column label="姓名" prop="nickName" align="center"></el-table-column>
<el-table-column label="用户名" prop="userName" align="center"></el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
</el-dialog>
</template>
<script>
import { listData, pointsDetail } from '@/api/pointsManage';
export default {
data() {
return {
visible: false,
title: '选择',
list: [],
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: '',
userName: ''
},
total: 0,
selectDataList: [],
loading: false
}
},
props: {
multiple: {
type: Boolean,
default: false
},
modelValue: {
type: [Object, Array],
default: undefined
},
data: {
type: [String, Number, Array],
default: undefined
},
},
methods: {
openModal(data) {
this.visible = true;
this.getList(data)
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList()
},
handleReset() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
nickName: '',
userName: ''
}
this.getList()
},
getList(data) {
this.loading = true;
listData(this.queryParams).then(res => {
this.list = res.rows;
this.total = res.total
if (data) {
this.getDetail(data)
}
}).finally(() => {
this.loading = false
})
},
getDetail(data) {
let _this = this;
pointsDetail(data).then(res => {
_this.selectDataList = [res.data]
})
const users = this.list.filter((item) => {
return data == item.userName;
});
if (users.length > 0) {
users.forEach(async (item) => {
await _this.$nextTick(() => {
this.$refs.tableRef.toggleRowSelection(item, true);
});
})
}
},
handleCheckboxChange(selection) {
if (!this.multiple) {
if (selection.length > 1) {
this.$refs.tableRef.clearSelection();
this.$refs.tableRef.toggleRowSelection(selection[selection.length - 1]);
this.selectDataList = [selection[selection.length - 1]]
} else {
this.selectDataList = selection
}
} else {
this.selectDataList = selection
}
},
handleClose() {
// this.selectDataList = [];
// this.list = [];
// this.total = 0;
this.visible = false
},
handleConfirm() {
this.$emit('update:modelValue', this.selectDataList);
this.$emit('confirmCallBack', this.selectDataList);
this.handleClose()
}
}
}
</script>
\ No newline at end of file
<template>
<div style="width: 100%;">
<el-input v-model="selectName" :readonly="readonly" :placeholder="placeholder">
<el-button slot="append" icon="el-icon-search" @click="openUserSelect"></el-button>
</el-input>
<UserSelect ref="userSelectRef" :multiple="multiple" :data="selectData" @confirmCallBack="userSelectCallBack">
</UserSelect>
</div>
</template>
<script>
import { pointsDetail } from '@/api/pointsManage';
import UserSelect from './index.vue'
export default {
data() {
return {
selectName: '',
selectData: ''
}
},
components: {
UserSelect
},
props: {
multiple: {
type: Boolean,
default: false
},
placeholder: {
value: String,
default: '请选择'
},
value: {
value: [String, Number],
default: ''
},
readonly: {
type: Boolean,
default: true
},
},
watch: {
value: {
handler: function (val, oVal) {
if (val) {
this.selectData = val;
this.handleUserChange(val)
}
}
},
deep: true,
immediate: true
},
methods: {
openUserSelect() {
this.$refs.userSelectRef.openModal(this.selectData)
},
userSelectCallBack(data) {
debugger
if (data.length === 0) {
this.selectName = undefined
this.selectData = ''
} else {
this.selectName = data.map((item) => item.nickName).join(',');
this.selectData = data.map((item) => item.userName).join(',');
}
this.$emit('update:value', this.selectData);
this.$emit('getValue', this.selectData, this.selectName);
},
handleUserChange(val) {
pointsDetail(val).then(res => {
if (val) {
this.selectName = res.data.nickName;
}
})
},
}
}
</script>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<div class="page-container">
<el-form :model="queryParams" :inline="true" label-width="80px">
<el-form-item label="评论内容">
<el-input v-model="queryParams.content" placeholder="请输入"></el-input>
<el-input v-model="queryParams.momentContent" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="姓名">
<el-input v-model="queryParams.nickName" placeholder="请输入"></el-input>
......
......@@ -158,7 +158,7 @@ export default {
<style rel="stylesheet/scss" lang="scss">
.login {
display: flex;
justify-content: center;
justify-content: flex-end;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-background.jpg");
......@@ -175,6 +175,7 @@ export default {
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
margin-right: 240px;
.el-input {
height: 38px;
input {
......
......@@ -15,7 +15,8 @@
<div class="text">{{ form.content }}</div>
<div class="imgs" v-if="form.attachments && form.attachments.length > 0">
<template v-for="(item, index) in form.attachments">
<img class="item" :src="item.url"></img>
<el-image class="item" :src="item.url" :preview-src-list="[item.url]"></el-image>
<!-- <img class="item" :src="item.url"></img> -->
</template>
</div>
</div>
......
......@@ -7,8 +7,9 @@
<el-input placeholder="请输入" v-model="queryParams.content" style="width: 220px;"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker placeholder="请选择" value-format="YYYY-MM-DD"
v-model="queryParams.createTime"></el-date-picker>
<el-date-picker placeholder="请选择" type="daterange" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
v-model="dateRange" range-separator="至" start-placeholder="开始时间"
end-placeholder="结束时间" @change="dateChange"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
......@@ -25,7 +26,7 @@
<el-table-column label="帐号" prop="userName" align="center" width="140"></el-table-column>
<el-table-column label="姓名" prop="nickName" align="center" width="120"></el-table-column>
<el-table-column label="点赞数" prop="likeCount" align="center" width="100"></el-table-column>
<el-table-column label="评论数" prop="commentCount" align="center" width="100"></el-table-column>
<el-table-column label="评论数" prop="commentCount" align="center" width="100"></el-table-column>
<el-table-column label="创建时间" prop="createTime" align="center" width="160"></el-table-column>
<el-table-column label="操作" align="center" width="160">
<template #default="{ row }">
......@@ -38,12 +39,12 @@
:limit.sync="queryParams.pageSize" @pagination="getList" />
</div>
<!-- 动态详情 -->
<detail-dialog ref="detailDialogRef"></detail-dialog>
<detail-dialog ref="detailDialogRef"></detail-dialog>
</div>
</template>
<script>
import { listData , delData} from '@/api/moments';
import { listData, delData } from '@/api/moments';
import DetailDialog from './DetailDialog.vue';
export default {
name: 'Moments',
......@@ -58,7 +59,7 @@ export default {
dateRange: [],
}
},
components:{
components: {
DetailDialog
},
created() {
......@@ -90,6 +91,12 @@ export default {
this.getList()
})
},
dateChange(val){
if(val.length > 0){
this.queryParams['params[startTime]'] = val[0]
this.queryParams['params[endTime]'] = val[1]
}
},
// 查询
handleQuery() {
this.queryParams.pageNum = 1;
......@@ -101,6 +108,7 @@ export default {
pageNum: 1,
pageSize: 10
}
this.dateRange = []
this.getList()
}
}
......
......@@ -4,16 +4,13 @@
<el-form :model="queryParams" :inline="true" label-width="80px">
<el-form-item label="兑换时间">
<el-date-picker v-model="dateRange" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
style="width: 220px;" value-format="YYYY-MM-DD" @change="dateChange"></el-date-picker>
style="width: 240px;" value-format="yyyy-MM-dd" @change="dateChange"></el-date-picker>
</el-form-item>
<el-form-item label="兑换人">
<el-input placeholder="请输入" v-model="queryParams.userName" style="width: 220px;"></el-input>
</el-form-item>
<el-form-item label="兑换商品">
<el-select v-model="queryParams.goodsCode" placeholder="请选择" style="width: 220px;">
<el-option v-for="(item, index) in optionList" :label="item.name" :value="item.code"
:key="index"></el-option>
</el-select>
<el-input placeholder="请输入" v-model="queryParams.goodsName" style="width: 220px;"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
......@@ -109,9 +106,9 @@ export default {
},
// 时间段选择
dateChange(val){
if(val){
this.queryParams.startTime = val[0]
this.queryParams.endTime = val[1]
if(val.length > 0){
this.queryParams['params[startTime]'] = val[0]
this.queryParams['params[endTime]'] = val[1]
}
},
// 查询
......
......@@ -78,7 +78,7 @@ export default {
},
// 查详情
getDetail(row) {
detailData(row.id).then(res => {
detailData(row.code).then(res => {
console.log(res)
this.form = { ...res.data }
})
......
<template>
<el-dialog :visible.sync="visible" title="兑换明细" width="70%">
<el-dialog :visible.sync="visible" title="积分明细" width="70%">
<el-table :data="tableList" v-loading="loading">
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column label="明细名称" prop="detailName" align="center" width="150"></el-table-column>
......
<template>
<el-dialog :visible.sync="visible" v-if="visible" title="积分兑换" width="36%" class="dialog" @close="handleClose">
<el-form :model="form" ref="formRef" label-position="top" :rules="rules">
<el-form-item label="兑换人">
<el-select placeholder="请选择" style="width: 100%;" v-model="form.userName" @change="handleUserChange">
<el-option v-for="(item, index) in userList" :key="index" :value="item.userName"
:label="item.nickName"></el-option>
</el-select>
<el-form-item label="兑换人" prop="userName">
<UserSelectInput v-model="form.userName" :value.sync="form.userName" placeholder="请选择兑换人"></UserSelectInput>
</el-form-item>
<el-form-item label="会员等级">
<el-input v-model="form.gradeName" :disabled="true" placeholder="请输入"></el-input>
<el-input v-model="form.gradeName" :readonly="true" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="当前积分">
<el-input v-model="form.currentPoints" :disabled="true" placeholder="请输入"></el-input>
<el-input v-model="form.currentPoints" :readonly="true" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="兑换商品" prop="goodsCode">
<el-select placeholder="请选择" style="width: 100%;" v-model="form.goodsCode">
<el-option v-for="(item, index) in optionList" :label="item.name" :value="item.code"
:key="index"></el-option>
</el-select>
<GoodsSelectInput :value.sync="form.goodsCode" placeholder="请选择兑换商品"></GoodsSelectInput>
</el-form-item>
</el-form>
<template #footer>
......@@ -27,7 +21,10 @@
</el-dialog>
</template>
<script>
import { pointsExchange, exchangeUser, exchange } from '@/api/pointsExchange'
import { pointsExchange, exchange } from '@/api/pointsExchange'
import { pointsDetail } from '@/api/pointsManage';
import UserSelectInput from '@/components/UserSelect/input'
import GoodsSelectInput from '@/components/GoodsSelect/input'
export default {
data() {
return {
......@@ -36,57 +33,54 @@ export default {
userList: [],
optionList: [],
rules: {
goodsCode: [{ required: true, message: '请选择兑换商品', trigger: 'change' }]
userName:[{required: true, message: '请选择兑换人', trigger:['blur', 'change']}],
goodsCode: [{ required: true, message: '请选择兑换商品', trigger: ['blur', 'change'] }]
},
disabled: false
}
},
components: {
UserSelectInput,
GoodsSelectInput
},
watch: {
"form.userName": {
handler: function (val, oVal) {
console.log(val, oVal)
if (val) {
this.handleUserChange(val)
}
}
},
deep: true,
immediate: true
},
methods: {
// 打开兑换窗口
openModal(row) {
this.visible = true;
this.getUsers(row)
this.getOptions()
this.disabled = row ? true : false
this.$nextTick(() => {
this.form = { ...this.form, ...row }
})
},
// 兑换人
getUsers(row) {
exchangeUser().then(res => {
console.log(res)
this.userList = res.data;
if (row && row.userName) {
res.data.forEach((item) => {
if (item.userName == row.userName) {
this.form.nickName = item.nickName;
this.form.gradeName = item.gradeName
}
})
}
})
},
handleUserChange(val) {
this.userList.forEach((item) => {
if (item.userName == val) {
this.form.nickName = item.nickName;
this.form.gradeName = item.gradeName
this.form.currentPoints = item.currentPoints
pointsDetail(val).then(res => {
if (val) {
console.log(res.data)
this.form = { ...this.form, ...res.data }
}
})
},
// 兑换商品列表
getOptions() {
pointsExchange().then(res => {
console.log(res)
this.optionList = res.data
})
},
handleConfirm() {
let { nickName, userName, userGradeName, goodsCode } = this.form
let data = { nickName, userName, userGradeName, goodsCode }
let { nickName, userName, userGradeName, goodsCode, currentPoints } = this.form;
let data = {
nickName,
userName,
userGradeName,
goodsCode,
currentPoints
}
this.$refs.formRef.validate((valid) => {
if (valid) {
exchange(data).then(res => {
......@@ -95,7 +89,7 @@ export default {
this.handleClose()
this.$emit('handleOk');
} else {
this.$modal.msgSuccess(res.msg || "兑换失败");
this.$modal.msgError(res.msg || "兑换失败");
}
})
}
......
......@@ -91,7 +91,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^[1-9]\d*$/,
inputErrorMessage: '增加积分需大于0'
inputErrorMessage: '增加积分需为大于0的正整数'
}).then(({ value }) => {
let data = {
userName: row.userName,
......@@ -115,7 +115,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^[1-9]\d*$/,
inputErrorMessage: '扣减积分需大于0'
inputErrorMessage: '扣减积分需为大于0的正整数'
}).then(({ value }) => {
let data = {
userName: row.userName,
......
<template>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".txt" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>导入文件格式:导入txt文件,每个敏感词占一行</span>
<!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
@click="importTemplate">下载模板</el-link> -->
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
data() {
return {
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "批量导入敏感词",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/bbs/moment/sensitive/word/import"
},
}
},
created() {
},
methods: {
openModal(){
this.upload.open = true
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.$emit('handleOk')
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
}
}
}
</script>
\ No newline at end of file
<template>
<el-dialog :visible.sync="visible" v-if="visible" :title="dialogTitle" width="28%" class="dialog" @close="handleClose">
<el-form :model="form" ref="formRef" :rules="rules">
<el-form :model="form" ref="formRef" :rules="rules" @submit.native.prevent>
<el-form-item label="敏感词" prop="name">
<el-input placeholder="请输入" v-model="form.name"></el-input>
</el-form-item>
......
<template>
<div class="app-container">
<div class="page-container">
<el-form :model="queryParams" :inline="true" label-width="90">
<el-form :model="queryParams" :inline="true" label-width="90" @submit.native.prevent>
<el-form-item label="敏感词">
<el-input v-model="queryParams.name" placeholder="请输入"></el-input>
<el-input v-model="queryParams.name" placeholder="请输入" @keyup.enter.native="handleQuery"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
......@@ -15,7 +15,7 @@
<el-button type="primary" @click="handleAdd">新增敏感词</el-button>
</el-col>
<el-col :span="2">
<el-button type="primary" plain>批量导入敏感词</el-button>
<el-button type="primary" plain @click="handleImport">批量导入敏感词</el-button>
</el-col>
</el-row>
<el-table :data="tableList">
......@@ -35,12 +35,15 @@
<!-- 表单 -->
<form-dialog ref="formDialogRef" @handleOk="handleReset"></form-dialog>
<!-- 批量导入 -->
<batch-import ref="batchImportRef" @handleOk="handleReset"></batch-import>
</div>
</template>
<script>
import { listData, setTop ,delData} from '@/api/sensitives';
import FormDialog from './FormDialog.vue';
import BatchImport from './BatchImport.vue';
export default {
name: 'Sensitives',
data() {
......@@ -54,7 +57,8 @@ export default {
}
},
components: {
FormDialog
FormDialog,
BatchImport
},
created() {
......@@ -101,7 +105,11 @@ export default {
pageSize: 10
}
this.getList()
}
},
// 导入敏感词
handleImport(){
this.$refs.batchImportRef.openModal()
},
}
}
</script>
......
......@@ -146,4 +146,12 @@ export function delComment(commentId){
url:`moment/comment/delete/${commentId}`,
method:'delete'
})
}
// 删除动态
export function delMonment(momentId){
return request({
url:`moment/delete/${momentId}`,
method:'delete'
})
}
\ No newline at end of file
......@@ -5,12 +5,12 @@
<view class="item" v-if="form.isSelf==1" :class="{'active':activeIndex==1}" @click="handleChange(1)">管理全部评论
</view>
</view>
<view class="empty-box" v-if="list.length == 0">
<view class="empty-box" v-if="commentList.length == 0">
<image src="/static/images/empty.png" class="icon"></image>
<view class="text">期待您的经常评论~</view>
</view>
<view class="comment-display-box" v-else>
<view class="comment-item" v-for="(item,index) in list">
<view class="comment-item" v-for="(item,index) in commentList">
<view class="user-info">
<view class="username">{{item.nickName}}</view>
<view class="datetime">{{item.createTime}}</view>
......@@ -23,12 +23,15 @@
<view class="operation-text">
<view class="add-text" v-if="form.isSelf==1&&activeIndex==1 &&item.isFeatured==0"
@click="handleFeatured(item)">加入精选</view>
<view v-if="form.isSelf==1&&activeIndex==1 &&item.isFeatured==1"
@click="handleFeatured(item)">取消精选</view>
<view v-if="form.isSelf==1&&activeIndex==1 &&item.isFeatured==1" @click="handleFeatured(item)">
取消精选</view>
<view v-if="form.isSelf==1&&activeIndex==1" @click="handleDelete(item)">删除</view>
</view>
</view>
</view>
<view class="show-more-box" v-if="commentList.length < total" @click="loadMore">
加载更多
<image src="/static/images/down.png" class="icon"></image>
</view>
</view>
......@@ -41,26 +44,27 @@
import PublishComment from './PublishComment.vue';
import {
commentFeatured,
delComment
delComment,
dynamicDetailComments
} from '@/api/api.js'
export default {
name: "Comment-Item",
data() {
return {
commentList: [],
activeIndex: 0
activeIndex: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
momentId: ''
},
total:0
};
},
components: {
PublishComment
},
props: {
list: {
type: Object,
default: () => {
return []
}
},
form: {
type: Object,
default: () => {
......@@ -68,39 +72,60 @@
}
}
},
watch: {
form(newVal, oldVal){
console.log(newVal, oldVal)
if(newVal.id){
this.queryParams.momentId = newVal.id;
this.getCommentList()
}
}
},
onLoad() {
},
methods: {
handleChange(index) {
this.activeIndex = index
},
handleRefresh() {
console.log('222')
this.$emit('refresh')
this.queryParams.pageNum = 1;
this.getCommentList()
},
getCommentList() {
dynamicDetailComments(this.queryParams).then(res => {
this.commentList = [...this.commentList,...res.rows]
this.total = res.total
})
},
loadMore(){
this.queryParams.pageNum += 1;
this.getCommentList()
},
// 回复评论
handleReplayComment(item) {
this.$refs.publishCommentRef.openModal(item)
},
// 加入精选,取消精选
handleFeatured(item){
handleFeatured(item) {
let _this = this;
let text = item.isFeatured==1?'取消精选':'加入精选'
let text = item.isFeatured == 1 ? '取消精选' : '加入精选'
let data = {
momentId:this.form.id,
commentId:item.id,
featuredStatus:item.isFeatured==1?0:1
momentId: this.form.id,
commentId: item.id,
featuredStatus: item.isFeatured == 1 ? 0 : 1
}
uni.showModal({
title: '提示',
content: `是否将评论:${item.content}${text}`,
success: function (res) {
success: function(res) {
if (res.confirm) {
commentFeatured(data).then(res=>{
if(res.code == 200){
commentFeatured(data).then(res => {
if (res.code == 200) {
uni.showToast({
title:`${text}成功`
title: `${text}成功`
})
_this.$emit('refresh')
_this.getCommentList()
}
})
} else if (res.cancel) {
......@@ -109,19 +134,19 @@
}
});
},
handleDelete(item){
handleDelete(item) {
let _this = this;
uni.showModal({
title: '提示',
content: `是否确认删除评论:${item.content}?`,
success: function (res) {
success: function(res) {
if (res.confirm) {
delComment(item.id).then(res=>{
if(res.code == 200){
delComment(item.id).then(res => {
if (res.code == 200) {
uni.showToast({
title:`删除成功`
title: `删除成功`
})
_this.$emit('refresh')
_this.getCommentList()
}
})
} else if (res.cancel) {
......@@ -231,4 +256,17 @@
}
}
}
</style>
.show-more-box{
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
color: #BBBBBB;
font-size: 24rpx;
.icon{
width: 32rpx;
height: 32rpx;
}
}
</style>
\ No newline at end of file
<template>
<view>
<view class="dynamic-item" @click="toDynamicDetailPage">
<view class="user-info-box">
<view class="user-info-box" style="position: relative;">
<image class="avatar" src="/static/images/default-avatar.png"></image>
<view class="user-name">{{form.nickName}}</view>
<image class="more-icon" src="/static/images/more-icon.png"></image>
<image v-if="!deleteable" class="more-icon" src="/static/images/more-icon.png"></image>
<image v-if="deleteable" class="more-icon" @click.stop="handleDelDynamics"
src="/static/images/more-icon.png"></image>
<!-- 删除按钮 -->
<view class="del-btn" v-if="showDelBtn" @click.stop="handleDel" :style="'left:' + clientX + 'rpx;' +'top:' + clientY + 'rpx'">
删除动态</view>
</view>
<view class="topics-box" v-if="form.topicNames && form.topicNames.length >0">
<template v-for="(name,index) in form.topicNames">
......@@ -15,7 +20,7 @@
<view class="text">{{form.content}}</view>
<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"></image>
<image class="item" :src="item.url" @click.stop="preview(item.url)"></image>
</template>
</view>
<view class="imgs" v-if="form.type=='VIDEO'&&form.attachments && form.attachments.length > 0">
......@@ -46,33 +51,41 @@
</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" class="img"></image>
<image :src="item.imageUrl" @click.stop="preview(item.imageUrl)" class="img"></image>
</template>
</view>
<!-- 未投票 -->
<view v-if="form.isVote==0">
<view class="pk-btns" v-if="form.voteOptions.length>0 ">
<view class="btns red-btn" @click.stop="handleVote(form.voteOptions[0])">
{{form.voteOptions[0].name}}</view>
{{form.voteOptions[0].name}}
</view>
<image src="/static/images/pk-img.png" class="img"></image>
<view class="btns blue-btn" @click.stop="handleVote(form.voteOptions[1])">
{{form.voteOptions[1].name}}</view>
{{form.voteOptions[1].name}}
</view>
</view>
<view class="pk-tips">点击上方按钮,选择你的观点</view>
</view>
<!-- 已投票,显示投票结果 -->
<view v-if="form.isVote==1" >
<view class="pk-results" >
<view class="left" @click.stop="toPKDetailPage(0)">
<view v-if="form.isVote==1">
<view class="pk-results">
<view class="left" @click.stop="toPKDetailPage(0)">
<view class="left-num">{{form.voteOptions[0].name}} {{form.voteOptions[0].voteCount}}</view>
<view class="results-item left-item"></view>
</view>
<view class="right" @click.stop="toPKDetailPage(1)">
<view class="right-num" >{{form.voteOptions[1].name}} {{form.voteOptions[1].voteCount}}</view>
<view class="right-num">{{form.voteOptions[1].name}} {{form.voteOptions[1].voteCount}}
</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>
<view class="right" :style="'flex:' + form.voteOptions[1].voteCount" @click.stop="toPKDetailPage(1)">
<view class="results-item right-item"></view>
</view>
</view>
<view class="results-sum" @click.stop="toPKDetailPage(0)">
<view>{{form.voteCount}}人参与</view>
<image src="/static/images/detail-icon.png" class="icon"></image>
......@@ -87,9 +100,10 @@
<view class="username">{{item.nickName}}:</view>
<view class="datetime">2025-07-01 04:21:21</view>
</view>
<view class="content" v-if="!item.replyNickName" @click.stop="handleReplayComment(item)">{{item.content}}</view>
<view class="content" v-if="!item.replyNikeName" @click.stop="handleReplayComment(item)">
{{item.content}}</view>
<view class="content" v-else @click.stop="handleReplayComment(item)">
回复<span style="color: #0058B6;">{{item.replyNickName}}:</span>:{{item.content}}
回复<span style="color: #0058B6;">{{item.replyNikeName}}:</span>:{{item.content}}
</view>
<!-- <view class="tips">未精选,仅自己可见</view> -->
</view>
......@@ -98,13 +112,15 @@
</view>
<!-- 发布评论区 -->
<publish-comment :form="form" ref="publishCommentRef" @refresh="$emit('refresh')"></publish-comment>
</view>
</template>
<script>
import {
dynamicLikeUnlike,
delMonment,
dynamicVote
} from '@/api/api.js'
import PublishComment from './PublishComment.vue';
......@@ -115,15 +131,22 @@
commentList: [{}, {}],
showComment: false,
commentContent: '',
clientX: 0,
clientY: 0,
showDelBtn: false
};
},
components:{
components: {
PublishComment
},
props: {
form: {
type: Object,
default: {}
},
deleteable: {
type: Boolean,
default: false
}
},
methods: {
......@@ -133,9 +156,17 @@
momentId: this.form.id,
likeStatus
}
if(likeStatus == '1'){
this.form.likeCount = this.form.likeCount + 1
this.form.isLike = 1
}
if(likeStatus == '0'){
this.form.likeCount = this.form.likeCount - 1
this.form.isLike = 0
}
dynamicLikeUnlike(data).then(res => {
if (res.code == 200) {
this.$emit('refresh')
// this.$emit('refresh')
}
})
......@@ -146,11 +177,39 @@
this.$refs.publishCommentRef.openModal()
},
// 回复评论
handleReplayComment(item){
handleReplayComment(item) {
console.log(item)
this.$refs.publishCommentRef.openModal(item)
},
// 展示删除动态按钮
handleDelDynamics(e) {
this.showDelBtn = !this.showDelBtn
this.clientX = (e.target.offsetLeft * 2 - 148);
this.clientY = ((e.target.offsetTop * 2) + 34);
},
// 删除动态
handleDel(){
let _this = this;
uni.showModal({
title: '提示',
content: '是否确认删除动态?',
success: function (res) {
if (res.confirm) {
delMonment(_this.form.id).then(res=>{
if(res.code == 200){
uni.showToast({
title:'删除成功',
})
_this.$emit('refresh');
uni.$emit('hanldeDynamicRefresh')
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 投票
handleVote(item) {
let data = {
......@@ -167,9 +226,15 @@
}
})
},
// 预览
preview(url) {
uni.previewImage({
urls: [url]
});
},
toDynamicDetailPage() {
let pathName = window.location.pathname
if(pathName.indexOf('/pages/dynamic-detail/dynamic-detail') > -1){
if (pathName.indexOf('/pages/dynamic-detail/dynamic-detail') > -1) {
return;
}
uni.navigateTo({
......@@ -195,4 +260,17 @@
<style lang="scss">
@import '@/static/styles/index.scss';
.del-btn {
position: absolute;
width: 168rpx;
height: 68rpx;
line-height: 68rpx;
border-radius: 6rpx;
background-color: rgba(255, 255, 255, 1);
color: rgba(102, 102, 102, 1);
font-size: 26rpx;
text-align: center;
box-shadow: 0px 2px 12rpx 0px rgba(0, 0, 0, 0.2);
}
</style>
......@@ -405,7 +405,7 @@
width: 20px;
height: 20px;
border-radius: 100%;
z-index: 999;
z-index: 900;
}
}
......
<template>
<view class="list-empty-components">
<image src="/static/images/empty.png" class="img"></image>
<view class="text">{{text}}</view>
</view>
</template>
<script>
export default {
name:"ListEmpty",
data() {
return {
};
},
props:{
text:{
type:String,
default:'暂无数据~'
}
},
}
</script>
<style lang="scss">
.list-empty-components{
min-height: 600rpx;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.img{
width:160rpx;
height: 160rpx;
}
.text{
color: rgba(195, 200, 206, 1);
font-size: 28rpx;
}
}
</style>
\ No newline at end of file
<template>
<view class="comment-dialog-shadow" v-if="showComment">
<view class="comment-edit-box">
<textarea v-model="commentContent" :placeholder="placeholder" class="textarea"></textarea>
<textarea v-model="commentContent" maxlength="120" :placeholder="placeholder" class="textarea"></textarea>
<view class="btns">
<button class="btn" size="mini" @click="handleCloseComment">取消</button>
<button class="btn" size="mini" type="primary" @click="handlePublishComment">确定</button>
......@@ -18,7 +18,7 @@
return {
showComment:false,
commentContent:'',
placeholder:'请输入评论',
placeholder:'请输入评论(最多输入120字)',
parentId:'',
};
},
......
......@@ -10,7 +10,8 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "轻享"
"navigationBarTitleText": "轻享",
"enablePullDownRefresh": true
}
},
{
......
......@@ -2,7 +2,7 @@
<view class="detail-page-container">
<dynamic-item :form="form" @refresh="handleRefresh"></dynamic-item>
<!-- 评论管理区 -->
<comment-item :list="commentList" :form="form" @refresh="getCommentList"></comment-item>
<comment-item :form="form" ></comment-item>
</view>
</template>
......@@ -28,7 +28,7 @@
this.momentId = momentId;
this.queryParams.momentId = momentId
this.getDetail()
this.getCommentList()
// this.getCommentList()
},
components: {
DynamicItem,
......
......@@ -5,11 +5,14 @@
<input placeholder="搜索" placeholder-class="placeholder-class" />
</view>
<scroll-view class="scroll-view-index" scroll-y :show-scrollbar="false" @scrolltolower="loadMore">
<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="getList"></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" :y="area.y" direction="all" @change="onChange"
......@@ -22,6 +25,7 @@
<script>
import DynamicItem from '@/components/Dynamic-Item.vue'
import ListEmpty from '@/components/ListEmpty.vue';
import {
dynamicList
} from '@/api/api.js'
......@@ -41,33 +45,56 @@
}
},
components: {
DynamicItem
DynamicItem,
ListEmpty
},
onLoad() {
this.getList()
let _this = this;
uni.$on('hanldeDynamicRefresh', function() {
_this.list = [];
_this.queryParams.pageNum = 1;
_this.getList()
})
},
beforeDestroy() {
uni.$off('hanldeDynamicRefresh')
},
onPullDownRefresh() {
this.refreshContentList()
setTimeout(()=>{
uni.stopPullDownRefresh();
}, 1000)
},
methods: {
getList() {
uni.showLoading({
title:'加载中...'
})
dynamicList(this.queryParams).then(res => {
console.log(res)
this.list = res.rows
this.list = [...this.list,...res.rows];
this.total = res.total
}).finally(()=>{
uni.hideLoading()
})
},
loadMore() {
if(this.list.length < this.total){
this.queryParams.pageNum += 1;
this.getList()
}
},
toPublishPage() {
uni.navigateTo({
url: '/pages/publish/publish'
})
},
// 下拉刷新
refreshContentList() {
this.list = [];
this.queryParams.pageNum = 1;
this.getList();
},
toPKDetailPage() {
uni.navigateTo({
url: '/pages/pk-detail/pk-detail'
......
......@@ -75,7 +75,7 @@
// window.location = res.data
// }
// })
window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww63ca87d5f8647514&redirect_uri=http%3A%2F%2Fqywx.tangguo.ren/h5/pages/login/login/&response_type=code&scope=snsapi_base#wechat_redirect'
window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww63ca87d5f8647514&redirect_uri=https%3A%2F%2Ftest.tangguo.ren/h5/pages/login/login/&response_type=code&scope=snsapi_base#wechat_redirect'
},
// 页面跳转
......
......@@ -7,7 +7,7 @@
<image v-else :src="userInfo.avatarUrl" class="avatar"></image>
<view class="name-class">
<view class="name">{{userInfo.nickName}}</view>
<view class="class-name">{{userInfo.deptName}}</view>
<view class="class-name">{{userInfo.dept.deptName}}</view>
</view>
<image src="/static/images/mine/detail-icon-white.png" class="more"></image>
</view>
......@@ -29,16 +29,20 @@
</view>
<!-- 我发的动态 -->
<scroll-view class="my-dynamics" scroll-y :show-scrollbar="false" v-if="list.length >0">
<scroll-view class="my-dynamics" scroll-y :show-scrollbar="false" v-if="list.length >0" @scrolltolower="loadMore">
<template v-for="(item,index) in list">
<dynamic-item :form="item" @refresh="getList"></dynamic-item>
<dynamic-item :form="item" @refresh="handleRefresh" :deleteable="true"></dynamic-item>
</template>
</scroll-view>
<scroll-view class="my-dynamics" scroll-y :show-scrollbar="false" v-if="list.length==0">
<list-empty></list-empty>
</scroll-view>
</view>
</template>
<script>
import DynamicItem from '@/components/Dynamic-Item.vue';
import ListEmpty from '@/components/ListEmpty.vue';
import {
getInfo
} from '@/api/login.js';
......@@ -55,18 +59,21 @@
queryParams: {
pageNum: 1,
pageSize: 10
}
},
total:0
}
},
components: {
DynamicItem
DynamicItem,
ListEmpty
},
onLoad() {
this.getUserInfo();
},
onShow() {
this.getStatistics();
this.list = [];
this.queryParams.pageNum = 1;
this.getList()
},
methods: {
......@@ -83,12 +90,30 @@
this.analysisData = res.data
})
},
handleRefresh(){
this.getStatistics();
this.list = [];
this.queryParams.pageNum = 1;
this.getList()
},
// 获取当前用户动态列表
getList() {
uni.showLoading({
title:'加载中...'
})
userDynamics(this.queryParams).then(res => {
this.list = res.rows
this.list = [...this.list,...res.rows];
this.total = res.total;
}).finally(()=>{
uni.hideLoading()
})
}
},
loadMore() {
if(this.list.length < this.total){
this.queryParams.pageNum += 1;
this.getList()
}
},
}
}
</script>
......
......@@ -6,13 +6,16 @@
</view>
</view>
<scroll-view class="scroll-view-pk" v-if="list.length>0">
<scroll-view class="scroll-view-pk" scroll-y :show-scrollbar="false" v-if="list.length>0" @scrolltolower="loadMore">
<view class="list-item" v-for="(item,index) in list">
<image src="/static/images/default-avatar.png" class="avatar"></image>
<view class="name">{{item.nickName}}</view>
<view class="datetime">{{item.createTime}}</view>
</view>
</scroll-view>
<scroll-view class="scroll-view-pk" scroll-y :show-scrollbar="false" v-if="list.length==0">
<list-empty></list-empty>
</scroll-view>
</view>
</template>
......@@ -21,6 +24,7 @@
import {
voteList
} from '@/api/api.js'
import ListEmpty from '@/components/ListEmpty.vue';
export default {
data() {
return {
......@@ -30,11 +34,15 @@
momentId: '',
optionCode:undefined
},
total:0,
activeIndex: 0,
voteOptions: [],
list:[]
}
},
components:{
ListEmpty
},
onLoad(options) {
let {
momentId,
......@@ -49,16 +57,29 @@
},
methods: {
getList() {
uni.showLoading({
title:'加载中...'
})
voteList(this.queryParams).then(res => {
console.log(res)
this.list = res.data
this.list = [...this.list,...res.rows];
this.total = res.total;
}).finally(()=>{
uni.hideLoading()
})
},
handleChange(item,index){
this.activeIndex = index
this.queryParams.optionCode = item.code;
this.queryParams.pageNum = 1;
this.list = []
this.getList()
}
},
loadMore() {
if(this.list.length < this.total){
this.queryParams.pageNum += 1;
this.getList()
}
},
}
}
</script>
......@@ -67,6 +88,7 @@
@import '@/static/styles/common.scss';
.pk-detail-page {
background-color: white;
.pk-tab-box {
height: 92rpx;
display: flex;
......
......@@ -8,27 +8,32 @@
<view class="publish-box">
<textarea class="textarea" v-model="form.content" placeholder="分享有趣事~"
placeholder-class="placeholder-class" />
<image-upload v-model="form.attachments" :limit="9" :showIcons="true" @componentsType="handleSetComponentsType" @handleTopic="handleOpenTopicSelection"></image-upload>
<image-upload v-model="form.attachments" :limit="9" :showIcons="true"
@componentsType="handleSetComponentsType" @handleTopic="handleOpenTopicSelection"></image-upload>
</view>
<view class="permission-box">
<view class="item">
<view class="text">允许评论</view>
<switch color="#00E165" @change="(val)=>handleChange(val,'isEnableComment')" :checked="form.isEnableComment==1" />
<switch color="#00E165" @change="(val)=>handleChange(val,'isEnableComment')"
:checked="form.isEnableComment==1" />
</view>
<view class="item">
<view class="text">开启评论精选</view>
<switch color="#00E165" @change="(val)=>handleChange(val,'isEnableFeaturedComment')" :checked="form.isEnableFeaturedComment==1"/>
<switch color="#00E165" @change="(val)=>handleChange(val,'isEnableFeaturedComment')"
:checked="form.isEnableFeaturedComment==1" />
</view>
<view class="item">
<view class="text">开启PK</view>
<switch color="#00E165" @change="(val)=>handleChange(val,'isEnableVote')" :checked="form.isEnableVote==1"/>
<switch color="#00E165" @change="(val)=>handleChange(val,'isEnableVote')"
:checked="form.isEnableVote==1" />
</view>
</view>
<!-- pk数据编辑 -->
<view class="pk-edit-box" v-if="form.isEnableVote==1">
<view class="textarea-box">
<textarea class="textarea" v-model="form.voteTitle" placeholder="请输入PK标题~(0/12)" placeholder-class="placeholder-class" />
<textarea class="textarea" v-model="form.voteTitle" placeholder="请输入PK标题~(0/12)"
placeholder-class="placeholder-class" />
</view>
<view class="pk-type-box">
<radio-group v-model="form.voteOptionType" @change="radioChange">
......@@ -42,11 +47,13 @@
<view class="choice-box" v-if="form.voteOptionType=='IMAGE'">
<view class="choice-item">
<image-upload v-model="voteOptionsAffirmative" :limit="1" :width="120" :height="120" :showIcons="false"></image-upload>
<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字以内)" />
</view>
<view class="choice-item">
<image-upload v-model="voteOptionsOpposing" :limit="1" :width="120" :height="120" :showIcons="false"></image-upload>
<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字以内)" />
</view>
</view>
......@@ -134,82 +141,99 @@
voteTitle: '',
voteOptionType: 'TEXT',
voteOptions: [{
name:'',
imageUrl:''
},{
name:'',
imageUrl:''
name: '',
imageUrl: ''
}, {
name: '',
imageUrl: ''
}],
},
voteOptionsAffirmative:[],
voteOptionsOpposing:[]
voteOptionsAffirmative: [],
voteOptionsOpposing: []
}
},
components: {
ImageUpload
},
onLoad(options) {
let {topicId,topicName} = options;
if(topicId){
this.topicList.push({name:topicName,id:topicId})
let {
topicId,
topicName
} = options;
if (topicId) {
this.topicList.push({
name: topicName,
id: topicId,
})
}
},
methods: {
// 允许评论,开启精选等操作
handleChange(e,field){
console.log(e,field)
this.form[field] = e.detail.value?1:0
handleChange(e, field) {
console.log(e, field)
this.form[field] = e.detail.value ? 1 : 0
},
// 图文PK或者文字PK
radioChange(e) {
console.log(e)
this.form.voteOptionType = e.detail.value
},
handleSetComponentsType(type){
if(type && this.form.attachments.length > 0){
handleSetComponentsType(type) {
if (type && this.form.attachments.length > 0) {
this.form.type = type
}else{
} else {
this.form.type = 'TEXT'
}
},
// 发布动态
handleSubmit(){
if(this.topicList.length > 0){
handleSubmit() {
if (this.topicList.length > 0) {
this.form.topicNames = [];
this.form.topicIds = [];
this.topicList.forEach((item)=>{
this.topicList.forEach((item) => {
this.form.topicNames.push(item.name);
this.form.topicIds.push(item.id)
})
}
if(this.form.voteOptionType=='IMAGE'){
if(this.voteOptionsAffirmative.length == 0){
// 开启PK校验
if (this.form.isEnableVote == '1') {
if (this.form.voteOptionType == 'IMAGE') {
if (this.voteOptionsAffirmative.length == 0 || this.voteOptionsOpposing.length == 0) {
uni.showToast({
title: '请上传PK图片',
icon: 'error'
})
return;
}
}
if (this.form.voteOptionType == 'IMAGE') {
this.$set(this.form.voteOptions[0], 'imageUrl', this.voteOptionsAffirmative[0].url);
this.$set(this.form.voteOptions[1], 'imageUrl', this.voteOptionsOpposing[0].url);
}
if(!this.form.voteTitle){
uni.showToast({
title:'请上传PK图片'
title: '请输入PK标题',
icon: 'error'
})
return;
}
if(this.voteOptionsOpposing.length == 0){
if (!this.form.voteOptions[0].name || !this.form.voteOptions[1].name) {
uni.showToast({
title:'请上传PK图片'
title: '请输入PK选项',
icon: 'error'
})
return;
}
}
if(this.form.voteOptionType == 'IMAGE'){
this.$set(this.form.voteOptions[0], 'imageUrl', this.voteOptionsAffirmative[0].url);
this.$set(this.form.voteOptions[1], 'imageUrl', this.voteOptionsOpposing[0].url);
}
console.log(this.form)
crateNewDynamic(this.form).then(res=>{
if(res.code == 200){
crateNewDynamic(this.form).then(res => {
if (res.code == 200) {
uni.showToast({
title:'创建成功',
title: '创建成功',
})
uni.$emit('hanldeDynamicRefresh')
uni.switchTab({
url:'/pages/index/index'
url: '/pages/index/index'
})
}
})
......
......@@ -9,13 +9,14 @@
<image src="/static/images/topic.png" class="topic-img"></image>
</view>
</view>
<scroll-view class="scroll-view-topic" scroll-y :show-scrollbar="false" v-if="list.length>0">
<scroll-view class="scroll-view-topic" scroll-y :show-scrollbar="false" v-if="list.length>0"
@scrolltolower="loadMore">
<template v-for="(item,index) in list">
<dynamic-item :form="item"></dynamic-item>
</template>
</scroll-view>
<scroll-view class="scroll-view-topic" scroll-y :show-scrollbar="false" v-else>
<list-empty></list-empty>
</scroll-view>
<view class="publisb-box">
<view class="publish-btn" @click="handleToPublish">
......@@ -28,113 +29,143 @@
<script>
import DynamicItem from '@/components/Dynamic-Item.vue';
import {topicDynamics} from '@/api/api.js';
import ListEmpty from '@/components/ListEmpty.vue';
import {
topicDynamics
} from '@/api/api.js';
export default {
data() {
return {
list:[],
topicName:'',
queryParams:{
pageNum:1,
pageSize:10,
topicId:''
}
list: [],
topicName: '',
queryParams: {
pageNum: 1,
pageSize: 10,
topicId: ''
},
total: 0
}
},
components:{
DynamicItem
components: {
DynamicItem,
ListEmpty
},
onLoad(options) {
let {topicId,topicName} = options;
let {
topicId,
topicName
} = options;
this.topicName = topicName
if(topicId){
if (topicId) {
this.queryParams.topicId = topicId
this.getDetail()
}
},
methods: {
getDetail(){
topicDynamics(this.queryParams).then(res=>{
console.log(res)
this.list = res.rows
getDetail() {
uni.showLoading({
title: '加载中...'
})
topicDynamics(this.queryParams).then(res => {
this.list = [...this.list, ...res.rows];
this.total = res.total;
}).finally(() => {
uni.hideLoading()
})
},
handleToPublish(){
handleToPublish() {
uni.navigateTo({
url:`/pages/publish/publish?topicId=${this.queryParams.topicId}&topicName=${this.topicName}`
url: `/pages/publish/publish?topicId=${this.queryParams.topicId}&topicName=${this.topicName}`
})
}
},
loadMore() {
if (this.list.length < this.total) {
this.queryParams.pageNum += 1;
this.getList()
}
},
}
}
</script>
<style lang="scss">
@import '@/static/styles/common.scss';
.topic-detail-page{
background-color: white;
.topic-box{
padding: 32rpx 34rpx 0 32rpx;
.topic-container{
width: 92vw;
height: 180rpx;
border-radius: 12rpx;
background: linear-gradient(89.31deg, rgba(230,246,254,1) 1.2%,rgba(186,239,255,1) 99.53%);
text-align: center;
padding: 0 30rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
.topic-title-num{
width: calc(100% - 180rpx);
text-align: left;
.title{
color: rgba(16, 16, 16, 1);
font-size: 36rpx;
@import '@/static/styles/common.scss';
.topic-detail-page {
background-color: white;
.topic-box {
padding: 32rpx 34rpx 0 32rpx;
.topic-container {
width: 92vw;
height: 180rpx;
border-radius: 12rpx;
background: linear-gradient(89.31deg, rgba(230, 246, 254, 1) 1.2%, rgba(186, 239, 255, 1) 99.53%);
text-align: center;
padding: 0 30rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
.topic-title-num {
width: calc(100% - 180rpx);
text-align: left;
.title {
color: rgba(16, 16, 16, 1);
font-size: 36rpx;
}
.num {
color: rgba(162, 170, 184, 1);
font-size: 24rpx;
margin-top: 12rpx;
}
}
.num{
color: rgba(162, 170, 184, 1);
font-size: 24rpx;
margin-top: 12rpx;
.topic-img {
width: 160rpx;
height: 160rpx;
}
}
.topic-img{
width: 160rpx;
height: 160rpx;
}
}
}
.scroll-view-topic{
@include scroll-view-container(calc(100vh - 340rpx))
}
.publisb-box{
height:124rpx ;
background-color: rgba(244, 244, 244, 1);
display: flex;
justify-content: center;
align-items: center;
.publish-btn{
width: 240rpx;
height: 80rpx;
border-radius: 12rpx;
background-color: rgba(255, 255, 255, 1);
text-align: center;
border: 1px solid rgba(230, 230, 230, 1);
.scroll-view-topic {
@include scroll-view-container(calc(100vh - 340rpx))
}
.publisb-box {
height: 122rpx;
background-color: white;
border-top: 1px solid #eee;
display: flex;
align-items: center;
justify-content: center;
.icon{
width: 36rpx;
height: 36rpx;
margin-right: 16rpx;
}
.text{
color: rgba(187, 187, 187, 1);
font-size: 32rpx;
align-items: center;
.publish-btn {
width: 240rpx;
height: 80rpx;
border-radius: 12rpx;
background-color: rgba(255, 255, 255, 1);
text-align: center;
border: 1px solid rgba(230, 230, 230, 1);
display: flex;
align-items: center;
justify-content: center;
.icon {
width: 36rpx;
height: 36rpx;
margin-right: 16rpx;
}
.text {
color: rgba(187, 187, 187, 1);
font-size: 32rpx;
}
}
}
}
}
</style>
</style>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<view class="page-container topics-page">
<view class="search-box-common">
<image src="/static/images/search-icon.png" class="search-icon"></image>
<input placeholder="搜索" placeholder-class="placeholder-class" />
<input placeholder="搜索" style="width: 100%;" v-model="topicName" @keypress.enter="getList" placeholder-class="placeholder-class" />
</view>
<view class="hot-container">
<view class="hot-tag-box">
......@@ -27,6 +27,7 @@
data() {
return {
hotList:[],
topicName:''
}
},
onShow() {
......@@ -35,7 +36,10 @@
methods: {
// 话题热搜榜
getList(){
hotTopicRanking().then(res=>{
let params = {
name:this.topicName
}
hotTopicRanking(params).then(res=>{
console.log(res)
this.hotList = res.data
})
......
......@@ -193,7 +193,6 @@
.results-item{
width: 100%;
height: 12rpx;
background-color: rgba(238, 238, 238, 1);
color: rgba(255, 255, 255, 1);
font-size: 28rpx;
......@@ -201,10 +200,12 @@
.left-item{
border-radius: 6rpx 0 0 6rpx;
margin-right: 10rpx;
background-color: rgba(255, 100, 95, 1);
}
.right-item{
border-radius: 0 6rpx 6rpx 0;
margin-left: 10rpx;
background-color: rgba(52, 132, 253, 1);
}
}
......
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