Commit 47696d435c02d7687c326018e2ead060583a904c

Authored by yvan.ni
1 parent 6e9100cc

1.小程序顶部颜色

2. 会员二维吗64位加密
pages/index/index/index.js
@@ -204,6 +204,15 @@ Page({ @@ -204,6 +204,15 @@ Page({
204 isTemplate: 1, 204 isTemplate: 1,
205 bgcolor_t: temp_data.bkcolor 205 bgcolor_t: temp_data.bkcolor
206 }); 206 });
  207 +
  208 + //---如果有设定顶部的颜色的时候--
  209 + if(temp_data.top_color && temp_data.top_color!='null' ){
  210 + wx.setNavigationBarColor({
  211 + frontColor: '#ffffff', // 必写项
  212 + backgroundColor: temp_data.top_color, // 必写项
  213 + })
  214 + }
  215 +
207 } 216 }
208 }) 217 })
209 218
pages/template/index.js
@@ -51,6 +51,15 @@ Page({ @@ -51,6 +51,15 @@ Page({
51 isTemplate: 1, 51 isTemplate: 1,
52 bgcolor_t: temp_data.bkcolor 52 bgcolor_t: temp_data.bkcolor
53 }); 53 });
  54 +
  55 + //---如果有设定顶部的颜色的时候--
  56 + if(temp_data.top_color && temp_data.top_color!='null' ){
  57 + wx.setNavigationBarColor({
  58 + frontColor: '#ffffff', // 必写项
  59 + backgroundColor: temp_data.top_color, // 必写项
  60 + })
  61 + }
  62 +
54 } 63 }
55 }) 64 })
56 65
pages/user/index/index.js
@@ -359,7 +359,11 @@ Page({ @@ -359,7 +359,11 @@ Page({
359 //------卡片的显示和关闭-------- 359 //------卡片的显示和关闭--------
360 show_tc: function() { 360 show_tc: function() {
361 if (!this.data.userInfo) return false; 361 if (!this.data.userInfo) return false;
362 - qrcode('qrcode', this.data.userInfo.mobile, 480, 480, this); 362 + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s')
  363 + var val= this.data.userInfo.mobile+"|"+ut.formatTime();
  364 + val=ut.base64_encode(val);
  365 +
  366 + qrcode('qrcode', val, 480, 480, this);
363 this.setData({ 367 this.setData({
364 tc_hide: false, 368 tc_hide: false,
365 }); 369 });
utils/util.js
@@ -371,7 +371,35 @@ function isContained(aa, bb) { @@ -371,7 +371,35 @@ function isContained(aa, bb) {
371 return true; 371 return true;
372 } 372 }
373 373
374 - 374 +//---base64位编码---
  375 +function base64_encode (str) { // 编码,配合encodeURIComponent使用
  376 + var c1, c2, c3;
  377 + var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  378 + var i = 0, len = str.length, strin = '';
  379 + while (i < len) {
  380 + c1 = str.charCodeAt(i++) & 0xff;
  381 + if (i == len) {
  382 + strin += base64EncodeChars.charAt(c1 >> 2);
  383 + strin += base64EncodeChars.charAt((c1 & 0x3) << 4);
  384 + strin += "==";
  385 + break;
  386 + }
  387 + c2 = str.charCodeAt(i++);
  388 + if (i == len) {
  389 + strin += base64EncodeChars.charAt(c1 >> 2);
  390 + strin += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  391 + strin += base64EncodeChars.charAt((c2 & 0xF) << 2);
  392 + strin += "=";
  393 + break;
  394 + }
  395 + c3 = str.charCodeAt(i++);
  396 + strin += base64EncodeChars.charAt(c1 >> 2);
  397 + strin += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  398 + strin += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
  399 + strin += base64EncodeChars.charAt(c3 & 0x3F)
  400 + }
  401 + return strin
  402 +}
375 403
376 module.exports = { 404 module.exports = {
377 formatTime: function(e, r) { 405 formatTime: function(e, r) {
@@ -477,4 +505,5 @@ module.exports = { @@ -477,4 +505,5 @@ module.exports = {
477 draw_circle:draw_circle,//绘制圆, 505 draw_circle:draw_circle,//绘制圆,
478 mergeArray:mergeArray, //数组合并 506 mergeArray:mergeArray, //数组合并
479 isContained:isContained, //是否包含 507 isContained:isContained, //是否包含
  508 + base64_encode:base64_encode //64位加密
480 }; 509 };