| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- <template>
- <view class="content">
- <u-swiper :list="list" mode="dot" class="index_uswiper" height='300'></u-swiper>
- <view class="function">
- <view class="function_item" v-for="(item,index) in functionimg" :key="index" @click="tabfunction(index)">
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.src" mode=""></image>
- <p>{{item.text}}</p>
- </view>
- </view>
- <view class="equipment">
- <p class="equipment_p">系统设备</p>
- <view class="equipment_item">
- <view class="equipment_item_img" v-for="(item,index) in equipmentimg" :key="index" @click="tabequipment(index)">
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+item.src" mode=""></image>
- </view>
- </view>
- </view>
- <u-modal v-model="show" :mask-close-able="true" :show-cancel-button="true" confirm-text="拍病害" cancel-text="拍虫害" cancel-color="#4BB85F"
- content="拍照识别病虫害" @confirm="confirm" @cancel="cancel"></u-modal>
- <kps-image-cutter @ok="onok" @cancel="oncancle" :url="url" :fixed="false" :blob="true" :maxWidth="500" :maxHeight="380" :height="380"></kps-image-cutter>
- <view class="loading" v-if="loadTF">
- <u-loading mode="flower" size="100" :show="true" ></u-loading>
- </view>
- </view>
- </template>
- <script>
- import kpsImageCutter from "@/components/ksp-image-cutter/ksp-image-cutter.vue";
- export default {
- components: {
- kpsImageCutter
- },
- data() {
- return {
- loadTF:false,
- currentPage: 'tabBar1',
- list: [{
- image: 'http://www.hnyfwlw.com:8006/bigdata_app/image/index/11.png'
- }, ],
- functionimg: [{
- src: "/image/index/1.png",
- text: "四情基地"
- },
- {
- src: "/image/index/2.png",
- text: "病虫识别"
- },
- {
- src: "/image/index/3.png",
- text: "专家诊断"
- },
- {
- src: "/image/index/4.png",
- text: "售后服务"
- }
- ],
- equipmentimg: [{
- src: "/image/index/5.png"
- },
- {
- src: "/image/index/6.png"
- },
- {
- src: "/image/index/7.png"
- },
- {
- src: "/image/index/8.png"
- },
- {
- src: "/image/index/9.png"
- },
- {
- src: "/image/index/10.png"
- }
- ],
- url: '',
- path: '',
- flag: 1,
- show: false,
- jurisdiction:{
- cbtf:false,
- jktf:false,
- hjtf:false,
- fztf:false,
- sytf:false,
- sbtf:false,
- sqtf:false,
- zjtf:false
- }
- }
- },
- onLoad() {
- this.getUserlogin()
- },
- onShow(){
- this.loadTF = false
- this.getUserlogin()
- },
- methods: {
- async getUserlogin() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=user.login.user_login_info',
- })
- uni.setStorage({
- key: 'jurisdiction',
- data: JSON.stringify(res.children),
- })
- uni.setStorage({
- key: 'myuser_type',
- data: JSON.stringify(res.myuser_type),
- })
- console.log(res.children)
- this.jurisdiction={
- cbtf:false,
- jktf:false,
- hjtf:false,
- fztf:false,
- sytf:false,
- sbtf:false,
- sqtf:false,
- zjtf:false
- }
- for(var i=0;i<res.children.length;i++){
- switch (res.children[i].purview_name){
- case "测报系统":
- this.jurisdiction.cbtf = true
- break;
- case "可视农业":
- this.jurisdiction.jktf = true
- break;
- case "环境监测系统":
- this.jurisdiction.hjtf = true
- break;
- case "防治系统":
- this.jurisdiction.fztf = true
- break;
- case "溯源系统":
- this.jurisdiction.sytf = true
- break;
- case "系统管理":
- this.jurisdiction.sbtf = true
- break;
- case "四情基地":
- this.jurisdiction.sqtf = true
- break;
- case "专家诊断":
- this.jurisdiction.zjtf = true
- break;
- }
- }
- },
- tabfunction(index) {
- if (index == 0) {
- if(this.jurisdiction.sqtf){
- uni.navigateTo({
- url: "../fourBase/index"
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 1) {
- var that = this
- this.show = true
- } else if (index == 2) {
- if(this.jurisdiction.zjtf){
- uni.navigateTo({
- url: "../expertDiagnosis/index",
-
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 3) {
- uni.navigateTo({
- url: "../afterSale/index"
- })
- }
- },
- tabequipment(index) {
- if (index == 0) {
- if(this.jurisdiction.cbtf){
- uni.navigateTo({
- url: "../cb/index/index"
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 1) {
- if(this.jurisdiction.fztf){
- uni.navigateTo({
- url: "../prevention/index"
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 2) {
- console.log(this.jurisdiction.jktf)
- if(this.jurisdiction.jktf){
- uni.navigateTo({
- url: "/pages/monitor/index"
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 3) {
- if(this.jurisdiction.hjtf){
- uni.navigateTo({
- url: "../environment/index"
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 4) {
- console.log(this.jurisdiction.sbtf)
- if(this.jurisdiction.sbtf){
- uni.navigateTo({
- url: "../equipMange/index/index"
- })
- }else{
- uni.showToast({
- title: "此账号未开启此模块,如有需要,请联系管理员",
- icon: "none"
- })
- }
- } else if (index == 5) {
- uni.showToast({
- title: '此功能暂未开放',
- duration: 2000,
- icon:"none"
- });
- }
- },
- onok(ev) {
- this.path = this.url
- console.log(ev)
- this.loadTF = true
- uni.showLoading({
- mask:true,
- success:function(){
- console.log(999)
- }
- });
- if(this.flag == 2){
- console.log('111')
- // pest.pests.insect_discern 虫害
- uni.uploadFile({
- // url: 'http://182.92.193.64:8002/api/api_gateway?method=base.bases.base_photo', //仅为示例,非真实的接口地址
- url: 'https://wx.hnyfwlw.com/api/api_gateway?method=pest.pests.insect_discern', //仅为示例,非真实的接口地址
- filePath: ev.path,
- name: 'img_file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- console.log(JSON.parse(uploadFileRes.data))
- uni.navigateTo({
- url: "../disandpests/index?datas=" + uploadFileRes.data + "&path=" + ev.path
- })
- }
- });
- }else if(this.flag == 1){
- //pest.pests.insect_discern病害识别
- uni.showLoading({
- title: '加载中'
- });
- uni.uploadFile({
- // url: 'http://182.92.193.64:8002/api/api_gateway?method=base.bases.base_photo', //仅为示例,非真实的接口地址
- url: 'https://wx.hnyfwlw.com/api/api_gateway?method=pest.pests.plant_discern', //仅为示例,非真实的接口地址
- filePath: ev.path,
- name: 'img_file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- console.log(JSON.parse(uploadFileRes.data))
- uni.navigateTo({
- url: "../disandpests/index?datas="+uploadFileRes.data + "&path=" + ev.path
- })
- }
- });
- }
- this.url = "";
- },
- oncancle() {
- // url设置为空,隐藏控件
- this.url = ''
- },
- confirm() {
- this.flag = 1
- uni.chooseImage({
- count: 1, //默认9
- // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['camera','album'], //从相册选择
- success: (res) => {
- this.url = res.tempFilePaths[0]
- }
- });
- console.log(1)
- },
- cancel() {
- this.flag = 2
- uni.chooseImage({
- count: 1, //默认9
- // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['camera','album'], //从相册选择
- success: (res) => {
- console.log(1)
- this.url = res.tempFilePaths[0]
- }
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .index_uswiper {
- width: 95%;
- margin: 0 auto;
- border-radius: 20rpx !important;
- }
- .loading{
- position: absolute;
- top: 0;
- left: 0;
- z-index: 100;
- width:100%;
- height: 100vh;
- background-color: rgba(0,0,0,0.5);
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .function {
- width: 95%;
- margin: 20rpx auto;
- display: flex;
- justify-content: space-around;
- .function_item {
- width: 18%;
- text-align: center;
- image {
- width: 90rpx;
- height: 90rpx;
- }
- p {
- font-size: 24rpx;
- }
- }
- }
- .equipment {
- width: 95%;
- margin: 30rpx auto 0;
- .equipment_p {
- width: 90%;
- border-left: 8rpx solid #4BB85F;
- font-weight: 700;
- padding-left: 20rpx;
- margin-bottom: 20rpx;
- }
- .equipment_item {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .equipment_item_img {
- width: 49%;
- margin-top: 20rpx;
- image {
- width: 100%;
- height: 190rpx;
- }
- }
- }
- }
- </style>
|