浏览代码

fix: 新版更新

lkd9698906@163.com 1 年之前
父节点
当前提交
511ac1d8bf

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
     "jsqr": "^1.4.0",
     "pinia": "^2.1.6",
     "pinia-use-persist": "^0.0.21",
+    "uuid": "^10.0.0",
     "vant": "^4.6.8",
     "vue": "^3.3.4",
     "vue-qrcode-reader": "^5.5.7",

+ 49 - 3
src/assets/iconfont/demo_index.html

@@ -54,6 +54,18 @@
       <div class="content unicode" style="display: block;">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+              <span class="icon iconfont">&#xe609;</span>
+                <div class="name">NB-IOT物联</div>
+                <div class="code-name">&amp;#xe609;</div>
+              </li>
+          
+            <li class="dib">
+              <span class="icon iconfont">&#xe603;</span>
+                <div class="name">4G</div>
+                <div class="code-name">&amp;#xe603;</div>
+              </li>
+          
             <li class="dib">
               <span class="icon iconfont">&#xe688;</span>
                 <div class="name">WIFI</div>
@@ -84,9 +96,9 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.woff2?t=1728618228432') format('woff2'),
-       url('iconfont.woff?t=1728618228432') format('woff'),
-       url('iconfont.ttf?t=1728618228432') format('truetype');
+  src: url('iconfont.woff2?t=1729475797664') format('woff2'),
+       url('iconfont.woff?t=1729475797664') format('woff'),
+       url('iconfont.ttf?t=1729475797664') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -112,6 +124,24 @@
       <div class="content font-class">
         <ul class="icon_lists dib-box">
           
+          <li class="dib">
+            <span class="icon iconfont iconfont-NB-IOTwulian"></span>
+            <div class="name">
+              NB-IOT物联
+            </div>
+            <div class="code-name">.iconfont-NB-IOTwulian
+            </div>
+          </li>
+          
+          <li class="dib">
+            <span class="icon iconfont iconfont-G"></span>
+            <div class="name">
+              4G
+            </div>
+            <div class="code-name">.iconfont-G
+            </div>
+          </li>
+          
           <li class="dib">
             <span class="icon iconfont iconfont-WIFI"></span>
             <div class="name">
@@ -157,6 +187,22 @@
       <div class="content symbol">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#iconfont-NB-IOTwulian"></use>
+                </svg>
+                <div class="name">NB-IOT物联</div>
+                <div class="code-name">#iconfont-NB-IOTwulian</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#iconfont-G"></use>
+                </svg>
+                <div class="name">4G</div>
+                <div class="code-name">#iconfont-G</div>
+            </li>
+          
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#iconfont-WIFI"></use>

+ 11 - 3
src/assets/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 3974207 */
-  src: url('iconfont.woff2?t=1728618228432') format('woff2'),
-       url('iconfont.woff?t=1728618228432') format('woff'),
-       url('iconfont.ttf?t=1728618228432') format('truetype');
+  src: url('iconfont.woff2?t=1729475797664') format('woff2'),
+       url('iconfont.woff?t=1729475797664') format('woff'),
+       url('iconfont.ttf?t=1729475797664') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,14 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.iconfont-NB-IOT:before {
+  content: "\e609";
+}
+
+.iconfont-4G:before {
+  content: "\e603";
+}
+
 .iconfont-WIFI:before {
   content: "\e688";
 }

文件差异内容过多而无法显示
+ 0 - 0
src/assets/iconfont/iconfont.js


+ 14 - 0
src/assets/iconfont/iconfont.json

