detection-business/pages/authority/authority.vue
2024-09-11 15:55:28 +08:00

989 lines
20 KiB
Vue

<!-- 默认复制 -->
<template>
<view class="content">
<u-overlay :show="show" @click="show = false">
<view class="warp">
<view class="warp-top">
<image src="http://www.nuoyunr.com/lananRsc/detection/gold.png" mode=""></image>
</view>
<view class="bcai-title">平台福利</view>
<view class="w-box" >
<view class="war-box" v-for="(item,index) in couponlist" :key="index">
<view class="war-left">
<text>¥{{item.discount / 100}}</text>
</view>
<view class="war-right">
<text>{{item.title}}</text>
</view>
</view>
</view>
<view class="wrap-bott">
<image src="http://www.nuoyunr.com/lananRsc/detection/red.png" mode=""></image>
</view>
<view class="rect" @tap.stop="drawDownCoupon()">
<text>立即领取</text>
</view>
</view>
</u-overlay>
<view class="dil">
<view style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;">
<view style="display: flex; align-items: center; width: 100%;">
<view class="touxiang" >
<u-upload
:fileList="fileList6"
@afterRead="afterRead"
@delete="deletePic"
name="6"
multiple
:maxCount="1"
width="60"
height="60"
>
<image :src=" baseUrl + userInfo.avatar " v-if="userInfo.avatar != '' " style="width: 60px; height: 60px; border-radius: 50%;" mode="" ></image>
</u-upload>
</view>
<!-- <view class="touxiang" v-if="userInfo.avatar != '' " >
<image :src=" baseUrl + userInfo.avatar " mode="" ></image>
</view> -->
<view class="">
<view class="c-title" >{{userInfo.realName || ''}}</view>
<view class="c-title" >{{userInfo.phonenumber || ''}}</view>
</view>
</view>
<view class="youbai" @click="dialogToggle()">
<view class="" style="margin-left: 6px;">
<uni-icons type="upload" color="#ffffff" size="28" ></uni-icons>
</view>
<view style="font-size: 14px;width: 100%; text-align: center;">退出</view>
</view>
</view>
<!-- banner -->
<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
:duration="duration">
<swiper-item v-for="(item,index) in bannerliet" :key="index">
<view class="swiper-box">
<image :src="baseUrl+ item.swiperPicture" mode=""></image>
</view>
</swiper-item>
</swiper>
<!-- jingangq -->
<view class="jgq">
<!-- <view class="j-box" @click="goshowMenu()">
<view class="j-img">
<image src="http://www.nuoyunr.com/lananRsc/detection/hmzc.png" mode=""></image>
</view>
<view class="">
<text>使用说明</text>
</view>
</view> -->
<view class="j-box" @click="getgolist(2)">
<view class="j-img">
<image src="http://www.nuoyunr.com/lananRsc/detection/hygg.png" mode=""></image>
</view>
<view class="">
<text>行业公告</text>
</view>
</view>
<view class="j-box" @click="getgolist(3)">
<view class="j-img">
<image src="http://www.nuoyunr.com/lananRsc/detection/qcjc.png" mode=""></image>
</view>
<view class="">
<text>汽车检测</text>
</view>
</view>
<view class="j-box" @click="gostatistics" >
<view class="j-img">
<image src="http://www.nuoyunr.com/lananRsc/detection/jcsj.png" mode=""></image>
</view>
<view class="">
<text>检测数据</text>
</view>
</view>
</view>
<!-- shangpin -->
<view class="Productbox">
<view class="p-top">
<view class="p-left">
<view class="p-lan">近期公告</view>
<view class="gang"></view>
</view>
</view>
<view class="p-cont">
<view class="dlist-box" v-for="(item,index) in bottomlist" :key="index" @click="getpartnerId(item.id)">
<view class="listimg">
<image :src="baseUrl + item.newsCover" mode=""></image>
</view>
<view class="listright">
<view class="n-title">{{item.publishUnit}}</view>
<view class="youyou">
<view class="hui">{{item.newsContent}}</view>
<!-- <view class="youzi">{{item.newsContent}}</view> -->
</view>
</view>
</view>
</view>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog cancelText="关闭" confirmText="同意" title="通知" content="您确认要退出登录吗!" @confirm="dialogConfirm"
@close="dialogClose"></uni-popup-dialog>
</uni-popup>
<view style="width: 100%; height: 60px;"></view>
</view>
</view>
</view>
</template>
<script>
import config from '@/config'
import request from '../../utils/request';
import upload from '@/utils/upload.js'
import { getToken } from '@/utils/auth'
export default{
data(){
return{
fileList6:[],
roles:[],
userInfo:{ },
jcshopRole:false,
jcgfRole:false,
msg:"1",
text:[
{size:'公告的详细内容,最多展示两行多余部分一省略号代替公告的详细内容,最多展示两...'},
],
baseUrl:this.$baseUrl,
bannerliet:[],
background: ['color1', 'color2', 'color3'],
indicatorDots: false,
autoplay: true,
interval: 5000,
duration: 500,
goodslist:[],
animate:false,
timer:null,
notics: [],
listarr:[],
couponlist:[],
bottomlist:[],
show:false,
longitude:"105.442024",
latitude:"28.871325",
}
},
onLoad() {
// this.baseUrl = this.$baseUrl
this.getbanner()
this.timer = setInterval(this.scroll, 2000)
this.vgetlist()
this.canLedCoupon()
this.getlistindex()
this.userInfo = uni.getStorageSync('userinfo')
console.log(this.userInfo.avatar);
},
onShow() {
console.log(uni.getStorageSync('role'))
this.roles = uni.getStorageSync('role')
if(this.roles){
this.roles.forEach(item=>{
if(item =='jcgf'){
this.jcgfRole = true
}
})
}
},
onShareAppMessage(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '机动车管家',
path: '/pages/detection/detection'
}
},
onShareTimeline(res) {
return {
title: '机动车管家',
path: '/pages/detection/detection'
}
},
methods:{
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.onChooseavatar(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
// uploadFilePromise(url) {
// console.log(url);
// upload({
// url:'/common/upload',
// filePath: url,
// }).then((res)=>{
// console.log(res.fileName);
// this.onChooseavatar(res.fileName)
// })
// },
onChooseavatar(e) {
uni.uploadFile({
url: this.baseUrl + '/system/user/profile/avatar',
filePath: e,
name: 'avatarfile',
header: {
Authorization: 'Bearer ' + getToken()
},
success: (uploadFileRes) => {
console.log(uploadFileRes);
if (uploadFileRes.statusCode == 200) {
this.getUserinfo()
}
}
});
},
getUserinfo(){
uni.showLoading({
title: '加载中'
});
console.log('官方');
request({
url: '/getAppInfo',
method: 'get',
}).then((res)=>{
if(res.code == 200){
uni.setStorageSync('userinfo',res.user)
this.userInfo = res.user
uni.hideLoading();
}
})
},
goshowMenu(){
uni.downloadFile({
url: 'https://www.nuoyunr.com/jdcJc/profile/upload/2023/08/19/jdcSysc.pdf',
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {
console.log('打开文档成功');
}
});
}
});
return
},
hunong(){
uni.navigateTo({
url:'/pages/detection/VehicleInspection'
})
},
dialogToggle(){
this.$refs.alertDialog.open()
},
dialogConfirm(){
uni.clearStorageSync();
this.$refs.alertDialog.close()
uni.reLaunch({
url:'/pages/Login/login'
})
},
dialogClose() {
this.$refs.alertDialog.close()
},
async canLedCoupon(){
if (!getToken() ) {
return
}
let res = await request({
url: '/appInspection/goods/canLedCouponPlatform',
method: 'get',
})
console.log(res);
this.couponlist = res.data.slice(0, 3);
if(res.data.length > 0 ){
this.show = true
}
},
async drawDownCoupon(){
let res = await request({
url: '/appInspection/goods/drawDownCouponPlatform' ,
method: 'post',
})
uni.showToast({
title:'领取成功'
})
this.show=false
},
async getlistindex(){
let res = await request({
url: '/appInspection/news/list',
method: 'get',
data: {
type:"hygg",
category:'zflm',
pageSize:10,
pageNum:1
}
})
console.log('底部列表',res);
this.bottomlist = res.rows
},
async vgetlist(){
// 列表获取
let that = this
uni.getLocation({
type: 'wgs84',
success: function (res) {
let data = {
longitude:res.longitude,
latitude:res.latitude,
}
request({
url: '/appInspection/appHome/homePartner',
method: 'get',
params: data
}).then(res=>{
that.listarr = res.rows
})
},
fail(e) {
console.log(e)
let data = {
longitude:that.longitude,
latitude:that.latitude,
}
request({
url: '/appInspection/appHome/homePartner',
method: 'get',
params: data
}).then(res=>{
that.listarr = res.rows
})
}
});
},
jlFunction(num){
let snum = num / 1000
if(snum >= 1){
return snum.toFixed(2) +'Km'
}else{
return snum.toFixed(2) +'m'
}
},
getdetails(id){
uni.navigateTo({
url:'/pages/detection/detedetails?id='+id
})
},
getpartnerId(id){
uni.navigateTo({
url:'/pages/authority/details?id='+id
})
},
getgolist(id){
if(id == 1){
uni.navigateTo({
url:'/pages/detection/detelist'
})
}
if(id == 2){
uni.navigateTo({
url:'/pages/authority/announcement'
})
}
if(id == 3){
uni.navigateTo({
url:'/pages/authority/Detection'
})
}
},
getback(){
uni.navigateBack({
delta:1,
})
},
async getbanner(){
let res = await request({
url: '/appInspection/appHome/listSwiper',
method: 'get',
})
this.bannerliet = res.data
let ress = await request({
url: '/appInspection/appHome/listNews',
method: 'get',
})
this.newslist = res.data
// let resss = await request({
// url:'/appInspection/appHome/homeGoods',
// method: 'get',
// })
// this.goodslist = resss.rows
let gg = await request({
url:'/appInspection/appHome/listNews',
method: 'get',
})
console.log('公告',gg);
this.text = gg.data
},
gostatistics(){
uni.navigateTo({
url:"/pages/authority/statistics"
})
},
goM(){
uni.navigateTo({
url:"/pages/M/M"
})
},
going(id){
uni.navigateTo({
url:"/pages/detection/Merchantproducts?id="+id
})
},
scroll() {
this.animate = true;
setTimeout(() => {
this.notics.push(this.notics[0]);
this.notics.shift();
this.animate = false;
}, 1000);
},
}
}
</script>
<style scoped lang="scss">
@import "@/uni_modules/uview-ui/index.scss";
.warp{
width: 275px;
height: 375px;
background: #FB4746;
border-radius: 10px;
margin: 0 auto;
margin-top: 200px;
box-sizing: border-box;
padding: 15px;
position: relative;
}
.warp-top{
position: absolute;
width: 100%;
height: 40px;
top: 0px;
left: 0px;
image{
width: 100%;
height: 100%;
}
}
.bcai-title{
width: 100%;
text-align: center;
font-size: 16px;
color: white;
font-weight: bold;
color: #FFFFFF;
margin-bottom: 10px;
}
.w-box{
background: #cf2c2f;
width: 100%;
height: 300px;
border-radius: 10px;
box-sizing: border-box;
padding: 8px;
}
.war-left{
width: 40%;
border-right: 1px solid #EBC29D;
font-size: 26px;
text-align: center;
font-weight: bold;
color: #E0262C;
}
.war-right{
width: 60%;
font-size: 16px;
font-weight: bold;
color: #7D592C;
box-sizing: border-box;
padding-left: 10px;
}
.wrap-bott{
position: absolute;
left: 0px;
bottom: 0px;
width: 100%;
height: 80px;
image{
width: 100%;
height: 100%;
}
}
.war-box{
width: 100%;
height: 69px;
background: linear-gradient(90deg, #FFF1E4 0%, #FACEA6 100%);
border-radius: 6px 6px 6px 6px;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 10px;
margin-bottom: 10px;
}
.rect{
width: 172px;
height: 36px;
background: linear-gradient(90deg, #FFF4CB 0%, #FDDC66 100%);
border-radius: 50px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
font-weight: bold;
color: #E11E27;
position: absolute;
bottom: 20px;
transform: translate(-50%);
left: 50%;
z-index: 999;
}
.uni-margin-wrap {
width: 100%;
}
.uni-margin-wrap {
width: 690rpx;
width: 100%;
}
.swiper {
height: 180px;
border-radius: 8px;
}
.swiper-item {
display: block;
height: 300rpx;
line-height: 300rpx;
text-align: center;
}
.swiper-list {
margin-top: 40rpx;
margin-bottom: 0;
}
.uni-common-mt {
margin-top: 60rpx;
position: relative;
}
.info {
position: absolute;
right: 20rpx;
}
.uni-padding-wrap {
width: 550rpx;
padding: 0 100rpx;
}
.swiper-box{
background-color: white;
height: 180px;
border-radius: 8px;
overflow: hidden;
width: 95%;
margin: 0 auto;
image{
width: 100%;
height: 100%;
}
}
.content{
width: 100%;
height: calc(100vh);
background: linear-gradient(180deg, #0D2E8D 0%, rgba(13,46,141,0) 100%);
box-sizing: border-box;
padding-top: 40px;
}
.dil{
background-color: rgba(13,46,141,0.1);
box-sizing: border-box;
// padding: 0px 12px;
}
.dix{
display: flex;
align-items: center;
}
.sousuo{
width: 95%;
height: 36px;
border-radius: 18px;
background: #FFFFFF;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0px 12px;
margin: 0 auto;
margin-bottom: 28px;
}
.jgq{
// height: 160px;
background: linear-gradient(180deg, #DFE2EB 0%, #FFFFFF 100%);
border-radius: 8px ;
width: 95%;
border: 1px solid #FFFFFF;
margin: 0 auto;
margin-top: 10px;
box-sizing: border-box;
// padding: 0px 15px;
flex-wrap: wrap;
display: flex;
padding-bottom: 15px;
}
.j-box{
text-align: center;
width: 25%;
font-size: 18px;
font-weight: 400;
color: #333333;
margin-top: 15px;
}
.j-img{
margin: 0 auto;
width: 40px;
height: 40px;
image{
width: 100%;
height: 100%;
}
}
.notice{
width: 95%;
background: #FFFFFF;
box-shadow: 0px 0px 8px 0px rgba(13,46,141,0.1);
border-radius: 8px ;
margin: 10px auto;
box-sizing: border-box;
padding: 10px;
display: flex;
}
.n-img{
width: 20%;
image{
width: 100%;
height: 100%;
}
margin-right: 10px;
}
.n-title{
box-sizing: border-box;
font-size: 16px;
font-weight: bold;
color: #333333;
}
.n-zi{
font-size: 13px;
font-weight: 400;
color: #999999;
width: 300px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.gang{
margin-top: 2px;
width: 100%;
height: 4px;
background: linear-gradient(90deg, #0D2E8D 0%, rgba(13,46,141,0) 100%);
}
.n-right{
width:70%;
display: flex;
justify-content: space-between;
align-items: center;
}
.Productbox{
width: 100%;
background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
border-radius: 8px ;
box-sizing: border-box;
padding: 16px;
margin-top: 15px;
}
.p-top{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.p-left{
}
.p-lan{
font-size: 16px;
font-weight: bold;
color: #0D2054;
}
.p-right{
display: flex;
align-items: center;
}
.p-z{
font-size: 15px;
font-weight: 400;
color: #999999;
}
.daqi{
width: 100%;
box-sizing: border-box;
padding: 10px;
}
.p-cont{
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.p-box{
width: 49%;
background: #FFFFFF;
border-radius: 8px ;
overflow: hidden;
margin-top: 10px;
position: relative;
}
.p-img{
width: 100%;
height: 166px;
image{
width: 100%;
height: 100%;
}
}
.p-t-z{
font-size: 16px;
font-weight: 600;
color: #333333;
margin-bottom: 10px;
}
.p-d{
width: auto;
// background: #EEEEEE;
// border-radius: 10px;
font-size: 16px;
font-weight: 400;
color: #666666;
box-sizing: border-box;
display: flex;
align-items: center;
// padding: 2px 5px;
margin-bottom: 10px;
}
.p-bottom{
width: 100%;
display: flex;
justify-content: space-between;
}
.p-jia{
font-size: 16px;
font-weight: bold;
color: #FF571A;
}
.aniu{
background: #0D2E8D;
display: flex;
justify-content: center;
align-items: center;
border-radius: 11px;
font-size: 12px;
font-weight: 400;
color: #FFFFFF;
padding: 2px 5px;
}
.p-biao{
position: absolute;
top: 0px;
right: 1px;
width: 43px;
height: 22px;
background: linear-gradient(90deg, #EE8342 0%, #EA3942 100%);
border-radius: 0px 8px 0px 8px;
display: flex;
justify-content: center;
align-items: center;
color: #FFFFFF;
font-size: 12px;
}
.lists{
height: 70px;
overflow: hidden;
width: 100%;
}
.youzi{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
}
.youyou{
}
.list{
height: 100rpx;
width: 100%;
// display: flex;
// align-items: center;
font-size: 26rpx;
margin-bottom: 20px;
}
text{
padding-left: 20rpx;
}
.top {
transition: all 1s;
margin-top: -100rpx;
}
.dlist-box{
width: 100%;
box-sizing: border-box;
padding: 15px;
background: #FFFFFF;
border-radius: 8px;
display: flex;
align-items: center;
margin-top: 10px;
}
.dixb{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between
}
.huang{
display: flex;
align-items: center;
font-size: 18px;
font-weight: 400;
color: #FF9600;
margin: 5px 0px;
}
.hui{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 15px;
font-weight: 400;
color: #999999;
}
.listright{
width: 70%;
}
.listimg{
width: 50%;
height: 70px;
border-radius: 8px 8px 8px 8px;
overflow: hidden;
border: 1px solid #EEEEEE;
margin-right: 10px;
image{
width: 100%;
height: 100%;
}
}
.touxiang{
width: 60px;
height: 60px;
// background: #D9D9D9;
border-radius: 50%;
overflow: hidden;
border: 2px solid #FFFFFF;
margin: 0px 10px;
margin-top: 0px;
image{
width: 100%;
height: 100%;
}
}
.c-title{
width: 50%;
font-size: 18px;
color: white;
font-weight: bold;
}
.youbai{
color: white;
margin-right: 20px;
width: 20%;
}
</style>