提交 906526a9 编写于 作者: 杨广俊's avatar 杨广俊

测试历史

上级 8bc69e99
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
mounted(){ mounted(){
let _self = this; let _self = this;
window.__getUserInfo = function(params){ window.__getUserInfo = function(params){
// alert(JSON.stringify(params)) alert('eeeeeee' + JSON.stringify(params))
_self.token = params.userToken _self.token = params.userToken
// _self.SET_USER_INFO(params) // _self.SET_USER_INFO(params)
_self.getData() _self.getData()
...@@ -92,6 +92,7 @@ export default { ...@@ -92,6 +92,7 @@ export default {
} }
let url = 'contents/searchHistory/listHistory' let url = 'contents/searchHistory/listHistory'
this.GET(url, para).then(res => { this.GET(url, para).then(res => {
alert('getData' + JSON.stringify(res))
if (res.code == '000000') { if (res.code == '000000') {
this.allLabels = res.data.list this.allLabels = res.data.list
console.log(res) console.log(res)
......
...@@ -38,7 +38,16 @@ export default { ...@@ -38,7 +38,16 @@ export default {
gotoPage(itemData){ gotoPage(itemData){
console.log('itemData', itemData) console.log('itemData', itemData)
// 如果没有跳转信息,则直接到搜索结果页面 // 如果没有跳转信息,则直接到搜索结果页面
if(!itemData.appModuleInfo || !(itemData.appModuleInfo.code === 'M300' || itemData.appModuleInfo.code === 'M400' || itemData.appModuleInfo.code === 'M500')){ if(!itemData.appModuleInfo
|| !(itemData.appModuleInfo.code === 'M001'
|| itemData.appModuleInfo.code === 'M002'
|| itemData.appModuleInfo.code === 'M003'
|| itemData.appModuleInfo.code === 'M100'
|| itemData.appModuleInfo.code === 'M200'
|| itemData.appModuleInfo.code === 'M300'
|| itemData.appModuleInfo.code === 'M400'
|| itemData.appModuleInfo.code === 'M500'
)){
console.log('不支持的中转。。。') console.log('不支持的中转。。。')
this.searchAction(itemData.keyword) this.searchAction(itemData.keyword)
return return
......
/** /**
* Created by Anndy Yang on 18/03/18. * Created by Anndy Yang on 18/09/18.
*/ */
Date.prototype.format = function(fmt) {
var o = {
'M+': this.getMonth() + 1, // 月份
'd+': this.getDate(), // 日
'h+': this.getHours(), // 小时
'm+': this.getMinutes(), // 分
's+': this.getSeconds(), // 秒
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
'S': this.getMilliseconds() // 毫秒
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
}
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if (('' + time).length === 10) time = parseInt(time) * 1000
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
export function formatTime(time, option) {
time = +time * 1000
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000
let des = ''
if (diff < 30) {
des = '刚刚'
} else if (diff < 3600) { // less 1 hour
des = Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
des = Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
des = '1天前'
}
if (option) {
return parseTime(time, option)
} else {
if (des) {
return des + ' (' + (d.getMonth() + 1) + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds() + ')'
} else {
return d.getMonth() + 1 + '/' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds()
}
}
}
// 将树形结构任意两个key修改成对应的特定key
// {id: '', name: ''} => {id: '', label: ''}
export function convertTreeData(originData, orgId = 'id', orgLabel = 'name', targetId = 'id', targetLabel = 'label') {
const targetData = []
let targetObj = {}
for (let i = 0; i < originData.length; i++) {
targetObj = {}
targetObj[targetId] = originData[i][orgId]
targetObj[targetLabel] = originData[i][orgLabel]
targetData.push(targetObj)
if (originData[i].children && originData[i].children.length > 0) {
targetObj.children = convertTreeData(originData[i].children, orgId, orgLabel, targetId, targetLabel)
}
}
return targetData
}
/**
* JSON数组去重
* @param: [array] json Array
* @param: [string] 唯一的key名,根据此键名进行去重
*/
export function uniqueArray(array, key) {
const result = [array[0]]
for (let i = 1; i < array.length; i++) {
const item = array[i]
let repeat = false
for (let j = 0; j < result.length; j++) {
if (item[key] === result[j][key]) {
repeat = true
break
}
}
if (!repeat) {
result.push(item)
}
}
return result
}
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId',
containerHeightId = 'appContainerId', innerHeightId = 'elTableId'){
if (!p_getElm(refHeightId) || !p_getElm(containerHeightId) || !p_getElm(innerHeightId)) {
// window.onresize = null
console.warn('No certain dom id!!!');
}
let containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 50
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
p_getElm(innerHeightId).style.height = containerHeight - iMinuxHeight + 'px'
if(p_getElm('elTableIdInner')){
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
}
window.onresize = function() {
containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 50
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
p_getElm(innerHeightId).style.height = containerHeight - iMinuxHeight + 'px'
if (p_getElm('elTableIdInner')) {
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
}
}
}
function p_getElm(elmId) {
return document.getElementById(elmId)
}
export function getHostnameAndPort() {
const NODE_ENV = process.env.NODE_ENV
if (NODE_ENV === 'production') {
return location.hostname + ':' + location.port
} else {
return '192.168.80.191:8080'
}
}
function setRouterParm(paramList){
let parm = {};
if(paramList.length<=1){
return '';
}
for(let i=1;i<paramList.length;i++){
parm[paramList[i].key] = paramList[i].value;
}
return parm;
}
export function setEventByModuleCode(itemData){ export function setEventByModuleCode(itemData){
let modeCode = itemData.appModuleInfo.code || ''; let modeCode = itemData.appModuleInfo.code || '';
let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : '' let paramList = itemData.appModuleInfo.paramList ? itemData.appModuleInfo.paramList : ''
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<img class="search-container-img" @click="back" src="../images/sousuo/left-arrow-black.png"/> <img class="search-container-img" @click="back" src="../images/sousuo/left-arrow-black.png"/>
<div > <div >
<span class="search-container-img2"><img class="search-container-img" src="../images/sousuo/search-black.png"/></span> <span class="search-container-img2"><img class="search-container-img" src="../images/sousuo/search-black.png"/></span>
<input class="search-container-input" type="search" v-model="searchText" maxlength="100"> <input id="search-input" class="search-container-input" type="search" v-model="searchText" maxlength="100">
<span class="search-container-img3" @click="clearText"><img class="search-container-img" src="../images/sousuo/delete.png"/></span> <span class="search-container-img3" @click="clearText"><img class="search-container-img" src="../images/sousuo/delete.png"/></span>
<span class="search-container-cancle" @click.prevent="search">搜索</span> <span class="search-container-cancle" @click.prevent="search">搜索</span>
</div> </div>
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
<!-- 没有结果页面 --> <!-- 没有结果页面 -->
<article v-show="!(showTab1 || showTab2 || showTab3 || showTab4)" class="mt-80"> <article v-show="!(showTab1 || showTab2 || showTab3 || showTab4)" class="mt-80">
<section></section>
<NoResultPage/> <NoResultPage/>
<SplitLine borderWidth="3px"/> <SplitLine borderWidth="3px"/>
<CourseAdjust :parmData="adjustList"/> <CourseAdjust :parmData="adjustList"/>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<img class="search-container-img" @click="back" src="../images/sousuo/left-arrow-black.png"/> <img class="search-container-img" @click="back" src="../images/sousuo/left-arrow-black.png"/>
<div > <div >
<span class="search-container-img2"><img class="search-container-img" src="../images/sousuo/search-black.png"/></span> <span class="search-container-img2"><img class="search-container-img" src="../images/sousuo/search-black.png"/></span>
<input class="search-container-input" type="search" v-model="searchText" maxlength="100"> <input class="search-container-input" type="search" v-model="searchText" maxlength="100" :placeholder="pSearchText">
<span class="search-container-img3" @click="clearText"><img class="search-container-img" src="../images/sousuo/delete.png"/></span> <span class="search-container-img3" @click="clearText"><img class="search-container-img" src="../images/sousuo/delete.png"/></span>
<span class="search-container-cancle" @click.prevent="search">搜索</span> <span class="search-container-cancle" @click.prevent="search">搜索</span>
</div> </div>
...@@ -35,6 +35,7 @@ export default { ...@@ -35,6 +35,7 @@ export default {
data() { data() {
return { return {
searchText: '', searchText: '',
pSearchText: 'rrr',
token: '' token: ''
} }
}, },
...@@ -55,6 +56,7 @@ export default { ...@@ -55,6 +56,7 @@ export default {
mounted(){ mounted(){
let _self = this; let _self = this;
window.__getUserInfo = function(params){ window.__getUserInfo = function(params){
alert(JSON.stringify(params))
_self.token = params.userToken _self.token = params.userToken
// _self.SET_USER_INFO(params) // _self.SET_USER_INFO(params)
_self.getData() _self.getData()
...@@ -96,7 +98,7 @@ export default { ...@@ -96,7 +98,7 @@ export default {
this.$router.push({ this.$router.push({
path: '/result', path: '/result',
query: { query: {
searchText: this.searchText searchText: this.searchText || this.pSearchText
} }
}) })
}, },
...@@ -110,15 +112,18 @@ export default { ...@@ -110,15 +112,18 @@ export default {
} }
let url = '/contents/searchKeyword/listKeywords' let url = '/contents/searchKeyword/listKeywords'
this.GET(url, para).then(res => { this.GET(url, para).then(res => {
alert(JSON.stringify(res))
if (res.code == '000000') { if (res.code == '000000') {
if (res.data && res.data.length) { if (res.data && res.data.length) {
let index = Math.floor(Math.random() * res.data.length) let index = Math.floor(Math.random() * res.data.length)
this.searchText = res.data[index].keyword this.pSearchText = res.data[index].keyword
// this.searchText = res.data[index].keyword
} }
} }
}) })
}, },
getUserInfo: function () { getUserInfo: function () {
alert('getUserInfo')
rocNative.getUserInfo({'__funcName': '__getUserInfo'}) rocNative.getUserInfo({'__funcName': '__getUserInfo'})
}, },
getStatusBarHeight: function () { getStatusBarHeight: function () {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册