Browse Source

登录页服务器配置

ming 2 years ago
parent
commit
cf11aa18af
3 changed files with 104 additions and 47 deletions
  1. 24 1
      src/pages/login.vue
  2. 79 46
      src/pages/serveConfig.vue
  3. 1 0
      src/store/modules/public.js

+ 24 - 1
src/pages/login.vue

@@ -1,6 +1,11 @@
 <template>
   <view class="section">
+
+
+    <!-- #ifdef APP-PLUS-->
     <view style="position:absolute;top:10px;right:10px;z-index:99;color:#2a98ff" @tap="goSeverConfig">服务器配置</view>
+    <!--#endif-->
+
 
     <view class="bg">
       <!-- <image class="bgImage" :src="bg" v-if="bg" /> -->
@@ -55,11 +60,18 @@ import { getToken, setToken, removeToken } from "@/utils/auth";
 import { Lock, User, Cellphone } from "@element-plus/icons-vue";
 import { getCodeImg, getMobileTenantConfig } from "@/api/login";
 
+import publicStore from "@/store/modules/public.js";
+
 import useStores from "@/store/modules/user.js";
 const useStore = useStores();
+const newPublicStore = publicStore();
+
+
 
 const { proxy } = getCurrentInstance();
 
+
+
 const data = reactive({
   /** saas数据 */
   bg: "/static/images/wt/bg.png",
@@ -220,10 +232,21 @@ async function submitRes() {
       });
       return;
     }
+    
+    // #ifdef APP-PLUS
+    if(newPublicStore.serveUrl){
+      login({
+        username: username.value,
+        password: password.value,
+        serveUrl: newPublicStore.serveUrl
+      });
+    }
+    // #endif
+
+
     login({
       username: username.value,
       password: password.value,
-      tenantId: tenantId.value,
     });
   }
 }

+ 79 - 46
src/pages/serveConfig.vue

@@ -1,69 +1,102 @@
 <template>
-  <view id="serveConfig">
-    <u--form :model="form" ref="uForm" :rules="rules" labelWidth="80">
-        <view style="padding: 10px 0">
-            <view style="padding: 10px 40px 20px 40px; background: #ffffff">
-            <view style="padding-left: 9px">
-                <u-form-item label="链接地址" prop="companyName" required :borderBottom="true">
-                    <u-input  class="configInput" v-model="form.companyName" placeholder="请输入链接地址" border="none" @click="companySubmit(form.companyName)">
-                    
+    <view id="serveConfig">
+        <view style="padding: 10px 40px 20px 40px;">
+            <u--form :model="form" ref="uForm" :rules="rules" labelWidth="80">
+                <u-form-item label="链接地址" prop="linkUrl" required :borderBottom="true">
+                    <u-input class="configInput" v-model="form.linkUrl" placeholder="请输入链接地址" border="none">
+
                     </u-input>
                 </u-form-item>
-            </view>
-            </view>
+                <view >
+                    <u-button type="primary" style="width: 50%; height: 36px; font-size: 14px;margin-top:20px" @click="handleSubmit()"
+                        shape="circle"> 保 存 </u-button>
+                </view>
+            </u--form>
         </view>
-    </u--form>
-</view>
-
+    </view>
 </template>
 
 <script setup>
 import { ref, onMounted, inject, shallowRef, reactive, toRefs, getCurrentInstance } from "vue";
+import publicStore from "@/store/modules/public.js";
+const newPublicStore = publicStore();
+const dataList = reactive({
+    form: {
+        linkUrl: "", //链接地址
+       
+    },
+    rules: {
+    linkUrl: [
+      {
+        required: true,
+        message: "请输入链接地址",
+        trigger: ["blur"],
+      },
+      {
+        type: "string",
+        required: true,
+        message: "请输入正确的链接地址",
+        pattern: /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/,
+        trigger: ["blur", "change"],
+      },
+    ],
+  
+  },
+});
 
+const uForm = ref(null);
+const { form, baseBuildListForm, rules, baseBuildListRules, noticeBarText, pagingBool, actionTitle, actionIndex, actionsList, actionShow, showTime, timeValue, timeTitle, timeIndex, modalShow } =
+    toRefs(dataList);
 
-  const dataList = reactive({
-  form: {
-    companyName: "", //单位名称
-    // organization: "", //信用代码
-    // delegateName: "", //法人代表姓名
-    // streetTown: "", //所属街镇
-    // streetTownValue: 0, //所属街镇
-    // address: "", //详细地址
-    // fireManagePhone: "", //消防安全管理人电话
-    // foundTime: "", //单位成立时间
-    // fireDutyName: "", //消防安全责任人姓名
-    // fireManageName: "", //消防安全管理人姓名
-    // employeeNum: "", //职工人数
-    // fixedAssets: "", //固定资产(单位:万元)
-    // companyNature: "", //单位性质
-    // companyNatureValue: 0, //单位性质
-    // buildArea: "", //建筑面积
+/**
+ * @提交
+ * @按钮点击事件
+ */
+function handleSubmit() {
+    uForm.value
+    .validate()
+    .then((res) => {
+        newPublicStore.serveUrl=form.value.linkUrl
+      uni.navigateTo({
+            url: '/pages/login'
+        })
+    })
 
-    // baseBuildList: [],
-  }
-});
-const { form, baseBuildListForm, rules, baseBuildListRules, noticeBarText, pagingBool, actionTitle, actionIndex, actionsList, actionShow, showTime, timeValue, timeTitle, timeIndex, modalShow } =
-  toRefs(dataList);
+}
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
 body {
-  background: #fff;
+    background: #fff;
 }
-#serveConfig{
-    background:#fff;
-    .configInput{
+
+#serveConfig {
+    background: #fff;
+
+    ::v-deep .u-input__content__field-wrapper__field {
+        height: 30px;
+        line-height: 30px
+    }
+    ::v-deep .u-button--circle{
+        border-radius:5px
+    }
+
+    .configInput {
         border: 1px solid gray;
-      
+
     }
-    .uni-input-placeholder{
-        padding:10px;
+    ::v-deep .uni-input-input{
+        padding:8px
+    }
+
+      .uni-input-placeholder {
+        padding: 10px;
 
     }
-    ::v-deep .u-line{
-        display:none!important
+
+    ::v-deep .u-line {
+        display: none !important
     }
 
 }
-
 </style>

+ 1 - 0
src/store/modules/public.js

@@ -4,6 +4,7 @@ const publicStore = defineStore("public", {
   state: () => ({
     leftBtn: true, //左侧收起按钮
     rightBtn: true, //右侧收起按钮
+    serveUrl:null,//链接地址
 
     mapBool: 1, //1.高德 2.测绘院
     streetTownList: [