代码规范处理

This commit is contained in:
linfeng 2022-09-14 12:55:12 +08:00
parent c4cf54be05
commit e4db154794
6 changed files with 333 additions and 5 deletions

View File

@ -25,6 +25,7 @@ import io.linfeng.modules.app.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -49,11 +50,16 @@ public class AppLoginController {
@Autowired
private AppUserService appUserService;
@Value("${sms.open}")
private boolean isOpen;
@PostMapping("/sendSmsCode")
@ApiOperation("发送验证码")
@ApiOperation("测试发送验证码")
public R sendSmsCode(@RequestBody SendCodeForm param) {
String code = appUserService.sendSmsCode(param);
if(isOpen){
//TODO send Aliyun Sms code
}
return R.ok("测试阶段验证码:" + code);
}

View File

@ -90,3 +90,7 @@ qiniu:
max-size: 30
admin-max-size: 5
# 是否开启短信验证码
sms:
open: false

View File

@ -97,6 +97,25 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/square/square",
"style" :
{
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/post/category",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
@ -117,10 +136,10 @@
"text": "主页"
},
{
"pagePath": "pages/message/message",
"pagePath": "pages/square/square",
"iconPath": "static/tabbar/msg-1.png",
"selectedIconPath": "static/tabbar/msg.png",
"text": "消息"
"text": "广场"
},
{
"pagePath": "pages/user/user",

View File

@ -15,6 +15,12 @@
:auto-upload="false"
></u-upload>
</block>
<!-- 分类 -->
<view @click="chooseClass" class="choose-item">
<u-icon class="icon add-icon" name="file-text-fill" color="#999" size="40"></u-icon>
<text class="txt">{{ cateName || '选择分类' }}</text>
<u-icon class="u-icon" name="arrow-right"></u-icon>
</view>
<!-- 所在位置 -->
<view @click="chooseLocation" class="choose-item">
<u-icon class="icon add-icon" name="map" color="#999" size="40"></u-icon>
@ -46,9 +52,10 @@ export default {
longitude: 0,
latitude: 0,
address: '',
cut: 0,
cut: 0,//id
pay: '',
},
cateName:'',
header: {
token: uni.getStorageSync('token')
},
@ -60,7 +67,11 @@ export default {
this.form.latitude = location.latitude;
},
methods: {
chooseClass(){
uni.navigateTo({
url:"category"
})
},
uploadImg() {
if (!this.form.content) {

View File

@ -0,0 +1,70 @@
<template>
<view class="container">
<view class="title">选择圈子类目</view>
<view class="class-wrap">
<view class="class-item u-line-1" @click="chooseClass(item.cateId,item.cateName)" v-for="(item, index) in classList" :key="index">{{ item.cateName }}</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
classList: []
};
},
created() {
this.getClassList();
},
methods: {
getClassList(){
this.$H.get('topic/classList').then(res=>{
this.classList=res.result
})
},
chooseClass(id,name){
console.log('id:',id)
console.log('name:',name)
let pages=getCurrentPages();
let nowPage=pages[pages.length-1];
let prevPage=pages[pages.length-2];
prevPage.$vm.form.cut=id;
prevPage.$vm.cateName=name;
uni.navigateBack();
}
}
};
</script>
<style lang="scss" scoped>
.title {
margin-bottom: 30rpx;
}
.class-wrap {
.class-item {
width: 30%;
display: inline-block;
border: 1px solid #999;
padding: 20rpx;
font-size: 24rpx;
color: #999;
text-align: center;
margin-bottom: 20rpx;
border-radius: 10rpx;
&:nth-child(3n + 2) {
margin-left: 5%;
margin-right: 5%;
}
&:active{
background-color: #333;
color: #fff;
}
}
}
</style>

View File

@ -0,0 +1,218 @@
<template>
<view>
<!-- navbar -->
<u-navbar :is-back="false" :border-bottom="false">
<u-icon name="search" :size="40" class="search-wrap" @click="toSearch"></u-icon>
<u-tabs :list="pageTab" :current="pageCurrent" @change="pageTabChange"></u-tabs>
</u-navbar>
<!-- 创作广场 -->
<view v-show="pageCurrent == 0">
<!-- 分类 -->
<view class="tabs-wrap">
<u-tabs :list="classList" name="cateName" :current="current" @change="tabChange"></u-tabs>
</view>
<view v-show="current == 0">
<!-- 轮播图 -->
<view class="wrap">
<u-swiper :list="swiperList" name="img" border-radius="20" mode="dot" :effect3d="true"></u-swiper>
</view>
</view>
<!-- 帖子列表 -->
<post-list :list="postList" :loadStatus="loadPostStatus"></post-list>
</view>
<!-- 发帖达人 -->
<view v-show="pageCurrent == 1">
发帖达人
</view>
<!-- 发帖入口 -->
<add-post-tag></add-post-tag>
</view>
</template>
<script>
import addPostTag from '../../components/add-post-tag/add-post-tag.vue'
export default {
data() {
return {
pageCurrent: 0,
current: 0,
pageTab: [{
name: '创作广场'
},
{
name: '发帖达人'
}
],
classList: [{
cateId: 0,
cateName: '推荐'
} ],
swiperList: [],
postList: [],
loadPostStatus: 'loadmore',
classId:0,
page:1,
}
},
onLoad() {
this.getBannerList();
this.getPostList();
this.getClassList();
},
onReachBottom() {
if(this.pageCurrent == 0){
this.page++;
this.getPostList()
}
if(this.pageCurrent == 1){
}
},
onPullDownRefresh() {
if(this.pageCurrent == 0){
this.page=1
this.pageList=[]
this.getPostList()
}
if(this.pageCurrent == 1){
}
},
methods: {
getBannerList() {
this.$H.get('link/list').then(res => {
if (res.code == 0) {
this.swiperList = res.result
}
})
},
toSearch() {
uni.navigateTo({
url: '/pages/search/search'
})
},
pageTabChange(index) {
// console.log(index)
this.pageCurrent = index
},
tabChange(index) {
this.current = index
this.page=1
this.classId=this.classList[index].cateId
this.postList=[]
this.getPostList()
},
getClassList(){
this.$H.get('topic/classList').then(res=>{
console.log(res.result)
this.classList=this.classList.concat(res.result)
})
},
//
getPostList() {
console.log('classId:',this.classId)
this.loadPostStatus = 'loading';
this.$H
.post('post/list', {
classId: this.classId,
page: this.page
})
.then(res => {
this.postList = this.postList.concat(res.result.data);
if (res.result.current_page === res.result.last_page || res.result.last_page === 0) {
this.loadPostStatus = 'nomore';
} else {
this.loadPostStatus = 'loadmore';
}
});
},
}
}
</script>
<style lang="scss" scoped>
.search-wrap {
margin-left: 20rpx;
margin-right: 30%;
}
.tabs-wrap {
position: sticky;
z-index: 999;
}
.wrap {
padding: 0 40rpx;
}
//
.user-item {
margin: 30rpx;
padding: 20rpx;
display: flex;
border-bottom: 1px solid #f5f5f5;
.user-index-hot {
margin-right: 20rpx;
color: #fff;
background-image: linear-gradient(#7979b6, #aaaaff);
width: 55rpx;
height: 55rpx;
border-radius: 50%;
text-align: center;
line-height: 55rpx;
}
.user-index {
margin-right: 20rpx;
color: #aaaaff;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
}
.avatar {
width: 100rpx;
height: 100rpx;
border-radius: 10rpx;
margin-right: 20rpx;
}
.right {
flex: 1;
.username {
font-weight: bold;
}
.tag-wrap {
font-size: 20rpx;
.tag {
display: inline-block;
padding: 5rpx 20rpx;
border-radius: 10rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
background-color: #99ccff;
&:nth-child(2n) {
background-color: #ccb3ff;
}
&:nth-child(3n) {
background-color: #ffe7b3;
}
&:nth-child(5n) {
background-color: #b3e0ff;
}
}
}
}
}
</style>