-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwritecomment.html
118 lines (110 loc) · 3.44 KB
/
writecomment.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>
<head>
<meta charset="utf-8">
<title>写点评</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!--标准mui.css-->
<link rel="stylesheet" href="css/mui.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/font-awesome.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="css/app.css" />
<script src="js/mui.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/app.js"></script>
<script src="js/vue.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
</head>
<body>
<!--<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">写点评</h1>
</header>-->
<nav class="mui-bar mui-bar-tab no-border">
<a class="mui-col-xs-12 mui-btn mui-btn-blue" onclick="submit()">
提交
</a>
</nav>
<div class="mui-content" id="content">
<div class="feedback mui-text-center">
<h5>您的评价会让我们做得更好</h5>
<div class="icons mui-inline">
<i data-index="1" class="fa" v-on:click="data.score=10" :class="data.score>=10?'fa-star':'fa-star-o'"></i>
<i data-index="2" class="fa" v-on:click="data.score=20" :class="data.score>=20?'fa-star':'fa-star-o'"></i>
<i data-index="3" class="fa" v-on:click="data.score=30" :class="data.score>=30?'fa-star':'fa-star-o'"></i>
<i data-index="4" class="fa" v-on:click="data.score=40" :class="data.score>=40?'fa-star':'fa-star-o'"></i>
<i data-index="5" class="fa" v-on:click="data.score=50" :class="data.score>=50?'fa-star':'fa-star-o'"></i>
</div>
</div>
<div class=" pos-rel">
<textarea placeholder="导游讲解点怎么样,与大家分享一下吧" v-model="data.comment"></textarea>
<span id="word" class="word pos-abs">200</span>
</div>
</div>
</body>
<script type="text/javascript">
var vue1 = new Vue({
el: '#content',
data: {
data: {
score:50,
comment:""
}
},
updated: function() {
this.$nextTick(function() {
})
},
methods: {
chooseCity: function(event) {
wx.miniProgram.navigateBack();
}
},
watch:{
'data.comment':function(comment,oldComment){
var len = comment.length;
if(len > 200) {
this.data.comment = oldComment
}
}
}
});
function submit() {
if(vue1.data.comment.trim() == ""){
mui.toast("请输入评价内容!")
return;
}
$.ajax({
dataType: "json",
type: "post",
headers: {
'Content-Type': 'application/json',
'token': myLocalStorage.getItem("token")
},
url: basePath + "services/grade",
data: JSON.stringify(
{
"comment":vue1.data.comment,
"lineid":myLocalStorage.getItem("lineid"),
"score":vue1.data.score
}
),
success: function(res) {
if(res.status == 0) {
mui.toast("提交成功!");
wx.navigateBack();
} else {
mui.toast(res.errmsg)
}
},
error: function(result) {
mui.toast("请求遇到问题!")
}
});
}
</script>
</body>
</html>