获取openid和session_key
https://developers.weixin.qq.com/miniprogram/dev/api/api-login.html


工具md5加密

/* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 1.1 Copyright (C) Paul Johnston 1999 - 2002. * Code also contributed by Greg Holt * See http://pajhome.org.uk/site/legal.html for details. *//* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */
function safe_add(x, y) {var lsw = (x & 0xFFFF) + (y & 0xFFFF)var msw = (x >> 16) + (y >> 16) + (lsw >> 16)return (msw << 16) | (lsw & 0xFFFF)
}/* * Bitwise rotate a 32-bit number to the left. */
function rol(num, cnt) {return (num << cnt) | (num >>> (32 - cnt))
}/* * These functions implement the four basic operations the algorithm uses. */
function cmn(q, a, b, x, s, t) {return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
}
function ff(a, b, c, d, x, s, t) {return cmn((b & c) | ((~b) & d), a, b, x, s, t)
}
function gg(a, b, c, d, x, s, t) {return cmn((b & d) | (c & (~d)), a, b, x, s, t)
}
function hh(a, b, c, d, x, s, t) {return cmn(b ^ c ^ d, a, b, x, s, t)
}
function ii(a, b, c, d, x, s, t) {return cmn(c ^ (b | (~d)), a, b, x, s, t)
}/* * Calculate the MD5 of an array of little-endian words, producing an array * of little-endian words. */
function coreMD5(x) {var a = 1732584193var b = -271733879var c = -1732584194var d = 271733878for (var i = 0; i < x.length; i += 16) {var olda = avar oldb = bvar oldc = cvar oldd = da = ff(a, b, c, d, x[i + 0], 7, -680876936)d = ff(d, a, b, c, x[i + 1], 12, -389564586)c = ff(c, d, a, b, x[i + 2], 17, 606105819)b = ff(b, c, d, a, x[i + 3], 22, -1044525330)a = ff(a, b, c, d, x[i + 4], 7, -176418897)d = ff(d, a, b, c, x[i + 5], 12, 1200080426)c = ff(c, d, a, b, x[i + 6], 17, -1473231341)b = ff(b, c, d, a, x[i + 7], 22, -45705983)a = ff(a, b, c, d, x[i + 8], 7, 1770035416)d = ff(d, a, b, c, x[i + 9], 12, -1958414417)c = ff(c, d, a, b, x[i + 10], 17, -42063)b = ff(b, c, d, a, x[i + 11], 22, -1990404162)a = ff(a, b, c, d, x[i + 12], 7, 1804603682)d = ff(d, a, b, c, x[i + 13], 12, -40341101)c = ff(c, d, a, b, x[i + 14], 17, -1502002290)b = ff(b, c, d, a, x[i + 15], 22, 1236535329)a = gg(a, b, c, d, x[i + 1], 5, -165796510)d = gg(d, a, b, c, x[i + 6], 9, -1069501632)c = gg(c, d, a, b, x[i + 11], 14, 643717713)b = gg(b, c, d, a, x[i + 0], 20, -373897302)a = gg(a, b, c, d, x[i + 5], 5, -701558691)d = gg(d, a, b, c, x[i + 10], 9, 38016083)c = gg(c, d, a, b, x[i + 15], 14, -660478335)b = gg(b, c, d, a, x[i + 4], 20, -405537848)a = gg(a, b, c, d, x[i + 9], 5, 568446438)d = gg(d, a, b, c, x[i + 14], 9, -1019803690)c = gg(c, d, a, b, x[i + 3], 14, -187363961)b = gg(b, c, d, a, x[i + 8], 20, 1163531501)a = gg(a, b, c, d, x[i + 13], 5, -1444681467)d = gg(d, a, b, c, x[i + 2], 9, -51403784)c = gg(c, d, a, b, x[i + 7], 14, 1735328473)b = gg(b, c, d, a, x[i + 12], 20, -1926607734)a = hh(a, b, c, d, x[i + 5], 4, -378558)d = hh(d, a, b, c, x[i + 8], 11, -2022574463)c = hh(c, d, a, b, x[i + 11], 16, 1839030562)b = hh(b, c, d, a, x[i + 14], 23, -35309556)a = hh(a, b, c, d, x[i + 1], 4, -1530992060)d = hh(d, a, b, c, x[i + 4], 11, 1272893353)c = hh(c, d, a, b, x[i + 7], 16, -155497632)b = hh(b, c, d, a, x[i + 10], 23, -1094730640)a = hh(a, b, c, d, x[i + 13], 4, 681279174)d = hh(d, a, b, c, x[i + 0], 11, -358537222)c = hh(c, d, a, b, x[i + 3], 16, -722521979)b = hh(b, c, d, a, x[i + 6], 23, 76029189)a = hh(a, b, c, d, x[i + 9], 4, -640364487)d = hh(d, a, b, c, x[i + 12], 11, -421815835)c = hh(c, d, a, b, x[i + 15], 16, 530742520)b = hh(b, c, d, a, x[i + 2], 23, -995338651)a = ii(a, b, c, d, x[i + 0], 6, -198630844)d = ii(d, a, b, c, x[i + 7], 10, 1126891415)c = ii(c, d, a, b, x[i + 14], 15, -1416354905)b = ii(b, c, d, a, x[i + 5], 21, -57434055)a = ii(a, b, c, d, x[i + 12], 6, 1700485571)d = ii(d, a, b, c, x[i + 3], 10, -1894986606)c = ii(c, d, a, b, x[i + 10], 15, -1051523)b = ii(b, c, d, a, x[i + 1], 21, -2054922799)a = ii(a, b, c, d, x[i + 8], 6, 1873313359)d = ii(d, a, b, c, x[i + 15], 10, -30611744)c = ii(c, d, a, b, x[i + 6], 15, -1560198380)b = ii(b, c, d, a, x[i + 13], 21, 1309151649)a = ii(a, b, c, d, x[i + 4], 6, -145523070)d = ii(d, a, b, c, x[i + 11], 10, -1120210379)c = ii(c, d, a, b, x[i + 2], 15, 718787259)b = ii(b, c, d, a, x[i + 9], 21, -343485551)a = safe_add(a, olda)b = safe_add(b, oldb)c = safe_add(c, oldc)d = safe_add(d, oldd)}return [a, b, c, d]
}/* * Convert an array of little-endian words to a hex string. */
function binl2hex(binarray) {var hex_tab = "0123456789abcdef"var str = ""for (var i = 0; i < binarray.length * 4; i++) {str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF)}return str
}/* * Convert an array of little-endian words to a base64 encoded string. */
function binl2b64(binarray) {var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"var str = ""for (var i = 0; i < binarray.length * 32; i += 6) {str += tab.charAt(((binarray[i >> 5] << (i % 32)) & 0x3F) |((binarray[i >> 5 + 1] >> (32 - i % 32)) & 0x3F))}return str
}/* * Convert an 8-bit character string to a sequence of 16-word blocks, stored * as an array, and append appropriate padding for MD4/5 calculation. * If any of the characters are >255, the high byte is silently ignored. */
function str2binl(str) {var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks  var blks = new Array(nblk * 16)for (var i = 0; i < nblk * 16; i++) blks[i] = 0for (var i = 0; i < str.length; i++)blks[i >> 2] |= (str.charCodeAt(i) & 0xFF) << ((i % 4) * 8)blks[i >> 2] |= 0x80 << ((i % 4) * 8)blks[nblk * 16 - 2] = str.length * 8return blks
}/* * Convert a wide-character string to a sequence of 16-word blocks, stored as * an array, and append appropriate padding for MD4/5 calculation. */
function strw2binl(str) {var nblk = ((str.length + 4) >> 5) + 1 // number of 16-word blocks  var blks = new Array(nblk * 16)for (var i = 0; i < nblk * 16; i++) blks[i] = 0for (var i = 0; i < str.length; i++)blks[i >> 1] |= str.charCodeAt(i) << ((i % 2) * 16)blks[i >> 1] |= 0x80 << ((i % 2) * 16)blks[nblk * 16 - 2] = str.length * 16return blks
}/* * External interface */
function hexMD5(str) { return binl2hex(coreMD5(str2binl(str))) }
function hexMD5w(str) { return binl2hex(coreMD5(strw2binl(str))) }
function b64MD5(str) { return binl2b64(coreMD5(str2binl(str))) }
function b64MD5w(str) { return binl2b64(coreMD5(strw2binl(str))) }
/* Backward compatibility */
function calcMD5(str) { return binl2hex(coreMD5(str2binl(str))) }
module.exports = {hexMD5: hexMD5
}

