wechat
ihzero 2023-10-29 18:20:33 +08:00
parent ba46652f9b
commit a442c2ca59
32 changed files with 12650 additions and 14801 deletions

View File

@ -77,6 +77,8 @@
"node-sass": "^6.0.1",
"sass-loader": "^13.3.2",
"uview-ui": "^1.8.8",
"video.js": "^8.6.1",
"videojs-contrib-hls": "^5.15.0",
"vue": "^2.6.11",
"vuex": "^3.2.0",
"vuex-persistedstate": "^4.1.0"

View File

@ -4,12 +4,13 @@ export default {
onLaunch: function () {
console.log('App Launch')
if (!(store.state.user_access_token && store.state.userInfo['id'])) {
if (!store.state.user_access_token) {
//
uni.redirectTo({
url: '/pages/login/login',
})
} else {
this.$store.dispatch('getUserInfo')
// console.log(store.state.user_access_token)
}
},
@ -28,7 +29,8 @@ export default {
<style lang="scss">
@import 'uview-ui/index.scss';
/*每个页面公共css */
body, uni-page-body {
body,
uni-page-body {
background-color: #f8f8f8;
}
@ -647,8 +649,8 @@ body, uni-page-body {
}
}
.dropdownClose{
.u-dropdown__content{
.dropdownClose {
.u-dropdown__content {
pointer-events: none;
}
}

View File

@ -32,6 +32,7 @@
</u-popup>
</template>
<script>
import checkPermission from '@/utils/permission.js'
export default {
props: {
value: {
@ -46,6 +47,14 @@ export default {
type: Array,
default: () => [],
},
editAuth: {
type: Array,
default: () => [],
},
delAuth: {
type: Array,
default: () => [],
},
},
computed: {
show: {
@ -57,10 +66,10 @@ export default {
},
},
isEdit() {
return !!this.$listeners.onEdit
return !!this.$listeners.onEdit && checkPermission(this.editAuth)
},
isDel() {
return !!this.$listeners.onDel
return !!this.$listeners.onDel && checkPermission(this.delAuth)
},
columsList() {
const arr = []

View File

@ -0,0 +1,103 @@
<template>
<div class="video-js" ref="videos" style="width: 100%; height: 100%"></div>
</template>
<script>
import videojs from 'video.js'
import 'videojs-contrib-hls'
import 'video.js/dist/video-js.css'
export default {
props: {
url: {
type: String,
default: '',
},
id: {
type: String,
default: 'videoRefI',
},
},
data() {
return {
player: null,
}
},
mounted() {
this.initVideo()
},
beforeDestroy() {
this.player?.dispose()
},
methods: {
initVideo() {
let video = document.createElement('video')
video.id = this.id
video.style = 'width: 100%; height: 100%;'
video.controls = true
video.preload = 'auto'
video.setAttribute('playsinline', true) //IOS
video.setAttribute('webkit-playsinline', true) //baiios 10duzhivideo
video.setAttribute('x5-video-player-type', 'h5') // H5 video西
let source = document.createElement('source')
source.src = this.url
video.appendChild(source)
// return
this.$refs.videos.appendChild(video)
let that = this
let player = videojs(
this.id,
{
playbackRates: [0.7, 1.0, 1.5, 2.0], //
autoDisable: true,
preload: 'none', //auto - meta - none -
language: 'zh-CN',
fluid: true, //
muted: true, //
aspectRatio: '16:9', // 使 - "16:9""4:3"
controls: false, // true,false ,api
autoplay: true, //true, autoplay: "muted", // //,muted:
loop: true, //
screenshot: true,
controlBar: {
volumePanel: {
//
inline: false, // 使
},
timeDivider: true, // 线
durationDisplay: true, //
progressControl: true, //
remainingTimeDisplay: true, //
fullscreenToggle: true, //
pictureInPictureToggle: true, //
},
},
function () {
this.on('error', function (err) {
//
console.log('请求数据时遇到错误', err)
})
this.on('stalled', function (stalled) {
//
console.log('网速失速', stalled)
})
}
)
},
},
}
</script>
<style lang="scss">
// .vjs-loading-spinner {
// .vjs-control-text {
// display: none !important;
// }
// }
.myvideo {
@apply w-full h-full;
video {
@apply w-full h-full;
}
}
</style>

View File

@ -0,0 +1,14 @@
import permission from './permission'
const install = function(Vue) {
Vue.directive('permission', permission)
}
if (window.Vue) {
window['permission'] = permission
Vue.use(install); // eslint-disable-line
}
permission.install = install
export default permission

View File

@ -0,0 +1,30 @@
import store from '@/store'
function checkPermission(el, binding) {
const { value } = binding
const roles = store.getters && (store.getters.userInfo?.permissions_slug ?? [])
if (value && value instanceof Array) {
if (value.length > 0) {
const permissionRoles = value
const hasPermission = roles.some(role => {
return permissionRoles.includes(role)
})
if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el)
}
}
} else {
throw new Error(`need roles! Like v-permission="['admin','editor']"`)
}
}
export default {
inserted(el, binding) {
checkPermission(el, binding)
},
update(el, binding) {
checkPermission(el, binding)
}
}

View File

@ -13,6 +13,9 @@ Vue.component('ynSelectInputList', ynSelectInputList)
Vue.prototype.$http = http
Vue.prototype.$getFullUrl = getFullUrl
App.mpType = 'app'
import permission from '@/directive/permission/index.js'
Vue.directive('auth', permission)

View File

@ -2,7 +2,12 @@
<view>
<Appbar title="基地数据">
<template #right>
<view class="text-white mr-20px" @click="handleCreate"></view>
<view
v-auth="['endpoint.agricultural_basic.create']"
class="text-white mr-20px"
@click="handleCreate"
>新增</view
>
</template>
</Appbar>
<u-sticky>
@ -61,6 +66,8 @@
:data="currentData"
@onEdit="handleEdit"
@onDel="handleDel"
:editAuth="['endpoint.agricultural_basic.edit']"
:delAuth="['endpoint.agricultural_basic.destroy']"
></BaseTablePopup>
<!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑基地' : '新增基地'">
@ -80,6 +87,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [
{
title: '基地名称',
@ -164,22 +172,7 @@ export default {
},
},
dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false,
baseShow: false,
searchFormSchema: [
@ -211,6 +204,30 @@ export default {
],
}
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.agricultural_basic.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.agricultural_basic.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) =>
checkPermission(e.permission)
)
},
},
methods: {
handleSubmit(e) {
this.filterParmas = e

View File

@ -3,9 +3,9 @@
<view class="bg-white p-30rpx">
<view class="flex justify-between items-center">
<view class="text-32rpx">全市数据统计</view>
<u-button size="mini" @click="cityEditShow = true">编辑</u-button>
<u-button size="mini" v-auth="['endpoint.town_street.base_statistics_edit']" @click="cityEditShow = true"></u-button>
</view>
<view class="grid grid-cols-2 mt-20rpx">
<view class="grid grid-cols-2 mt-20rpx" v-auth="['endpoint.town_street.base_statistics']">
<CountItem
v-for="(item, i) in showCityList"
:key="i"

View File

@ -2,7 +2,7 @@
<view>
<Appbar title="基地农作物">
<template #right>
<view class="text-white mr-20px" @click="handleCreate"></view>
<view v-auth="['endpoint.crops.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template>
</Appbar>
<u-sticky>
@ -52,17 +52,9 @@
:data="currentData"
@onEdit="handleEdit"
@onDel="handleDel"
:editAuth="['endpoint.crops.edit']"
:delAuth="['endpoint.crops.destroy']"
>
<!-- <template #extends="{ data }">
<view
class="flex justify-between w-full px-30rpx py-20rpx"
v-for="(item, i) in data.value"
:key="i"
>
<view> 名称{{ item.name }}</view>
<view> 单位{{ item.unit }}</view>
</view>
</template> -->
</BaseTablePopup>
<!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑农作物' : '新增农作物'">
@ -83,6 +75,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [
{
title: '名称',
@ -128,22 +121,6 @@ export default {
},
},
dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false,
baseShow: false,
searchFormSchema: [
@ -158,6 +135,28 @@ export default {
],
}
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.crops.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.crops.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: {
handleSubmit(e) {
this.filterParmas = e

View File

@ -2,7 +2,12 @@
<view>
<Appbar title="城镇农作物">
<template #right>
<view class="text-white mr-20px" @click="handleCreate"></view>
<view
v-auth="['endpoint.town_crops.create']"
class="text-white mr-20px"
@click="handleCreate"
>新增</view
>
</template>
</Appbar>
<u-sticky>
@ -52,20 +57,15 @@
:data="currentData"
@onEdit="handleEdit"
@onDel="handleDel"
:editAuth="['endpoint.town_crops.edit']"
:delAuth="['endpoint.town_crops.destroy']"
>
<!-- <template #extends="{ data }">
<view
class="flex justify-between w-full px-30rpx py-20rpx"
v-for="(item, i) in data.value"
:key="i"
>
<view> 名称{{ item.name }}</view>
<view> 单位{{ item.unit }}</view>
</view>
</template> -->
</BaseTablePopup>
<!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑农作物' : '新增农作物'">
<cuPopup
v-model="formShow"
:title="currentData ? '编辑农作物' : '新增农作物'"
>
<BasicsEdit
@cancel="formShow = false"
@confirm="handleEditConfirm"
@ -82,6 +82,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [
{
title: '名称',
@ -127,22 +128,6 @@ export default {
},
},
dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false,
baseShow: false,
searchFormSchema: [
@ -157,6 +142,28 @@ export default {
],
}
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.town_crops.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.town_crops.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: {
handleSubmit(e) {
this.filterParmas = e

View File

@ -3,7 +3,7 @@
<u-navbar title="设备管理" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view>
<view v-auth="['endpoint.device.create']" class="custom_btn add_btn" @click="addBtn()"></view>
</view>
</u-navbar>
<view class="secreen-section">
@ -172,8 +172,8 @@
<view class="popup-form-info">
<view class="top_box u-border-bottom">
<view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view>
<view class="btn_del" v-auth="['endpoint.device.destroy']" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" v-auth="['endpoint.device.edit']" @click="editInfoId(formInfo.id)"></view>
</view>
</view>
<view class="section_c">
@ -288,6 +288,7 @@
<script>
import {navigateBack} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
@ -299,20 +300,6 @@
page:1,
list:[],
loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false,
cindex:-1,//
editShow:false,
@ -433,7 +420,28 @@
}
};
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.device.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.device.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
onLoad() {
this.queryDataList();
this.getDeviceTypes();

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
<u-navbar title="稻虾产业" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view>
<view v-auth="['endpoint.rice_shrimp_industries.create']" class="custom_btn add_btn" @click="addBtn()"></view>
</view>
</u-navbar>
<view class="secreen-section">
@ -125,8 +125,8 @@
<view class="popup-form-info">
<view class="top_box u-border-bottom">
<view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.rice_shrimp_industries.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.rice_shrimp_industries.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view>
</view>
<view class="section_c">
@ -195,6 +195,7 @@
<script>
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
@ -206,20 +207,7 @@
page:1,
list:[],
loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false,
cindex:-1,//
editShow:false,
@ -276,6 +264,28 @@
]
};
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.rice_shrimp_industries.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.rice_shrimp_industries.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters:{
quartername(val){
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}

View File

@ -3,7 +3,7 @@
<u-navbar title="大宗物资" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view>
<view v-auth="['endpoint.materiels.create']" class="custom_btn add_btn" @click="addBtn()"></view>
</view>
</u-navbar>
<view class="secreen-section">
@ -134,8 +134,8 @@
<view class="popup-form-info">
<view class="top_box u-border-bottom">
<view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view>
<view class="btn_del" v-auth="['endpoint.materiels.destroy']" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" v-auth="['endpoint.materiels.edit']" @click="editInfoId(formInfo.id)"></view>
</view>
</view>
<view class="section_c">
@ -225,6 +225,7 @@
<script>
import {formatDate,showLoading,hideLoading,navigateBack} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
@ -236,20 +237,6 @@
page:1,
list:[],
loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false,
cindex:-1,//
editShow:false,
@ -319,6 +306,28 @@
]
};
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.materiels.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.materiels.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters:{
quartername(val){
let keys = {1:'第一季度',2:'第二季度',3:'第三季度',4:'第四季度'}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,13 +10,13 @@
<view class="content-box">
<view
class="menus-section"
v-for="(menu, index) in menuList"
v-for="(menu, index) in menus"
:key="index"
>
<view class="title-t" v-if="menu.parent"
<view class="title-t" v-if="menu.parent && menu.children.length>0"
>{{ menu.parent }}-{{ menu.label }}</view
>
<view class="title-t" v-else>{{ menu.label }}</view>
<view class="title-t" v-if="!menu.parent && menu.children.length>0">{{ menu.label }}</view>
<view class="menu-ul">
<view class="menu-li" v-for="(cdm, i) in menu.children" :key="i">
<view class="menu_item" @click="linknavFn(cdm)">
@ -31,6 +31,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
export default {
data() {
return {
@ -42,44 +43,40 @@ export default {
{
label: '气象监测',
url: '/pages/index/meteorological',
permission: 'endpoint.weather.index',
},
{
label: '智能监控',
url: '/pages/index/monitor',
permission: 'endpoint.camera.index',
},
{
label: '土壤监控',
url: '/pages/index/soil-monitoring',
permission: 'endpoint.soil.index',
},
{
label: '水质监控',
url: '/pages/index/water-quality',
permission: 'endpoint.water.index',
},
{
label: '昆虫性诱监测',
url: '/pages/index/insect-monitors',
permission: 'endpoint.insect.index',
},
{
label: '虫情监测',
url: '/pages/index/pests',
permission: 'endpoint.worm_statics.index',
},
{
label: '杀虫灯检测',
url: '/pages/index/insecticidal-lamp',
permission: 'endpoint.insecticidal_lamp.index',
},
],
},
// {
// label:'',
// children:[
// {
// label:'',
// },
// {
// label:'',
// },
// ],
// },
{
label: '全市基础数据',
parent: '基础数据管理',
@ -87,10 +84,12 @@ export default {
{
label: '城镇数据',
url: '/pages/basics/town-base',
permission: 'endpoint.town_street.index',
},
{
label: '基地数据',
url: '/pages/basics/basics-base',
permission: 'endpoint.agricultural_basic.index',
},
],
},
@ -101,10 +100,12 @@ export default {
{
label: '城镇农作物',
url: '/pages/crop/town-crop',
permission: 'endpoint.town_crops.index',
},
{
label: '基地农作物',
url: '/pages/crop/basics-crop',
permission: 'endpoint.crops.index',
},
],
},
@ -115,10 +116,12 @@ export default {
{
label: '城镇产量',
url: '/pages/yield/town-yield',
permission: 'endpoint.town_crops_output.index',
},
{
label: '基地产量',
url: '/pages/yield/basics-yield',
permission: 'endpoint.crops_output.index',
},
],
},
@ -129,22 +132,27 @@ export default {
{
label: '稻虾价格',
url: '/pages/estate/estate-price',
permission: 'endpoint.rice_shrimp_prices.index',
},
{
label: '稻虾每周价格',
url: '/pages/estate/estate-week-price',
permission: 'endpoint.rice_shrimp_weekly_prices.index',
},
{
label: '稻虾产业',
url: '/pages/estate/estate-industry',
permission: 'endpoint.rice_shrimp_industries.index',
},
{
label: '稻虾流向',
url: '/pages/estate/estate-flows',
permission: 'endpoint.rice_shrimp_flows.index',
},
{
label: '大宗物资',
url: '/pages/estate/estate-materiels',
permission: 'endpoint.materiels.index',
},
],
},
@ -154,18 +162,48 @@ export default {
{
label: '设备管理',
url: '/pages/device/index',
permission: 'endpoint.device.index',
},
{
label: '警报明细',
url: '/pages/device/warning',
permission: 'endpoint.warnings.index',
},
],
},
],
}
},
computed: {
...mapGetters(['userInfo']),
menus(){
return this.filterAsyncRoutes(this.menuList, this.userInfo?.permissions_slug ?? [])
}
},
onLoad() {},
methods: {
hasPermission(roles, route) {
if (route.permission) {
return roles.some((role) => route.permission.includes(role))
} else {
return true
}
},
filterAsyncRoutes(routes, roles) {
const res = []
routes.forEach((route) => {
const tmp = { ...route }
if (this.hasPermission(roles, tmp)) {
if (tmp.children) {
tmp.children = this.filterAsyncRoutes(tmp.children, roles)
}
res.push(tmp)
}
})
return res
},
linknavFn(item) {
console.log(item)
uni.navigateTo({

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
<view class="top_box u-border-bottom">
<view class="tit">预警数据统计</view>
<view class="set_warning">
<u-button class="set_btn" @click="setWarnInfo()" size="mini">设置</u-button>
<u-button v-auth="['endpoint.soil.setting','endpoint.soil.setting_edit']" class="set_btn" @click="setWarnInfo()" size="mini"></u-button>
</view>
</view>
<view class="cont-box">

View File

@ -44,7 +44,7 @@
<view class="top_box u-border-bottom">
<view class="tit">预警数据统计</view>
<view class="set_warning">
<u-button class="set_btn" @click="setWarnInfo()" size="mini">设置</u-button>
<u-button v-auth="['endpoint.water.setting','endpoint.water.setting_edit']" class="set_btn" @click="setWarnInfo()" size="mini"></u-button>
</view>
</view>
<view class="cont-box">

View File

@ -1,222 +1,231 @@
<template>
<view class="login-page bg-page">
<view class="img-a">
<view class="t-b">
隆昌农业大数据监控平台
</view>
</view>
<view class="login-view" style="">
<view class="t-login">
<form class="cl">
<view class="t-a">
<text class="txt">账号</text>
<input type="text" name="username" placeholder="请输入您的账号"
v-model="username" />
</view>
<view class="t-a">
<text class="txt">密码</text>
<input type="password" name="password" maxlength="18"
placeholder="请输入您的密码" v-model="password" />
</view>
<button @tap="login()" type="button"> </button>
<!-- <view class="reg" @tap="reg()"> </view> -->
</form>
</view>
</view>
</view>
<view class="login-page bg-page">
<view class="img-a">
<view class="t-b"> 隆昌农业大数据监控平台 </view>
</view>
<view class="login-view" style="">
<view class="t-login">
<form class="cl">
<view class="t-a">
<text class="txt">账号</text>
<input
type="text"
name="username"
placeholder="请输入您的账号"
v-model="username"
/>
</view>
<view class="t-a">
<text class="txt">密码</text>
<input
type="password"
name="password"
maxlength="18"
placeholder="请输入您的密码"
v-model="password"
/>
</view>
<button @tap="login()" type="button"> </button>
<!-- <view class="reg" @tap="reg()"> </view> -->
</form>
</view>
</view>
</view>
</template>
<script>
import {getStorageSync,setStorageSync,setStorage, toast} from '@/com/utils.js'
import {
getStorageSync,
setStorageSync,
setStorage,
toast,
} from '@/com/utils.js'
import jwt from '@/api/jwt.js'
export default {
data() {
return {
username: '', //
password: '' //
};
},
onLoad() {
},
methods: {
//
login() {
if (!this.username) {
uni.showToast({ title: '请输入您的账号', icon: 'none' });
return;
}
if (!this.password) {
uni.showToast({ title: '请输入您的密码', icon: 'none' });
return;
}
let params = {
username:this.username,
password:this.password
};
this.$http.post('/api/auth/login',params,{
custom:{
auth:false
}
}).then(({data})=>{
console.log(data);
if(data.code==200){
let _data = data.data;
let _info = _data.info;
console.log(_data)
jwt.setAccessToken(_data.token)
this.$store.dispatch('USER_INFO',_info);
uni.switchTab({
url:'/pages/index/index'
})
uni.showToast({ title: '登录成功!', icon: 'none' });
}
}).catch(()=>{
uni.showToast({ title: '登录失败!', icon: 'none' });
})
},
}
};
data() {
return {
username: '', //
password: '', //
}
},
onLoad() {},
methods: {
//
login() {
if (!this.username) {
uni.showToast({ title: '请输入您的账号', icon: 'none' })
return
}
if (!this.password) {
uni.showToast({ title: '请输入您的密码', icon: 'none' })
return
}
let params = {
username: this.username,
password: this.password,
}
this.$http
.post('/api/auth/login', params, {
custom: {
auth: false,
},
})
.then(({ data }) => {
console.log(data)
if (data.code == 200) {
let _data = data.data
let _info = _data.info
console.log(_data)
jwt.setAccessToken(_data.token)
this.$store.dispatch('getUserInfo')
uni.switchTab({
url: '/pages/index/index',
})
uni.showToast({ title: '登录成功!', icon: 'none' })
}
})
.catch(() => {
uni.showToast({ title: '登录失败!', icon: 'none' })
})
},
},
}
</script>
<style lang="scss" scoped>
.login-page{
background-color: #fff;
.txt {
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.img-a {
width: 100%;
height: 450rpx;
background-image: url(../../static/head.png);
background-size: 100%;
}
.reg {
font-size: 28rpx;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
font-weight: bold;
background: #f5f6fa;
color: #000000;
text-align: center;
margin-top: 30rpx;
}
.login-page {
background-color: #fff;
.txt {
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.img-a {
width: 100%;
height: 450rpx;
background-image: url(../../static/head.png);
background-size: 100%;
}
.reg {
font-size: 28rpx;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
font-weight: bold;
background: #f5f6fa;
color: #000000;
text-align: center;
margin-top: 30rpx;
}
.login-view {
width: 100%;
position: relative;
margin-top: -120rpx;
background-color: #ffffff;
border-radius: 8% 8% 0% 0;
}
.login-view {
width: 100%;
position: relative;
margin-top: -120rpx;
background-color: #ffffff;
border-radius: 8% 8% 0% 0;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
padding-top: 80rpx;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
padding-top: 80rpx;
}
.t-login button {
font-size: 28rpx;
background: #2796f2;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
font-weight: bold;
}
.t-login button {
font-size: 28rpx;
background: #2796f2;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
font-weight: bold;
}
.t-login input {
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
border-bottom: 1px solid #e9e9e9;
font-size: 28rpx;
}
.t-login input {
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
border-bottom: 1px solid #e9e9e9;
font-size: 28rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a {
position: relative;
}
.t-b {
text-align: left;
font-size: 42rpx;
color: #ffffff;
padding: 130rpx 0 0 70rpx;
font-weight: bold;
line-height: 70rpx;
}
.t-b {
text-align: left;
font-size: 42rpx;
color: #ffffff;
padding: 130rpx 0 0 70rpx;
font-weight: bold;
line-height: 70rpx;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .t-f {
text-align: center;
margin: 150rpx 0 0 0;
color: #666;
}
.t-login .t-f {
text-align: center;
margin: 150rpx 0 0 0;
color: #666;
}
.t-login .t-f text {
margin-left: 20rpx;
color: #aaaaaa;
font-size: 27rpx;
}
.t-login .t-f text {
margin-left: 20rpx;
color: #aaaaaa;
font-size: 27rpx;
}
.t-login .uni-input-placeholder {
color: #aeaeae;
}
.t-login .uni-input-placeholder {
color: #aeaeae;
}
.cl {
zoom: 1;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
}
</style>

View File

@ -4,7 +4,7 @@
<view class="top-title-box">
<view class="title">账号列表</view>
<view class="handle-option">
<u-button class="btn" size="medium"
<u-button v-auth="['endpoint.admin_users.create']" class="btn" size="medium"
@click="addBtn()" type="primary">新增</u-button>
</view>
</view>
@ -127,9 +127,9 @@
<view class="popup-form-info">
<view class="top_box u-border-bottom">
<view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editPwdPopup(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.admin_users.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.admin_users.edit_password']" class="btn_edit" @click="editPwdPopup(formInfo.id)"></view>
<view v-auth="['endpoint.admin_users.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view>
</view>
<view class="section_c">
@ -235,6 +235,7 @@
<script>
import {showLoading,hideLoading} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
@ -242,20 +243,6 @@
page:1,
list:[],
loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false,
cindex:-1,//
editShow:false,
@ -324,6 +311,26 @@
};
},
computed:{
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.device.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.device.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
seletedShow(){
let arrName = [];
for(let item of this.seletedBaseList){

View File

@ -3,7 +3,7 @@
<u-navbar title="友情链接" :background="background" :custom-back="goback"
:title-color="titleColor" :back-icon-color="titleColor">
<view class="nav_slot_right_box" slot="right">
<view class="custom_btn add_btn" @click="addBtn()"></view>
<view v-auth="['endpoint.friend_links.edit']" class="custom_btn add_btn" @click="addBtn()"></view>
</view>
</u-navbar>
<u-sticky z-index="99">
@ -164,8 +164,8 @@
<view class="popup-form-info">
<view class="top_box u-border-bottom">
<view class="handle-btns">
<view class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view class="btn_edit" @click="editInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.friend_links.destroy']" class="btn_del" @click="deleteInfoId(formInfo.id)"></view>
<view v-auth="['endpoint.friend_links.edit']" class="btn_edit" @click="editInfoId(formInfo.id)"></view>
</view>
</view>
<view class="section_c">
@ -218,6 +218,7 @@
<script>
import {formatDate,navigateBack,showLoading,hideLoading} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
data() {
return {
@ -229,20 +230,6 @@
page:1,
list:[],
loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false,
cindex:-1,//
editShow:false,
@ -287,6 +274,28 @@
dropDownShow:false,
};
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.friend_links.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.friend_links.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
filters:{
timeFormat(val){
return formatDate(val*1000, 'yyyy-MM-dd hh:mm');

View File

@ -4,7 +4,7 @@
<view class="top-title-box">
<view class="title">角色列表</view>
<view class="handle-option">
<u-button class="btn" size="medium"
<u-button v-auth="['endpoint.admin_roles.create']" class="btn" size="medium"
@click="addBtn()" type="primary">新增</u-button>
</view>
</view>
@ -82,8 +82,8 @@
<view class="popup-form-info">
<view class="top_box">
<view class="handle-btns">
<view class="btn_del" @click="deleteRoleId(info.id)"></view>
<view class="btn_edit" @click="editRoleId(info.id)"></view>
<view v-auth="['endpoint.admin_roles.destroy']" class="btn_del" @click="deleteRoleId(info.id)"></view>
<view v-auth="['endpoint.admin_roles.edit']" class="btn_edit" @click="editRoleId(info.id)"></view>
</view>
</view>
<view class="section_c">
@ -106,6 +106,7 @@
<script>
import DaTreeVue2 from '@/components/da-tree-vue2/index.vue'
import {showLoading,hideLoading} from '@/com/utils.js'
import checkPermission from '@/utils/permission.js'
export default {
components: { DaTreeVue2 },
data() {
@ -114,20 +115,6 @@
page:1,
rolelist:[],
loading:'loadmore',
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
popupShow:false,
info:{},//
cindex:-1,//
@ -144,6 +131,28 @@
defaultCheckedKeysValue: [],
};
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.admin_roles.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.admin_roles.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
onLoad() {
this.queryAdminRoleList();
this.queryPermissions();

View File

@ -40,16 +40,16 @@
<view class="arrow_R"></view>
</view>
</view>
<view class="nav-list" @click="linnavF('/pages/system/role')">
<view v-auth="['endpoint.admin_roles.index']" class="nav-list" @click="linnavF('/pages/system/role')">
<view class="icon_img">
<u-icon name="man-add" size="46"></u-icon>
</view>
<view class="item-c">
<view class="item-c" >
<view class="tname">角色管理</view>
<view class="arrow_R"></view>
</view>
</view>
<view class="nav-list" @click="linnavF('/pages/system/account')">
<view v-auth="['endpoint.admin_users.index']" class="nav-list" @click="linnavF('/pages/system/account')">
<view class="icon_img">
<u-icon name="account" size="46"></u-icon>
</view>
@ -58,7 +58,7 @@
<view class="arrow_R"></view>
</view>
</view>
<view class="nav-list" @click="linnavF('/pages/system/log')">
<view v-auth="['endpoint.operation_log.index']" class="nav-list" @click="linnavF('/pages/system/log')">
<view class="icon_img">
<u-icon name="clock" size="46"></u-icon>
</view>
@ -67,7 +67,7 @@
<view class="arrow_R"></view>
</view>
</view>
<view class="nav-list" @click="linnavF('/pages/system/links')">
<view v-auth="['endpoint.friend_links.index']" class="nav-list" @click="linnavF('/pages/system/links')">
<view class="icon_img">
<u-icon name="attach" size="46"></u-icon>
</view>

View File

@ -2,7 +2,7 @@
<view>
<Appbar title="基地产量">
<template #right>
<view class="text-white mr-20px" @click="handleCreate"></view>
<view v-auth="['endpoint.crops_output.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template>
</Appbar>
<u-sticky>
@ -61,6 +61,8 @@
:data="currentData"
@onEdit="handleEdit"
@onDel="handleDel"
:eidtAuth="['endpoint.crops_output.edit']"
:delAuth="['endpoint.crops_output.destroy']"
></BaseTablePopup>
<!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑产量' : '新增产量'">
@ -81,6 +83,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [
{
title: '街镇名称',
@ -147,22 +150,6 @@ export default {
},
},
dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false,
baseShow: false,
searchFormSchema: [
@ -203,6 +190,28 @@ export default {
],
}
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.crops_output.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.crops_output.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: {
handleSubmit(e) {
this.filterParmas = e

View File

@ -2,7 +2,7 @@
<view>
<Appbar title="城镇产量">
<template #right>
<view class="text-white mr-20px" @click="handleCreate"></view>
<view v-auth="['endpoint.town_crops_output.create']" class="text-white mr-20px" @click="handleCreate"></view>
</template>
</Appbar>
<u-sticky>
@ -61,6 +61,8 @@
:data="currentData"
@onEdit="handleEdit"
@onDel="handleDel"
:eidtAuth="['endpoint.town_crops_output.edit']"
:delAuth="['endpoint.town_crops_output.destroy']"
></BaseTablePopup>
<!-- 编辑 -->
<cuPopup v-model="formShow" :title="currentData ? '编辑产量' : '新增产量'">
@ -80,6 +82,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me
import cuPopup from '@/components/cu-popup/index.vue'
import BaseTablePopup from '@/components/base-table/popup.vue'
import BasicsEdit from './components/basics-edit.vue'
import checkPermission from '@/utils/permission.js'
const baseTableColums = [
{
title: '街镇名称',
@ -146,22 +149,7 @@ export default {
},
},
dataList: [],
options: [
{
text: '编辑',
opt: 'edit',
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
style: {
backgroundColor: '#dd524d',
},
},
],
formShow: false,
baseShow: false,
searchFormSchema: [
@ -202,6 +190,28 @@ export default {
],
}
},
computed: {
options() {
return [
{
text: '编辑',
opt: 'edit',
permission: ['endpoint.town_crops_output.edit'],
style: {
backgroundColor: '#007aff',
},
},
{
text: '删除',
opt: 'delete',
permission: ['endpoint.town_crops_output.destroy'],
style: {
backgroundColor: '#dd524d',
},
},
].filter((e) => checkPermission(e.permission))
},
},
methods: {
handleSubmit(e) {
this.filterParmas = e

View File

@ -1,16 +1,36 @@
import * as types from "./mutation-types";
import {getStorageSync,setStorageSync,setStorage} from '@/com/utils.js'
import { getStorageSync, setStorageSync, setStorage, clearStorageSync } from '@/com/utils.js'
import jwt from '@/api/jwt.js'
import { http } from '@/api/index.js'
const actions = {
[types.USER_INFO]({commit},userInfo){
let _data = {};
if(userInfo&&userInfo.id){
_data = userInfo;
// setStorage('userInfo',userInfo)
}else{
_data = getStorageSync('userInfo');
[types.USER_INFO]({ commit }, userInfo) {
let _data = {};
if (userInfo) {
console.log(userInfo);
_data = userInfo;
// setStorage('userInfo',userInfo)
} else {
_data = getStorageSync('userInfo');
}
commit(types.USER_INFO, _data);
},
logout({ commit }) {
clearStorageSync()
jwt.clearAccessToken()
},
async getUserInfo({ commit, dispatch }, userInfo) {
try {
const { data } = await http.get('/api/users/info')
dispatch(types.USER_INFO, data.data)
} catch (error) {
dispatch('logout')
uni.reLaunch({
url:'/pages/login/login'
})
}
}
commit(types.USER_INFO, _data);
},
};
export default actions;

View File

@ -14,17 +14,17 @@ const store = new Vuex.Store({
actions,
mutations,
plugins: [
createPersistedState({
// 当state中的值发生变化的时候出发reduce函数
reducer(val) {
console.log(val,'createPersistedState') // value值为当前state中的所有值对象
// return什么localstorage中的key值为vuex的value值就是什么而且是实时与state中的值保持同步
return {
userInfo: val.userInfo,
user_access_token:val.user_access_token
}
}
})
createPersistedState({
// 当state中的值发生变化的时候出发reduce函数
reducer(val) {
console.log(val, 'createPersistedState') // value值为当前state中的所有值对象
// return什么localstorage中的key值为vuex的value值就是什么而且是实时与state中的值保持同步
return {
userInfo: val.userInfo,
user_access_token: val.user_access_token
}
}
})
]
});

View File

@ -0,0 +1,16 @@
import store from '@/store'
export default function checkPermission(value) {
if (value && value instanceof Array && value.length > 0) {
const roles = store.getters && (store.getters.userInfo?.permissions_slug ?? [])
const permissionRoles = value
const hasPermission = roles.some(role => {
return permissionRoles.includes(role)
})
return hasPermission
} else {
return false
}
}

21581
yarn.lock

File diff suppressed because it is too large Load Diff