提交 1310641d 编写于 作者: guangjun.yang's avatar guangjun.yang

no message

上级 a8a5e40f
...@@ -66,7 +66,7 @@ module.exports = { ...@@ -66,7 +66,7 @@ module.exports = {
** Build configuration ** Build configuration
*/ */
router: { router: {
base: '/sousuo_ssr/', // 上下文根据自己的需求自行打开修改 base: '/lnreport_ssr/', // 上下文根据自己的需求自行打开修改
extendRoutes (routes, resolve) { extendRoutes (routes, resolve) {
routes.push({ routes.push({
name: 'search', name: 'search',
......
<!-- 总体概况页面 -->
<template> <template>
<div > <div>
<div class="top-bar-height"></div> {{testData}}
<form @submit.prevent="search" action="/">
<div class="search-container">
<img class="search-container-img pt-22" @click.stop="back" src="../assets/images/sousuo/left-arrow-black.png"/>
<div class="search-content">
<!--<span class="search-container-img2 search-black">
<img
class="search-container-img" :class="{'ios-top': isIOS}"
@click.stop="back"
src="../images/sousuo/search-black.png"
/>
</span>-->
<van-search
v-bp="{ component_tag: '003#022002' }"
v-model="searchText"
:maxlength="20"
:placeholder="pSearchText"
class="search-container-input"
:show-action="appVerstion >= 308"
@search="search">
<!--<img class="search-voice" slot="label" src="../images/sousuo/search-black.png" alt="">-->
<img class="search-black" slot="left-icon" src="../assets/images/sousuo/search-black.png" alt="">
<div v-if="appVerstion >= 308" class="voice-container" slot="action"><span></span><img class="voice-search" @click="awakeVoiceSearch" src="../assets/images/sousuo/icon-voice.svg" alt=""></div>
</van-search>
<span v-bp="{ component_tag: '003#022003' }" class="search-container-cancle" @click.prevent="search">搜索</span>
</div>
</div>
<button v-bp="{ component_tag: '003#022003' }" v-show="false" type="submit" />
</form>
<div class="pd-80"></div>
<HistoryLabels/>
<HotLabels/>
</div> </div>
</template> </template>
<script> <script>
import SplitLine from '../components/search/SplitLine'; // import SplitLine from '../components/search/SplitLine';
import HistoryLabels from '@/components/search/HistoryLabels';
import HotLabels from '@/components/search/HotLabels';
import VanSearch from 'vant/lib/search';
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from 'vuex';
// import { getHotLabels, getHotLabelsService } from '@/service'; // import { getHotLabels, getHotLabelsService } from '@/service';
import { getHotLabelsService } from '@/service';
// import 'vant/lib/search/style';
const cookies = require('cookie-universal')();
export default { export default {
data() { data() {
return { return {
searchText: '', testData: 'testData',
pSearchText: '',
token: 'C8D5E10A1F1243D38DFFE9BE5D8C5601',
needShowFirstTime: true,
isOnFocus: false,
isIOS: false,
isWeb: true isWeb: true
} }
}, },
components: { components: {
SplitLine,
HistoryLabels,
HotLabels,
VanSearch
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
statusBarHeight: 'statusBarHeight',
refreshNum: 'refreshNum',
userInfo: 'userInfo', userInfo: 'userInfo',
}), }),
appVerstion() {
let appVersion = this.userInfo.appVersion || '300';
cookies.set('appVersion', parseInt(appVersion.replace(/\./g, '')))
return appVersion.split('.').join('')
},
}, },
created() { created() {
if (process.client) { if (process.client) {
let _self = this; let _self = this;
this.isWeb = this.$rocNative.isWeb this.isWeb = this.$rocNative.isWeb
if(this.isWeb) { if(this.isWeb) {
_self.getHotLabels() // _self.getHotLabels()
} }
} }
}, },
mounted() { mounted() {
if(!this.isWeb) { if(!this.isWeb) {
this.getUserInfo() this.getUserInfo()
} }
...@@ -99,34 +46,6 @@ export default { ...@@ -99,34 +46,6 @@ export default {
...mapActions({ ...mapActions({
setUserInfo: 'setUserInfo', setUserInfo: 'setUserInfo',
}), }),
awakeVoiceSearch() {
this.$rocNative.gotoVoiceSearchActivity()
},
// 跳转到结果页面,并
search() {
this.$router.push({
path: '/result',
query: {
searchText: this.searchText || this.pSearchText,
pageFrom: 'searchIndex',
token: this.token || 'C8D5E10A1F1243D38DFFE9BE5D8C5601'
}
})
},
// 获取输入框中要显示的内容
getHotLabels() {
getHotLabelsService({type: 1}).then(res => {
if (res.code == '000000') {
if (res.data && res.data.length) {
let index = Math.floor(Math.random() * res.data.length)
this.pSearchText = res.data[index].keyword
}
}
// this.allLabels = res.data;
});
},
// 获取用户信息 // 获取用户信息
getUserInfo() { getUserInfo() {
this.$rocNative this.$rocNative
...@@ -134,185 +53,12 @@ export default { ...@@ -134,185 +53,12 @@ export default {
.then(params => { .then(params => {
this.setUserInfo(params) this.setUserInfo(params)
this.token = params.userToken this.token = params.userToken
this.getHotLabels() });
// this.getData()
// this.userMobile = params.userMobile;
});
}, },
}
back() {
this.$rocNative.goBack()
},
},
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@import '@/assets/style/mixin'; @import '@/assets/style/mixin';
// .van-cell__value {
// top: px2rem(2px) !important;
// }
.van-field__control {
margin-top: px2rem(4px) !important;
}
.mint-search {
position: fixed;
top: 0px;
z-index: 2;
height: 66px;
width: 100%;
/* margin: 0 20px; */
border-bottom: 0.5px solid #E7E7E7 !important;
background-color: #fff;
}
.mint-searchbar {
position: relative;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
background: #fff;
box-sizing: border-box;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin: 0 10px;
padding: 30px 10px 8px;
z-index: 1;
}
.mint-searchbar-cancel {
margin-left: 10px;
font-size: 14px ;
color: #999;
text-decoration: none;
}
.mint-searchbar-inner {
background: #F5F6F6;
}
.mint-searchbar-core {
color: #555555;
background: #F5F6F6;
}
</style>
<!-- Add "scoped" attribute to limit CSS to this component only --> </style>
<style lang="scss" scoped>
@import '@/assets/style/mixin';
@import '@/assets/style/global';
.pd-80 {
padding-top: px2rem(80px);
}
.mt-100 {
padding-top: px2rem(63px) !important;
}
.search-icon {
font-size: 20px;
}
.search-icon:before {
content: "\E604";
}
.search-container {
display: flex;
position: fixed;
top: 0;
left: 0;
z-index: 3;
width: 100%;
flex-direction: row;
text-align: center;
// padding: px2rem(30px) 0 px2rem(4px);
padding: px2rem(40px) 0 px2rem(12.5px);
background: #fff;
// border-bottom: 1px solid #E7E7E7;
&-img {
/* padding: 0 0 px2rem(10px) px2rem(16px);*/
position: absolute;
bottom: px2rem(18px);
left: px2rem(16px);
width: px2rem(20px);
height: px2rem(20px);
// transform: rotate(180deg);
}
// .pt-22 {
// /* padding-bottom: px2rem(20px);*/
// }
&-img2 {
position: absolute;
top: px2rem(13px);
left: px2rem(35px);
z-index: 2;
img {
width: px2rem(25px);
height: px2rem(25px);
}
}
&-img3 {
position: absolute;
top: px2rem(9px);
left: px2rem(274px);
z-index: 2;
img {
width: px2rem(22px);
height: px2rem(22px);
}
}
&-input {
display: inline-flex;
flex: 1;
position: relative;
left: px2rem(0px);
width: px2rem(280px);
height: px2rem(30px);
margin-left: px2rem(0px);
// padding-left: px2rem(26px);
// padding-right: px2rem(28px);
border-radius: px2rem(4px);
background: rgba(246, 246, 246, 1);
font-size: px2rem(13px);
color: #666;
-webkit-appearance: none;
vertical-align: bottom;
}
&-cancle {
position: relative;
/* top: px2rem(1px);*/
top: px2rem(-6px);
left: px2rem(4px);
height: px2rem(14px);
line-height: px2rem(14px);
margin-top: px2rem(2px);
font-size: px2rem(14px);
color: #373839;
vertical-align: baseline;
}
.search-content {
margin-left: px2rem(40px);
}
}
.top-bar-height {
position: fixed;
height: px2rem(20px);
width: 100%;
top: 0;
left: 0;
z-index: 2;
background: #fff;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
.ios-top {
padding-top: px2rem(22.5px);
}
.search-black>img{
padding: 0;
}
.lux-close {
position: absolute;
width: 25px;
height: 25px;
top: 15.5px;
right: 10px;
background-image: url('../assets/images/sousuo/search-black.png');
background-repeat: no-repeat;
background-size: contain;
}</style>
export const state = () => ({ export const state = () => ({
userInfo: {}, userInfo: {},
cSearchText: '',
refreshNum: 1,
orderNum: 1,
displayConfig: {
courseDisplayFlag: 0,
courseDisplayContent: '',
courseDisplayParam: [],
educationComtentDisplayFlag: 0,
educationComtentDisplayContent: '',
educationComtentDisplayParam: {id: 1, name: '高血压', seqNo: "1"},
},
allHistoryLabels: [],
}) })
export const getters = { export const getters = {
userInfo(state) { userInfo(state) {
return state.userInfo return state.userInfo
},
cSearchText(state) {
return state.cSearchText
},
refreshNum(state) {
return state.refreshNum
},
orderNum(state) {
return state.orderNum
},
displayConfig(state) {
return state.displayConfig
},
allHistoryLabels(state) {
return state.allHistoryLabels
} }
} }
export const mutations = { export const mutations = {
SET_USER_INFO(state, userInfo) { SET_USER_INFO(state, userInfo) {
state.userInfo = userInfo state.userInfo = userInfo
},
SET_C_SEARCH_TEXT(state, cSearchText) {
state.cSearchText = cSearchText
},
SET_REFRESH_NUM(state, refreshNum) {
state.refreshNum = refreshNum
},
SET_ORDER_NUM(state, orderNum) {
state.orderNum = orderNum
},
SET_DISPLAY_CONFIG(state, displayConfig) {
state.displayConfig = displayConfig
},
SET_ALL_HISTORY_LABELS(state, allHistoryLabels) {
state.allHistoryLabels = allHistoryLabels
} }
} }
export const actions = { export const actions = {
setUserInfo({ commit }, userInfo) { setUserInfo({ commit }, userInfo) {
commit('SET_USER_INFO', userInfo); commit('SET_USER_INFO', userInfo);
}, }
setCSearchText({ commit }, cSearchText) {
commit('SET_C_SEARCH_TEXT', cSearchText);
},
setRefreshNum({ commit }, refreshNum) {
commit('SET_REFRESH_NUM', refreshNum);
},
setOrderNum({ commit }, orderNum) {
commit('SET_ORDER_NUM', orderNum);
},
setDisplayConfig({ commit }, displayConfig) {
commit('SET_DISPLAY_CONFIG', displayConfig);
},
setAllHistoryLabels({ commit }, allHistoryLabels) {
commit('SET_ALL_HISTORY_LABELS', allHistoryLabels);
},
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册