使用方法:

var utilMd5 = require('../../utils/md5.js');
var password = utilMd5.hexMD5("password");

小程序设置背景图的时候不能使用本地资源,必须使用在线资源或则是base64图片
base64转化:
http://imgbase64.duoshitong.com/
------------------------
在线设计
https://www.chuangkit.com
---------------------
在使用canvasToTempFilePath和saveimagetoalbum之后,保存下来的图片是在电脑端是看不到的,白色的,需要在手机才能看到,大坑啊!!!
----------------------
转发功能

需要给button 元素加上 open-type="share",就可以了,不过一定要定义Page.onShareAppMessage() 事件,
https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/page.html


设置倒计时的时候,使用setInterval函数,不能在页面生命周期里面去调用
要自己写方法在里面调用
--------------
小程序微信样式库
https://github.com/Tencent/weui-wxss/tree/master/src/example
-------------------

转载于:https://www.cnblogs.com/cyany/p/9732287.html

mini programer(1)相关推荐

  1. 正点原子:STM32F103(战舰)、STM32F407(探索者)、STM32F103(MINI)原理图和PCB

    目录 1.STM32F103(战舰) 2.STM32F407(探索者) 3.STM32F103(MINI) 为各位嵌入式好朋友分享三个重磅资源,正点原子三件套,可直接打样使用~ 1.STM32F103 ...

  2. 投影转换_即插即用,办公投影不用愁:毕亚兹Mini DP转HDMIVGA转换器

    日常办公的时候一些办公小件也很有用的,就比如说HDMI,VGA的转接头,不起眼但是很实用.去客户那里汇报工作,笔记本没有VGA接口,结果会很尴尬,到处借,没有转接头就是接不了,所以索性还是自己入手一个 ...

  3. 性能优化工具 MVC Mini Profiler

    MVC MiniProfiler是Stack Overflow团队设计的一款对ASP.NET MVC.WebForm 以及WCF 的性能分析的小程序.可以对一个页面本身,及该页面通过直接引用.Ajax ...

  4. iPad mini时隔四年更新,搭载A12芯片,起售价2999

    整理 | 非主流 出品 | AI科技大本营(公众号id:rgznai100) 距离苹果的春季发布还有一周,但就在昨天,苹果毫无征兆地给广大果粉来了一场预热. 3 月 18 日下午,苹果官网进行更新,悄 ...

  5. AI一分钟 | 小米发布小爱音箱mini,169元;天猫汽车无人贩卖机大楼落地,刷脸可购车试驾

    2018 区块链技术及应用峰会(BTA)·中国 倒计时 3 天 2018,想要follow最火的区块链技术?你还差一场严谨纯粹的技术交流会--2018区块链技术及应用峰会(BTA)·中国将于2018年 ...

  6. AI一分钟 | 小米智能音箱mini版曝光,或售199元;特朗普被指利用AI竞选成功

    整理 | 阿司匹林 一分钟AI 3月19日,小米社区有网友曝光了小爱同学mini版,它可能是3月27日小米MIX 2S发布会的"小惊喜",售价可能为199元. 据外媒报道,剑桥分析 ...

  7. 苹果12 Pro Max和mini测评来了,看完我选择了iPhone 12

    萧箫 发自 凹非寺 量子位 报道 | 公众号 QbitAI -iPhone 12 Pro Max和iPhone 12 mini,现在开售了. 不过这两款手机,媒体评价究竟如何? 来自The Verge ...

  8. 4.7 mini趴 走进猎豹

    2019独角兽企业重金招聘Python工程师标准>>> 4.7 mini趴 走进猎豹 技术分享提醒: 时间: 今晚 19:30~21:00 地点: 富力盈通31F 3110 会议室 ...

  9. TechParty Mini.0

    2019独角兽企业重金招聘Python工程师标准>>> 150310 Mini.0 ~ 任性,体验 原案: 150310 Mini.0 - techparty.hackpad.com ...

  10. pyBoard Mini从安装到简单测试

    ▌01 PyBoard Mini 在 淘宝购买到的<Python微控制器编程 从零开始> ,其中提到了 pyBoard Mini 核心板的应用.今天购买到的PyBoard到货了.对其进行初 ...

