正在显示
1 个修改的文件
包含
73 行增加
和
89 行删除
@@ -66,107 +66,91 @@ | @@ -66,107 +66,91 @@ | ||
66 | <script src="__CDN__/assets/advertising/mui/mui.picker.min.js"></script> | 66 | <script src="__CDN__/assets/advertising/mui/mui.picker.min.js"></script> |
67 | <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> | 67 | <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> |
68 | <script> | 68 | <script> |
69 | - var picker = new mui.PopPicker(); | ||
70 | - picker.setData([{ | ||
71 | - value: '1', | ||
72 | - text: '男' | ||
73 | - }, { | ||
74 | - value: '2', | ||
75 | - text: '女' | ||
76 | - }]); | ||
77 | - $("#sexPicker").click(function() { | ||
78 | - var sex = $(".sex_input").val(); | ||
79 | - if (!sex) { | ||
80 | - picker.show(function(selectItems) { | ||
81 | - $(".sex_input").val(selectItems[0].text) | ||
82 | - }) | ||
83 | - } | ||
84 | - | ||
85 | - }); | 69 | + $(function(){ |
70 | + var picker = new mui.PopPicker(); | ||
71 | + picker.setData([{ | ||
72 | + value: '1', | ||
73 | + text: '男' | ||
74 | + }, { | ||
75 | + value: '2', | ||
76 | + text: '女' | ||
77 | + }]); | ||
78 | + $("#sexPicker").click(function() { | ||
79 | + var sex = $(".sex_input").val(); | ||
80 | + if (!sex) { | ||
81 | + picker.show(function(selectItems) { | ||
82 | + $(".sex_input").val(selectItems[0].text) | ||
83 | + }) | ||
84 | + } | ||
86 | 85 | ||
87 | - // 年 | ||
88 | - var dtPicker = new mui.DtPicker({ | ||
89 | - type: "year", | ||
90 | - beginDate: new Date(1815, 04, 25), //设置开始日期 | ||
91 | - endDate: new Date(2119, 04, 25), //设置结束日期 | ||
92 | - }); | ||
93 | - $("#agePicker").click(function() { | ||
94 | - var year = $(".age_input").val(); | ||
95 | - if (!year) { | ||
96 | - dtPicker.show(function(e) { | ||
97 | - $(".age_input").val(e.y.text); | ||
98 | - }); | ||
99 | - } | 86 | + }); |
100 | 87 | ||
101 | - }); | 88 | + // 年 |
89 | + var dtPicker = new mui.DtPicker({ | ||
90 | + type: "year", | ||
91 | + beginDate: new Date(1815, 04, 25), //设置开始日期 | ||
92 | + endDate: new Date(2119, 04, 25), //设置结束日期 | ||
93 | + }); | ||
94 | + $("#agePicker").click(function() { | ||
95 | + var year = $(".age_input").val(); | ||
96 | + if (!year) { | ||
97 | + dtPicker.show(function(e) { | ||
98 | + $(".age_input").val(e.y.text); | ||
99 | + }); | ||
100 | + } | ||
102 | 101 | ||
103 | - // 月日 | ||
104 | - var dtPicker1 = new mui.DtPicker({ | ||
105 | - type: "day", | ||
106 | - }); | ||
107 | - $("#datePicker").click(function() { | ||
108 | - var date = $(".date_input").val(); | ||
109 | - if (!date) { | ||
110 | - dtPicker1.show(function(e) { | ||
111 | - $(".date_input").val(e.value) | ||
112 | - }) | ||
113 | - } | ||
114 | - }); | 102 | + }); |
115 | 103 | ||
116 | - wx.config( | ||
117 | - {$jssdk} | ||
118 | - ); | ||
119 | - wx.ready(function () { | ||
120 | - wx.getLocation({ | ||
121 | - success: function (res) { | ||
122 | - success(res); | ||
123 | - }, | ||
124 | - cancel: function (res) { | ||
125 | - alert('必须同意授权获取地理位置才能获得奖励哦'); | 104 | + // 月日 |
105 | + var dtPicker1 = new mui.DtPicker({ | ||
106 | + type: "day", | ||
107 | + }); | ||
108 | + $("#datePicker").click(function() { | ||
109 | + var date = $(".date_input").val(); | ||
110 | + if (!date) { | ||
111 | + dtPicker1.show(function(e) { | ||
112 | + $(".date_input").val(e.value) | ||
113 | + }) | ||
126 | } | 114 | } |
127 | }); | 115 | }); |
128 | - }); | ||
129 | - function success(data) { | ||
130 | - lat = data.latitude; //经度 | ||
131 | - lng = data.longitude; //纬度 | ||
132 | - //保存到用户表 | ||
133 | - $.ajax({ | ||
134 | - url:"{:url('home/user/location')}", | ||
135 | - type:"POST", | ||
136 | - data:{'user_id':user_id,'longitude':lng,'latitude':lat}, | ||
137 | - success:function(res){ | ||
138 | - if(res.code == 1){ | ||
139 | - toast('定位成功'); | ||
140 | - }else{ | ||
141 | - toast('定位失败'); | 116 | + var user_id = "{$user.id}"; |
117 | + var lat = ''; | ||
118 | + var lng = ''; | ||
119 | + wx.config( | ||
120 | + {$jssdk} | ||
121 | + ); | ||
122 | + wx.ready(function () { | ||
123 | + wx.getLocation({ | ||
124 | + success: function (res) { | ||
125 | + console.log(res); | ||
126 | + success(res); | ||
127 | + }, | ||
128 | + cancel: function (res) { | ||
129 | + alert('必须同意授权获取地理位置才能获得奖励哦'); | ||
142 | } | 130 | } |
143 | - }, | ||
144 | - error:function(res){ | ||
145 | - toast('与服务器断开连接') | ||
146 | - } | 131 | + }); |
147 | }); | 132 | }); |
148 | - //判断商户条件是否满足 | ||
149 | - $.ajax({ | ||
150 | - url:"{:url('home/index/distance_where')}", | ||
151 | - type:"POST", | ||
152 | - data:{'user_id':user_id,'longitude':lng,'latitude':lat,'goods_id':goods_id}, | ||
153 | - success:function(res){ | ||
154 | - if(res.code == 1){ | ||
155 | - is_where_satisfy = res.data.is_where_satisfy; | ||
156 | - if (is_satisfy == '1' && is_where_satisfy == '1') { | ||
157 | - init(); | 133 | + function success(data) { |
134 | + lat = data.latitude; //经度 | ||
135 | + lng = data.longitude; //纬度 | ||
136 | + //保存到用户表 | ||
137 | + $.ajax({ | ||
138 | + url:"{:url('home/user/location')}", | ||
139 | + type:"POST", | ||
140 | + data:{'user_id':user_id,'longitude':lng,'latitude':lat}, | ||
141 | + success:function(res){ | ||
142 | + if(res.code == 1){ | ||
143 | + toast('定位成功'); | ||
158 | }else{ | 144 | }else{ |
159 | - $(".quest_condition").show(); | 145 | + toast('定位失败'); |
160 | } | 146 | } |
161 | - }else{ | 147 | + }, |
148 | + error:function(res){ | ||
162 | toast('与服务器断开连接') | 149 | toast('与服务器断开连接') |
163 | } | 150 | } |
164 | - }, | ||
165 | - error:function(){ | ||
166 | - toast('与服务器断开连接'); | ||
167 | - } | ||
168 | - }); | ||
169 | - } | 151 | + }); |
152 | + } | ||
153 | + }); | ||
170 | </script> | 154 | </script> |
171 | </body> | 155 | </body> |
172 | 156 |
-
请 注册 或 登录 后发表评论