Commit 320ebb78 authored by 夏彬's avatar 夏彬

Merge remote-tracking branch 'origin/test' into test

parents 0df3ddeb d3475fe8
...@@ -17,6 +17,7 @@ module.exports = { ...@@ -17,6 +17,7 @@ module.exports = {
noInfo: true, noInfo: true,
quiet: false quiet: false
}, },
devtool: '#cheap-module-source-map',
stats: { stats: {
modules: false modules: false
} }
......
...@@ -8,7 +8,7 @@ module.exports = { ...@@ -8,7 +8,7 @@ module.exports = {
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__BASE_URL__: JSON.stringify('http://code.ibanshou.cn/songxia/'), __BASE_URL__: JSON.stringify('http://code.ibanshou.cn/songxia/'),
__SERVER_URL__: JSON.stringify('http://code.ibanshou.cn/'), __SERVER_URL__: JSON.stringify('https://code.ibanshou.cn/'),
__QINIU_URL__: JSON.stringify('http://img.2g.vgot.net/'), __QINIU_URL__: JSON.stringify('http://img.2g.vgot.net/'),
__NODE_ENV__: '"production"' __NODE_ENV__: '"production"'
}), }),
......
...@@ -20,6 +20,7 @@ module.exports = { ...@@ -20,6 +20,7 @@ module.exports = {
new webpack.LoaderOptionsPlugin({ new webpack.LoaderOptionsPlugin({
minimize: true minimize: true
}) })
] ],
devtool: '#source-map'
}; };
...@@ -173,7 +173,6 @@ body{ ...@@ -173,7 +173,6 @@ body{
} }
.error-code-fixed { .error-code-fixed {
display: none;
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
......
<template> <template>
<form method="post" action="/" class="full-box"> <div class="full-box">
<div class="vertical-obj"> <div class="vertical-obj">
<div class="vertical-obj-cont"> <div class="vertical-obj-cont">
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
</div> </div>
<div class="type-code"> <div class="type-code">
<a href="javascript:;" @click="openErrorTypeBox()" :class="{'has-code':code}">{{code?code:'请输入故障码,示例:E6'}}</a> <a href="javascript:;" @click="blurSearch=true" :class="{'has-code':code}">{{code?code:'请输入故障码,示例:E6'}}</a>
</div> </div>
<div class="error-code-fixed"> <div class="error-code-fixed" v-show="blurSearch">
<input type="text" name="code" v-model.trim="code" placeholder="请输入故障码,示例:E6" id="codeSearchInput" onfocus=""> <input type="search" name="code" v-model.trim="code" @keyup.enter="searchCode" placeholder="请输入故障码,示例:E6" id="codeSearchInput">
<a href="javascript:;" @click="closeErrorFixed()">取消</a> <a href="javascript:;" @click="blurSearch=false">取消</a>
</div> </div>
<div class="error-code" v-if="isUseCaptcha"> <div class="error-code" v-if="isUseCaptcha">
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</div> </div>
<div class="foot-btn"> <div class="foot-btn">
<button class="search-btn" type="submit" :disabled="!searchable">查一下</button> <button class="search-btn" type="button" :disabled="!searchable" @click="searchCode">查一下</button>
</div> </div>
</div> </div>
...@@ -111,15 +111,16 @@ ...@@ -111,15 +111,16 @@
<a href="javascript:;" @click="showMedal = false"><i class="iconfont icon-close"></i></a> <a href="javascript:;" @click="showMedal = false"><i class="iconfont icon-close"></i></a>
</div> </div>
</form> </div>
</template> </template>
<script> <script>
require("script-loader!../libs/slidernav.js");
import autoComplete from "../libs/autocomplete/jquery.autocomplete"; import autoComplete from "../libs/autocomplete/jquery.autocomplete";
import weixinShare from '../utils/weixin-share'; import weixinShare from '../utils/weixin-share';
import gt from '../utils/gt'; import gt from '../utils/gt';
import api from "../utils/api"; import api from "../utils/api";
require("script-loader!../libs/slidernav.js");
export default { export default {
data() { data() {
return { return {
...@@ -138,6 +139,7 @@ export default { ...@@ -138,6 +139,7 @@ export default {
//bsTimer: null, //bsTimer: null,
input: null, input: null,
acBind: false, acBind: false,
blurSearch: false,
isCheckCaptcha: false, isCheckCaptcha: false,
showBanshouQrcode: false, showBanshouQrcode: false,
isUseCaptcha: false isUseCaptcha: false
...@@ -160,6 +162,16 @@ export default { ...@@ -160,6 +162,16 @@ export default {
categoryId() { categoryId() {
this.autocomplete(); this.autocomplete();
}, },
blurSearch(val) {
//如果是显示,则聚集到输入框
if (val) {
let self = this;
this.$nextTick(() => {
self.input.focus();
});
}
}
}, },
computed: { computed: {
selectedText() { selectedText() {
...@@ -231,7 +243,10 @@ export default { ...@@ -231,7 +243,10 @@ export default {
this.input = $("#codeSearchInput"); this.input = $("#codeSearchInput");
//提交搜索 //提交搜索
$(this.$el).submit(self.searchCode); $(this.$el).submit(() => {
self.searchCode();
return false;
});
var title = '扳手快查'; var title = '扳手快查';
var imgUrl = common.getUrl('img/share_logo.jpg'); var imgUrl = common.getUrl('img/share_logo.jpg');
...@@ -299,64 +314,59 @@ export default { ...@@ -299,64 +314,59 @@ export default {
return common.getUrl(url); return common.getUrl(url);
}, },
openErrorTypeBox(){ searchCode() {
$('.error-code-fixed').show(); var self = this;
this.input.focus();
}, if (!self.searchable) {
self.blurSearch = false;
return false;
}
if (sessionStorage) {
sessionStorage.homeState = JSON.stringify({
brandId: self.brandId,
categoryId: self.categoryId,
code: self.code
});
}
searchCode(){ //移除中文
let self = this; var code = self.code.replace(/[\u4E00-\u9FA5]/g, '');
if (self.searchable) {
if (sessionStorage) { api.post("code/hit", {
sessionStorage.homeState = JSON.stringify({ brand_id: self.brandId,
brandId: self.brandId, category_id: self.categoryId,
categoryId: self.categoryId, code: code
code: self.code }).done(res => {
if (!res.status) {
layer.alert(res.message, {
closeBtn: false,
title: false,
icon: 7,
shade: 0.3
}); });
return;
} }
var reg = /[\u4E00-\u9FA5]/g; var url = common.getUrl('#/code/' + self.brandId + '/' + self.categoryId)
var code = self.code.replace(reg, ''); + "?code=" + encodeURIComponent(code) + "&t=" + res.data.tk;
var invite = common.getParameterByName('invite');
api.post("code/hit", {
brand_id: self.brandId,
category_id: self.categoryId,
code: code
}).done(res => {
if (!res.status) {
layer.alert(res.message, {
closeBtn: false,
title: false,
icon: 7,
shade: 0.3
});
return;
}
var url = common.getUrl('#/code/' + self.brandId + '/' + self.categoryId)
+ "?code=" + encodeURIComponent(code) + "&t=" + res.data.tk;
var invite = common.getParameterByName('invite');
if (invite) { if (invite) {
url = url + '&invite=' + invite url = url + '&invite=' + invite
} }
if (!self.isLogin) { if (!self.isLogin) {
common.requestLogin(url); common.requestLogin(url);
return false; return false;
} }
self.$router.push(self.targetUrl); self.$router.push(self.targetUrl);
}); });
}
return false; return false;
}, },
closeErrorFixed(){
$('.error-code-fixed').hide();
},
getIcon(className){ getIcon(className){
var iconFont = { var iconFont = {
'电视机':'dianshi', '电视机':'dianshi',
...@@ -415,13 +425,13 @@ export default { ...@@ -415,13 +425,13 @@ export default {
return {suggestions: []}; return {suggestions: []};
} }
}, },
triggerSelectOnValidInput: false,
onSelect: function (item) { onSelect: function (item) {
if (self.code != item.data) { if (self.code != item.data) {
self.code = item.data;
self.code = item.code;
if (!self.searchable) { if (!self.searchable) {
self.closeErrorFixed(); self.blurSearch = false;
} else { } else {
self.searchCode(); self.searchCode();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment