前言:最近小程序开发挺火的,然后小编也研究一下,发现不对劲,开发可以用http,但上线要https,于是想弄个https玩玩,结果怎么配还是失败,于是请教了一个大神,他说3步就可以拿下。。。
1、 阿里云把配置文件下载下来放到tomcat根目录下的cert文件夹中
2、 server.xml配置三个
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" URIEncoding="utf8" />
这个是从阿里云复制下来 改port,protocol
<Connector port="443"
protocol="org.apache.coyote.http11.Http11Protocol"
SSLEnabled="true"
scheme="https"
secure="true"
keystoreFile="cert/00xx.pfx"
keystoreType="PKCS12"
keystorePass="00xx"
clientAuth="false"
SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"
ciphers="TLS_RSA_WIT。。。。。。。。C_SHA256"/>
<Connector port="8019" protocol="AJP/1.3" redirectPort="443" />
3、 web.xml配置一个,重启tomcat
<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>Client Cert Users-only Area</realm-name>
</login-config>
<security-constraint>
<web-resource-collection >
<web-resource-name >SSL</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
是不是很简单捏。。。
一起艳学小程序开发
1、简易教程:https://mp.weixin.qq.com/debug/wxadoc/dev/index.html
微信小程序 H5 功能 LOL英雄联盟
wxml html 骨架 英雄
wxss css 样式 皮肤
js js 逻辑 技能
json json 配置 符文/天赋
#首先要注册页面,小程序由哪些页面组成
app.json
"pages":[
"pages/index/index",
"pages/logs/logs",
"pages/question/question",
"pages/info/info",
"pages/report/report"
],
#跳转页面
bindtap='onTap'
Page({
onTap:function(event){
wx.redirectTo({
url: '../question/question'
})
}
});
#banner图
<swiper indicator-dots='true' autoplay='true' interval='5000'>
<swiper-item>
<image src='/images/index_banner.jpg'></image>
</swiper-item>
<swiper-item>1</swiper-item>
<swiper-item>2</swiper-item>
</swiper>
#循环遍历
<block wx:for="{{posts_container}}" wx:for-item="item"></block>
this.setData({
posts_container: postData.postList
});
#数据绑定
var post_content = [{
date: "Sep 184 2016",
title: "dsa",
post_img: "/images/index_banner.jpg",
view_num: "121",
collect_num: "86",
auth_img: "/images/index_banner.jpg"
}, {
date: "Sep 185 2016",
title: "dsa",
post_img: "/images/index_banner.jpg",
view_num: "121",
collect_num: "86",
auth_img: "/images/index_banner.jpg"
}]
module.exports = {
postList: post_content
}
var postData = require('../../data/data.js');
#shuju get
bindViewTap : function(){
//console.log("111")
wx.request({
url: 'http://localhost:8080/index/wxProgram/index.do', //仅为示例,并非真实的接口地址
data: {
value: 'wo shi weixin'
},
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
//console.log(res.data)
if(res.data.success){
var arr = JSON.parse(res.data.result);
for(var i in arr){
console.log(arr[i]);
}
}
}
})
},
#id页面js传值
<view catchtap=“onPostTap” data-postId="item.postId"></view>
js中
onPostTap:function(event){
var postId = event.currentTarget.dataset.postid;
wx.navigateTo({
url:"post-detail/post-detail?id="+postId
});
}
另一个js
Page({
onLoad:function(option){
var postId = option.id;
}
})
源码下载:链接:http://pan.baidu.com/s/1boKg5X1 密码:32vi