Skip to content

Commit

Permalink
mip-story 横屏时增加二维码 (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo-Li authored Apr 25, 2019
1 parent e816959 commit f21c3dd
Show file tree
Hide file tree
Showing 6 changed files with 691 additions and 1 deletion.
File renamed without changes.
670 changes: 670 additions & 0 deletions src/mip-story/lib/qrcode.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/mip-story/mip-story-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ define(function (require) {
var MIP_STORY_PAGE_SWITCH_RIGHT_CLASS = 'mip-story-page-switch-rt';

var util = require('util');
var QRCode = require('./lib/qrcode');

function MIPStoryHint(root) {
this.rootEl = root;
Expand All @@ -39,6 +40,7 @@ define(function (require) {
+ '<div class="mip-story-hint-rotate">'
+ '<mip-img src="https://www.mipengine.org/static/img/mip-story/mip-story-rotate.png"></mip-img>'
+ '<p>为了更好的体验,请将手机横过来</p>'
+ '<div class="mip-story-qrcode"></div>'
+ '</div>'
+ '<div class="mip-story-page-switch">'
+ '<span class="mip-story-page-switch-left">'
Expand All @@ -54,6 +56,19 @@ define(function (require) {
return html;
};

MIPStoryHint.prototype.generateQRCode = function () {
var ele = this.rootEl.querySelector('.mip-story-qrcode');
new QRCode(ele, {
text: window.location.href,
width: 96,
height: 96,
border: 2,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
}

MIPStoryHint.prototype.showDamping = function () {
var self = this;
var ele = this.rootEl.querySelector(MIP_STORY_HINT_CLASS);
Expand Down
2 changes: 1 addition & 1 deletion src/mip-story/mip-story-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define(function (require) {
'use strict';

var customElement = require('customElement').create();
var JSMpeg = require('./jsmpeg/jsmpeg');
var JSMpeg = require('./lib/jsmpeg');
var util = require('util');
var Detector = require('./video-detector');
var css = util.css;
Expand Down
1 change: 1 addition & 0 deletions src/mip-story/mip-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ define(function (require) {
this.hint = new HintLayer(element);
var html = dm.create(this.hint.build());
this.element.appendChild(html);
this.hint.generateQRCode();
};

MIPStory.prototype.initShare = function (storyConfig, element) {
Expand Down
4 changes: 4 additions & 0 deletions src/mip-story/mip-story.less
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ mip-story-layer[template=thirds] {
height: 45px;
}

.mip-story-qrcode {
margin-top: 10px;
}

@media all and (orientation: portrait) {
.mip-story-hint-rotate {
display: none;
Expand Down

0 comments on commit f21c3dd

Please sign in to comment.