Commit 732cdb39 authored by zhanglw's avatar zhanglw

收藏

parent 4040b07d
......@@ -535,6 +535,16 @@ export const HttpReq = {
method: 'get'
})
},
// 收藏产品-供应商
collectProductOrSupplier: function(data) {
return request({
url: '/api/bsw/bigScreen/index/collectProductOrSupplier',
method: 'post',
data: data
}).then((res) => {
return res
})
},
id: null
}
}
......
src/assets/home_images/cisnet_logo.png

6.67 KB | W: | H:

src/assets/home_images/cisnet_logo.png

7.35 KB | W: | H:

src/assets/home_images/cisnet_logo.png
src/assets/home_images/cisnet_logo.png
src/assets/home_images/cisnet_logo.png
src/assets/home_images/cisnet_logo.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -6,6 +6,7 @@ import { getToken } from '@/utils/auth'
import Config from '@/settings'
import Cookies from 'js-cookie'
const backUrlList = ['/dashboard', '/system', '/monitor', '/sys-tools', '/backstage']// 后台路由
// 创建axios实例
const service = axios.create({
baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url
......@@ -56,14 +57,26 @@ service.interceptors.response.use(
return Promise.reject(error)
}
}
console.log(code)
if (code) {
if (code === 401) {
store.dispatch('LogOut').then(() => {
// 用户登录界面提示
Cookies.set('point', 401)
location.reload()
})
const findUrl = (urlList, path) => {
let flag = false
urlList.forEach(url => {
if (path.indexOf(url) !== -1) {
flag = true
}
})
return flag
}
if (findUrl(backUrlList, window.location.href)) {
store.dispatch('LogOut').then(() => {
Cookies.set('point', 401)
location.reload()
})
} else {
Cookies.set('loginTip', 401)
router.push({ path: `/login?redirect=${window.location.pathname}` })
}
} else if (code === 403) {
router.push({ path: '/401' })
} else {
......
......@@ -206,11 +206,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
......
......@@ -27,9 +27,9 @@
</div>
<div class="sup_area">
<img src="@/assets/home_images/locate.png">
<span>{{ item.area }}</span>
<img v-if="item.isStore" class="touch" src="@/assets/home_images/to_like_h.png" title="点击取消收藏" style="right:-12px;top:7px" @click="storeShowcase(item, 'supplier')">
<img v-else class="touch" src="@/assets/home_images/to_like.png" title="点击收藏" style="right:-12px;top:7px" @click="storeShowcase(item, 'supplier')">
<span :title="item.area">{{ item.area }}</span>
<img v-if="item.isStore" class="touch" src="@/assets/home_images/to_like_h.png" title="点击取消收藏" style="position: absolute;top: 58px;right: 220px" @click="storeShowcase(item, 'supplier')">
<img v-else class="touch" src="@/assets/home_images/to_like.png" title="点击收藏" style="position: absolute;top: 58px;right: 220px" @click="storeShowcase(item, 'supplier')">
</div>
<div style="margin: 25px 40px">
<div class="block-c">
......@@ -80,6 +80,7 @@ import languageSetting from '../components/languageSettingV2'
import homeFooter from '../components/homeFooter'
import inquiryView from '../components/inquiryView'
import userMenus from '../components/userMenus'
import { HttpReq } from '@/api/common'
export default {
components: { titleMenus, userLogin, languageSetting, homeFooter, inquiryView, userMenus },
......@@ -163,11 +164,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
......@@ -267,9 +273,14 @@ export default {
}
}
.sup_area {
width: 460px;
padding: 10px 0;
color: #666666;
font-size: 18px;
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
img {
position:relative;
top:4px;
......
......@@ -277,11 +277,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
......
......@@ -173,6 +173,7 @@ export default {
this.getCookie()
// token 过期提示
this.point()
this.loginTip()
},
beforeDestroy() {
if (this.timer) {
......@@ -289,7 +290,7 @@ export default {
}
this.$store.dispatch('Login', user).then(() => {
this.loading = false
this.$router.push({ path: '/console' })
this.$router.push({ path: this.redirect || '/console' })
}).catch(() => {
this.loading = false
this.getCode()
......@@ -311,6 +312,17 @@ export default {
})
Cookies.remove('point')
}
},
loginTip() {
const point = Cookies.get('loginTip') !== undefined
if (point) {
this.$notify({
message: '当前操作需要您先登录,请登录!',
type: 'warning',
duration: 5000
})
Cookies.remove('loginTip')
}
}
}
}
......
......@@ -219,11 +219,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
......
......@@ -281,11 +281,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
......
......@@ -265,6 +265,7 @@ import languageSetting from '../components/languageSettingV2'
import homeFooter from '../components/homeFooter'
import inquiryView from '../components/inquiryView'
import floatInquiryView from '../components/floatInquiryView'
import { HttpReq } from '@/api/common'
export default {
components: { titleMenus, userLogin, languageSetting, homeFooter, inquiryView, floatInquiryView },
......@@ -472,11 +473,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
......
......@@ -228,11 +228,16 @@ export default {
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
HttpReq.webClientApi.collectProductOrSupplier({
id: item.id,
collect: !item.isStore,
type: type
}).then((res) => {
item.isStore = !item.isStore
this.$message.warning({
message: res.msg
})
})
console.log(item, type)
},
pageChange(e) {
this.page = e
......
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