index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import * as WxJsApi from '@/utils/wxJsApi.js'
  2. import * as API from '@/apis/index.js'
  3. export default {
  4. data() {
  5. return {
  6. longitude: '',
  7. latitude: '',
  8. list: [{
  9. image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  10. title: '昨夜星辰昨夜风,画楼西畔桂堂东',
  11. url:"/pages/buytickets/site?id=0cb4dd6c-ca33-4837-bd4a-7f01afb4d1a3"
  12. },
  13. {
  14. image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
  15. title: '身无彩凤双飞翼,心有灵犀一点通',
  16. url:"/pages/buytickets/site?id=0cb4dd6c-ca33-4837-bd4a-7f01afb4d1a3"
  17. },
  18. {
  19. image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
  20. title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳',
  21. url:"/pages/buytickets/site?id=0cb4dd6c-ca33-4837-bd4a-7f01afb4d1a3"
  22. }
  23. ],
  24. }
  25. },
  26. onLoad(){
  27. },
  28. methods: {
  29. getPoint() {
  30. WxJsApi.getLocation().then((res) => {
  31. var latitude = parseFloat(res.latitude);
  32. var longitude = parseFloat(res.longitude);
  33. this.latitude = latitude;
  34. this.longitude = longitude;
  35. }).catch(error => {
  36. })
  37. },
  38. getScan(){
  39. WxJsApi.scanQRCode(0).then(function(url){
  40. console.log(url)
  41. window.location.href=url;
  42. });
  43. },
  44. clickSwiper(index){
  45. var url=this.list[index].url;
  46. if(url){
  47. if(url.indexOf("http")==0){
  48. window.location.href=url;
  49. }else if(url.indexOf("/pages/")==0){
  50. uni.navigateTo({
  51. url:this.list[index].url
  52. })
  53. }
  54. }
  55. },
  56. closeDropdown() {
  57. this.$refs.uDropdown.close();
  58. }
  59. },onReady(){
  60. WxJsApi.getWxConfig(['scanQRCode','getLocation']);
  61. this.getPoint();
  62. //清空缓存
  63. this.carhelp.set("form",{});
  64. }
  65. }