-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserinfo.html
246 lines (222 loc) · 7.59 KB
/
userinfo.html
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>个人资料</title>
<link rel="stylesheet" href="css/sta.css">
<link href="css/mui.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/cropper.css" />
<script src="js/jquery-3.2.1.slim.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/cropper.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mui.min.js"></script>
</head>
<body style="background:#f0f0f0;">
<div id="main">
<router-view></router-view>
</div>
</body>
<script type="text/template" id="index-page">
<div>
<div class="index_box" id="app" style="margin-top:60px">
<div class="nearby_top">
<h1>个人资料</h1>
<a class="index_back mui-action-back"><img src="img/back.png" alt="" width="100%" height="100%"></a>
</div>
<div class="people_date_box">
<h5><a onclick="showActionSheet()">头像<img src="img/bac.png" alt="" class="date_img2"><img :src="logo" alt="" class="date_img1" id="headIcon"></a></h5>
<div class="clr"></div>
<p>
<router-link :to="{ path: 'nickname', query: { nickname: nickname }}"><span>昵称<b>{{nickname}}</b></span><i><img src="img/bac.png" alt=""></i></router-link>
</p>
<p>
<router-link :to="{ path: 'sign', query: { signature: signature }}"><span>签名<b>{{signature}}</b></span><i><img src="img/bac.png" alt=""></i></router-link>
</p>
</div>
<div class="people_date_box">
<p>
<a @tap="goPage('bank.html')"><span>银行卡</span><i><img src="img/bac.png" alt=""></i></a>
</p>
<p>
<a @tap="goPage('realname.html')"><span>实名认证</span><i><img src="img/bac.png" alt=""></i></a>
</p>
<p>
<a @tap="goPage('account.html')"><span>账户安全</span><i><img src="img/bac.png" alt=""></i></a>
</p>
<p>
<a @tap="goPage('contacts.html')"><span>用户地址</span><i><img src="img/bac.png" alt=""></i></a>
</p>
</div>
</div>
<div style="text-align: center;z-index: 99;width: 100%;height: 2000px;background-color: #f2f2f2 ;position: absolute;top:40px;left: 0px;display: none;"
id="spinner">
<div style="width:90px;padding-top:200px;margin:0 auto;height: 100%;">
<div style="width:30px;float: left;">
<span class="mui-spinner" style="height: 20px;"></span>//等待动画
</div>
<div style="width:60px;float: left;">请稍等...</div>
<div class="clear"></div>
</div>
</div>
<div id="showEdit" style="width:100%;height: 100%;background-color: #fff;position: absolute;top:60;left: 0;display: none;z-index: 9;">
<div id="report" style="width:100%;height: 100%;z-index: 10;">
<img id="readyimg" style="width:100%;">
</div>
<div class="mui-content-padded" style="width:100%;height: 100px;z-index: 110;position: absolute;top:0px;left:0px;margin: 10px 0;">
<div class="flex-container" style="height: 40px;background: #000;">
<a style="color: #fff;width: 25%;float: left;height: 40px;line-height: 40px;"><span class="mui-icon mui-icon-closeempty" onclick="closepop()" style="font-size: 40px;"></span></a>
<a style="color: #fff;width: 25%;float: left;text-align: center;height: 40px;line-height: 40px;"><span class="mui-icon mui-icon-undo" onclick="rotateimgleft()" style="font-size: 40px;"></span></a>
<a style="color: #fff;width: 25%;float: left;text-align: center;height: 40px;line-height: 40px;"><span class="mui-icon mui-icon-redo" onclick="rotateimg()" style="font-size: 40px;"></span></a>
<a style="color: #fff;width: 25%;float: left;text-align: right;height: 40px;line-height: 40px;"><span class="mui-icon mui-icon-checkmarkempty" onclick="confirmSelect()" style="font-size: 40px;"></span></a>
<div class="clr"></div>
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="nickname-page">
<div class="index_box">
<div class="nearby_top">
<h1>修改昵称</h1>
<a class="index_back mui-action-back"><img src="img/back.png" alt="" width="100%" height="100%"></a>
</div>
<div style="margin: 60px 0 60px 0;">
<div class="nikename_box">
<input type="text" v-model="nickname">
</div>
<div class="nikename_bt">
<button @tap="setNickname">保存</button>
</div>
</div>
</div>
</script>
<script type="text/template" id="sign-page">
<div class="index_box">
<div class="nearby_top">
<h1>修改签名</h1>
<a class="index_back mui-action-back"><img src="img/back.png" alt="" width="100%" height="100%"></a>
</div>
<!-- 列表 -->
<div style="margin: 60px 0 60px 0;">
<div class="nikename_box">
<input type="text" v-model="signature">
</div>
<div class="nikename_bt">
<button @tap="setSign">保存</button>
</div>
</div>
</div>
</script>
<script src="js/config.js"></script>
<script src="js/common.js"></script>
<script src="js/vue.js"></script>
<script src="js/vue-router.js"></script>
<script src="js/userinfo.js"></script>
<script type="text/javascript">
//拍照
function getImage() {
var cmr = plus.camera.getCamera();
cmr.captureImage(function (p) {
plus.io.resolveLocalFileSystemURL(p, function (entry) {
var localurl = entry.toLocalURL(); //
$("#report").html('<img src="' + localurl + '">');
cutImg();
mui('#picture').popover('toggle');
});
});
}
//相册选取
function galleryImgs() {
plus.gallery.pick(function (e) {
//alert(e);
$("#readyimg").attr("src", e);
cutImg();
mui('#picture').popover('toggle');
}, function (e) {
//outSet( "取消选择图片" );
}, {
filter: "image"
});
}
//照片裁剪类
function cutImg() {
$("#app").hide();
$("#showEdit").show();
var $image = $('#report > img');
$image.cropper({
checkImageOrigin: true,
aspectRatio: 1 / 1,
autoCropArea: 0.3,
zoom: -0.2
});
// $image.cropper('zoom',-0.5);
}
//确认照片,展示效果
function confirmSelect() {
$("#showEdit").hide();
var $image = $('#report > img');
var dataURL = $image.cropper("getCroppedCanvas");
// var imgurl = dataURL.toDataURL("image/png", 0.5);
//换成下边的方法,转成jpeg,但是把质量降低,
//经测试51k的png,转成0.3质量,大小为3k多,0.5质量大小为4k多,
//这回应该不会出现卡的情况了,
//既然差别1k多,还是用0.5的质量,还是要兼顾下显示效果的。
var imgurl = dataURL.toDataURL("image/jpeg", 0.5);
postAvatar(imgurl);
}
//旋转照片
function rotateimg() {
$("#readyimg").cropper('rotate', 90);
}
function rotateimgleft() {
$("#readyimg").cropper('rotate', -90);
}
function closepop() {
$("#showEdit").show();
var $image = $('#report > img');
$image.cropper('destroy');
$("#app").show();
}
function showActionSheet() {
var bts = [{
title: "拍照"
}, {
title: "从相册选择"
}];
plus.nativeUI.actionSheet({
cancel: "取消",
buttons: bts
},
function (e) {
if (e.index == 1) {
getImage();
} else if (e.index == 2) {
galleryImgs();
}
//outLine( "选择了\""+((e.index>0)?bts[e.index-1].title:"取消")+"\"");
}
);
}
//post内容
function postAvatar(imgurl) {
postJson(
'api/user/setAvatar', {
img: imgurl
},
function (ret) {
if (ret.code == 200) {
$("#headIcon").attr("src", imgurl);
$("#app").show();
}
},
function () {
mui.toast('上传失败, 请重试');
},
true
);
}
</script>
</html>