You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

264 lines
8.2 KiB

2 years ago
<template>
<view class="home_page_container">
2 years ago
<!-- <view :style="{paddingTop:styles.top+styles.height + 'px'}" class="home_page_header">
2 years ago
<view class="home_page_header_title">
2 years ago
{{user.name?`Hi ,${user.name}` : user.userPhone?user.userPhone:'暂未设置'}}
<uni-icons @tap.stop='close()' class="iconclass" color="#ffffff" custom-prefix="iconfont"
type="iconkaiguan" size="35">
2 years ago
</uni-icons>
</view>
<view class="home_page_header_identity">{{user.roles[0].roleName}}</view>
2 years ago
</view> -->
2 years ago
2 years ago
<!-- <view :style="{transform:`rotate(${180}deg)`}" class="home_page_menu">
2 years ago
<view class="home_page_menu_name">
{{menuList[menuIndex].name?menuList[menuIndex].name:''}}
</view>
<view class="bgtracking"></view>
<view class="bj"></view>
<view :style="{transform:`rotate(${trackingPosition.angle}deg)`}" @click="gestureAnalysis"
class="home_page_menu_circular">
<view @click="menuClick(index)" class="home_page_menu_item" v-for="(item,index) in menuList"
:style="{left:item.x,top:item.y,transform:`rotate(${180+trackingPosition.fangle}deg)`}">
<uni-icons class="menu_icon" :style="{transform:`scale(${menuIndex==index?1.2:1})`}"
2 years ago
:color="item.colorOpen? '#2866FF': '#ffffff'" custom-prefix="iconfont" :type="item.icon"
2 years ago
size="25"></uni-icons>
</view>
</view>
2 years ago
</view> -->
<!-- <view :style="{transform:`translateY(${Submenu?0:-433}rpx)`}" class="Submenu">
2 years ago
<view @tap.stop="jump(item)" v-if="user.authList.includes(item.lable)"
v-for="(item,index) in menuList[menuIndex].submenu" class="Submenu_item">
2 years ago
<view @tap.stop="collectionFn(item)" class="label">
2 years ago
<uni-icons :color=" iconFn(item) " custom-prefix="iconfont" type="iconshoucang-yishoucang"
size="30"></uni-icons>
2 years ago
</view>
<view class="Submenu_item_name">{{item.name}}</view>
</view>
2 years ago
</view> -->
<view class="header">
<view class="info-frame">
<image src="../../static/tx.png"></image>
<view>{{user.userPhone || '暂未设置'}}</view>
<view>{{user.name ||'暂未设置'}}</view>
2 years ago
<!-- <view>{{user.roles[0].roleName}}</view> -->
2 years ago
<uni-icons @tap.stop='close()' class="iconclass" color="#bbb" custom-prefix="iconfont"
type="iconkaiguan" size="35">
</uni-icons>
</view>
2 years ago
</view>
2 years ago
<view class="domain">
2 years ago
<template v-for="item,index in menuList">
<view class="item" v-if="isHaveAuth(item.submenu)" :key="index">
<view class="title">{{item.name}}</view>
<view class="options-frame" >
<template v-for="optionItme,optionIndex in item.submenu">
<view class="option" v-if="user.authList.includes(optionItme.lable)" :key="optionIndex" @tap.stop="jump(optionItme)">
<view class="star" @tap.stop="collectionFn(optionItme)">
<uni-icons :color="iconFn(optionItme)" custom-prefix="iconfont" type="iconshoucang-yishoucang" size="18"></uni-icons>
</view>
<view class="wall">
<view class="name">{{optionItme.name}}</view>
<uni-icons color="#fff" custom-prefix="iconfont" :type="optionItme.icon" size="50"></uni-icons>
</view>
</view>
</template>
2 years ago
</view>
2 years ago
</view>
2 years ago
</template>
2 years ago
</view>
<view class="collection">
<view class="collect-frame">
<template v-for="(item,index) in collection">
<view v-if="item" @tap.stop="jump(item)" class="collection_item">
<view @tap.stop="remove(item)" class="tip">
<uni-icons custom-prefix="iconfont" color="#fff" type="iconchiping" size="20"></uni-icons>
</view>
<view class="collection_item_name">
<uni-icons custom-prefix="iconfont" color="#2866FF" :type="item.icon" size="30"></uni-icons>
<view class="collection_item_text">{{item.name}}</view>
</view>
2 years ago
</view>
2 years ago
<view v-else class="collection-empty">
<view>
<text>点击</text>
<uni-icons style="margin-left: 10rpx;" color="#bbbbbb" custom-prefix="iconfont"
type="iconshoucang-yishoucang" size="12"></uni-icons>
</view>
<view>收藏</view>
</view>
</template>
2 years ago
</view>
</view>
</view>
</template>
<script>
import menus from './menu'
import oilIdentityApi from '@/api/oil-identity'
export default {
data() {
return {
2 years ago
user: null,
collection: [],
2 years ago
menuList: [],
trackingPosition: {
angle: 0,
fangle: 0
},
Submenu: false,
menuIndex: 0,
styles: null,
mousePosition: 0,
circle_w: 520, //圆盘的宽
circle_h: 600, //圆盘的高
PI: 360, //分布角度,默认为360deg
stard: 360, //起始角度
stard_s: null, //用来默认储存第一个初始值
boxNum: 5, //圆盘上覆盖的小圆点个数
descTitle: '', //模块描述标题
descContent: '', //模块描述内容
activeIndex: 1, //默认下标
}
},
onLoad() {
this.styles = uni.getMenuButtonBoundingClientRect();
},
created() {
this.initFn();
},
2 years ago
watch: {
menuIndex: (n, o) => {
},
collection: function(n, o) {
uni.setStorageSync('collection', n);
2 years ago
}
},
methods: {
2 years ago
isHaveAuth(submenu) {
return submenu.some(item => this.user.authList.includes(item.lable))
},
2 years ago
close() {
uni.showModal({
title: '提示',
content: '确认退出登录',
2 years ago
success: function(res) {
2 years ago
if (res.confirm) {
oilIdentityApi.logoutAuthSystem().then(res => {
uni.redirectTo({
url: '../login/login?type=1'
})
})
}
}
});
},
2 years ago
jump(e) {
if (this.user.authList.includes(e.lable)) {
2 years ago
uni.navigateTo({
2 years ago
url: e.router,
2 years ago
})
2 years ago
} else {
2 years ago
uni.showToast({
2 years ago
title: '暂无权限',
icon: 'none'
2 years ago
})
}
},
2 years ago
remove(item) {
let index = this.collection.findIndex(i => i.name === item.name)
this.$set(this.collection,index,'')
2 years ago
},
2 years ago
iconFn(e) {
return this.collection.filter((item) => e.name == item.name).length == 0 ? '#bbbbbb' : '#FFB730';
2 years ago
},
initFn() {
2 years ago
this.menuList = JSON.parse(JSON.stringify(menus))
2 years ago
// this.menuList.forEach((item, index) => {
// item = Object.assign(item, this.circularPositioning(index));
// })
// this.trackingPosition.x = this.menuList[0].x;
// this.trackingPosition.y = this.menuList[0].y;
this.collection = uni.getStorageSync('collection') || ['','',''];
2 years ago
this.user = uni.getStorageSync('user');
},
2 years ago
collectionFn(item) {
let isHave = this.collection.find(i => i.name === item.name)
// 是否已收藏
if(isHave) {
this.remove(item)
return
}
let isHaveEmptyIndex = this.collection.findIndex(i => i === '')
// 是否有空余的收藏位置
if(isHaveEmptyIndex !== -1) {
this.$set(this.collection,isHaveEmptyIndex,item)
return
2 years ago
}
2 years ago
//如果收藏满了 栈底推出
this.collection.pop()
2 years ago
//栈顶推入
this.collection.unshift(item)
2 years ago
},
2 years ago
gestureAnalysis(e) {},
indexDis(e) {
2 years ago
let x = this.menuIndex
let y = e
2 years ago
console.log(x, y)
2 years ago
let average = 360 / this.menuList.length;
2 years ago
let a = x - y;
let b = this.menuList.length - 1 - (x - y - 1);
let deg = a > b ? b * average : a * average;
if (b > a) {
this.trackingPosition.angle = deg * -1
} else {
this.trackingPosition.angle = deg
}
console.log(this.trackingPosition.angle)
2 years ago
this.menuIndex = null
setTimeout(() => {
this.menuIndex = e
}, 500);
},
menuClick(index) {
2 years ago
this.Submenu = false
2 years ago
let average = 360 / this.menuList.length;
this.trackingPosition.angle = index * average;
this.trackingPosition.fangle = -this.trackingPosition.angle;
2 years ago
if (this.menuList[this.menuIndex].colorOpen) {
this.menuList[this.menuIndex].colorOpen = false
}
2 years ago
setTimeout(() => {
this.menuIndex = index
2 years ago
this.menuList[this.menuIndex].colorOpen = true
this.Submenu = true
2 years ago
}, 500);
},
circularPositioning(index, position) {
let avd = this.PI / this.menuList.length //每一个 img-box 对应的角度
let ahd = (avd * Math.PI) / 180 //每一个 img-box 对应的弧度
let radius = this.circle_w / 2 //圆的半径
let x = (Math.sin(ahd * index) * radius) - 30 + 300 + 'rpx'
let y = (Math.cos(ahd * index) * radius) - 30 + 300 + 'rpx'
return {
x,
y
}
}
}
}
</script>
<style>
@import url("./newindex.css");
</style>