<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>小程序 &#8211; 「马马虎虎」</title>
	<atom:link href="https://www.gek6.cn/category/web-front-end/%E5%B0%8F%E7%A8%8B%E5%BA%8F/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.gek6.cn</link>
	<description>极客蜗牛-开发效率很慢的...</description>
	<lastBuildDate>Thu, 03 Aug 2023 01:43:56 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.gek6.cn/wp-content/uploads/2021/12/20211205200322145-32x32.png</url>
	<title>小程序 &#8211; 「马马虎虎」</title>
	<link>https://www.gek6.cn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>解决微信公众平台素材库图片防盗链的问题</title>
		<link>https://www.gek6.cn/%e8%a7%a3%e5%86%b3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%b9%b3%e5%8f%b0%e7%b4%a0%e6%9d%90%e5%ba%93%e5%9b%be%e7%89%87%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/%e8%a7%a3%e5%86%b3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%b9%b3%e5%8f%b0%e7%b4%a0%e6%9d%90%e5%ba%93%e5%9b%be%e7%89%87%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Thu, 03 Aug 2023 01:43:48 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=163</guid>

					<description><![CDATA[微信公众号素材引用时提示：此图片&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<p>微信公众号素材引用时提示：此图片来自微信公众平台未经允许不可引用<br />
html模板加上这个属性即可 简单粗暴！</p>
<pre><code>&lt;meta name=&quot;referrer&quot; content=&quot;no-referrer&quot;/&gt;</code></pre>
<p>Referer 头部是一个 HTTP 头部，用于标识请求是从哪个页面发出的。例如，如果你从页面 A 点击一个链接到页面 B，那么在请求页面 B 时，浏览器会发送一个 Referer 头部，值为页面 A 的 URL。</p>
<p>设置了 referrer 策略为 &quot;no-referrer&quot;。这表示浏览器在请求资源时，不会发送 Referer 头部。这意味着目标服务器无法知道请求是从哪个页面发出的。</p>
<p>这个策略在一些情况下可能很有用，例如，当你不希望其他人知道你的页面从哪里链接过来时，或者你不希望把你的页面的 URL 暴露给其他人时。然而，它也可能导致一些问题，因为一些服务可能依赖 Referer 头部来进行防盗链或者跟踪用户行为。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e8%a7%a3%e5%86%b3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%b9%b3%e5%8f%b0%e7%b4%a0%e6%9d%90%e5%ba%93%e5%9b%be%e7%89%87%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>IOS12.X 微信小程序样式错乱问题</title>
		<link>https://www.gek6.cn/ios12-x-%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%a0%b7%e5%bc%8f%e9%94%99%e4%b9%b1%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/ios12-x-%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%a0%b7%e5%bc%8f%e9%94%99%e4%b9%b1%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Wed, 03 Aug 2022 06:45:19 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=123</guid>

					<description><![CDATA[嵌套flex布局引起]]></description>
										<content:encoded><![CDATA[<h2>嵌套flex布局引起</h2>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/ios12-x-%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%a0%b7%e5%bc%8f%e9%94%99%e4%b9%b1%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>webstorm开发uniapp时rpx单位问题</title>
		<link>https://www.gek6.cn/webstorm%e5%bc%80%e5%8f%91uniapp%e6%97%b6rpx%e5%8d%95%e4%bd%8d%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/webstorm%e5%bc%80%e5%8f%91uniapp%e6%97%b6rpx%e5%8d%95%e4%bd%8d%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Thu, 28 Jul 2022 07:13:56 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=101</guid>

					<description><![CDATA[痛点：使用webstorm开发小&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h3>痛点：使用webstorm开发小程序或者uniapp时，无法识别rpx单位报红，格式化后会在数值与单位之间添加空格</h3>
<p><img decoding="async" src="https://www.gek6.cn/wp-content/uploads/2022/07/下载插件.png" alt="下载插件" /></p>
<p><img decoding="async" src="https://www.gek6.cn/wp-content/uploads/2022/07/配置插件.png" alt="配置插件" /></p>
<p><img decoding="async" src="https://www.gek6.cn/wp-content/uploads/2022/07/配置后rpx就不飘红了.png" alt="配置后rpx就不飘红了" /></p>
<ul>
<li>使用webstorm自带格式化 OK</li>
<li>使用es-lint格式化 OK</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/webstorm%e5%bc%80%e5%8f%91uniapp%e6%97%b6rpx%e5%8d%95%e4%bd%8d%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>小程序解决轮播图倒角（圆角），IOS无法生效的问题</title>
		<link>https://www.gek6.cn/%e5%b0%8f%e7%a8%8b%e5%ba%8f%e8%a7%a3%e5%86%b3%e8%bd%ae%e6%92%ad%e5%9b%be%e5%80%92%e8%a7%92%ef%bc%88%e5%9c%86%e8%a7%92%ef%bc%89%ef%bc%8cios%e6%97%a0%e6%b3%95%e7%94%9f%e6%95%88%e7%9a%84%e9%97%ae/</link>
					<comments>https://www.gek6.cn/%e5%b0%8f%e7%a8%8b%e5%ba%8f%e8%a7%a3%e5%86%b3%e8%bd%ae%e6%92%ad%e5%9b%be%e5%80%92%e8%a7%92%ef%bc%88%e5%9c%86%e8%a7%92%ef%bc%89%ef%bc%8cios%e6%97%a0%e6%b3%95%e7%94%9f%e6%95%88%e7%9a%84%e9%97%ae/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Sun, 05 Dec 2021 11:31:48 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=49</guid>

					<description><![CDATA[小程序解决轮播图倒角（圆角），I&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h3>小程序解决轮播图倒角（圆角），IOS无法生效的问题</h3>
<h3>HTML</h3>
<p><!-- 轮播图 --></p>
<pre><code class="language-html">
&lt;!-- 轮播图 --&gt;
&lt;swiper class=&quot;screen-swiper&quot;     :circular=&quot;true&quot;
:autoplay=&quot;true&quot; interval=&quot;5000&quot; duration=&quot;500&quot; :indicator-color=&quot;bannerDotColor&quot; :indicator-active-color=&quot;bannerDotActiveColor&quot;&gt;
    &lt;swiper-item v-for=&quot;(item,index) in swiperList&quot; :key=&quot;index&quot;&gt;
        &lt;image :src=&quot;item.url&quot; mode=&quot;aspectFill&quot; v-if=&quot;item.type==&#039;image&#039;&quot;&gt;&lt;/image&gt;
        &lt;video :src=&quot;item.url&quot; autoplay loop muted :show-play-btn=&quot;false&quot; :controls=&quot;false&quot; objectFit=&quot;cover&quot; v-if=&quot;item.type==&#039;video&#039;&quot;&gt;&lt;/video&gt;
    &lt;/swiper-item&gt;
&lt;/swiper&gt;</code></pre>
<h3>CSS</h3>
<pre><code class="language-css">.screen-swiper{
    box-shadow:0px 20upx 14upx -20upx #000; border-radius:10px; 
     -webkit-backface-visibility: hidden;
     -webkit-transform: translate3d(0, 0, 0);
}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e5%b0%8f%e7%a8%8b%e5%ba%8f%e8%a7%a3%e5%86%b3%e8%bd%ae%e6%92%ad%e5%9b%be%e5%80%92%e8%a7%92%ef%bc%88%e5%9c%86%e8%a7%92%ef%bc%89%ef%bc%8cios%e6%97%a0%e6%b3%95%e7%94%9f%e6%95%88%e7%9a%84%e9%97%ae/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>获取任意一个小程序的APPID及页面路径信息</title>
		<link>https://www.gek6.cn/%e8%8e%b7%e5%8f%96%e4%bb%bb%e6%84%8f%e4%b8%80%e4%b8%aa%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%9a%84appid%e5%8f%8a%e9%a1%b5%e9%9d%a2%e8%b7%af%e5%be%84%e4%bf%a1%e6%81%af/</link>
					<comments>https://www.gek6.cn/%e8%8e%b7%e5%8f%96%e4%bb%bb%e6%84%8f%e4%b8%80%e4%b8%aa%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%9a%84appid%e5%8f%8a%e9%a1%b5%e9%9d%a2%e8%b7%af%e5%be%84%e4%bf%a1%e6%81%af/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Sun, 05 Dec 2021 11:16:00 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=46</guid>

					<description><![CDATA[第一步获取APPID 第二步 获&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h3>第一步获取APPID</h3>
<p><img decoding="async" src="http://thamiti-blog.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2021/12/20211205191027800.png" alt="1" /></p>
<p><img decoding="async" src="http://thamiti-blog.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2021/12/20211205191305676.png" alt="2" /></p>
<p><img decoding="async" src="http://thamiti-blog.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2021/12/20211205191307133.png" alt="3" /></p>
<h3>第二步 获取 页面路径</h3>
<h5>首先自己有个小程序</h5>
<p><img decoding="async" src="https://thamiti-blog.oss-accelerate.aliyuncs.com/tuchuang/%E8%8E%B7%E5%8F%96%E4%BB%BB%E6%84%8F%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84APPID%E5%8F%8A%E9%A1%B5%E9%9D%A2%E8%B7%AF%E5%BE%84%E4%BF%A1%E6%81%AF/4.png" alt="1" /><br />
<img decoding="async" src="https://thamiti-blog.oss-accelerate.aliyuncs.com/tuchuang/%E8%8E%B7%E5%8F%96%E4%BB%BB%E6%84%8F%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84APPID%E5%8F%8A%E9%A1%B5%E9%9D%A2%E8%B7%AF%E5%BE%84%E4%BF%A1%E6%81%AF/5.png" alt="2" /><br />
<img decoding="async" src="https://thamiti-blog.oss-accelerate.aliyuncs.com/tuchuang/%E8%8E%B7%E5%8F%96%E4%BB%BB%E6%84%8F%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84APPID%E5%8F%8A%E9%A1%B5%E9%9D%A2%E8%B7%AF%E5%BE%84%E4%BF%A1%E6%81%AF/6.png" alt="3" /><br />
<img decoding="async" src="https://thamiti-blog.oss-accelerate.aliyuncs.com/tuchuang/%E8%8E%B7%E5%8F%96%E4%BB%BB%E6%84%8F%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84APPID%E5%8F%8A%E9%A1%B5%E9%9D%A2%E8%B7%AF%E5%BE%84%E4%BF%A1%E6%81%AF/7.png" alt="4" /></p>
<h5>回到手机</h5>
<p><img decoding="async" src="https://thamiti-blog.oss-accelerate.aliyuncs.com/tuchuang/%E8%8E%B7%E5%8F%96%E4%BB%BB%E6%84%8F%E4%B8%80%E4%B8%AA%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%9A%84APPID%E5%8F%8A%E9%A1%B5%E9%9D%A2%E8%B7%AF%E5%BE%84%E4%BF%A1%E6%81%AF/8.png" alt="5" /></p>
<h5>复制路径</h5>
<blockquote>
<p>pages/index/index.html  删除后面带的 .html 即可</p>
</blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e8%8e%b7%e5%8f%96%e4%bb%bb%e6%84%8f%e4%b8%80%e4%b8%aa%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%9a%84appid%e5%8f%8a%e9%a1%b5%e9%9d%a2%e8%b7%af%e5%be%84%e4%bf%a1%e6%81%af/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>浏览器/小程序 直传图片至minIO（私有OSS）</title>
		<link>https://www.gek6.cn/%e6%b5%8f%e8%a7%88%e5%99%a8-%e5%b0%8f%e7%a8%8b%e5%ba%8f-%e7%9b%b4%e4%bc%a0%e5%9b%be%e7%89%87%e8%87%b3minio%ef%bc%88%e7%a7%81%e6%9c%89oss%ef%bc%89/</link>
					<comments>https://www.gek6.cn/%e6%b5%8f%e8%a7%88%e5%99%a8-%e5%b0%8f%e7%a8%8b%e5%ba%8f-%e7%9b%b4%e4%bc%a0%e5%9b%be%e7%89%87%e8%87%b3minio%ef%bc%88%e7%a7%81%e6%9c%89oss%ef%bc%89/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Sun, 01 Sep 2019 11:40:54 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=55</guid>

					<description><![CDATA[先上预览 先说WEB端（不论PC&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h3>先上预览</h3>
<p><img decoding="async" src="https://thamiti-blog.oss-accelerate.aliyuncs.com/tuchuang/%E7%9B%B4%E4%BC%A0%E5%9B%BE%E7%89%87%E8%87%B3minIO/14418687-17db79a7dada1ca1.gif" alt="小程序上传预览" /></p>
<h3>先说WEB端（不论PC还是H5）</h3>
<h4>1、前端自己签名（不安全，不推荐）</h4>
<ul>
<li>web端因为所有代码 都会暴露给用户，所有有密钥泄露的风险。</li>
<li>小程序端，虽然在微信客户端黑盒执行，但是引入 minIO 包后 小程序体积直线上升，也不好。
<pre><code class="language-javascript">// 签名方法
function signUrl(filePath) {
// minIO 配置
var minioClient = new Minio.Client({
endPoint: &#039;xx.xx.xx.xx&#039;,
port: xxxx,
useSSL: false,
accessKey: &#039;xxxxx&#039;,
secretKey: &#039;xxxxx&#039;,
bucketName: &#039;xxxxx&#039;
});
return new Promise((resolve, reject) =&gt; {
let bucketName = &#039;house&#039;
var policy = minioClient.newPostPolicy()
policy.setBucket(bucketName)
policy.setKey(filePath)
var expires = new Date
expires.setSeconds(24 * 60 * 60 * 10);
policy.setExpires(expires)
minioClient.presignedPostPolicy(policy, function (err, data) {
  if (err) return console.log(err)
  resolve(data)
})
})
}</code></pre>
</li>
</ul>
<h4>2、拿到签名后上传</h4>
<pre><code class="language-javascript">async function upload(file) {
    // file 为浏览器 input 选择的 file对象
    let fileName = file.name; 
    let d = new Date();
    // 设置后的文件路径，其实本质是没有路径的，只是通过/来分割文件夹层级
    let filePath = `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()}/${d.getTime()}-${fileName}`;
    // 获取签名
    let uploadInfo = await signUrl(filePath);

    let data = new FormData();
    for (const key in uploadInfo.formData) {
      if (Object.hasOwnProperty.call(uploadInfo.formData, key)) {
        const element = uploadInfo.formData[key];
        data.append(key, element)
      }
    }
    data.append(&#039;file&#039;, file)
    await axios.post(uploadInfo.postURL, data, {
      headers: { &#039;Content-Type&#039;: &#039;multipart/form-data&#039; },
    }).catch(err=&gt;{
      console.log(err)
    })
    // minIO 服务器 响应结果为空，判断是否成功 用HTTP状态码即可。
    // 这里返回的状态码 是204 但是文件确实已经上传成功了，所以上面代码 加了catch捕获异常
    // 直接返回 刚才拼接的 文件路径。  前缀拼上 域名/IP+桶名+filePath 访问。
    return filePath;
  },</code></pre>
<h2>小程序端</h2>
<h5>这里使用后端签名，后端使用nodeJS    代码和浏览器自签 几乎 一模一样</h5>
<pre><code class="language-javascript">// 记得先安装这些个依赖
var Minio = require(&#039;minio&#039;)
const express = require(&#039;express&#039;)
// 用 express 起个web服务
const app = express()
app.use(express.json()) // for parsing application/json
app.use(express.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
const port = 3000

app.post(&#039;/makeUploadUrl&#039;, (req, res) =&gt; {
    console.log(req.body);

    var minioClient = new Minio.Client({
        endPoint: &#039;xx.xx.xx.xx&#039;,
        port: xxxx,
        useSSL: false,
        accessKey: &#039;xxxx&#039;,
        secretKey: &#039;xxxx&#039;,
        bucketName: &#039;xxxx&#039;
    });

    let bucketName = &#039;xxxx&#039;
    var policy = minioClient.newPostPolicy()
    policy.setBucket(bucketName)
    policy.setKey(req.body.filePath)
    var expires = new Date
    // 过期时间
    expires.setSeconds(24 * 60 * 60 * 10);
    policy.setExpires(expires)
    minioClient.presignedPostPolicy(policy, function(err, data) {
      if (err) return console.log(err)
      res.json(data)
    })

})
app.listen(port, () =&gt; console.log(`minio app listening on port ${port}!`))</code></pre>
<h4>小程序端获取签名并上传</h4>
<pre><code class="language-javascript">// 从服务器获取签名
function getSign(filePath) {
    return new Promise((resolve, reject) =&gt; {
        uni.request({
            url: &quot;http://127.0.0.1:3000/makeUploadUrl&quot;,
            method: &quot;POST&quot;,
            data: {
                filePath
            },
            success(res) {
                console.log(res);
                resolve(res.data)
            }
        })
    })
}
// 发送上传请求
function putImg(putObj, file) {
    return new Promise((resolve, reject) =&gt; {
        // 和web端的区别是 这里的file是 小程序获取的图片临时地址，而不是file对象
        // 这里用的 uni-app 框架 ，如果用的 微信原生小程序开发的 改成 wx.uploadFile 即可
        uni.uploadFile({
            url: putObj.postURL,
            filePath:file,
            name:&#039;file&#039;,
            formData:{
                ...putObj.formData
            },
            header: {
                &quot;content-type&quot;: &quot;multipart/form-data&quot;
            },
            success: (res) =&gt; {
                // console.log(res)
                resolve()
            },
            fail(err) {
                // console.log(err)
                reject(err)
            }
        })
    })
}
export default {
    async upload(file) {
        let fileName = file.split(&quot;/&quot;)[file.split(&quot;/&quot;).length - 1];
        let d = new Date();
        let filePath = `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()}/${d.getTime()}-${fileName}`;
        let putObj = await getSign(filePath);
        await putImg(putObj, file)
        return filePath
    },
}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e6%b5%8f%e8%a7%88%e5%99%a8-%e5%b0%8f%e7%a8%8b%e5%ba%8f-%e7%9b%b4%e4%bc%a0%e5%9b%be%e7%89%87%e8%87%b3minio%ef%bc%88%e7%a7%81%e6%9c%89oss%ef%bc%89/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
