|
|
@@ -21,7 +21,7 @@
|
|
|
</van-row>
|
|
|
|
|
|
<van-cell-group class="user-group">
|
|
|
- <van-cell icon="records" title="全部订单" is-link />
|
|
|
+ <van-cell icon="records" title="全部订单" is-link @click="location"/>
|
|
|
</van-cell-group>
|
|
|
|
|
|
<van-cell-group>
|
|
|
@@ -33,7 +33,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { Row, Col, Icon, Cell, CellGroup } from 'vant';
|
|
|
+import { Row, Col, Icon, Cell, CellGroup,Toast } from 'vant';
|
|
|
+import {getAction} from '@/api/manage'
|
|
|
+import wx from 'weixin-jsapi'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -43,10 +45,61 @@ export default {
|
|
|
[Cell.name]: Cell,
|
|
|
[CellGroup.name]: CellGroup
|
|
|
},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ url: {
|
|
|
+ getJsapiConfig: '/f/api/wechat/getJsapiConfig',
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
created(){
|
|
|
//获取传入的参数
|
|
|
var param = this.$route.query;
|
|
|
console.log("ddf",param)
|
|
|
+ this.getJsapiConfig();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getJsapiConfig(){
|
|
|
+ //获取微信js配置信息
|
|
|
+ getAction(this.url.getJsapiConfig, {fullUrl:encodeURIComponent(location.href.split('#')[0])})
|
|
|
+ .then((res) => {
|
|
|
+ console.log("res",res);
|
|
|
+ var _config = eval('(' + res.data.configValue + ')');
|
|
|
+ console.log("12345====js", _config.appId)
|
|
|
+ wx.config({
|
|
|
+ debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
+ appId: _config.appId, // 必填,公众号的唯一标识
|
|
|
+ timestamp: _config.timeStamp, // 必填,生成签名的时间戳
|
|
|
+ nonceStr: _config.nonceStr, // 必填,生成签名的随机串
|
|
|
+ signature: _config.signature, // 必填,签名,见附录1
|
|
|
+ jsApiList: ['chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'getLocation'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
+ });
|
|
|
+ wx.ready(function() {
|
|
|
+ console.log("微信验证")
|
|
|
+ });
|
|
|
+ wx.error(function() {
|
|
|
+ console.log("微信验证失败")
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ location(){
|
|
|
+ wx.getLocation({
|
|
|
+ type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
+ success: function(res) {
|
|
|
+ console.log(JSON.stringify(res))
|
|
|
+ // var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
|
|
|
+ // var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
|
|
|
+ // var speed = res.speed; // 速度,以米/每秒计
|
|
|
+ // var accuracy = res.accuracy; // 位置精度
|
|
|
+ },
|
|
|
+ cancel: function() {
|
|
|
+ console.log("获取位置失败,请检查定位");
|
|
|
+ Toast("获取位置失败,请检查定位")
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|