my_information.html
6.3 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
<!DOCTYPE html>
<html lang="en">
{include file="public/head"/}
<link rel="stylesheet" href="__CDN__/assets/advertising/css/personalMsg.css">
<link rel="stylesheet" href="__CDN__/assets/advertising/mui/mui.picker.min.css">
<body>
<!-- 顶部 -->
<div class="personal_msg_top">
<!-- 头像 -->
<div class="per_msg_header layout align_center justify flex_row">
<div class="">头像</div>
<div class="header_img">
<img src="{$user.avatar}" alt="">
</div>
</div>
<div class="per_msg_nick layout align_center justify flex_row">
<div class="">昵称</div>
<div class="">
<input type="text" value="{$user.nickname}" placeholder="请输入微信昵称">
</div>
</div>
</div>
<!-- 底部 -->
<div class="personal_msg_bottom">
<div class="per_msg_single layout align_center justify flex_row" id="sexPicker">
<div class="">性别</div>
<div class="layout align_center justify flex_row">
<input type="text" placeholder="请选择性别" disabled class="sex_input" value="{$user.gender}">
<img src="__CDN__/assets/advertising/img/right.png" alt="">
</div>
</div>
<div class="per_msg_single layout align_center justify flex_row" id="agePicker">
<div class="">年龄</div>
<div class="layout align_center justify flex_row">
<input type="text" placeholder="请选择年份" disabled class="age_input" value="{:date('Y',$user['birthday'])}">
<img src="__CDN__/assets/advertising/img/right.png" alt="">
</div>
</div>
<div class="per_msg_single layout align_center justify flex_row" id="datePicker">
<div class="">生日</div>
<div class="layout align_center justify flex_row">
<input type="text" placeholder="请选择出生日期" disabled class="date_input" value="{:date('m-d',$user['birthday'])}">
<img src="__CDN__/assets/advertising/img/right.png" alt="">
</div>
</div>
<div class="per_msg_single layout align_center justify flex_row">
<div class="">所在城市</div>
<div class="city_name"></div>
</div>
<div class="btn">保存</div>
</div>
<!-- 提示 -->
<div class="personal_msg_tips layout justify flex_row">
<div class="personal_tips_icon">
<img src="__CDN__/assets/advertising/img/sun_34@2x.png" alt="">
</div>
<div>
<p>如实填写信息将有助于获取更多、更有用的信息!</p>
<p> 性别,年龄,生日填写后无法修改,如填写错误请联系客 服进行处理。</p>
</div>
</div>
{include file="public/js" /}
<script src="__CDN__/assets/advertising/mui/mui.min.js"></script>
<script src="__CDN__/assets/advertising/mui/mui.picker.min.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
var picker = new mui.PopPicker();
picker.setData([{
value: '1',
text: '男'
}, {
value: '2',
text: '女'
}]);
$("#sexPicker").click(function() {
var sex = $(".sex_input").val();
if (!sex) {
picker.show(function(selectItems) {
$(".sex_input").val(selectItems[0].text)
})
}
});
// 年
var dtPicker = new mui.DtPicker({
type: "year",
beginDate: new Date(1815, 04, 25), //设置开始日期
endDate: new Date(2119, 04, 25), //设置结束日期
});
$("#agePicker").click(function() {
var year = $(".age_input").val();
if (!year) {
dtPicker.show(function(e) {
$(".age_input").val(e.y.text);
});
}
});
// 月日
var dtPicker1 = new mui.DtPicker({
type: "day",
});
$("#datePicker").click(function() {
var date = $(".date_input").val();
if (!date) {
dtPicker1.show(function(e) {
$(".date_input").val(e.value)
})
}
});
wx.config(
{$jssdk}
);
wx.ready(function () {
wx.getLocation({
success: function (res) {
success(res);
},
cancel: function (res) {
alert('必须同意授权获取地理位置才能获得奖励哦');
}
});
});
function success(data) {
lat = data.latitude; //经度
lng = data.longitude; //纬度
//保存到用户表
$.ajax({
url:"{:url('home/user/location')}",
type:"POST",
data:{'user_id':user_id,'longitude':lng,'latitude':lat},
success:function(res){
if(res.code == 1){
toast('定位成功');
}else{
toast('定位失败');
}
},
error:function(res){
toast('与服务器断开连接')
}
});
//判断商户条件是否满足
$.ajax({
url:"{:url('home/index/distance_where')}",
type:"POST",
data:{'user_id':user_id,'longitude':lng,'latitude':lat,'goods_id':goods_id},
success:function(res){
if(res.code == 1){
is_where_satisfy = res.data.is_where_satisfy;
if (is_satisfy == '1' && is_where_satisfy == '1') {
init();
}else{
$(".quest_condition").show();
}
}else{
toast('与服务器断开连接')
}
},
error:function(){
toast('与服务器断开连接');
}
});
}
</script>
</body>
</html>