-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting-user-name.html
118 lines (106 loc) · 4.17 KB
/
setting-user-name.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>nav</title>
<link href="css/icon-svg.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/edit.css" rel="stylesheet">
<link href="css/setting-detail.css" rel="stylesheet">
<link rel="stylesheet" href="less-css/public.css" />
<script src="js/vue.js"></script>
<script src="js/fastclick.js"></script>
<script>
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body);
}, false);
}
</script>
</head>
<body>
<div id="body-container"></div>
<div id="wrap" class="container-fluid">
<header id="header">
<button class="goback close glyphicon glyphicon-close" @click="close" key="save"></button>
</header>
<div class="row clear_margin_right" id="_EDIT_WRAP">
<div class="col-xs-12">
<button type="button" @click="setUserName" class="publish-btn btn">提交</button>
<h4 class="tx-nav">EDIT</h4>
<small class="tx-inform">修改用户名</small>
</div>
<div class="col-xs-12 _EDIT_CONTAINER" id="_EDIT_CONTAINER" >
<textarea name="textarea" v-model="message" placeholder="最少2个字..." class="textarea-edit"></textarea>
</div>
</div>
</div>
<div id="map"></div>
<script src="js/renyi.js"></script>
<script src="js/ready-pubilc.js"></script>
<script>
var _IMAGES = document.getElementById('_IMAGES');
new Vue({
el: '#header',
data: {
nav : false
},
methods : {
close : function () {
var w = plus.webview.currentWebview();//获取我这个窗口
plus.webview.close(w ,'slide-out-right' ,300);
}
}
});
var EDIT = new Vue({
el: '#_EDIT_WRAP',
data: {
message : window.localStorage.getItem('userName'),
message_type : false
},
methods : {
setUserName : function () {
this.message = this.message.replace(/\s/g,'');
if(this.message.length > 2 ) {
if(this.message_type) {
plus.nativeUI.showWaiting( "修改中..." );
var self = this;
renyi.ajax({
url : 'http://120.27.38.110/other/renyi/userAct.php',
type : 'post',
data : {
type : 'setUserName',
userId : parseInt(localStorage.getItem('userId'), 10),
userName : self.message
},
success : function () {
plus.nativeUI.closeWaiting();//关闭等待
window.localStorage.setItem('userName', self.message);
var w = plus.webview.currentWebview();//获取我这个窗口
plus.webview.close(w ,'slide-out-right' ,300);
},
error : function (data) {
plus.nativeUI.closeWaiting();//关闭等待
alert('请求失败'+data);
}
});
}else {
//直接关闭
var w = plus.webview.currentWebview();//获取我这个窗口
plus.webview.close(w ,'slide-out-right' ,300);
}
}else {
plus.nativeUI.toast( '用户名至少两个字符串' );
}
}
},
watch : {
message : function () {
this.message_type = true;
}
}
});
</script>
</body>
</html>