清冷白月光趁总裁不备竟学习微信小程序的DAY2

先插播一下,太烦有的应用自启动了,自存一个设置方法。

win-i,然后找到应用,然后点启动。

宝宝,你睡得着吗?《影响很大》。

一、笔记

1.小程序页面配置

"window": {
    "navigationBarTextStyle": "white",
    "navigationBarTitleText": "Weixin",
    "navigationBarBackgroundColor": "#003377",
    "enablePullDownRefresh": true,
    "backgroundTextStyle": "light",
    "onReachBottomDistance": 50
  },

2.域名配置

在微信小程序官网里面

二、问题

拼尽全力无法解决

first.js:13 GET https://www.escook.cn/api/get?name=zs&age=20 404(env: Windows,mp,1.06.2412050; lib: 3.8.1)
getInfo @ first.js:13
first.js:21 <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

解决了

啊啊啊这是我亲爹送来的api

//获取轮播图数据的方法
  getSwiperList(){
    wx.request({
      url: 'https://applet-base-api-t.itheima.net/slides',
      method:'GET',
      success: (res) => {
          console.log(res)
      }
    })
  },

但是我发现我根本没明白。

这里面的九宫格完全是后端的吧,完全不能修改,就是他应该是从属于这个域名里面的,搭建后端就是要域名 吗?关键是这个域名也不是随便自己能建的,要是连tomcat,他的网站不是https就加不进域名。哇哇哇,而且我现在关注的都是很表面的,深层的做起来更是永无天日。哈哈。真的吗。加油

我又解决了

谁懂呢,谁懂这一刻的救赎感,只要地图在,我人就在!地图亡则我亡!我真是天才少女啊!哈哈哈哈哈哈哈哈哈哈哈哈哈哈(不知道在燃什么)

宝宝我们是一个好宝宝。

代码写一下

1.plan.js

Page({
  data: {
    longitude: 116.397128,  
    latitude: 39.916527,
    key: 'oooo'  // 替换为你的腾讯地图 Key
  },

  onLoad: function () {
    // this.getLocation();  // 页面加载时获取用户位置
  },

  getLocation: function () {
    wx.getLocation({
      type: 'wgs84',  // 使用WGS84标准
      success: res => {
        this.setData({
          longitude: res.longitude,  // 设置获取到的经度
          latitude: res.latitude      // 设置获取到的纬度
        });
      },
      fail: () => {
        wx.showToast({
          title: '获取位置失败',  // 获取位置失败时提示用户
          icon: 'none'
        });
      }
    });
  }
});

2.plan.wxml

<view class="container">
  <map id="myMap" longitude="{{longitude}}" latitude="{{latitude}}" scale="14" style="width: 100%; height: 100%;">
    <!-- 地图组件,绑定经纬度,设置缩放级别 -->
  </map>
</view>

3.plan.wxss

.container {
  width: 100%;
  height: 800px;  
  margin: 0;  /* 清除外边距 */
  padding: 0;
}

map {
  width: 100%;   
  height: 800px; 
}

4.plan.json

{
  "usingComponents": {}, 
  "plugins": {
    "planChooseLocation": {
      "version": "1.0.0",
      "provider": "oooo"  
  },
  "permission": {
    "scope.userLocation": {
      "desc": "你的位置信息将用于小程序定位"  
    }
  }
}
}

5.app.js

// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)




// app.js
App({
  globalData: {
    mapKey: 'ooooo' // 替换为你的地图 API Key
  }
});




    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    userInfo: null
  }
})

6.app.json

{
  "pages": [
    "pages/first/first",
    "pages/plan/plan",
    "pages/tool/tool",
    "pages/home/home"
  ],
  "window": {
    "navigationBarTextStyle": "white",
    "navigationBarTitleText": "Weixin",
    "navigationBarBackgroundColor": "#003377",
    "enablePullDownRefresh": true,
    "backgroundTextStyle": "light",
    "onReachBottomDistance": 50
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/first/first",
      "text": "首页",
      "iconPath": "/images/9.png",
      "selectedIconPath": "/images/10.png"
    },
    {
      "pagePath": "pages/plan/plan",
      "text": "计划",
      "iconPath": "/images/3.png",
      "selectedIconPath": "/images/4.png"
    },
  
    {
      "pagePath": "pages/tool/tool",
      "text": "工具",
      "iconPath": "/images/5.png",
      "selectedIconPath": "/images/6.png"
    },
    {
      "pagePath": "pages/home/home",
      "text": "我的",
      "iconPath": "/images/7.png",
      "selectedIconPath": "/images/8.png"
    }]
  },
  

  "permission": {
    "scope.userLocation": {
      "desc": "你的位置信息将用于小程序位置接口的效果展示" 
    }
  },
  
    


  "style": "v2",
  "componentFramework": "glass-easel",
  "sitemapLocation": "sitemap.json",
  "lazyCodeLoading": "requiredComponents"
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值