Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
2ad38adf
提交
2ad38adf
authored
6月 29, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
帖子管理代码提交
上级
1ca172e8
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
377 行增加
和
105 行删除
+377
-105
PostEntity.java
...m-admin/src/main/java/com/platform/entity/PostEntity.java
+110
-45
PostServiceImpl.java
.../main/java/com/platform/service/impl/PostServiceImpl.java
+59
-3
PostDao.xml
...orm-admin/src/main/resources/com/platform/dao/PostDao.xml
+23
-6
post.html
platform-admin/src/main/webapp/WEB-INF/page/sys/post.html
+54
-33
post.js
platform-admin/src/main/webapp/js/sys/post.js
+131
-18
没有找到文件。
platform-admin/src/main/java/com/platform/entity/PostEntity.java
浏览文件 @
2ad38adf
...
...
@@ -8,200 +8,265 @@ import java.util.Date;
* 表名 post
*
* @author lipengjun
* @date 2020-06-
17 11:02:2
1
* @date 2020-06-
28 15:28:3
1
*/
public
class
PostEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*
帖子ID
*/
private
String
id
;
/**
*
*
0:已删除 1:正常 2:下线
*/
private
Integer
archived
;
/**
*
*
删除人
*/
private
String
archivedBy
;
/**
*
*
删除时间
*/
private
Date
archivedDate
;
/**
*
* 用户类型 0:系统用户 1:app用户
*/
private
Integer
userType
;
/**
* 创建时间
*/
private
Date
createDate
;
/**
*
*
创建人
*/
private
String
createdBy
;
/**
*
*
更新时间
*/
private
Date
updateDate
;
/**
*
*
更新人
*/
private
String
updatedBy
;
/**
*
*
版本
*/
private
Integer
version
;
/**
*
* 图片
*/
private
String
picture
;
/**
* 标题
*/
private
String
caption
;
/**
*
*
文章内容
*/
private
String
category
;
/**
*
*
用户ID
*/
private
String
userId
;
/**
* 是否置顶 0: 不置顶 1:置顶
*/
private
Integer
isTop
;
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
/**
* 设置:帖子ID
*/
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
/**
* 获取:帖子ID
*/
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
/**
* 设置:0:已删除 1:正常 2:下线
*/
public
void
setArchived
(
Integer
archived
)
{
this
.
archived
=
archived
;
}
/**
* 获取:0:已删除 1:正常 2:下线
*/
public
Integer
getArchived
()
{
return
archived
;
}
public
void
setArchived
(
Integer
archived
)
{
this
.
archived
=
archived
;
}
/**
* 设置:
* 设置:
删除人
*/
public
void
setArchivedBy
(
String
archivedBy
)
{
this
.
archivedBy
=
archivedBy
;
}
/**
* 获取:
* 获取:
删除人
*/
public
String
getArchivedBy
()
{
return
archivedBy
;
}
/**
* 设置:
* 设置:
删除时间
*/
public
void
setArchivedDate
(
Date
archivedDate
)
{
this
.
archivedDate
=
archivedDate
;
}
/**
* 获取:
* 获取:
删除时间
*/
public
Date
getArchivedDate
()
{
return
archivedDate
;
}
/**
* 设置:
* 设置:用户类型 0:系统用户 1:app用户
*/
public
void
setUserType
(
Integer
userType
)
{
this
.
userType
=
userType
;
}
/**
* 获取:用户类型 0:系统用户 1:app用户
*/
public
Integer
getUserType
()
{
return
userType
;
}
/**
* 设置:创建时间
*/
public
void
setCreateDate
(
Date
createDate
)
{
this
.
createDate
=
createDate
;
}
/**
* 获取:
* 获取:
创建时间
*/
public
Date
getCreateDate
()
{
return
createDate
;
}
/**
* 设置:
* 设置:
创建人
*/
public
void
setCreatedBy
(
String
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
/**
* 获取:
* 获取:
创建人
*/
public
String
getCreatedBy
()
{
return
createdBy
;
}
/**
* 设置:
* 设置:
更新时间
*/
public
void
setUpdateDate
(
Date
updateDate
)
{
this
.
updateDate
=
updateDate
;
}
/**
* 获取:
* 获取:
更新时间
*/
public
Date
getUpdateDate
()
{
return
updateDate
;
}
/**
* 设置:
* 设置:
更新人
*/
public
void
setUpdatedBy
(
String
updatedBy
)
{
this
.
updatedBy
=
updatedBy
;
}
/**
* 获取:
* 获取:
更新人
*/
public
String
getUpdatedBy
()
{
return
updatedBy
;
}
/**
* 设置:
* 设置:
版本
*/
public
void
setVersion
(
Integer
version
)
{
this
.
version
=
version
;
}
/**
* 获取:
* 获取:
版本
*/
public
Integer
getVersion
()
{
return
version
;
}
/**
* 设置:
* 设置:图片
*/
public
void
setPicture
(
String
picture
)
{
this
.
picture
=
picture
;
}
/**
* 获取:图片
*/
public
String
getPicture
()
{
return
picture
;
}
/**
* 设置:标题
*/
public
void
setCaption
(
String
caption
)
{
this
.
caption
=
caption
;
}
/**
* 获取:
* 获取:
标题
*/
public
String
getCaption
()
{
return
caption
;
}
/**
* 设置:
* 设置:
文章内容
*/
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
/**
* 获取:
* 获取:
文章内容
*/
public
String
getCategory
()
{
return
category
;
}
/**
* 设置:用户ID
*/
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
/**
* 获取:用户ID
*/
public
String
getUserId
()
{
return
userId
;
}
/**
* 设置:是否置顶 0: 不置顶 1:置顶
*/
public
void
setIsTop
(
Integer
isTop
)
{
this
.
isTop
=
isTop
;
}
/**
* 获取:是否置顶 0: 不置顶 1:置顶
*/
public
Integer
getIsTop
()
{
return
isTop
;
}
}
platform-admin/src/main/java/com/platform/service/impl/PostServiceImpl.java
浏览文件 @
2ad38adf
package
com
.
platform
.
service
.
impl
;
import
com.platform.dao.PostDao
;
import
com.platform.dao.SysUserDao
;
import
com.platform.dao.TbCfUserInfoDao
;
import
com.platform.entity.PostEntity
;
import
com.platform.entity.SysUserEntity
;
import
com.platform.entity.TbCfUserInfoEntity
;
import
com.platform.service.PostService
;
import
com.platform.utils.IdUtil
;
import
com.platform.utils.ShiroUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.net.URLDecoder
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
platform
.
utils
.
ShiroUtils
.
getUserId
;
/**
* Service实现类
*
...
...
@@ -21,6 +32,12 @@ public class PostServiceImpl implements PostService {
@Autowired
private
PostDao
postDao
;
@Autowired
private
TbCfUserInfoDao
tbCfUserInfoDao
;
@Autowired
private
SysUserDao
sysUserDao
;
@Override
public
PostEntity
queryObject
(
Long
id
)
{
return
postDao
.
queryObject
(
id
);
...
...
@@ -28,7 +45,24 @@ public class PostServiceImpl implements PostService {
@Override
public
List
<
PostEntity
>
queryList
(
Map
<
String
,
Object
>
map
)
{
return
postDao
.
queryList
(
map
);
List
<
PostEntity
>
list
=
new
ArrayList
<>();
List
<
PostEntity
>
postList
=
postDao
.
queryList
(
map
);
postList
.
forEach
(
post
->
{
String
userType
=
post
.
getUserType
().
toString
();
PostEntity
postEntity
=
new
PostEntity
();
BeanUtils
.
copyProperties
(
post
,
postEntity
);
//系统用户
if
(
"0"
.
equals
(
userType
))
{
SysUserEntity
user
=
sysUserDao
.
queryObject
(
post
.
getUserId
());
postEntity
.
setCreatedBy
(
user
.
getUserName
());
//app用户
}
else
if
(
"1"
.
equals
(
userType
))
{
TbCfUserInfoEntity
user
=
tbCfUserInfoDao
.
queryObject
(
post
.
getUserId
());
postEntity
.
setCreatedBy
(
user
.
getNick
());
}
list
.
add
(
postEntity
);
});
return
list
;
}
@Override
...
...
@@ -38,12 +72,34 @@ public class PostServiceImpl implements PostService {
@Override
public
int
save
(
PostEntity
post
)
{
post
.
setId
(
IdUtil
.
createIdbyUUID
());
return
postDao
.
save
(
post
);
int
res
=
0
;
try
{
post
.
setId
(
IdUtil
.
createIdbyUUID
());
post
.
setCreateDate
(
new
Date
());
post
.
setUpdateDate
(
new
Date
());
post
.
setVersion
(
1
);
post
.
setIsTop
(
0
);
post
.
setArchived
(
1
);
String
type
=
String
.
valueOf
(
post
.
getUserType
());
if
(
"0"
.
equals
(
type
))
{
post
.
setUserId
(
getUserId
());
}
if
(
"1"
.
equals
(
type
))
{
String
userId
=
tbCfUserInfoDao
.
queryById
(
post
.
getCreatedBy
());
post
.
setUserId
(
userId
);
}
post
.
setCategory
(
URLDecoder
.
decode
(
post
.
getCategory
(),
"utf-8"
));
res
=
postDao
.
save
(
post
);
}
catch
(
Exception
e
)
{
}
return
res
;
}
@Override
public
int
update
(
PostEntity
post
)
{
post
.
setUpdateDate
(
new
Date
());
post
.
setUpdatedBy
(
ShiroUtils
.
getUserId
());
return
postDao
.
update
(
post
);
}
...
...
platform-admin/src/main/resources/com/platform/dao/PostDao.xml
浏览文件 @
2ad38adf
...
...
@@ -8,14 +8,17 @@
<result
property=
"archived"
column=
"archived"
/>
<result
property=
"archivedBy"
column=
"archived_by"
/>
<result
property=
"archivedDate"
column=
"archived_date"
/>
<result
property=
"userType"
column=
"user_type"
/>
<result
property=
"createDate"
column=
"create_date"
/>
<result
property=
"createdBy"
column=
"created_by"
/>
<result
property=
"updateDate"
column=
"update_date"
/>
<result
property=
"updatedBy"
column=
"updated_by"
/>
<result
property=
"version"
column=
"version"
/>
<result
property=
"picture"
column=
"picture"
/>
<result
property=
"caption"
column=
"caption"
/>
<result
property=
"category"
column=
"category"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"isTop"
column=
"is_top"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.platform.entity.PostEntity"
>
...
...
@@ -24,14 +27,17 @@
`archived`,
`archived_by`,
`archived_date`,
`user_type`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`picture`,
`caption`,
`category`,
`user_id`
`user_id`,
`is_top`
from post
where id = #{id}
</select>
...
...
@@ -65,7 +71,7 @@
order by ${sidx} ${order}
</when>
<otherwise>
order by
id
desc
order by
create_time
desc
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
...
...
@@ -90,31 +96,39 @@
</if>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.PostEntity"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"save"
parameterType=
"com.platform.entity.PostEntity"
>
insert into post(
`id`,
`archived`,
`archived_by`,
`archived_date`,
`user_type`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`picture`,
`caption`,
`category`,
`user_id`)
`user_id`,
`is_top`)
values(
#{id},
#{archived},
#{archivedBy},
#{archivedDate},
#{userType},
#{createDate},
#{createdBy},
#{updateDate},
#{updatedBy},
#{version},
#{picture},
#{caption},
#{category},
#{userId})
#{userId},
#{isTop})
</insert>
<update
id=
"update"
parameterType=
"com.platform.entity.PostEntity"
>
...
...
@@ -123,14 +137,17 @@
<if
test=
"archived != null"
>
`archived` = #{archived},
</if>
<if
test=
"archivedBy != null"
>
`archived_by` = #{archivedBy},
</if>
<if
test=
"archivedDate != null"
>
`archived_date` = #{archivedDate},
</if>
<if
test=
"userType != null"
>
`user_type` = #{userType},
</if>
<if
test=
"createDate != null"
>
`create_date` = #{createDate},
</if>
<if
test=
"createdBy != null"
>
`created_by` = #{createdBy},
</if>
<if
test=
"updateDate != null"
>
`update_date` = #{updateDate},
</if>
<if
test=
"updatedBy != null"
>
`updated_by` = #{updatedBy},
</if>
<if
test=
"version != null"
>
`version` = #{version},
</if>
<if
test=
"picture != null"
>
`picture` = #{picture},
</if>
<if
test=
"caption != null"
>
`caption` = #{caption},
</if>
<if
test=
"category != null"
>
`category` = #{category},
</if>
<if
test=
"userId != null"
>
`user_id` = #{userId}
</if>
<if
test=
"userId != null"
>
`user_id` = #{userId},
</if>
<if
test=
"isTop != null"
>
`is_top` = #{isTop}
</if>
</set>
where id = #{id}
</update>
...
...
platform-admin/src/main/webapp/WEB-INF/page/sys/post.html
浏览文件 @
2ad38adf
...
...
@@ -14,7 +14,7 @@
<i-input
v-model=
"q.title"
@
on-enter=
"query"
placeholder=
"标题"
style=
"width:160px"
>
</i-input>
</span>
&
nbsp
 
;
<span>
作者:
<i-input
v-model=
"q.author"
@
on-enter=
"query"
placeholder=
"作者"
style=
"width:160px"
>
...
...
@@ -46,49 +46,70 @@
<Card
v-show=
"!showList"
>
<p
slot=
"title"
>
{{title}}
</p>
<i-form
ref=
"formValidate"
:model=
"post"
:rules=
"ruleValidate"
:label-width=
"80"
>
<Form-item
label=
"
0:已删除 1:正常"
prop=
"archived
"
>
<i-input
v-model=
"post.
archived"
placeholder=
"0:已删除 1:正常
"
/>
<Form-item
label=
"
文章标题"
prop=
"caption"
style=
"width: 800px
"
>
<i-input
v-model=
"post.
caption"
placeholder=
"文章标题
"
/>
</Form-item>
<Form-item
label=
"删除人"
prop=
"archivedBy"
>
<i-input
v-model=
"post.archivedBy"
placeholder=
"删除人"
/>
<Form-item
label=
"用户类型"
prop=
"userType"
style=
"width: 800px"
>
<i-select
placeholder=
"请选择"
v-model=
"post.userType"
:disabled=
"disabled"
@
on-change=
"changeType"
>
<i-option
v-for=
"(el,i) in typeList"
:key=
'i'
:value=
"el.value"
>
{{el.label}}
</i-option>
</i-select>
</Form-item>
<Form-item
label=
"删除时间"
prop=
"archivedDate"
>
<i-input
v-model=
"post.archivedDate"
placeholder=
"删除时间"
/>
<Form-item
label=
"app账户"
prop=
"createdBy"
style=
"width: 800px"
v-show=
"!account"
>
<i-input
v-model=
"post.createdBy"
placeholder=
"260977204970 or ctehillah@gmail.com"
@
on-blur=
"queryAccount"
/>
</Form-item>
<Form-item
label=
"创建时间"
prop=
"createDate"
>
<i-input
v-model=
"post.createDate"
placeholder=
"创建时间"
/>
<Form-item
label=
"是否显示"
prop=
"isShow"
>
<i-Switch
size=
"large"
v-model=
"isShow"
true-color=
"#13ce66"
false-color=
"#eeddff"
>
<span
slot=
"open"
>
显示
</span>
<span
slot=
"close"
>
隐藏
</span>
</i-Switch>
</Form-item>
<Form-item
label=
"创建人"
prop=
"createdBy"
>
<i-input
v-model=
"post.createdBy"
placeholder=
"创建人"
/>
<Form-item
label=
"图片"
prop=
"picture"
>
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
multiple
action=
"../api/osstest/uploadtest"
:before-upload=
"handleBeforeUpload"
:on-success=
"handleSuccess"
:show-upload-list=
"false"
accept=
"image/jpeg, image/png"
>
<i-button
icon=
"ios-cloud-upload-outline"
>
请选择图片
</i-button>
</upload>
<div
style=
"display: flex;position: relative;"
>
<div
v-for=
"item in uploadList"
style=
"margin-left: 5px;"
>
<img
:src=
"item"
width=
"100"
height=
"100"
id=
"itemImg"
>
<i
class=
"ivu-icon ivu-icon-ios-trash-outline"
style=
"cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"
@
click=
"delImg1(item)"
></i>
</div>
</div>
</Form-item>
<Form-item
label=
"更新时间"
prop=
"updateDate"
>
<i-input
v-model=
"post.updateDate"
placeholder=
"更新时间"
/>
<Form-item
label=
"文章内容"
prop=
"content"
>
<!-- <script id="Detail" name="tbCfVersion.versionDetail"type="text/plain">${pd.COLLSORT_DETAILS}</script>-->
<textarea
id=
"content"
style=
"width: 800px;height: 600px;"
></textarea>
</Form-item>
<Form-item
label=
"更新人"
prop=
"updatedBy"
>
<i-input
v-model=
"post.updatedBy"
placeholder=
"更新人"
/>
</Form-item>
<Form-item
label=
"版本"
prop=
"version"
>
<i-input
v-model=
"post.version"
placeholder=
"版本"
/>
</Form-item>
<Form-item
label=
"标题"
prop=
"caption"
>
<i-input
v-model=
"post.caption"
placeholder=
"标题"
/>
</Form-item>
<Form-item
label=
"文章内容"
prop=
"category"
>
<i-input
v-model=
"post.category"
placeholder=
"文章内容"
/>
</Form-item>
<Form-item
label=
"用户ID"
prop=
"userId"
>
<i-input
v-model=
"post.userId"
placeholder=
"用户ID"
/>
</Form-item>
<Form-item>
<i-button
type=
"primary"
@
click=
"handleSubmit('formValidate')"
>
提交
</i-button>
<i-button
type=
"warning"
@
click=
"reload"
style=
"margin-left: 8px"
/>
返回
</i-button>
<i-button
type=
"ghost"
@
click=
"handleReset('formValidate')"
style=
"margin-left: 8px"
>
重置
</i-button>
<i-button
type=
"primary"
@
click=
"handleSubmit('formValidate')"
>
提交
</i-button>
<i-button
type=
"warning"
@
click=
"reload"
style=
"margin-left: 8px"
/>
返回
</i-button>
<i-button
type=
"ghost"
@
click=
"handleReset('formValidate')"
style=
"margin-left: 8px"
>
重置
</i-button>
</Form-item>
</i-form>
</Card>
</div>
<script
src=
"${rc.contextPath}/js/sys/post.js?_${date.systemTime}"
></script>
<script
type=
"text/javascript"
>
var
content
=
UE
.
getEditor
(
'content'
);
UE
.
Editor
.
prototype
.
_bkGetActionUrl
=
UE
.
Editor
.
prototype
.
getActionUrl
;
UE
.
Editor
.
prototype
.
getActionUrl
=
function
(
action
)
{
if
(
action
==
'uploadimage'
||
action
==
'uploadscrawl'
||
action
==
'uploadimage'
)
{
return
'${rc.contextPath}/api/osstest/uploaditemimage'
;
}
else
{
return
this
.
_bkGetActionUrl
.
call
(
this
,
action
);
}
};
</script>
</body>
</html>
\ No newline at end of file
platform-admin/src/main/webapp/js/sys/post.js
浏览文件 @
2ad38adf
...
...
@@ -7,12 +7,20 @@ $(function () {
{
label
:
'用户ID'
,
name
:
'userId'
,
index
:
'user_id'
,
width
:
80
},
{
label
:
'评论数量'
,
name
:
'count'
,
index
:
'count'
,
width
:
80
},
{
label
:
'点赞数量'
,
name
:
'likes'
,
index
:
'likes'
,
width
:
80
},
{
label
:
'状态'
,
name
:
'archived'
,
index
:
'archived'
,
width
:
80
},
{
label
:
'状态'
,
name
:
'archived'
,
index
:
'archived'
,
width
:
80
,
formatter
:
function
(
value
,
options
,
row
)
{
if
(
value
===
1
)
{
return
'<span class="label label-success">正常</span>'
}
else
if
(
value
===
2
)
{
return
'<span class="label label-warning">下线</span>'
}
}
},
{
label
:
'创建时间'
,
name
:
'createDate'
,
index
:
'create_date'
,
width
:
80
},
{
label
:
'作者'
,
name
:
'createdBy'
,
index
:
'created_by'
,
width
:
80
},
{
label
:
'操作'
,
index
:
'operate'
,
width
:
80
,
formatter
:
function
(
value
,
grid
,
rows
)
{
return
'<
i-button class=
\
"ivu-btn ivu-btn-info
\
" style=
\'
border-radius:25px;
\'
type=
\
"info
\
" @click="placedTop">置顶</i-butto
n>'
;
return
'<
span class="label label-info pointer" onclick="vm.placedTop('
+
rows
.
id
+
')">置顶</spa
n>'
;
}
}
]
...
...
@@ -22,9 +30,24 @@ $(function () {
let
vm
=
new
Vue
({
el
:
'#rrapp'
,
data
:
{
uploadList
:
[],
account
:
true
,
typeList
:
[
{
value
:
0
,
label
:
'系统用户'
},
{
value
:
1
,
label
:
'app用户'
}
],
isShow
:
false
,
disabled
:
false
,
showList
:
true
,
title
:
null
,
post
:
{},
flag
:
true
,
ruleValidate
:
{
name
:
[
{
required
:
true
,
message
:
'名称不能为空'
,
trigger
:
'blur'
}
...
...
@@ -38,13 +61,81 @@ let vm = new Vue({
}
},
methods
:
{
changeType
:
function
()
{
let
type
=
this
.
post
.
userType
;
if
(
type
===
0
)
{
vm
.
account
=
true
;
}
else
if
(
type
===
1
)
{
vm
.
account
=
false
;
}
},
queryAccount
:
function
()
{
let
flag
=
vm
.
flag
;
let
url
=
'../tbcfuserinfo/queryByAccount?account='
+
this
.
post
.
createdBy
;
console
.
log
(
123456
,
this
.
post
.
createBy
)
Ajax
.
request
({
url
:
url
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
(
r
)
{
let
userId
=
r
.
userId
;
if
(
userId
==
null
||
userId
==
''
)
{
flag
=
false
}
}
});
return
flag
;
},
handleBeforeUpload
(
file
)
{
// 上传图片大小不超过5M
if
(
file
.
size
>
5
*
1024
*
1024
)
{
alert
(
'请上传不超过5M的图片'
);
return
false
;
}
console
.
log
(
123456
,
this
.
uploadList
)
const
check
=
this
.
uploadList
.
length
<
9
;
if
(
!
check
)
{
this
.
$Notice
.
warning
({
title
:
'最多只能上传九张图片'
});
return
false
;
}
// 限制上传文件的宽高
// return this.checkImageWH(file,750,320);
},
placedTop
:
function
()
{
},
handleSuccess
(
response
,
file
,
fileList
)
{
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
vm
.
uploadList
.
push
(
response
);
$
(
"#itemImg"
).
show
();
},
// 删除上传图片
delImg1
:
function
(
url
)
{
if
(
vm
.
title
!=
"详情"
)
{
vm
.
uploadList
.
remove
(
url
);
console
.
log
(
url
);
Ajax
.
request
({
url
:
"../api/upload/delFile?url="
+
url
,
async
:
false
,
type
:
"POST"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
// console.log(resultData);
iview
.
Message
.
success
(
resultData
.
success
);
}
});
}
},
query
:
function
()
{
vm
.
reload
();
},
add
:
function
()
{
vm
.
account
=
true
;
vm
.
isShow
=
false
;
vm
.
disabled
=
false
;
vm
.
showList
=
false
;
vm
.
title
=
"新增"
;
vm
.
post
=
{};
...
...
@@ -60,18 +151,35 @@ let vm = new Vue({
vm
.
getInfo
(
id
);
},
saveOrUpdate
:
function
(
event
)
{
let
url
=
vm
.
post
.
id
==
null
?
"../post/save"
:
"../post/update"
;
Ajax
.
request
({
url
:
url
,
params
:
JSON
.
stringify
(
vm
.
post
),
type
:
"POST"
,
contentType
:
"application/json"
,
successCallback
:
function
(
r
)
{
alert
(
'操作成功'
,
function
(
index
)
{
vm
.
reload
();
})
;
let
flag
=
vm
.
flag
;
console
.
log
(
121323
,
vm
.
post
.
userType
)
if
(
vm
.
post
.
userType
===
1
&&
vm
.
post
.
id
==
null
)
{
flag
=
this
.
queryAccount
();
}
if
(
flag
)
{
if
(
!
vm
.
isShow
)
{
vm
.
post
.
isShow
=
0
;
}
else
{
vm
.
post
.
isShow
=
1
;
}
});
let
url
=
vm
.
post
.
id
==
null
?
"../post/save"
:
"../post/update"
;
vm
.
post
.
picture
=
this
.
uploadList
.
map
(
res
=>
res
).
join
(
','
);
vm
.
post
.
category
=
encodeURI
(
UE
.
getEditor
(
'content'
).
getContent
());
// 富文本取值
vm
.
post
.
category
=
vm
.
post
.
category
.
replace
(
/ /g
,
" "
);
Ajax
.
request
({
url
:
url
,
params
:
JSON
.
stringify
(
vm
.
post
),
type
:
"POST"
,
contentType
:
"application/json"
,
successCallback
:
function
(
r
)
{
alert
(
'操作成功'
,
function
(
index
)
{
vm
.
reload
();
});
}
});
}
else
{
alert
(
'此用户不存在'
)
}
},
del
:
function
(
event
)
{
let
ids
=
getSelectedRows
(
"#jqGrid"
);
...
...
@@ -92,7 +200,8 @@ let vm = new Vue({
}
});
});
},
}
,
getInfo
:
function
(
id
)
{
Ajax
.
request
({
url
:
"../post/info/"
+
id
,
...
...
@@ -101,7 +210,8 @@ let vm = new Vue({
vm
.
post
=
r
.
post
;
}
});
},
}
,
reload
:
function
(
event
)
{
vm
.
showList
=
true
;
let
page
=
$
(
"#jqGrid"
).
jqGrid
(
'getGridParam'
,
'page'
);
...
...
@@ -116,7 +226,8 @@ let vm = new Vue({
page
:
page
}).
trigger
(
"reloadGrid"
);
vm
.
handleReset
(
'formValidate'
);
},
}
,
reloadSearch
:
function
()
{
vm
.
q
=
{
name
:
''
,
...
...
@@ -125,12 +236,14 @@ let vm = new Vue({
topic
:
''
};
vm
.
reload
();
},
}
,
handleSubmit
:
function
(
name
)
{
handleSubmitValidate
(
this
,
name
,
function
()
{
vm
.
saveOrUpdate
()
});
},
}
,
handleReset
:
function
(
name
)
{
handleResetForm
(
this
,
name
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论