最新文章

  1. 刻意练习:LeetCode实战 -- Task15. 有效的括号
  2. python所有函数用法_python函数用法总结
  3. java我们一起打雪仗_我们一起打雪仗作文
  4. redhat和ubuntu上部署本地源
  5. 程序员思维是什么?程序员思维从哪里来?程序员思维到哪里去?
  6. Hadoop入门基础教程 Hadoop之单机模式搭建
  7. Linux Kernel Lock types and their rules
  8. 心情有些复杂,不知道还能做多久,未来也不知道该如何选择
  9. 用友重拳出击 布局BI剑指何处?
  10. rman备份控制文件
  11. ValueError: Cannot feed value of shape (784,) for Tensor 'Placeholder:0', which has shape '(?, 784)'
  12. Zune无法连接手机的解决办法
  13. 国内外GIS基础软件对比分析优缺特性及实际工作生产应用和成功案例综合评价
  14. 闲置电脑挂机赚钱-Traffmonetizer,支持windows,linux,Android,MacOS多平台
  15. 红米note10和红米note8pro哪个好
  16. 我的java学习之路之Mybatis
  17. 国内量化交易接口为什么券商不对个人提供?
  18. 在WPS 中使用LaTeX
  19. 计算机主板维修的意义,主板维修个人经验 -电脑资料
  20. google推荐系统初探

热门文章

  1. linux会计软件,免费好用的会计软件(Manager for Mac)
  2. 小米手机便签一键启动这个功能,可将便签录音秒变文字
  3. 收文和发文管理流程分析
  4. 什么软件硬盘测试修复最好,什么软件检测、修复硬盘坏道最好?
  5. access订单明细表怎么做_图书销售订单明细表
  6. 工具说明书 - Windows资源监视器: Resource Monitor
  7. Axure 9母版引发事件
  8. 原生PHP配置paypal支付接口成功!不用Composer!
  9. nginx静态代理设置一:静态文件在本机
  10. linux基础:快速搭建平台