|
|
|
<template>
|
|
|
|
<view :class="['page', {oh: !per}]">
|
|
|
|
<uni-search-bar class="search" radius="30" placeholder="请输入" v-model="keyword" clearButton="auto" cancelButton="none" />
|
|
|
|
|
|
|
|
<view class="banner">
|
|
|
|
<image class="img" src="@/static/image/index/banner.png" mode="widthFix"></image>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="block">
|
|
|
|
<view class="title-wrap">
|
|
|
|
<view class="title">热门标签</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<ul class="tags">
|
|
|
|
<li v-for="(tag, i) in tags" :key="i" @click="toHot(tag)">
|
|
|
|
<image class="icon" :src="require('@/static/image/index/' + (i + 1) + '.png')"></image>
|
|
|
|
<view class="text ell">{{ tag.tagsName }}</view>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="block">
|
|
|
|
<view class="title-wrap">
|
|
|
|
<view class="title">热销产品</view>
|
|
|
|
<view class="all" @click="toProduct">全部产品</view>
|
|
|
|
</view>
|
|
|
|
<view class="list">
|
|
|
|
<view v-for="(item, i) in hotProducts" :key="i" class="item" @click="toDetail(item)">
|
|
|
|
<image class="pic" :src="$util.getIcon(item)"></image>
|
|
|
|
<view class="texts">
|
|
|
|
<view class="name ell">{{ item.productName }}</view>
|
|
|
|
<view class="des ell" v-html="item.productIntroduction"></view>
|
|
|
|
<view class="meta">
|
|
|
|
<image class="icon" src="@/static/image/index/9.png"></image>
|
|
|
|
适用专业:
|
|
|
|
<text class="ell">{{ item.professionalName }}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="block">
|
|
|
|
<view class="title-wrap">
|
|
|
|
<view class="title">官方推荐</view>
|
|
|
|
<view class="all" @click="toProduct">全部产品</view>
|
|
|
|
</view>
|
|
|
|
<view class="list">
|
|
|
|
<view v-for="(item, i) in offcialProducts" :key="i" class="item" @click="toDetail(item)">
|
|
|
|
<image class="pic" :src="$util.getIcon(item)"></image>
|
|
|
|
<view class="texts">
|
|
|
|
<view class="name ell">{{ item.productName }}</view>
|
|
|
|
<view class="des ell" v-html="item.productIntroduction"></view>
|
|
|
|
<view class="meta">
|
|
|
|
<image class="icon" src="@/static/image/index/9.png"></image>
|
|
|
|
适用专业:
|
|
|
|
<text class="ell">{{ item.professionalName }}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view v-if="!per" class="per-mask">功能升级中,敬请期待...</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { getUserRolesPermissionMenu } from '@/apis/modules/user.js'
|
|
|
|
import { tagsList, listOfGoods } from '@/apis/modules/product.js'
|
|
|
|
import { getTeamsByAccountId } from '@/apis/modules/client.js'
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
per: true, // 是否有权限
|
|
|
|
teamId: uni.getStorageSync('teamId') || '',
|
|
|
|
list: [],
|
|
|
|
keyword: '',
|
|
|
|
tags: [],
|
|
|
|
hotProducts: [],
|
|
|
|
offcialProducts: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
keyword () {
|
|
|
|
clearTimeout(this.searchTimer)
|
|
|
|
this.searchTimer = setTimeout(() => {
|
|
|
|
this.initList()
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.per = true
|
|
|
|
this.getInfo()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 初始化权限
|
|
|
|
initRole() {
|
|
|
|
if (!uni.getStorageSync('auth').includes('首页')) {
|
|
|
|
this.per = false
|
|
|
|
}
|
|
|
|
this.getTags()
|
|
|
|
this.getProducts()
|
|
|
|
},
|
|
|
|
// 查询当前角色权限
|
|
|
|
getAuth() {
|
|
|
|
uni.getStorageSync('token') && getUserRolesPermissionMenu({
|
|
|
|
teamId: this.list.find(e => e.teamId == this.teamId).partnerClassificationId,
|
|
|
|
platformId: 4
|
|
|
|
}).then(({ permissionMenu }) => {
|
|
|
|
uni.hideLoading()
|
|
|
|
const auth = []
|
|
|
|
// 生成权限数组
|
|
|
|
const generateAuth = (list, parent) => {
|
|
|
|
list.map(e => {
|
|
|
|
const name = `${parent ? parent + ':' : ''}${e.name}`
|
|
|
|
auth.push(name)
|
|
|
|
generateAuth(e.children, name)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
generateAuth(permissionMenu[0].children, '')
|
|
|
|
uni.setStorageSync('auth', auth)
|
|
|
|
this.$forceUpdate()
|
|
|
|
this.initRole()
|
|
|
|
}).catch(e => {
|
|
|
|
uni.hideLoading()
|
|
|
|
uni.setStorageSync('auth', [])
|
|
|
|
this.initRole()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取团队
|
|
|
|
getInfo() {
|
|
|
|
uni.showLoading({
|
|
|
|
title: '加载中'
|
|
|
|
})
|
|
|
|
getTeamsByAccountId().then(({ data }) => {
|
|
|
|
data.map(e => {
|
|
|
|
const n = e.partnerClassificationList
|
|
|
|
e.id = n.id
|
|
|
|
// parnerId是商务经理id,teamId则是下面这个,其他地方要用的话直接uni.getStorageSync('team').partnerId去使用
|
|
|
|
e.teamId = e.isTeam == 1 ? +e.partnerClassificationId : n.id
|
|
|
|
e.partnerClassificationName = n.partnerClassificationName
|
|
|
|
delete e.partnerClassificationList
|
|
|
|
})
|
|
|
|
if (data.length) {
|
|
|
|
/**
|
|
|
|
* @description 如果是第一次进,则默认选中第一个团队,并把该团队的信息存入缓存
|
|
|
|
* 或者团队列表里没有该id,则说明超管已经被转让,也需要重新选中团队
|
|
|
|
*/
|
|
|
|
if (!uni.getStorageSync('team') || !data.find(e => e.teamId == this.teamId)) {
|
|
|
|
this.teamId = data[0].teamId
|
|
|
|
uni.setStorageSync('team', data[0])
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// 如果没有团队,则退出登录
|
|
|
|
uni.hideLoading()
|
|
|
|
uni.clearStorageSync()
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '../login/login'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
this.list = data
|
|
|
|
this.getAuth()
|
|
|
|
}).catch(e => {
|
|
|
|
uni.hideLoading()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 热门标签
|
|
|
|
getTags() {
|
|
|
|
tagsList().then(res => {
|
|
|
|
this.tags = res.tagsList.slice(0, 8)
|
|
|
|
}).catch(e => {})
|
|
|
|
},
|
|
|
|
// 产品
|
|
|
|
getProducts() {
|
|
|
|
// 热销产品
|
|
|
|
listOfGoods({
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 5,
|
|
|
|
sort: 1,
|
|
|
|
isShelves: 0,
|
|
|
|
hotTag: 1
|
|
|
|
}).then(({ page }) => {
|
|
|
|
this.hotProducts = page.records
|
|
|
|
}).catch(e => {})
|
|
|
|
|
|
|
|
// 官方推荐
|
|
|
|
listOfGoods({
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 5,
|
|
|
|
sort: 0,
|
|
|
|
isShelves: 0,
|
|
|
|
hotTag: 1,
|
|
|
|
selection: 1
|
|
|
|
}).then(({ page }) => {
|
|
|
|
this.offcialProducts = page.records
|
|
|
|
}).catch(e => {})
|
|
|
|
},
|
|
|
|
// 跳转热门标签
|
|
|
|
toHot(item) {
|
|
|
|
this.$util.to(`/order/products/products?tagId=${item.tagsId}`)
|
|
|
|
},
|
|
|
|
// 跳转学习
|
|
|
|
toProduct() {
|
|
|
|
this.$util.to('/order/products/products')
|
|
|
|
},
|
|
|
|
// 跳转学习详情
|
|
|
|
toDetail(item) {
|
|
|
|
this.$util.to('/order/productDetail/productDetail?id=' + item.mallId)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.page {
|
|
|
|
position: relative;
|
|
|
|
min-height: 100%;
|
|
|
|
padding: 30rpx 22rpx;
|
|
|
|
box-sizing: border-box;
|
|
|
|
background-color: #fff;
|
|
|
|
}
|
|
|
|
.banner {
|
|
|
|
position: relative;
|
|
|
|
.img {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.info {
|
|
|
|
position: absolute;
|
|
|
|
top: 80rpx;
|
|
|
|
left: 46rpx;
|
|
|
|
}
|
|
|
|
.title {
|
|
|
|
margin-bottom: 15rpx;
|
|
|
|
font-size: 36rpx;
|
|
|
|
font-weight: 600;
|
|
|
|
color: #001D67;
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
font-size: 20rpx;
|
|
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
|
|
color: #001D67;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.block {
|
|
|
|
margin: 40rpx 0;
|
|
|
|
.title-wrap {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
margin-bottom: 34rpx;
|
|
|
|
.all {
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #666;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.title {
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333;
|
|
|
|
&:before {
|
|
|
|
content: '';
|
|
|
|
width: 10rpx;
|
|
|
|
height: 26rpx;
|
|
|
|
margin-right: 14rpx;
|
|
|
|
background: #007FFF;
|
|
|
|
border-radius: 5px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.tags {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
li {
|
|
|
|
width: 25%;
|
|
|
|
margin-bottom: 24rpx;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.icon {
|
|
|
|
width: 64rpx;
|
|
|
|
height: 64rpx;
|
|
|
|
margin-bottom: 18rpx;
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
width: 110rpx;
|
|
|
|
margin: 0 auto;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.list {
|
|
|
|
.item {
|
|
|
|
display: flex;
|
|
|
|
margin-bottom: 28rpx;
|
|
|
|
}
|
|
|
|
.pic {
|
|
|
|
width: 136rpx;
|
|
|
|
height: 136rpx;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
}
|
|
|
|
.texts {
|
|
|
|
width: calc(100% - 156rpx);
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.des {
|
|
|
|
margin: 17rpx 0;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #666;
|
|
|
|
}
|
|
|
|
.meta {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #2E2D31;
|
|
|
|
.icon {
|
|
|
|
width: 32rpx;
|
|
|
|
height: 32rpx;
|
|
|
|
margin-right: 12rpx;
|
|
|
|
}
|
|
|
|
text {
|
|
|
|
width: 330rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|