小程序

wechat
ihzero 2023-11-11 18:40:58 +08:00
parent 7d7827e480
commit 5f3df387e7
9 changed files with 293 additions and 222 deletions

View File

@ -1,10 +1,10 @@
import Vue from 'vue'
import App from './App'
import PortalVue from 'portal-vue'
// import PortalVue from 'portal-vue'
import './uni.promisify.adaptor'
import uView from "uview-ui";
Vue.use(uView);
Vue.use(PortalVue)
// Vue.use(PortalVue)
import {http,getFullUrl} from '@/api/index.js'
import store from './store/index.js'
Vue.config.productionTip = false
@ -13,9 +13,9 @@ Vue.component('ynSelectInputList', ynSelectInputList)
Vue.prototype.$http = http
Vue.prototype.$getFullUrl = getFullUrl
App.mpType = 'app'
import permission from '@/directive/permission/index.js'
// import permission from '@/directive/permission/index.js'
Vue.directive('auth', permission)
// Vue.directive('auth', permission)

View File

@ -55,9 +55,11 @@
/* */
"mp-weixin" : {
/* */
"appid" : "",
"appid" : "wx401e351ad84bc92d",
"setting" : {
"urlCheck" : false
"urlCheck" : false,
"es6" : false,
"minified" : false
},
"usingComponents" : true
},
@ -75,6 +77,7 @@
},
"h5" : {
"template" : ""
// "publicPath" : "http://lcny.sk797.cn/h5/"
}
}
// "publicPath" : "http://lcny.sk797.cn/h5/"

View File

@ -2,7 +2,7 @@
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
"pages": [
{
"path": "pages/index/index",
"style": {
@ -46,222 +46,230 @@
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/index/meteorological",
"style" :
{
"navigationBarTitleText": "气象监测",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/index/monitor",
"style" :
{
"navigationBarTitleText": "智能监控",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/index/soil-monitoring",
"style" :
{
"navigationBarTitleText": "土壤监控",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/index/water-quality",
"style" :
{
"navigationBarTitleText": "水质监控",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/system/account",
"style" :
{
"navigationBarTitleText": "账号管理",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/system/log",
"style" :
{
"navigationBarTitleText": "系统日志",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/system/links",
"style" :
{
"navigationBarTitleText": "友情链接",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/device/warning",
"style" :
{
"navigationBarTitleText": "警报明细",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/device/index",
"style" :
{
"navigationBarTitleText": "设备管理",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/index/insect-monitors",
"style" :
{
"navigationBarTitleText": "昆虫性诱监测",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/estate/estate-price",
"style" :
{
"navigationBarTitleText": "稻虾价格",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/estate/estate-week-price",
"style" :
{
"navigationBarTitleText": "稻虾每周价格",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/estate/estate-industry",
"style" :
{
"navigationBarTitleText": "稻虾产业",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/estate/estate-flows",
"style" :
{
"navigationBarTitleText": "稻虾流向",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/estate/estate-materiels",
"style" :
{
"navigationBarTitleText": "大宗物资",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/index/warning-list",
"style" :
{
"navigationBarTitleText": "预警列表",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},{
"path" : "pages/index/pests",
"path" : "pages/webview/index",
"style" :
{
"navigationBarTitleText": "虫情监测",
"navigationBarTitleText": "webview",
"enablePullDownRefresh": false
}
},{
"path" : "pages/index/insecticidal-lamp",
"style" :
{
"navigationBarTitleText": "杀虫灯监测",
"enablePullDownRefresh": false
}
},{
"path" : "pages/basics/town-base",
"style" :
{
"navigationBarTitleText": "城镇数据",
"enablePullDownRefresh": false
}
},{
"path" : "pages/basics/basics-base",
"style" :
{
"navigationBarTitleText": "基地数据",
"enablePullDownRefresh": false,
"navigationStyle":"custom"
}
},{
"path" : "pages/crop/town-crop",
"style" :
{
"navigationBarTitleText": "城镇农作物",
"enablePullDownRefresh": false,
"navigationStyle":"custom"
}
},{
"path" : "pages/crop/basics-crop",
"style" :
{
"navigationBarTitleText": "基地农作物",
"enablePullDownRefresh": false,
"navigationStyle":"custom"
}
},{
"path" : "pages/yield/town-yield",
"style" :
{
"navigationBarTitleText": "城镇产量",
"enablePullDownRefresh": false,
"navigationStyle":"custom"
}
},{
"path" : "pages/yield/basics-yield",
"style" :
{
"navigationBarTitleText": "基地产量",
"enablePullDownRefresh": false,
"navigationStyle":"custom"
}
}
// ,{
// "path" : "pages/index/meteorological",
// "style" :
// {
// "navigationBarTitleText": "气象监测",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/index/monitor",
// "style" :
// {
// "navigationBarTitleText": "智能监控",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/index/soil-monitoring",
// "style" :
// {
// "navigationBarTitleText": "土壤监控",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/index/water-quality",
// "style" :
// {
// "navigationBarTitleText": "水质监控",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/system/account",
// "style" :
// {
// "navigationBarTitleText": "账号管理",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/system/log",
// "style" :
// {
// "navigationBarTitleText": "系统日志",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/system/links",
// "style" :
// {
// "navigationBarTitleText": "友情链接",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/device/warning",
// "style" :
// {
// "navigationBarTitleText": "警报明细",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/device/index",
// "style" :
// {
// "navigationBarTitleText": "设备管理",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/index/insect-monitors",
// "style" :
// {
// "navigationBarTitleText": "昆虫性诱监测",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/estate/estate-price",
// "style" :
// {
// "navigationBarTitleText": "稻虾价格",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/estate/estate-week-price",
// "style" :
// {
// "navigationBarTitleText": "稻虾每周价格",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/estate/estate-industry",
// "style" :
// {
// "navigationBarTitleText": "稻虾产业",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/estate/estate-flows",
// "style" :
// {
// "navigationBarTitleText": "稻虾流向",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/estate/estate-materiels",
// "style" :
// {
// "navigationBarTitleText": "大宗物资",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// }
// ,{
// "path" : "pages/index/warning-list",
// "style" :
// {
// "navigationBarTitleText": "预警列表",
// "enablePullDownRefresh": false,
// "navigationStyle": "custom"
// }
// },{
// "path" : "pages/index/pests",
// "style" :
// {
// "navigationBarTitleText": "虫情监测",
// "enablePullDownRefresh": false
// }
// },{
// "path" : "pages/index/insecticidal-lamp",
// "style" :
// {
// "navigationBarTitleText": "杀虫灯监测",
// "enablePullDownRefresh": false
// }
// },{
// "path" : "pages/basics/town-base",
// "style" :
// {
// "navigationBarTitleText": "城镇数据",
// "enablePullDownRefresh": false
// }
// },{
// "path" : "pages/basics/basics-base",
// "style" :
// {
// "navigationBarTitleText": "基地数据",
// "enablePullDownRefresh": false,
// "navigationStyle":"custom"
// }
// },{
// "path" : "pages/crop/town-crop",
// "style" :
// {
// "navigationBarTitleText": "城镇农作物",
// "enablePullDownRefresh": false,
// "navigationStyle":"custom"
// }
// },{
// "path" : "pages/crop/basics-crop",
// "style" :
// {
// "navigationBarTitleText": "基地农作物",
// "enablePullDownRefresh": false,
// "navigationStyle":"custom"
// }
// },{
// "path" : "pages/yield/town-yield",
// "style" :
// {
// "navigationBarTitleText": "城镇产量",
// "enablePullDownRefresh": false,
// "navigationStyle":"custom"
// }
// },{
// "path" : "pages/yield/basics-yield",
// "style" :
// {
// "navigationBarTitleText": "基地产量",
// "enablePullDownRefresh": false,
// "navigationStyle":"custom"
// }
// }
],
"globalStyle": {
"navigationBarTextStyle": "white",

View File

@ -205,9 +205,13 @@ export default {
},
linknavFn(item) {
console.log(item)
if(!item.url) return
const host = 'http://36.133.205.221:91'
// uni.navigateTo({
// url: `/pages/webview/index?url=${host}/#${item.url}`,
// })
uni.navigateTo({
url: `${item.url}`,
url: `/pages/webview/index?url=${host}/#/pages/login/login`,
})
},
},

View File

@ -1,7 +1,10 @@
<template>
<view class="login-page bg-page">
<view class="img-a">
<view class="img-a relative h-full">
<view class="t-b"> 隆昌农业大数据监控平台 </view>
<view class="absolute top-0 left-0 w-full h-full">
<image class="w-full h-full" src="/static/head.png"></image>
</view>
</view>
<view class="login-view" style="">
<view class="t-login">
@ -103,7 +106,7 @@ export default {
.img-a {
width: 100%;
height: 450rpx;
background-image: url(../../static/head.png);
// background-image: url(../../static/head.png);
background-size: 100%;
}
.reg {

View File

@ -0,0 +1,44 @@
<template>
<view >
<web-view :fullscreen="false" ref="webview" style="height: 500rpx;" :src="src" @onPostMessage="message"> </web-view>
<button class="button" @click="evalJs">evalJs(webview)</button>
</view>
</template>
<script>
export default {
data() {
return {
src: 'https://www.baidu.com',
webview_styles: {
progress: {
color: '#FF3333',
},
},
}
},
onLoad({ url }) {
// this.src = decodeURIComponent(url)
},
onReady() {
this.writeToWebView()
// this.webviewContext = uni.createWebviewContext('web-view', this)
},
mounted() {
setTimeout(()=>{
console.log(this.$refs.webview);
},2000)
},
methods: {
writeToWebView(data) {},
evalJs: function () {
console.log(this.$refs.webview);
this.$refs.webview.evalJs("document.body.style.background ='#00FF00'")
},
message(event) {
console.log(JSON.stringify(event))
},
},
}
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -14,7 +14,13 @@ const store = new Vuex.Store({
actions,
mutations,
plugins: [
createPersistedState({
storage: {
getItem: (key) => uni.getStorageSync(key),
setItem: (key, val) => uni.setStorageSync(key, val),
removeItem: (key) => uni.removeStorageSync(key)
},
// 当state中的值发生变化的时候出发reduce函数
reducer(val) {
console.log(val, 'createPersistedState') // value值为当前state中的所有值对象

View File

@ -8,7 +8,10 @@ export default defineConfig({
'node_modules/**/*',
'.git/**/*',
'src/vendor/**',
],
'src/components/**',
'src/pages/basics/**',
'src/pages/index/**',
]
},
theme: {
container: {