Authored by 陈峰

push

const yo = require('yo-cli');
const path = require('path');
module.exports = yo()
.style({
preLoaders: {
scss: true
}
})
.resolve({
alias: {
'create-api': 'common/create-api-client.js'
},
modules: [
path.join(__dirname, '../src'),
path.join(__dirname, '../src/statics'),
'node_modules'
]
})
.js({
babel: {
exclude: /node_modules/
}
})
.vue();
... ...
const yoBase = require('./yo.base.conf.js');
const yo = require('yo-cli');
module.exports = yo(yoBase)
.dev({
port: 8888,
hot: true,
historyApiFallback: true,
proxy: {
'/api': 'http://localhost:8887'
}
})
.run();
... ...
const fs = require('fs');
const path = require('path');
const _ = require('lodash');
const request = require('request');
const mime = require('mime');
const parseRange = require('range-parser');
const cluster = require('cluster');
const express = require('express');
const chokidar = require('chokidar');
const EventSource = require('eventsource');
const {createApp} = require('./create-app.js');
const {createBundleRenderer} = require('vue-server-renderer');
const {devServer, readFile, publish} = require('./build/dev-server.js');
const {devServer, publish} = require('./build/dev-server.js');
const watcher = {
paths: ['./apps', './create-app.js', './doraemon', './config', './utils'],
... ...
... ... @@ -65,7 +65,7 @@ $(() => {
}
// 拦截页面内所有 a 标签的跳转
$body.on('click', 'a[href]', function() {
$body.on('click', 'a[href]', function(e) {
if ($(this).hasClass('no-link')) {
return false;
}
... ... @@ -75,6 +75,8 @@ $(() => {
if (/^\/\//.test(href)) {
href = 'http:' + href;
}
e.preventDefault();
e.stopPropagation();
interceptClick.intercept(href);
return false;
}
... ...
... ... @@ -15,7 +15,6 @@ import store from 'yoho-store';
const nullFun = () => {};
let isYohoBuy = /YohoBuy/i.test(navigator.userAgent || '');
let $appLink = document.querySelector('#yoho-app-link');
if (isYohoBuy && !$appLink) {
... ... @@ -32,6 +31,7 @@ if (isYohoBuy && !$appLink) {
/* 提示信息 */
const tipInfo = '暂不支持,请在BLK应用中打开';
const yoho = {
/**
* 判断是否是 APP
... ... @@ -242,10 +242,14 @@ const yoho = {
}
});
}
$appLink.href = url;
$appLink.click();
if (this.isiOS) {
if (window.parent && window.parent !== window) {
window.parent.blkDocument.goNewPage({url});
} else {
$appLink.href = url;
$appLink.click();
if (this.isiOS) {
$appLink.click();
}
}
} else {
if (args.url) {
... ...
... ... @@ -15,9 +15,6 @@ import 'statics/scss/font.scss';
FastClick.attach(document.body);
if (process.env.NODE_ENV === 'development') {
yoho.isApp = true;
}
const {app, router, store} = createApp();
... ...
... ... @@ -2,7 +2,7 @@
<layout-body class="product-search">
<search-bar class="product-search-bar" @cancel="cancel" v-model="search"></search-bar>
<div class="frames">
<iframe :src="searchUrl" frameborder="0" v-if="showIframe || yoho.env.fs"></iframe>
<iframe ref="ifr" name="iframe" :src="searchUrl" frameborder="0" v-if="showIframe"></iframe>
</div>
</layout-body>
</template>
... ... @@ -30,10 +30,24 @@ export default {
this.search = this.$route.query.query;
},
mounted() {
window.blkDocument = {
goNewPage({url}) {
const $appLink = document.querySelector('#yoho-app-link');
$appLink.href = url;
$appLink.click();
if (this.yoho.env.isiOS) {
$appLink.click();
}
}
};
window.yohoInterface = window.yohoInterface;
this.$bus.$on('after-view-enter', () => {
this.showIframe = true;
});
console.log(location.origin)
if (this.yoho.env.fs) {
this.showIframe = true;
}
},
computed: {
...mapState(['yoho']),
... ... @@ -44,6 +58,11 @@ export default {
methods: {
cancel() {
this.$yoRouter.goBack(-1);
},
loadYohoInterface() {
// this.$yoho.ready(() => {
// });
}
},
components: {SearchBar}
... ...