MrShi
2025-03-12 69a1b3bf45738f048361ee4ccb6bdc64fce35720
h5_meeting/pages/index/config.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
<template>
   <view class="app">
      <view class="list">
         <view class="item">
            <view class="title">会议室编码</view>
            <view class="line">
               <input type="text" v-model="param.code" />
               <image src="../../static/icon/right.svg" class="icon"></image>
            </view>
         </view>
         <view class="item">
            <view class="title">接口地址</view>
            <view class="line">
               <input type="text" v-model="param.baseUrl" />
               <image src="../../static/icon/right.svg" class="icon"></image>
            </view>
         </view>
         <view class="item">
            <view class="title">是否为办公网</view>
            <view class="line">
               <switch :checked="param.officeFlag == '1'" style="transform:scale(0.7)" @change="changeSwi" color="#51b2ce"></switch>
            </view>
         </view>
         <view class="item">
            <view class="title">接口调用间隔(秒)</view>
            <view class="line">
               <input type="text" placeholder="60" v-model="param.time" />
               <image src="../../static/icon/right.svg" class="icon"></image>
            </view>
         </view>
      </view>
      <view class="save" @click="handleSave">保存配置</view>
   </view>
</template>
<script>
   import { baseUrl } from '@/utils/config.js'
   export default {
      data() {
         return {
            param: {
               baseUrl,
               time: 60,
               officeFlag: '0'
            }
         };
      },
      onLoad(){
         const param = uni.getStorageSync('param') || {
            baseUrl: baseUrl,
            time: 60,
            officeFlag: '0'
         }
         this.param = { ...param }
      },
      methods: {
         changeSwi(e) {
            this.$set(this.param, 'officeFlag', e.detail.value ? '1' : '0')
         },
         handleSave() {
            const param = this.param
            uni.setStorageSync('param', param)
            setTimeout(()=>{
               uni.showToast({
                  title: '更新配置成功',icon:'none'
               })
            })
            setTimeout(()=>{
               uni.redirectTo({
                  url:'/pages/index/index'
               })
            }, 400)
         }
      }
   }
</script>
<style lang="scss" scoped>
   .save{
      position: fixed;
      width: 680upx;
      height: 90upx;
      line-height: 90upx;
      background: #00B5D1;
      border-radius: 7upx;
      left: 35upx;
      bottom: 36upx;
      color: #fff;
      text-align: center;
      font-weight: 500;
      font-size: 32rpx;
   }
.list{
   .item{
      width: 100%;
      height: 148upx;
      padding: 28upx 34upx 0;
      .title{
         font-weight: 500;
         font-size: 28rpx;
         color: #111111;
         line-height: 39rpx;
      }
      .line{
         height: 80upx;
         display: flex;
         align-items: center;
         justify-content: space-between;
         border-bottom: 1rpx solid #CCCCCC;
         input{
            flex: 1;
            font-size: 28rpx;
            color: #666666;
         }
         .icon{
            width: 28upx;
            height: 28upx;
         }
      }
   }
}
</style>