virtualEdit.html
7.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="topicForm" id="topicForm" method="post">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>UID</label> <br>
<input id="uid" name="uid" class="easyui-textbox" style="width: 380px;"/>
<a id="userBotton" class="btn btn-small" style="font-size: 18px;">确认</a>
<div id="userInfo">
</div>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>达人昵称</label> <br>
<input id="nickName" name="nickName" class="easyui-textbox" style="width: 380px;"/>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>头像</label> <br>
<div id="imageUpload">
</div>
<!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>-->
</td>
</tr>
<tr style="height: 60px">
<td>
<label>简介</label> <br>
<textarea id="signature" name="signature" style="width: 380px;" rows="6" placeholder=""
required="true" maxlength="500"></textarea>
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red">*</span><label>用户身份</label><br>
<input class="easyui-combobox" id="groupId" name="groupId">
</input>
<!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>-->
</td>
</tr>
<tr style="height: 60px">
<td>
<span style="color:red"></span><label>擅长领域</label> <br>
<textarea id="skillsDesc" name="skillsDesc" style="width: 380px;" rows="6" placeholder=""
maxlength="500"></textarea>
<br>
<label>100字以内,案例:美食生活、数码电子、时尚穿搭</label>
</td>
</tr>
<tr style="height: 60px">
<td>
<input value="1" type="radio" name="authStatus">认证</input>
<input value="0" type="radio" name="authStatus" required="true">取消认证</input>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
$(function () {
$("#userBotton").linkbutton({
iconCls: "icon-search",
onClick: function () {
//发送请求
$.ajax({
type: "POST",
url: serverContextPath + "/grassArticle/getUserInfo", //提交到后端的url
dataType: 'json',
data: {
uid: $("#uid").textbox("getValue")
},
success: function (result) {
if (result.code == 200) {
if (result.data != null && result.data != '') {
debugger
var headIco = result.data.headIco.substring(0, result.data.headIco.indexOf("?"));
var nickName = result.data.nickName;
$("#nickName").textbox("setValue", nickName);
$("#imageUpload").imageUpload('setValue', headIco);
$("#userInfo").html("");
//图片不可更改
$("#imageUpload .file-close").hide();
} else {
var html = '<span style="color:red;font-size: 15px;">获取用户信息失败,请检查uid输入是否正确</span>';
$("#userInfo").html(html);
$("#nickName").textbox("setValue", "");
$("#imageUpload").imageUpload("setValue", "");
}
}
else {
var html = '<span style="color:red;font-size: 15px;">获取用户信息失败,请稍后重试</span>';
$("#userInfo").html(html);
$("#nickName").textbox("setValue", "");
$("#imageUpload").imageUpload("setValue", "");
}
}
});
}
});
$("#nickName").textbox({
required: true,
missingMessage: "昵称不能为空",
prompt: "请输入昵称"
});
$("#groupId").combobox({
valueField: "id",
textField: "groupName",
required: true,
prompt: "身份类型",
url: serverContextPath + "/grassUserManage/getAllVirtualGroup",
loadFilter: function (data) {
var data = defaultLoadFilter(data);
// data.unshift({'id': '', 'groupName': '--用户身份类型--'});
return data;
}
});
$("#imageUpload").imageUpload({
width: 171,
height: 120,
realInputName: "headIcon",
url: serverContextPath + '/fileupload/uploadFile',
queryParams: {
bucket: "yhb-img01"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误", data.message);
return "";
}
return data.data.url;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
return false;
}
});
//加载数据
var data = paramObject.mkData;
if (data) {
$("#userBotton").css("display", "none");
$("#uid").textbox('textbox').attr('readonly', true);
$("#uid").textbox("setValue", data.uid);
$("#nickName").textbox("setValue", data.nickName);
//图片
$("#imageUpload").imageUpload('setValue', data.headIcon);
$("#signature").html(data.signature);
$("#skillsDesc").html(data.skillsDesc== null ? "":data.skillsDesc);
//所属分组
$("#groupId").combobox('setValue', data.groupId);
$("input[name='authStatus'][value='" + data.authStatus + "']").attr("checked", "checked").parent().addClass('checked');
} else {
debugger
//新增
$("#nickName").textbox('textbox').attr('readonly', true);
$("#imageUpload").imageUpload("readonly", true);
}
});
</script>
</html>