将搜索条件存储为cookie
This commit is contained in:
parent
5d111c8642
commit
639bcd4848
|
|
@ -95,21 +95,6 @@ export default {
|
|||
if (typeof WebSocket == "undefined") {
|
||||
console.log("您的浏览器不支持WebSocket");
|
||||
} else {
|
||||
// 组装待发送的消息 json
|
||||
// {"type":"msg","data":"hello","to_user_id":1,"from_user_id":2002,"session":"11917957"}
|
||||
// let message = {
|
||||
// type: "msg",
|
||||
// data: "hello",
|
||||
// to_user_id: this.to_user_id,
|
||||
// from_user_id: this.tokenData.userId,
|
||||
// session: this.session,
|
||||
// };
|
||||
// let json=JSON.stringify(message)
|
||||
// var aesEnc = await this.aesEncrypt(
|
||||
// this.text,
|
||||
// this.imKey,
|
||||
// this.session
|
||||
// );
|
||||
var aesEnc = await this.aesEncrypt(this.text, this.imKey, this.imKey);
|
||||
let data =
|
||||
'{"type":"msg","data":"' +
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
import axios from "axios";
|
||||
import { SearchUserService } from "@/api/user.js";
|
||||
import router from "@/router/index.js";
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ip: "",
|
||||
tableData: [],
|
||||
search_id: 2002,
|
||||
keyword: "",
|
||||
tokenData: {
|
||||
token: localStorage.getItem("token"),
|
||||
ip: localStorage.getItem("ip"),
|
||||
|
|
@ -25,17 +27,15 @@ export default {
|
|||
async getUserList() {
|
||||
let result = {};
|
||||
try {
|
||||
this.tokenData.id = this.search_id;
|
||||
this.tokenData.keyword = this.keyword;
|
||||
Cookies.set("search_id", this.search_id);
|
||||
Cookies.set("keyword", this.keyword);
|
||||
result = await SearchUserService(this.tokenData);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
let data = result.data;
|
||||
|
||||
// for(let d in data){
|
||||
// let res = JSON.parse(d);
|
||||
// console.log("res=",res);
|
||||
// this.tableData.push(res);
|
||||
// }
|
||||
this.tableData = data;
|
||||
},
|
||||
onSubmit() {
|
||||
|
|
@ -91,6 +91,8 @@ export default {
|
|||
if (localStorage.getItem("token") === null) {
|
||||
router.push("/login");
|
||||
}
|
||||
this.search_id = Cookies.get("search_id")?cookies.get("search_id"):2002;
|
||||
this.keyword = Cookies.get("keyword")?cookies.get("keyword"):"";
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -125,14 +127,14 @@ export default {
|
|||
<!-- 搜索与添加区域 -->
|
||||
<el-input
|
||||
placeholder="请输入ID"
|
||||
v-model="tokenData.id"
|
||||
v-model="search_id"
|
||||
clearable
|
||||
@clear="getUserList"
|
||||
>
|
||||
</el-input>
|
||||
<el-input
|
||||
placeholder="请输入关键字"
|
||||
v-model="tokenData.keyword"
|
||||
v-model="keyword"
|
||||
clearable
|
||||
@clear="getUserList"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -5,13 +5,6 @@ import { delayVideoService } from "@/api/video.js";
|
|||
import router from "@/router/index.js";
|
||||
|
||||
export default {
|
||||
// data() 返回的属性将会成为响应式的状态
|
||||
// 并且暴露在 `this` 上
|
||||
// setup: function() {
|
||||
// const globalData = inject("globalData");
|
||||
// const token = globalData.token;
|
||||
// return { token };
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
ip: "",
|
||||
|
|
@ -38,6 +31,9 @@ export default {
|
|||
async getVideoList() {
|
||||
let result = {};
|
||||
try {
|
||||
if(this.tokenData.entrydate.length > 0) {
|
||||
Cookies.set("entrydate", this.tokenData.entrydate);
|
||||
}
|
||||
result = await getVideoListService(this.tokenData);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
|
@ -212,6 +208,7 @@ export default {
|
|||
}
|
||||
// console.log("mounted");
|
||||
await this.getIpClient();
|
||||
this.tokenData.entrydate = Cookies.get("entrydate")? Cookies.get("entrydate"): [];
|
||||
this.getVideoList();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue