Commit 6e3eada3 authored by 吴冠's avatar 吴冠

更改为Cookies

parent 94a9e5cf
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</el-dropdown> </el-dropdown>
<!-- <div class="checkout" v-show = "showButton" @mouseover="hover()">退出</div> --> <!-- <div class="checkout" v-show = "showButton" @mouseover="hover()">退出</div> -->
<nuxt-link to="/login/user" class="login" v-show="showDefault">请登录</nuxt-link> <nuxt-link to="/login/user" class="login" v-show="showDefault">请登录</nuxt-link>
<span style="color:blue;margin-left:30px" class="other" @click="loginOther" v-show="showDefault">商家免费入</span> <span style="color:blue;margin-left:30px" class="other" @click="loginOther" v-show="showDefault">商家免费入</span>
<button @click="jump" v-show="!showDefault" class="right-pos">商家管理后台</button> <button @click="jump" v-show="!showDefault" class="right-pos">商家管理后台</button>
</div> </div>
</div> </div>
...@@ -31,22 +31,16 @@ ...@@ -31,22 +31,16 @@
<script> <script>
import {getSecond} from '@/common/list.js' import {getSecond} from '@/common/list.js'
import Cookies from 'js-cookie'
export default { export default {
created(){ created(){
}, },
mounted(){ mounted(){
let tokenStr = sessionStorage.getItem("token") let tokenStr = Cookies.get("token")
console.log(tokenStr+"-------------") console.log(tokenStr+"-------------")
if(tokenStr){ if(tokenStr){
/* let a = sessionStorage.getItem("companyNameType")
if(a=="1"){
setTimeout(()=>{
location.reload()
sessionStorage.removeItem("companyNameType")
},10)
} */
this.getSecond() this.getSecond()
this.showDefault = false this.showDefault = false
this.isicon = true this.isicon = true
...@@ -76,7 +70,7 @@ import {getSecond} from '@/common/list.js' ...@@ -76,7 +70,7 @@ import {getSecond} from '@/common/list.js'
this.$message.success('同时按住ctrl+D收藏本站') this.$message.success('同时按住ctrl+D收藏本站')
}, },
jump(){ jump(){
let token=window.sessionStorage.getItem("token") let token=Cookies.get("token")
if(token){ if(token){
/* window.location.href="http://192.168.200.201:8082/#/purchaser/Home" */ /* window.location.href="http://192.168.200.201:8082/#/purchaser/Home" */
window.location.href=`http://60.205.251.80:8082/#/purchaser/Home?token=${token}` window.location.href=`http://60.205.251.80:8082/#/purchaser/Home?token=${token}`
...@@ -90,7 +84,7 @@ import {getSecond} from '@/common/list.js' ...@@ -90,7 +84,7 @@ import {getSecond} from '@/common/list.js'
this.showButton = false this.showButton = false
} */ } */
out(){ out(){
sessionStorage.clear() Cookies.remove("token")
this.$router.push("/login/user") this.$router.push("/login/user")
} }
}, },
......
...@@ -22,23 +22,22 @@ ...@@ -22,23 +22,22 @@
</template> </template>
<script> <script>
import Cookies from "js-cookie"
export default { export default {
methods:{ methods:{
toSearch(){ toSearch(){
sessionStorage.setItem("content",this.input) Cookies.set("content",this.input)
sessionStorage.setItem("contentStatus",1) Cookies.set("contentStatus",1)
if(window.location.pathname !=="/notice/all"){ if(window.location.pathname !=="/notice/all"){
this.$router.push('/notice/all') this.$router.push('/notice/all')
this.input = null this.input = null
}else{ }else{
location.reload() /* location.reload() */
console.log("请在下面进行查询") this.$message.error("请在下面查询!")
this.input = null this.input = null
} }
} }
}, },
mounted(){
},
data() { data() {
return { return {
showdefault:false, showdefault:false,
......
...@@ -6006,6 +6006,11 @@ ...@@ -6006,6 +6006,11 @@
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
}, },
"js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"js-tokens": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"axios": "^0.20.0", "axios": "^0.20.0",
"element-china-area-data": "^5.0.1", "element-china-area-data": "^5.0.1",
"element-ui": "^2.13.2", "element-ui": "^2.13.2",
"js-cookie": "^2.2.1",
"nuxt": "^2.14.0" "nuxt": "^2.14.0"
}, },
"devDependencies": {} "devDependencies": {}
......
...@@ -54,6 +54,7 @@ import { ...@@ -54,6 +54,7 @@ import {
getCategoryList, getCategoryList,
getnewsdetails, getnewsdetails,
} from '@/common/list.js' } from '@/common/list.js'
import Cookies from "js-cookie"
export default { export default {
name: 'cardApplyQuery', name: 'cardApplyQuery',
mounted(){ mounted(){
...@@ -69,13 +70,13 @@ import { ...@@ -69,13 +70,13 @@ import {
message.cateId = this.activeName message.cateId = this.activeName
} }
this.getListContent(message) this.getListContent(message)
let detailsType = sessionStorage.getItem("detailsType") let detailsType = Cookies.get("detailsType")
let detailsId = sessionStorage.getItem("detailsId") let detailsId = Cookies.get("detailsId")
//判断是否来自于首页底部三大模块 //判断是否来自于首页底部三大模块
if(detailsType =="1"){ if(detailsType =="1"){
this.isClick(detailsId) this.isClick(detailsId)
sessionStorage.removeItem("detailsType") Cookies.remove("detailsType")
sessionStorage.removeItem("detailsId") Cookies.remove("detailsId")
} }
}, },
/* async asyncData({params}){ /* async asyncData({params}){
...@@ -132,11 +133,11 @@ import { ...@@ -132,11 +133,11 @@ import {
let message = {} let message = {}
message.cateId = keyValue message.cateId = keyValue
this.getListContent(message) this.getListContent(message)
let contentStatus = sessionStorage.getItem("contentStatus") let contentStatus = Cookies.get("contentStatus")
if(contentStatus == '1'){ if(contentStatus == '1'){
this.isList = true this.isList = true
this.getListContent(message) this.getListContent(message)
sessionStorage.removeItem("contentStatus") Cookies.remove("contentStatus")
} }
}, },
//分类列表 //分类列表
...@@ -170,7 +171,7 @@ import { ...@@ -170,7 +171,7 @@ import {
const {data} = await getnewsdetails(id) const {data} = await getnewsdetails(id)
this.detailList= data this.detailList= data
this.isList = false this.isList = false
sessionStorage.setItem("contentStatus",1) Cookies.set("contentStatus",1)
}, },
//返回 //返回
returnPrev(){ returnPrev(){
......
...@@ -59,22 +59,23 @@ ...@@ -59,22 +59,23 @@
import {industryList} from '@/api/common/list.js' import {industryList} from '@/api/common/list.js'
import citySelect from '@/components/citySelect.vue' import citySelect from '@/components/citySelect.vue'
import {getAllList,getNoticeType} from '@/common/list.js' import {getAllList,getNoticeType} from '@/common/list.js'
import Cookies from 'js-cookie'
export default { export default {
components:{ components:{
citySelect citySelect
}, },
/* mounted(){ /* mounted(){
let inputContent = sessionStorage.getItem("content") let inputContent = Cookies.get("content")
let message = {} let message = {}
message.size = 10 message.size = 10
message.currentPage = 1 message.currentPage = 1
message.title = inputContent message.title = inputContent
this.industryList() this.industryList()
this.getAllList(message) this.getAllList(message)
sessionStorage.removeItem("content") Cookies.remove("content")
}, */ }, */
async asyncData({params}){ async asyncData({params}){
let inputContent = sessionStorage.getItem("content") let inputContent = Cookies.get("content")
let mes ={ let mes ={
currentPage:1, currentPage:1,
size:10, size:10,
...@@ -88,7 +89,7 @@ import {getAllList,getNoticeType} from '@/common/list.js' ...@@ -88,7 +89,7 @@ import {getAllList,getNoticeType} from '@/common/list.js'
total : total, total : total,
industryOptions:res industryOptions:res
} }
sessionStorage.removeItem("content") Cookies.remove("content")
}, },
data() { data() {
return { return {
...@@ -188,15 +189,17 @@ import {getAllList,getNoticeType} from '@/common/list.js' ...@@ -188,15 +189,17 @@ import {getAllList,getNoticeType} from '@/common/list.js'
const {data,total} = await getAllList(params) const {data,total} = await getAllList(params)
this.priceList = data this.priceList = data
this.total = total this.total = total
let contentStatus = sessionStorage.getItem("contentStatus") let contentStatus = Cookies.get("contentStatus")
if(contentStatus =='1'){ if(contentStatus =='1'){
if(this.total!==0){ if(total!='0'){
this.$message.success("查询成功!") console.log(111111111111111)
/* this.$message.success */alert("查询成功!")
}else{ }else{
console.log(111111111111111111111)
this.$message.error("请输入正确的公告名称!") this.$message.error("请输入正确的公告名称!")
this.getAllList(this.getData) this.getAllList(this.getData)
} }
sessionStorage.removeItem("contentStatus") Cookies.remove("contentStatus")
} }
}, },
receiveP(value) { receiveP(value) {
......
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
<script> <script>
import dataBreadcrumb from '@/components/dataBreadcrumb.vue' import dataBreadcrumb from '@/components/dataBreadcrumb.vue'
import {getBidingdetails} from '@/common/list.js' import {getBidingdetails} from '@/common/list.js'
import Cookies from "js-cookie"
export default { export default {
components: { components: {
dataBreadcrumb dataBreadcrumb
...@@ -152,7 +153,7 @@ export default { ...@@ -152,7 +153,7 @@ export default {
console.log(id) console.log(id)
this.getBidingdetails(id) this.getBidingdetails(id)
let noticeType = window.location.href.split("?id=")[1] let noticeType = window.location.href.split("?id=")[1]
sessionStorage.setItem("bidId",noticeType) Cookies.set("bidId",noticeType)
}, },
data() { data() {
return { return {
...@@ -167,12 +168,12 @@ export default { ...@@ -167,12 +168,12 @@ export default {
}, },
methods:{ methods:{
signUp(){ signUp(){
let tokenStr = sessionStorage.getItem("token") let tokenStr = Cookies.get("token")
if(!tokenStr){ if(!tokenStr){
sessionStorage.setItem("sign",1) Cookies.set("sign",1)
this.$router.push("/login/user") this.$router.push("/login/user")
}else{ }else{
let issupplier =sessionStorage.getItem("isSupplier") let issupplier =Cookies.get("isSupplier")
if(issupplier==="1"){ if(issupplier==="1"){
this.isshow = !this.isshow this.isshow = !this.isshow
}else{ }else{
......
...@@ -168,6 +168,7 @@ ...@@ -168,6 +168,7 @@
import dataTable from "@/components/dataTable.vue"; import dataTable from "@/components/dataTable.vue";
import breadCrumb from "@/components/dataBreadcrumb.vue"; import breadCrumb from "@/components/dataBreadcrumb.vue";
import { getenquirydetails } from "@/common/list.js"; import { getenquirydetails } from "@/common/list.js";
import Cookies from "js-cookie"
export default { export default {
components: { components: {
dataTable, dataTable,
...@@ -180,12 +181,12 @@ export default { ...@@ -180,12 +181,12 @@ export default {
message.size = 10 message.size = 10
console.log(id + "----------------------++++++++++++++++++"); console.log(id + "----------------------++++++++++++++++++");
this.getenquirydetails(id); this.getenquirydetails(id);
let number1 = sessionStorage.getItem("isSupplier") let number1 = Cookies.get("isSupplier")
if(number1 ==='1'){ if(number1 ==='1'){
this.isshowbutton = !this.isshowbutton this.isshowbutton = !this.isshowbutton
} }
let enquiryId = window.location.href.split("?id=")[1] let enquiryId = window.location.href.split("?id=")[1]
sessionStorage.setItem("Id",enquiryId) Cookies.set("Id",enquiryId)
}, },
/* async asyncData({route}){ /* async asyncData({route}){
let id = $route.query.id let id = $route.query.id
...@@ -281,13 +282,13 @@ export default { ...@@ -281,13 +282,13 @@ export default {
methods: { methods: {
//先判断是否登录 //先判断是否登录
putPrice(){ putPrice(){
let tokenStr = sessionStorage.getItem("token") let tokenStr = Cookies.get("token")
if(!tokenStr){ if(!tokenStr){
let b = 1 let b = 1
sessionStorage.setItem("status",b) Cookies.set("status",b)
this.$router.push("/login/user") this.$router.push("/login/user")
}else{ }else{
let number = sessionStorage.getItem("isSupplier") let number = Cookies.get("isSupplier")
if(number ==='2'){ if(number ==='2'){
this.$router.push(`/supply/bid/signupOnline/seePrice?id=${this.PROid}`) this.$router.push(`/supply/bid/signupOnline/seePrice?id=${this.PROid}`)
} }
......
...@@ -773,7 +773,7 @@ export default { ...@@ -773,7 +773,7 @@ export default {
}; };
//结算账号校验 //结算账号校验
let validateAccount = (rule, value, callback) => { let validateAccount = (rule, value, callback) => {
const realnameReg = /^([1-9]{1})(\d{14}|\d{18})$/; const realnameReg = /^([1-9]{1})(\d{14}|\d{17})$/;
if (!realnameReg.test(value)) { if (!realnameReg.test(value)) {
return callback(new Error("您的输入有误,请重新输入!")); return callback(new Error("您的输入有误,请重新输入!"));
} else { } else {
...@@ -974,6 +974,9 @@ export default { ...@@ -974,6 +974,9 @@ export default {
message: "请输入结算账号", message: "请输入结算账号",
trigger: "blur", trigger: "blur",
}, },
{
validator: validateAccount,
},
], ],
bankAccountName: [ bankAccountName: [
{ {
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<script> <script>
import {powerLogin} from '~/api/bid/login'; import {powerLogin} from '~/api/bid/login';
import {getSecond,sendSms,phoneCode1} from '@/common/list.js'; import {getSecond,sendSms,phoneCode1} from '@/common/list.js';
import Cookies from 'js-cookie'
export default { export default {
data() { data() {
return { return {
...@@ -144,7 +145,7 @@ ...@@ -144,7 +145,7 @@
//将手机号和密码发送 //将手机号和密码发送
console.log(data,code) console.log(data,code)
if (code == 200) { if (code == 200) {
sessionStorage.setItem("token",data); Cookies.set("token",data);
this.$message({ this.$message({
message: msg, message: msg,
type: 'success', type: 'success',
...@@ -180,7 +181,7 @@ ...@@ -180,7 +181,7 @@
const {data,code,msg} = await phoneCode1(mess) const {data,code,msg} = await phoneCode1(mess)
console.log(data,code) console.log(data,code)
if (code == 200) { if (code == 200) {
sessionStorage.setItem("token",data); Cookies.set("token",data);
this.$message({ this.$message({
message: msg, message: msg,
type: 'success', type: 'success',
......
import Vue from 'vue'
import Cookies from 'js-cookie'
Vue.use(Cookies)
\ No newline at end of file
import axios from 'axios' import axios from 'axios'
import Cookies from 'js-cookie'
import { Message } from 'element-ui'; import { Message } from 'element-ui';
import requestUrl from '../utils/Domain.js' import requestUrl from '../utils/Domain.js'
// import { Message, MessageBox } from 'element-ui' // import { Message, MessageBox } from 'element-ui'
...@@ -14,10 +15,10 @@ const service = axios.create({ ...@@ -14,10 +15,10 @@ const service = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
/* let token=sessionStorage.getItem("token") let token=Cookies.get("token")
if(token||token!=="undefined"){ if(token||token!=="undefined"){
config.headers['token']=token; config.headers['token']=token;
} */ }
// if (store.getters.token) { // if (store.getters.token) {
// let test = config.data; // let test = config.data;
// if(test){ // if(test){
......
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