提交 42efa0c9 作者: wk

菜单权限

父级 b630f663
......@@ -269,6 +269,10 @@ const params = {
getMostUsed: {
url: "/ydt/api/v1/navigation/list/at_most_used",
method: "get"
},
getAuthMenu: {
url: "/api/v1/user/user/get_auths",
method: "get"
}
}
......
const $authMenu = {
isHasAuth(objNo, list) {
var obj = list.find(item => item.object_no == objNo)
return obj
},
}
export default $authMenu
......@@ -17,13 +17,14 @@ const $date = {
}
},
formatDuring(mss) {
let days = Math.floor(mss / (1000 * 60 * 60 * 24));
let hours = Math.floor((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
// let days = Math.floor(mss / (1000 * 60 * 60 * 24));
let hours = Math.floor(mss / (1000 * 60 * 60));
let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.round((mss % (1000 * 60)) / 1000);
if (days > 0) {
return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
} else if (hours > 0) {
// if (days > 0) {
// return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
// } else
if (hours > 0) {
return hours + "小时" + minutes + "分钟" + seconds + "秒";
} else if (minutes > 0) {
return minutes + "分钟" + seconds + "秒";
......
......@@ -10,6 +10,8 @@ import $mta from "api/mta.js"
import $http from './api/request.js'
import $imageUtils from './common/imageUtils.js'
import $date from "./common/dateUtils.js"
import $authMenu from "./common/authMenu.js"
Vue.prototype.$authMenu = $authMenu
Vue.prototype.$date = $date
Vue.prototype.$http = $http
Vue.prototype.$mta = $mta
......
......@@ -14,7 +14,8 @@
</view>
<view class="time-content">
<view class="create-time">{{item.end_opt_time}}</view>
<view class="leave-time">处理倒计时:{{timeSpace(item.end_opt_time)}}</view>
<view class="leave-time" v-if="item.node_type!='999'">处理倒计时:{{timeSpace(item.end_opt_time)}}
</view>
</view>
<view class="line" style="margin: 30rpx 0;"></view>
</view>
......@@ -30,7 +31,7 @@
return {
tabs: ["全部待办", "未处理", "已处理"],
current: 0,
list: [{}, {}, {}],
list: [],
isDeal: 2,
totalCount: 0,
noDealCount: 0,
......@@ -53,6 +54,9 @@
}
},
methods: {
timeSpace(endTime) {
return this.$date.timeDiff(endTime, true)
},
getData() {
this.getAllCount()
this.getNoDealCount()
......@@ -71,8 +75,12 @@
this.getData()
},
itemClick(item) {
var isEdit = 1
if (item.node_type == '999') {
isEdit = 0
}
uni.navigateTo({
url: `/pages/gallery/processFormDetailPage/processFormDetailPage?obj_no=${item.obj_no}&check_module_id=${item.check_module_id}&check_tpl_id=${item.check_tpl_id}&project_id=${item.project_id}&title=${item.app_name}&is_edit=0`
url: `/pages/gallery/processFormDetailPage/processFormDetailPage?obj_no=${item.obj_no}&check_module_id=${item.check_module_id}&check_tpl_id=${item.check_tpl_id}&project_id=${item.project_id}&title=${item.app_name}&is_edit=${isEdit}`
})
},
getAllNeedDo() {
......
......@@ -10,7 +10,6 @@
</view>
<view class="time-content">
<view class="create-time">{{item.end_opt_time}}</view>
<view class="leave-time">处理倒计时:{{timeSpace(item.end_opt_time)}}</view>
</view>
<view class="line" style="margin: 30rpx 0;"></view>
</view>
......@@ -24,7 +23,7 @@
export default {
data() {
return {
list: [{}, {}, {}],
list: [],
page: 1,
pageSize: 20,
totalCount: 0
......
......@@ -185,7 +185,7 @@
})
},
toOutPage(currentModel) {
var url = this.currentModel.url
var url = currentModel.url
var params = ""
if (url.indexOf("?") != -1) { //有参数
params = url.split("?")[1]
......@@ -206,8 +206,8 @@
console.log(params);
let data = {
project_id: uni.getStorageSync("project_id") || "",
account: this.currentModel.user_name,
password: this.currentModel.user_pw,
account: currentModel.user_name,
password:currentModel.user_pw,
url: url
}
console.log(JSON.stringify(data));
......
......@@ -16,7 +16,7 @@
<text class="text-black-normal" style="flex: 1;">{{form.check_item_name}}</text>
<text class="text-blue-normal" v-if="form.business_type==4&&n==0&&isEditShow()"
@click="toEdit(n)">编辑</text>
<image :src="form.open?'../../static/icon_up_arrow.png':'../../static/icon_drop_arrow.png'"
<image :src="form.open?'../../../static/icon_up_arrow.png':'../../../static/icon_drop_arrow.png'"
style="width: 40rpx;height: 20rpx;margin-left: 40rpx;" @click="upOrDown(form)"></image>
</view>
<view class="executor-text" v-if="n!=0">
......@@ -267,8 +267,8 @@
</view>
<view style="height: 144rpx;" v-if="isEdit==1"></view>
<view class="uni-group-button" v-if="isEdit==1">
<button class="uni-grey-button" @click="toSave">暂存</button>
<button class="uni-blue-button" @click="toNext">下一步</button>
<view class="uni-grey-button" @click="toSave">暂存</view>
<view class="uni-blue-button" @click="toNext">下一步</view>
</view>
</view>
</template>
......
......@@ -48,14 +48,7 @@
},
methods: {
timeSpace(endTime) {
var dateTime = new Date();
var end = new Date(endTime);
var dateDiff = end.getTime() - dateTime.getTime(); //时间差的毫秒数
if (dateDiff > 0) {
return this.formatDuring(dateDiff)
} else {
return "0秒"
}
return this.$date.timeDiff(endTime, true)
},
formatDuring(mss) {
let days = Math.floor(mss / (1000 * 60 * 60 * 24));
......
......@@ -4,14 +4,16 @@
<image src="../../static/home-head.png" class="header-image"></image>
<navbar :title="title" :showBack="false"></navbar>
<!-- 天气 -->
<view class="weather-content" :style="{top:statusBarHeight+36+'px'}" v-if="isCompShow('onepoint-weather')">
<view class="weather-content" :style="{top:statusBarHeight+36+'px'}"
v-if="isCompShow('onepoint-weather','tq')">
<view class="temp-content" @click="toLinkOther">
<view class="temp">{{weather.temp}}</view>
<view class="weather">{{weather.weather}}</view>
</view>
<view class="line"></view>
<view class="login-info-content">
<view class="login-info">{{userInfo.user.user_name||"您好"}},欢迎登录 {{nowTime}}</view>
<view class="login-info">{{nameLengthDeal(userInfo.user.user_name||"")||"您好"}},欢迎登录{{nowTime}}
</view>
<view class="address-content">
<image src="../../static/loc.png" class="loc-image"></image>
<view class="address">{{address}}</view>
......@@ -20,11 +22,11 @@
</view>
<!-- <view class="banner-content" :style="{top:statusBarHeight+116+'px'}"> -->
<ls-swiper :list="banners" imgKey="coverImg" :loop="true" :dots='true' :autoplay='true' height='142'
@clickItem="clickItem()" v-if="isCompShow('OnePointBanner')" />
@clickItem="clickItem()" v-if="isCompShow('OnePointBanner','lbt')" />
<!-- </view> -->
</view>
<!-- 工地头条 -->
<view class=" top-new-content" @click="toLinkNew" v-if="isCompShow('OnePointNews')&&role!='VISITOR'">
<view class=" top-new-content" @click="toLinkNew" v-if="isCompShow('OnePointNews','gdtt')&&role!='VISITOR'">
<image src="../../static/notice.png" class="image"></image>
<view class="title">工地头条</view>
<swiper circular="true" :autoplay="true" class="swiper" :vertical="true">
......@@ -35,7 +37,7 @@
<image src="../../static/right-arrow.png" class="right-arrow"></image>
</view>
<!-- 常用应用 -->
<view class="bus-content" v-if="isCompShow('OnePointBusiness')">
<view class="bus-content" v-if="isCompShow('OnePointBusiness','cyyy')">
<view class="tab-content">
<view class="tab-item" @click="select(0)">
<view :class="isCommonSel?'tab-text-sel':'tab-text'">常用业务</view>
......@@ -72,7 +74,7 @@
</view>
</view>
<!-- 积分兑换 -->
<view class="score-content" v-if="isCompShow('OnePointScore')&&role=='WORKER'">
<view class="score-content" v-if="isCompShow('OnePointScore','jfdh')&&role=='WORKER'">
<view class="title-content">
<view class="title">积分兑换</view>
<view class="more" @click="toLinkScore">更多</view>
......@@ -145,14 +147,19 @@
city: "杭州市",
address: "浙江省杭州市",
weather: {},
userInfo: {},
userInfo: {
user: {
user_name: ""
}
},
pageTemplateComponent: [],
isWeatherShow: true,
role: "VISITOR",
nowTime: "",
project: {},
project_id: "",
changeRecords: []
changeRecords: [],
menus: []
}
},
onLoad() {
......@@ -160,7 +167,7 @@
this.statusBarHeight = info.statusBarHeight
let nowDate = new Date()
this.nowTime =
`${nowDate.getFullYear()}-${this.add0(nowDate.getMonth()+1)}-${this.add0(nowDate.getDate())}`
`${nowDate.getFullYear()}/${this.add0(nowDate.getMonth()+1)}/${this.add0(nowDate.getDate())}`
},
onShow() {
if (!getApp().globalData.isReject) {
......@@ -501,13 +508,28 @@
this.$toast.showToast(err.msg)
})
},
isCompShow(comNo) {
isCompShow(comNo, objNo) {
let show = false
this.pageTemplateComponent.forEach((item) => {
if (item.com_no == "onepoint-weather") {
show = true
}
})
if (show) {
if (this.menus && this.menus.length > 0) {
var children = this.menus.children_list
if (children) {
//是否有首页权限
var home = this.$authMenu.getAuthMenu("syqx", children)
if (home) {
var com = this.$authMenu.getAuthMenu(objNo, children)
if (com) {
show = true
}
}
}
}
}
return show
},
getUserInfo() {
......@@ -541,12 +563,23 @@
uni.setStorageSync("org_name", this.userInfo.currentProject.projectName)
this.city = this.userInfo.currentProject.city
this.getWeather()
this.getAuthMenu()
}
if (this.role != 'VISITOR') {
this.getNews()
this.getBanners()
}
},
getAuthMenu() {
Api.getAuthMenu({
data: {
user_id: this.userInfo.user.user_id
}
}).then((result) => {
console.log("权限菜单", result);
this.menus = result.data.list
})
},
toLogin: function() {
uni.navigateTo({
url: "/pages/login/login/login"
......@@ -706,7 +739,7 @@
})
},
toOutPage(currentModel) {
var url = this.currentModel.url
var url = currentModel.url
var params = ""
if (url.indexOf("?") != -1) { //有参数
params = url.split("?")[1]
......@@ -727,8 +760,8 @@
console.log(params);
let data = {
project_id: this.project_id,
account: this.currentModel.user_name,
password: this.currentModel.user_pw,
account: currentModel.user_name,
password: currentModel.user_pw,
url: url
}
console.log(JSON.stringify(data));
......@@ -791,7 +824,7 @@
.temp-content {
display: flex;
flex: 1;
min-width: 100rpx;
flex-direction: column;
align-items: flex-end;
......@@ -827,6 +860,9 @@
display: flex;
margin-left: 25rpx;
flex-direction: column;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.login-info {
font-family: "MicrosoftYaHei ";
......
<template>
<view class="history-score">
<titleBar title="历史积分"></titleBar>
<view class="choose-date">
<uni-datetime-picker @change="toggleDate" returnType="string" v-model="requestParam.time" type="date">
</uni-datetime-picker>
</view>
<view class="current-score">
<view class="score">
<view class="date">
{{requestParam.time}}当日积分
</view>
<view class="value">
+{{scoreDetail.current_integral||'0'}}
</view>
</view>
<view class="date">
<!-- 明细 -->
<!-- {{requestParam.time}} -->
</view>
<titleBar title="兑换历史"></titleBar>
<view class="order-content" @click="orderSearch">
<text class="text">时间排序</text>
<image :src="arrowIcon" class="image"></image>
</view>
<view class="score-list">
<view class="score-list-item" v-for="(item,index) in scoreDetail.listData" :key="index">
<text class="time">{{item.time}}</text>
<text class="desc">{{item.item_name}}</text>
<text class="score">+{{item.integral}}</text>
<view class="score-list-item" v-for="(item,index) in changeRecords" :key="index">
<image class="image" :src="item.goods_img"></image>
<view class="good-content">
<view class="title-content">
<view class="name">{{item.goods_name}}</view>
<view class="score">{{item.order_integral}}积分</view>
</view>
<view class="time-content">兑换时间:{{item.ex_time}}</view>
</view>
</view>
</view>
</view>
......@@ -41,9 +32,9 @@
time: '',
worker_id: ''
},
scoreDetail: {
listData: []
}
changeRecords: [],
order: "desc",
arrowIcon: "../../../static/icon_drop_arrow.png",
}
},
onShow() { //监听页面显示
......@@ -56,26 +47,50 @@
this.requestParam.time = year + '-' + month + '-' + day
this.requestParam.worker_id = this.userInfo.worker.workerId || ''
this.requestParam.project_id = this.project_id || ''
this.getScoreDetail() //暂时先注释掉02.16
this.getChangeRecord() //暂时先注释掉02.16
// for(var i=0;i<100;i++){//历史明细假数据
// this.scoreDetail.listData.push({id:i+1,time:'2022-02-16',item_name:'csy'+(i+1),integral:i+1})
// }
// console.log('scoreDetail.listData=',this.scoreDetail.listData);
},
methods: {
orderSearch() {
if (this.order == 'desc') {
this.order = 'asc'
this.arrowIcon = "../../../static/icon_up_arrow.png"
} else {
this.order = 'desc'
this.arrowIcon = '../../../static/icon_drop_arrow.png'
}
this.page = 1
this.getChangeRecord()
},
// 切换时间
toggleDate(date) {
this.requestParam.time = date
this.getScoreDetail()
this.getChangeRecord()
},
// 获取积分数据
getScoreDetail() {
Api.getUserScore({
data: this.requestParam
}).then(res => {
if (res.code === 0) {
this.scoreDetail = res.data;
getChangeRecord() {
Api.getExchangeList({
data: {
project_id: this.project_id,
type: 1,
is_page: 0,
page: 1,
page_size: 20,
order: this.order,
work_id: this.requestParam.worker_id
}
}).then((result) => {
console.log("兑换记录", result);
if (result.code == 0) {
this.changeRecords = result.data.list
} else {
this.$toast.showToast(result.msg)
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
}
......@@ -84,87 +99,80 @@
<style lang="scss">
.history-score {
.current-score {
display: flex;
flex-direction: column;
.order-content {
display: flex;
justify-content: space-between;
flex-direction: row;
align-items: center;
padding: 20rpx;
margin: 0 32rpx;
background-color: #FAFAFA;
margin-top: 32rpx;
justify-content: flex-end;
margin: 30rpx 30rpx 0 30rpx;
.score {
color: #666;
font-size: 24rpx;
text {
font-weight: 400;
font-size: 14px;
line-height: 20px;
text-align: center;
color: #656565;
}
.value {
color: #333;
font-size: 48rpx;
font-weight: bold;
image {
width: 28px;
height: 14px;
}
.date {}
}
.choose-date {
padding: 0 20rpx;
}
.score-list {
display: flex;
flex-direction: column;
padding: 20rpx 40rpx;
margin: 0 32rpx;
background-color: #FAFAFA;
.score-list-item {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
padding: 30rpx;
margin: 30rpx 30rpx 0 30rpx;
border-radius: 30rpx;
position: relative;
border-bottom: 1px solid rgba($color: #999, $alpha: 0.5);
background-color: #FFFFFF;
&:last-child {
.line {
display: none;
}
image {
width: 180rpx;
height: 180rpx;
border-radius: 16rpx;
}
// .circle{
// border:1px solid #1890ff;
// border-radius: 50%;
// background-color: #FFFFFF;
// width: 20rpx;
// height: 20rpx;
// }
// .line{
// position: absolute;
// width: 2rpx;
// height:100rpx;
// background-color: #000;
// left: 10rpx;
// opacity: 0.5;
// bottom: -90rpx;
// }
.time {
font-size: 28rpx;
color: #666;
}
.good-content {
display: flex;
margin-left: 30rpx;
flex-direction: column;
.desc {
font-size: 28rpx;
color: #666;
width: 250rpx;
}
.title-content {
display: flex;
margin-top: 30rpx;
flex-direction: row;
.name {
font-weight: 400;
font-size: 14px;
flex: 1;
color: #333;
}
.score {
font-size: 28rpx;
color: #333;
width: 60rpx;
text-align: right;
.score {
font-weight: 400;
font-size: 14px;
color: #333;
}
}
.time-content {
margin-top: 30rpx;
font-weight: 400;
font-size: 12px;
line-height: 20px;
text-align: center;
color: #999;
}
}
}
}
......
......@@ -37,7 +37,8 @@
totalPage: 1,
mDatas: [],
order: "desc",
arrowIcon: "../../../static/icon_drop_arrow.png"
arrowIcon: "../../../static/icon_drop_arrow.png",
key: ""
}
},
onLoad: function() {
......@@ -55,7 +56,9 @@
},
methods: {
search(e) {
this.key = e.detail.value
this.page = 1
this.getApplyList()
},
endeTime(time) {
return this.$date.getEndTime(time)
......@@ -130,7 +133,8 @@
is_page: 1,
page: this.page,
page_size: this.pageSize,
order_by: this.order
order_by: this.order,
search_word: this.key
},
}).then((result) => {
console.log("申请列表", result);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment