Browse Source

知识库

h5_css
蟑螂恶霸 3 years ago
parent
commit
8923db9e15
  1. 3
      main.js
  2. 3
      pages.json
  3. 50
      pages/knowledge/knowledge.vue
  4. 125
      pages/scan/scan.vue
  5. 4
      static/base_css.css
  6. 3
      utils/config.js

3
main.js

@ -14,7 +14,8 @@ uni.$http = $http
Vue.prototype.$api = api
$http.baseUrl = 'http://146.56.223.227:9527'
// $http.baseUrl = 'http://localhost:9527'
// $http.baseUrl = 'http://localhost:85'
$http.beforeRequest = function(options) {
uni.showLoading({

3
pages.json

@ -11,7 +11,8 @@
"path": "pages/scan/scan",
"style": {
"navigationBarTitleText": "全民演练",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{

50
pages/knowledge/knowledge.vue

@ -1,13 +1,26 @@
<template>
<view class="wrap">
<view class="stabar"></view>
<view class="secbar">
<view class="title">知识库</view>
</view>
<view class="mainwrap2">
<view class="mainwrap2">
<view class="subwrap">
<view class="artlist">
<view class="timetop">2024-02-19 04:21</view>
<view class="txtlist">凌晨突发6.2级地震!这份逃生避险指南,请收藏</view>
</view>
<view class="artlist">
<view class="timetop">2024-02-19 04:21</view>
<view class="txtlist">应急科普 | 注意防范!大范围雨雪进入鼎盛期 </view>
</view>
</view>
</view>
<tabbar :page="page"></tabbar>
</view>
</view>
</template>
@ -22,10 +35,41 @@
onShow() {
this.page= "know"
},
components: {tabbar},
methods: {
},
components: {tabbar}
}
</script>
<style lang="scss">
@import url("@/static/base_css.css");
.title {
margin-top: 0;
padding-top: 16rpx;
}
.mainwrap2 {
height: calc(100% - 300rpx);
}
.artlist {
margin: 2% 0 3.5%;
padding: 4% 3%;
width: 100%;
font-size: 1.05rem;
box-shadow: 0 0 10rpx #ddd;
background: #fff;
border-radius: 20rpx;
box-sizing: border-box;
}
.timetop {
margin: 0 0 3%;
/* padding: 0 0 2%;
border-bottom: 1px solid #eee; */
color: #999;
font-size: 0.9rem;
}
</style>

125
pages/scan/scan.vue

@ -1,48 +1,119 @@
<template>
<view class="wrap">
<view class="footbox">
<tabbar :page="page"></tabbar>
</view>
<view>
<!-- 扫描框 -->
<view class="scanBox" v-if="canScan">
<camera class="camera" mode="scanCode" @scancode="scancode" :flash='flashBtn'>
<image class="coverImg" src="/static/images/border.png"></image>
</camera>
<view style="text-align: center;margin: 80rpx 0 40rpx 0;">
<button class="cu-btn scancodePic" @click="changeflashBtn()">
<image :src="flashBtn=='on'?scancodeOpen:scancodeClose"></image>
</button>
</view>
<view class="scanTip">请扫描二维码</view>
<!-- 关闭扫码页面 -->
<view class="footbox">
<tabbar :page="page"></tabbar>
</view>
</view>
</view>
</template>
<script>
import tabbar from "@/components/tabbar/tabbar.vue";
import tabbar from "@/components/tabbar/tabbar.vue";
export default {
data() {
return {
page: ""
page: "",
sceneName:"",
canScan: true, // 是否显示自定义扫码界面
flashBtn: 'off', // off关闭 on 打开手电筒
scanResult: '' ,// 扫描结果
scancodeOpen:"/static/images/turn_on.png",
scancodeClose:"/static/images/turn_off.png",
};
},
onLoad() {
this.QR();
// setInterval(() => {
// this.QR(); // 定时刷新数据
// }, 3000); // 每隔3秒刷新一次
},
onShow() {
this.page= "scan"
this.page= "scan"
},
methods: {
QR() {
uni.scanCode({
success: (res) => {
console.log('扫描二维码成功,结果:' + res.result);
},
fail: (res) => {
console.log('扫描二维码出现错误')
}
async scancode(event) {
if (this.isTf) return;
this.isTf = true;
setTimeout(() => {
// 3秒扫描一次
this.isTf = false;
return;
}, 3000);
uni.vibrateShort(); // 触发手机振动
const { result } = event.detail; // 获取校验扫描结果
const { data: res } = await uni.$http.post('/small/scene/manage/listApp',{guid:result})
if (res.rows.length==0) {
return uni.showToast({title: '未找到相关演练场景'})
}
res.rows.forEach(item=>{
this.sceneName = item.name
})
uni.navigateTo({
url: '/subpkg/role/role?guid=' + result+'&name='+this.sceneName
})
},
// 打开关闭手电筒
changeflashBtn(){
if(this.flashBtn=="off"){
this.flashBtn="on"
}else if(this.flashBtn=="on"){
this.flashBtn="off"
}
},
},
components: {
tabbar
}
components: {tabbar}
}
</script>
<style lang="scss">
@import url("@/static/base_css.css");
.scanBox {
position: fixed;
top: 0;
width: 100%;
height: 100vh;
background-color: #000000;
}
.camera {
position: relative;
width: 70vw;
height: 70vw;
margin: 20vh auto 0;
}
.coverImg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999;
}
.scanTip {
padding: 20rpx 0 0 0;
font-size: 32rpx;
text-align: center;
color: #fff;
}
</style>
/* 开关手电筒 */
.scancodePic{
background: transparent !important;
width: 100rpx;
height: 100rpx;
padding: 0 !important;
}
.scancodePic>image{
width: 100%;
height: 100%;
}
</style>

4
static/base_css.css

@ -255,12 +255,12 @@ h3.contit span {
.subwrap {
position: relative;
top: -5%;
top: 0;
overflow: hidden;
overflow-y: auto;
padding: 1% 3%;
width: 94%;
height: 70%;
height: 100%;
}
.mainwrap2, .mainwrap3, .tabwrap {

3
utils/config.js

@ -1,3 +1,4 @@
let url_config = 'http://146.56.223.227:9527/'
// let url_config = 'http://localhost:9527/'
// let url_config = 'http://localhost:85/'
export default url_config
Loading…
Cancel
Save