Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
dd143f237e |
@ -4,6 +4,7 @@ import request from '@/config/axios'
|
||||
export interface CircleVO {
|
||||
id: number // 编号
|
||||
userId: number // 用户编号
|
||||
nickname: string //用户昵称
|
||||
content: string // 发表内容
|
||||
picUrl: string // 图片地址
|
||||
likeCount: number // 点赞量
|
||||
|
@ -51,3 +51,8 @@ export const updateUserPoint = async (data: any) => {
|
||||
export const updateUserBalance = async (data: any) => {
|
||||
return await request.put({ url: `/member/user/update-balance`, data })
|
||||
}
|
||||
|
||||
// 获得用户下拉列表
|
||||
export const getMemeberUserList = async () => {
|
||||
return await request.get({ url: `/member/user/member-list`})
|
||||
}
|
||||
|
@ -7,8 +7,16 @@
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="用户昵称" prop="nickname">
|
||||
<el-select v-model ="formData.nickname" placeholder="请选择用户昵称" class="!w-240px">
|
||||
<el-option v-for ="item in userlist"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.nickname"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户编号" prop="userId">
|
||||
<el-input v-model="formData.userId" placeholder="请输入用户编号" />
|
||||
<el-input v-model="formData.userId" placeholder="请输入用户编号" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发表内容" prop="content">
|
||||
<Editor v-model="formData.content" height="150px" />
|
||||
@ -25,9 +33,6 @@
|
||||
<el-form-item label="评论数量" prop="commentCount">
|
||||
<el-input v-model="formData.commentCount" placeholder="请输入评论数量" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="更新版本号" prop="version">
|
||||
<el-input v-model="formData.version" placeholder="请输入更新版本号" />
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
@ -37,6 +42,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { CircleApi, CircleVO } from '@/api/mall/promotion/circle'
|
||||
import * as UserVoApid from '@/api/member/user'
|
||||
|
||||
/** 商城动态 表单 */
|
||||
defineOptions({ name: 'CircleForm' })
|
||||
@ -50,6 +56,7 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
nickname: undefined,
|
||||
userId: undefined,
|
||||
content: undefined,
|
||||
picUrl: undefined,
|
||||
@ -104,10 +111,21 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 使用watch来监听formData.nickname的变化
|
||||
watch(() => formData.value.nickname, (newValue) => {
|
||||
const selectedUser = userlist.value.find(user => user.nickname === newValue);
|
||||
if (selectedUser) {
|
||||
formData.value.userId = selectedUser.id;
|
||||
} else {
|
||||
formData.value.userId = ''; // 如果没有找到,清空用户编号
|
||||
}
|
||||
});
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
nickname: undefined,
|
||||
userId: undefined,
|
||||
content: undefined,
|
||||
picUrl: undefined,
|
||||
@ -118,4 +136,10 @@ const resetForm = () => {
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const userlist = ref<UserVoApid.UserVO[]>([])//用户下拉列表
|
||||
//初始化
|
||||
onMounted(async () =>{
|
||||
userlist.value = (await UserVoApid.getMemeberUserList()) as UserVoApid.UserVO[]
|
||||
})
|
||||
</script>
|
@ -93,12 +93,16 @@
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="用户编号" align="center" prop="userId" />
|
||||
<el-table-column label="用户昵称" align="center" prop="nickname" />
|
||||
<el-table-column label="发表内容" align="center" prop="content" />
|
||||
<el-table-column label="图片地址" align="center" prop="picUrl" />
|
||||
<el-table-column label="发表图片" align="center" prop="picUrl" >
|
||||
<template #default="scope">
|
||||
<img :src="scope.row.picUrl" style="width: 40px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="点赞量" align="center" prop="likeCount" />
|
||||
<el-table-column label="访问量" align="center" prop="lookCount" />
|
||||
<el-table-column label="评论数量" align="center" prop="commentCount" />
|
||||
<!-- <el-table-column label="更新版本号" align="center" prop="version" /> -->
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
|
@ -18,6 +18,9 @@ public class CirclePageReqVO extends PageParam {
|
||||
@Schema(description = "用户编号", example = "20140")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "用户000")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "发表内容")
|
||||
private String content;
|
||||
|
||||
|
@ -22,6 +22,9 @@ public class CircleRespVO {
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "用户000")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "发表内容")
|
||||
@ExcelProperty("发表内容")
|
||||
private String content;
|
||||
|
@ -15,6 +15,9 @@ public class CircleSaveReqVO {
|
||||
@Schema(description = "用户编号", example = "20140")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "用户000")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "发表内容")
|
||||
private String content;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CirclePageReqVO;
|
||||
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleRespVO;
|
||||
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleSaveReqVO;
|
||||
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.CircleReviewSaveReqVO;
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
|
||||
@ -62,7 +63,26 @@ public class AppCircleController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/doBrowse")
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "发表社区动态")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> createCircle(@RequestBody CircleSaveReqVO createReqVO){
|
||||
String nickname = memberUserApi.getUser(getLoginUserId()).getNickname();
|
||||
createReqVO.setUserId(getLoginUserId());
|
||||
createReqVO.setNickname(nickname);
|
||||
circleService.createCircle(createReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/doCircleUpdate")
|
||||
@Operation(summary = "编辑社区动态")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> updateCircle(@RequestBody CircleSaveReqVO updateReqVO){
|
||||
circleService.updateCircle(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/doBrowse")
|
||||
@Operation(summary = "浏览量叠加")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doBrowse(@RequestParam("id") Long lookId){
|
||||
@ -70,7 +90,7 @@ public class AppCircleController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/doLike")
|
||||
@PutMapping("/doLike")
|
||||
@Operation(summary = "点赞/取消点赞")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doLike(@RequestParam("id") Long lookId){
|
||||
@ -87,7 +107,7 @@ public class AppCircleController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/doReviewDelete")
|
||||
@DeleteMapping("/doReviewDelete")
|
||||
@Operation(summary = "删除评论")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doReviewDelete(@RequestParam("id") Long lookId){
|
||||
@ -95,7 +115,7 @@ public class AppCircleController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/doCircleDelete")
|
||||
@DeleteMapping("/doCircleDelete")
|
||||
@Operation(summary = "删除动态")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doCircleDelete(@RequestParam("id") Long lookId){
|
||||
|
@ -31,6 +31,10 @@ public class CircleDO extends BaseDO {
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 发表内容
|
||||
*/
|
||||
|
@ -169,4 +169,13 @@ public class MemberUserController {
|
||||
memberCodeMapper.insert(memberCodeDo);
|
||||
return success(uuid);
|
||||
}
|
||||
|
||||
@GetMapping("/member-list")
|
||||
@Operation(summary = "获得会员用户下拉列表")
|
||||
@PreAuthorize("@ss.hasPermission('member:user:query')")
|
||||
public CommonResult<List<MemberUserDO>> getMemberUserList(){
|
||||
List<MemberUserDO> userDOList = memberUserService.getMemberUserList();
|
||||
return success(userDOList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -191,4 +191,5 @@ public interface MemberUserService {
|
||||
|
||||
void updateActivate(String cardName,Long userId);
|
||||
|
||||
List<MemberUserDO> getMemberUserList();
|
||||
}
|
||||
|
@ -340,4 +340,10 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
memberUserMapper.updateById(memberUserDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberUserDO> getMemberUserList() {
|
||||
List<MemberUserDO> list = memberUserMapper.selectList();
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user