@@ -5,6 +5,20 @@
   "css_prefix_text": "iconfont-",
   "description": "测试项目",
   "glyphs": [
+    {
+      "icon_id": "4904529",
+      "name": "NB-IOT物联",
+      "font_class": "NB-IOTwulian",
+      "unicode": "e609",
+      "unicode_decimal": 58889
+    },
+    {
+      "icon_id": "12614677",
+      "name": "4G",
+      "font_class": "G",
+      "unicode": "e603",
+      "unicode_decimal": 58883
+    },
     {
       "icon_id": "39082201",
       "name": "WIFI",

二进制
src/assets/iconfont/iconfont.ttf


二进制
src/assets/iconfont/iconfont.woff


二进制
src/assets/iconfont/iconfont.woff2


+ 225 - 62
src/pages/mine/wifi/Index.vue

@@ -5,26 +5,16 @@
     </CusNavigation>
 
     <div class="mains">
-      <div class="title">对接数据</div>
+      <div class="title">医院配置</div>
       <div class="form">
         <van-form @submit="onSubmit">
           <van-cell-group inset>
             <van-cell>
               <van-field
-                v-model="formData.localAddress"
-                name="localAddress"
-                label="对接地址"
-                placeholder="请输入对接地址"
-                :rules="[{ required: true, message: '请填写对接地址' }]"
-              />
-            </van-cell>
-            <van-cell>
-              <van-field
-                v-model="formData.localPort"
-                name="localPort"
-                label="对接端口"
-                placeholder="请填写对接端口"
-                :rules="[{ required: true, message: '请填写对接端口' }]"
+                v-model="formData.deviceSecret"
+                name="deviceSecret"
+                label="密钥"
+                placeholder="请填写密钥配置"
               />
             </van-cell>
           </van-cell-group>
@@ -35,10 +25,58 @@
           </div>
         </van-form>
       </div>
+      <!-- 对接配置 -->
+      <div class="title">
+        对接配置
+        <div>
+          <a @click="handleAdd('address')" style="margin-left: 20px"
+            >添加配置</a
+          >
+        </div>
+      </div>
+      <div class="form">
+        <div
+          class="wifi-info"
+          style=""
+          v-for="(item, index) in addressDatas"
+          :key="index"
+        >
+          <van-icon
+            class-prefix="iconfont"
+            :name="item.networkType"
+            :size="46"
+          />
+          <van-cell
+            :title="item.address"
+            :label="item.port"
+            style="margin: 0.625rem 0 0 1rem"
+          >
+            <van-button
+              plain
+              hairline
+              size="small"
+              text="编辑"
+              @click="handleEdit('address', item)"
+              type="primary"
+            />
+            <van-button
+              size="small"
+              plain
+              hairline
+              text="删除"
+              type="danger"
+              @click="handleDel(item, 'address')"
+              class="delete-button"
+            />
+          </van-cell>
+        </div>
+      </div>
+
+      <!-- WIFI配置块 -->
       <div class="title">
         WIFI配置
         <div>
-          <a @click="handleAdd" style="margin-left: 20px">添加网络</a>
+          <a @click="handleAdd('wifi')" style="margin-left: 20px">添加网络</a>
         </div>
       </div>
       <div class="form">
@@ -59,7 +97,7 @@
               hairline
               size="small"
               text="编辑"
-              @click="handleEdit(item)"
+              @click="handleEdit('wifi', item)"
               type="primary"
             />
             <van-button
@@ -68,7 +106,7 @@
               hairline
               text="删除"
               type="danger"
-              @click="handleDel(item)"
+              @click="handleDel(item, 'wifi')"
               class="delete-button"
             />
           </van-cell>
@@ -83,6 +121,7 @@
       <van-back-top target=".container" right="5vw" bottom="80px" />
     </div>
   </div>
+  <!-- wifi配置信息 -->
   <van-action-sheet v-model:show="wifiAction" :title="wifiTitle">
     <div class="form">
       <van-form @submit="onWifiSubmit">
@@ -93,7 +132,10 @@
               name="name"
               label="名称"
               placeholder="请输入WIFI名称"
-              :rules="[{ required: true, message: '请输入WIFI名称' }]"
+              :rules="[
+                { required: true, message: '请输入WIFI名称' },
+                { validator: validator8, message: 'WIFI名称不得大于8位' },
+              ]"
             />
           </van-cell>
           <van-cell>
@@ -102,7 +144,57 @@
               name="password"
               label="密码"
               placeholder="请填写WIFI密码"
-              :rules="[{ validator, message: 'WIFI密码不得于8位' }]"
+              :rules="[
+                { validator: validator20, message: 'WIFI密码不得大于20位' },
+              ]"
+            />
+          </van-cell>
+        </van-cell-group>
+        <div style="margin: 0.25rem 10%; width: 80%">
+          <van-button round block type="primary" native-type="submit">
+            确认
+          </van-button>
+        </div>
+      </van-form>
+    </div>
+  </van-action-sheet>
+  <!-- 对接配置信息 -->
+  <van-action-sheet v-model:show="addressAction" :title="addressTitle">
+    <div class="form">
+      <van-form @submit="onAddressSubmit">
+        <van-cell-group inset>
+          <van-cell>
+            <van-field
+              v-model="addressInfo.networkType"
+              name="networkType "
+              label="对接类型"
+              placeholder="请选择接类型"
+              @click="showPicker = true"
+              :rules="[{ required: true, message: '请选择接类型' }]"
+            />
+            <van-popup v-model:show="showPicker" round position="bottom">
+              <van-picker
+                :columns="selColumns"
+                @cancel="showPicker = false"
+                @confirm="onConfirm"
+              />
+            </van-popup>
+          </van-cell>
+          <van-cell>
+            <van-field
+              v-model="addressInfo.address"
+              name="address"
+              label="对接地址"
+              placeholder="请输入对接地址"
+              :rules="[{ required: true, message: '请输入WIFI名称' }]"
+            />
+          </van-cell>
+          <van-cell>
+            <van-field
+              v-model="addressInfo.port"
+              name="port"
+              label="对接端口"
+              placeholder="请填写对接端口"
             />
           </van-cell>
         </van-cell-group>
@@ -123,77 +215,146 @@ import { post_promise } from "@/network/axios";
 import { showToast } from "vant";
 import { showConfirmDialog } from "vant";
 import "vant/es/dialog/style";
-import { refreshCurrentRoute } from '@/router'
+import { refreshCurrentRoute } from "@/router";
 import { useStoreOfUserInfo } from "@/store/userInfo";
+import { v4 as uuidv4 } from "uuid";
+import { selColumns } from './data';
 const userInfo = useStoreOfUserInfo();
 
 const cusNavigation = ref();
 const wifiAction = ref(false); // wifi信息弹框
 const wifiTitle = ref<string>(""); // wifi信息弹框标头
+const addressAction = ref(false); // 对接信息弹框
+const addressTitle = ref<string>(""); // 对接信息弹框标头
 const formData = ref({} as any); // 表单信息
 const wifiInfo = ref({} as any); // WIFI信息
+const addressInfo = ref({} as any); // 对接信息
 const wifiDatas = ref<Array<any>>([]); // WIFI信息列表
-const validator = (val: string | any[]) => val && val.length < 8 ? false : true;
+const addressDatas = ref<Array<any>>([]); // WIFI信息列表
+const showPicker = ref(false);
+
+const validator8 = (val: string | any[]) =>
+  val && val.length > 8 ? false : true;
+
+const validator20 = (val: string | any[]) =>
+  val && val.length > 20 ? false : true;
 // 提交WIFI信息
 function onSubmit() {
-  console.log("提交WIFI信息....");
   formData.value.wifi = JSON.stringify(wifiDatas.value);
-  post_promise({ url: "/userConfig/config", data: formData.value }).then((res)=>{
-    if(res.code === 0){
-      showToast({message:'WIFI信息配置成功!',
-        onClose: () => {
-          refreshCurrentRoute();
-        }
-      });
-      wifiAction.value = false;
+  formData.value.address = JSON.stringify(addressDatas.value);
+  post_promise({ url: "/userConfig/config", data: formData.value }).then(
+    (res) => {
+      if (res.code === 0) {
+        showToast({
+          message: "WIFI信息配置成功!",
+          onClose: () => {
+            refreshCurrentRoute();
+          },
+        });
+        wifiAction.value = false;
+      }
     }
-  });
+  );
 }
 
+// 类型选项
+const onConfirm = ( selectedOptions: any ) => {
+      showPicker.value = false;
+      addressInfo.value.networkType = selectedOptions.selectedValues[0];
+    };
+
+
 // wifi修改及新增确认
 function onWifiSubmit() {
+  let tip = '新增';
   if (wifiInfo.value && wifiInfo.value.id) {
     for (let i = 0, len = wifiDatas.value.length - 1; i < len; i++) {
       if (wifiDatas.value[i].id === wifiInfo.value.id) {
-        wifiDatas.value[i] = wifiInfo;
+        wifiDatas.value[i] = wifiInfo.value;
+        tip = '编辑'
       }
     }
   } else {
-    wifiInfo.value = { ...wifiInfo.value, id: wifiDatas.value.length + 1 };
+    wifiInfo.value = { ...wifiInfo.value, id: uuidv4() };
     wifiDatas.value.push(wifiInfo.value);
   }
+  showToast('WIFI信息'+tip+'成功,保存后生效')
   wifiAction.value = false;
   wifiInfo.value = {};
 }
 
+// 对接配置确认
+function onAddressSubmit() {
+  let tip = '新增';
+  if (addressInfo.value && addressInfo.value.id) {
+    for (let i = 0, len = addressDatas.value.length - 1; i < len; i++) {
+      if (addressDatas.value[i].id === addressInfo.value.id) {
+        addressDatas.value[i] = addressInfo.value;
+        tip = '编辑'
+      }
+    }
+  }else {
+    addressInfo.value = { ...addressInfo.value, id: uuidv4() };
+    addressDatas.value.push(addressInfo.value);
+    
+  }
+  showToast('对接配置'+tip+'成功,保存后生效')
+  addressAction.value = false;
+  addressInfo.value = {};
+}
+
 // 添加wifi方法
-function handleAdd() {
-  console.log("添加wifi方法....");
-  wifiTitle.value = "添加WIFI配置";
-  wifiAction.value = true;
+function handleAdd(addType: string) {
+  if (addType === "wifi") {
+    wifiTitle.value = "添加WIFI配置";
+    wifiAction.value = true;
+  } else {
+    addressTitle.value = "添加对接配置";
+    addressAction.value = true;
+  }
 }
 
 // 编辑wifi信息
-function handleEdit(record?: any) {
-  console.log("编辑WFIFI方法...", record);
-  wifiInfo.value = record;
-  wifiTitle.value = "编辑WIFI配置";
-  wifiAction.value = true;
+function handleEdit(editType: string, record: any) {
+  if (editType === "wifi") {
+    wifiInfo.value = record;
+    wifiTitle.value = "编辑WIFI配置";
+    wifiAction.value = true;
+  } else {
+    addressInfo.value = record;
+    addressTitle.value = "编辑对接配置";
+    addressAction.value = true;
+  }
 }
 
-function handleDel(record?: any) {
-  showConfirmDialog({
-    title: "提示",
-    message: "是否删除" + record.name + "?",
-  })
-    .then(() => {
-      wifiDatas.value = wifiDatas.value.filter(
-        (obj: any) => obj.id != record.id
-      );
+function handleDel(record: any, delType: string) {
+  if (delType === "wifi") {
+    showConfirmDialog({
+      title: "提示",
+      message: "是否删除" + record.name + "?",
+    })
+      .then(() => {
+        wifiDatas.value = wifiDatas.value.filter(
+          (obj: any) => obj.id != record.id
+        );
+      })
+      .catch(() => {
+        console.log("删除WFIFI方法关闭...");
+      });
+  } else {
+    showConfirmDialog({
+      title: "提示",
+      message: "是否删除" + record.address + "对接配置?",
     })
-    .catch(() => {
-      console.log("删除WFIFI方法关闭...");
-    });
+      .then(() => {
+        addressDatas.value = addressDatas.value.filter(
+          (obj: any) => obj.id != record.id
+        );
+      })
+      .catch(() => {
+        console.log("删除WFIFI方法关闭...");
+      });
+  }
 }
 
 // 生命周期
@@ -215,6 +376,7 @@ function getWifiInfo() {
         if (result && result.data) {
           formData.value = result.data;
           wifiDatas.value = JSON.parse(result.data.wifi);
+          addressDatas.value = JSON.parse(result.data.address);
         }
       })
       .catch((err) => {
@@ -230,33 +392,34 @@ function getWifiInfo() {
   height: 100vh;
 }
 .mains {
-  height: 100vh;
+  height: 85vh;
+  overflow: auto;
   background-color: #f7f8fa;
   .title {
     display: flex;
     justify-content: space-between;
-    margin: 10px 5%;
+    margin: 0.625rem 5%;
     color: #969799;
   }
   .form {
     width: 95%;
     margin-left: 2%;
     background-color: #fff;
-    border-radius: 5px;
+    border-radius: 0.3125rem;
     .submit-btn {
       position: fixed;
-      bottom: 5px;
+      bottom: 0.1875rem;
       width: 95%;
     }
 
     .wifi-info {
-      height: 80px;
-      line-height: 80px;
+      height: 5rem;
+      line-height: 5rem;
       border-bottom: solid 1px #f5f6f7;
       display: flex;
       margin-left: 1.25rem;
       button {
-        margin-right: 8px;
+        margin-right: 0.5rem;
       }
     }
   }

+ 5 - 0
src/pages/mine/wifi/data.ts

@@ -0,0 +1,5 @@
+export const selColumns = [
+    {text: 'NB-IOT', value: 'NB-IOT'},
+    {text: '4G', value: '4G'},
+    {text: 'WIFI', value: 'WIFI'},
+]

部分文件因为文件数量过多而无法显示