Commit 732cdb39 authored by zhanglw's avatar zhanglw

收藏

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