22285461@qq.com пре 5 месеци
родитељ
комит
78050ebb25
6 измењених фајлова са 167 додато и 132 уклоњено
  1. 4 0
      dist/assets/index-42NA_cfs.js
  2. 0 4
      dist/assets/index-qObuI44o.js
  3. 1 1
      dist/index.html
  4. 30 0
      src/LocalModels.ts
  5. 4 4
      src/Network.ts
  6. 128 123
      src/components/ApplyUserInfo.vue

Разлика између датотеке није приказан због своје велике величине
+ 4 - 0
dist/assets/index-42NA_cfs.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 4
dist/assets/index-qObuI44o.js


+ 1 - 1
dist/index.html

@@ -5,7 +5,7 @@
     <link rel="icon" type="image/svg+xml" href="/vite.svg"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
     <title>桢禧文化</title>
-  <script type="module" crossorigin src="/assets/index-qObuI44o.js"></script>
+  <script type="module" crossorigin src="/assets/index-42NA_cfs.js"></script>
   <link rel="stylesheet" crossorigin href="/assets/index-FrvreMPU.css">
 </head>
 <body>

+ 30 - 0
src/LocalModels.ts

@@ -20,6 +20,36 @@ export namespace LocalModels {
         quPinYin: string
     }
 
+    export class BaseResponse {
+        code: number
+        msg: string
+
+        isSuccess() {
+            return this.code == 0
+        }
+
+        isError() {
+            return this.code < 0
+        }
+
+        isLargeError() {
+            return this.code == -100
+        }
+
+        static build(responseText: string) {
+            let rsp = new BaseResponse()
+            try {
+                let obj = JSON.parse(responseText)
+                rsp.code = obj["code"]
+                rsp.msg = obj["msg"]
+            } catch (e) {
+                rsp.code = -1
+                rsp.msg = "解析错误"
+            }
+            return rsp
+        }
+    }
+
     export class BaseRequest {
 
         toData() {

+ 4 - 4
src/Network.ts

@@ -7,10 +7,10 @@ export namespace Network {
 
     let debugMode = true
 
-    export function applyUserInfo(request: LocalModels.UserRequest, cb: () => void) {
-        post(getServerUrl() + "applyUserInfo", request.toData(), function (rsp: string) {
-            console.log(rsp)
-            cb && cb()
+    export function applyUserInfo(request: LocalModels.UserRequest, cb: (rsp: LocalModels.BaseResponse) => void) {
+        post(getServerUrl() + "applyUserInfo", request.toData(), function (response: string) {
+            let dt = LocalModels.BaseResponse.build(response)
+            cb && cb(dt)
         })
     }
 

+ 128 - 123
src/components/ApplyUserInfo.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import {computed, onMounted, ref} from "vue";
+import {computed, ref} from "vue";
 import {DataCenter} from "../DataCenter.ts";
 import {Tools} from "../Tools.ts";
 import {LocalModels} from "../LocalModels.ts";
@@ -23,6 +23,10 @@ let diquOptions = ref([])
 let userName = ref("")
 let isMan = ref(true)
 let userNameCompt = ref()
+let disablePage = ref(false)
+let lastMsg = ref("")
+let subButtonDisabled = ref(false)
+let tipType = ref("danger")
 
 function range(min: number, max: number) {
   let result = []
@@ -90,150 +94,151 @@ function applyInfo() {
   request.born_sheng = shengfen.value
   request.born_shi = chengshi.value
   request.born_qu = diqu.value
-  Network.applyUserInfo(request, function () {
-    console.log("over")
+  subButtonDisabled.value = true
+  Network.applyUserInfo(request, function (rsp: LocalModels.BaseResponse) {
+    Tools.showMessage(rsp.msg)
+    lastMsg.value = rsp.msg
+    if (rsp.isSuccess()) {
+      tipType.value = "success"
+      disablePage.value = true
+    } else {
+      tipType.value = "danger"
+      disablePage.value = true
+    }
+    subButtonDisabled.value = false
   })
   //todo
 }
 
-function checkWxOpenId() {
-  if (DataCenter.wxOpenId == null) {
-    let uri = encodeURI("https://yixuefrp.cxhy.cn/test")
-    Tools.showMessage(uri)
-    let url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf01ec97b45a4bc49&redirect_uri=" + uri + "&response_type=code&scope=snsapi_base&state=999#wechat_redirect"
-    window.location.href = url
-  }
-}
-
-onMounted(function () {
-  checkWxOpenId()
-})
-
 </script>
 
 <template>
-  <!--姓名、性别-->
-  <el-row style="width: 100%">
-    <el-row align="middle" style="margin-top: 10px;">
-      <el-col :span="4">姓名</el-col>
-      <el-col :span="18">
-        <el-input ref="userNameCompt" v-model="userName"></el-input>
-      </el-col>
-    </el-row>
-    <el-row align="middle" style="margin-top: 10px;">
-      <el-col :span="4"></el-col>
-      <el-col :span="18" align="left">
-        <el-switch
-            v-model="isMan"
-            class="ml-2"
-            inline-prompt
-            size="large"
-            style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949; margin-right: 20px"
-            active-text="男"
-            inactive-text="女"
-        />
-      </el-col>
-    </el-row>
-  </el-row>
-
-  <el-row align="middle" style="margin-top: 10px">
-    <el-col :span="4"></el-col>
-    <el-col :span="18">
-      <el-space style="width: 100%">
-        <el-radio-group v-model="dateMode">
-          <el-radio v-for="(txt,index) in dateModeTexts" :value="index">{{ txt }}</el-radio>
-        </el-radio-group>
-      </el-space>
-    </el-col>
-  </el-row>
-
-  <!--新历-->
-  <el-row v-if="dateMode == 0" style="width: 100%;">
-    <el-row align="middle" style="margin-top: 10px;">
-      <el-col :span="4">年</el-col>
-      <el-col :span="18">
-        <el-select v-model="curYear" @change="resetMaxDay" style="">
-          <el-option v-for="opt in range(1900,2100)" :value="opt">{{ opt }}</el-option>
-        </el-select>
-      </el-col>
-    </el-row>
-    <el-row align="middle" style="margin-top: 10px">
-      <el-col :span="4">月</el-col>
-      <el-col :span="18">
-        <el-select v-model="curMonth" @change="resetMaxDay">
-          <el-option v-for="opt in range(1,12)" :value="opt">{{ opt }}</el-option>
-        </el-select>
-      </el-col>
-    </el-row>
-    <el-row align="middle" style="margin-top: 10px">
-      <el-col :span="4">日</el-col>
-      <el-col :span="18">
-        <el-select v-model="curDay">
-          <el-option v-for="opt in range(1,maxDay)" :value="opt">{{ opt }}</el-option>
-        </el-select>
-      </el-col>
+  <div v-if="!disablePage">
+    <!--姓名、性别-->
+    <el-row style="width: 100%">
+      <el-row align="middle" style="margin-top: 10px;">
+        <el-col :span="4">姓名</el-col>
+        <el-col :span="18">
+          <el-input ref="userNameCompt" v-model="userName"></el-input>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px;">
+        <el-col :span="4"></el-col>
+        <el-col :span="18" align="left">
+          <el-switch
+              v-model="isMan"
+              class="ml-2"
+              inline-prompt
+              size="large"
+              style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949; margin-right: 20px"
+              active-text="男"
+              inactive-text="女"
+          />
+        </el-col>
+      </el-row>
     </el-row>
     <el-row align="middle" style="margin-top: 10px">
       <el-col :span="4"></el-col>
       <el-col :span="18">
         <el-space style="width: 100%">
-          <el-radio-group v-model="knowTimeValue">
-            <el-radio v-for="(txt,index) in knowTimeTexts" :value="index">{{ txt }}</el-radio>
+          <el-radio-group v-model="dateMode">
+            <el-radio v-for="(txt,index) in dateModeTexts" :value="index">{{ txt }}</el-radio>
           </el-radio-group>
         </el-space>
       </el-col>
     </el-row>
-    <el-row align="middle" style="margin-top: 10px" v-if="knowTimeValue==0">
-      <el-col :span="4">时</el-col>
-      <el-col :span="18">
-        <el-select v-model="curHour">
-          <el-option v-for="opt in range(0,23)" :value="opt">{{ opt }}</el-option>
-        </el-select>
-      </el-col>
-    </el-row>
-    <el-row align="middle" style="margin-top: 10px" v-if="knowTimeValue==0">
-      <el-col :span="4">分</el-col>
-      <el-col :span="18">
-        <el-select v-model="curMin">
-          <el-option v-for="opt in range(0,59)" :value="opt">{{ opt }}</el-option>
-        </el-select>
-      </el-col>
-    </el-row>
-  </el-row>
 
-  <!--出生地-->
-  <el-row style="width: 100%; margin-top: 20px">
-    <el-row align="middle" style="margin-top: 10px">
-      <el-col :span="4">省份</el-col>
-      <el-col :span="18">
-        <el-select v-model="shengfen" @change="onShengFenSelected">
-          <el-option v-for="sheng in getShengFens" :value="sheng">{{ sheng }}</el-option>
-        </el-select>
-      </el-col>
+    <!--新历-->
+    <el-row v-if="dateMode == 0" style="width: 100%;">
+      <el-row align="middle" style="margin-top: 10px;">
+        <el-col :span="4">年</el-col>
+        <el-col :span="18">
+          <el-select v-model="curYear" @change="resetMaxDay" style="">
+            <el-option v-for="opt in range(1900,2100)" :value="opt">{{ opt }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px">
+        <el-col :span="4">月</el-col>
+        <el-col :span="18">
+          <el-select v-model="curMonth" @change="resetMaxDay">
+            <el-option v-for="opt in range(1,12)" :value="opt">{{ opt }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px">
+        <el-col :span="4">日</el-col>
+        <el-col :span="18">
+          <el-select v-model="curDay">
+            <el-option v-for="opt in range(1,maxDay)" :value="opt">{{ opt }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px">
+        <el-col :span="4"></el-col>
+        <el-col :span="18">
+          <el-space style="width: 100%">
+            <el-radio-group v-model="knowTimeValue">
+              <el-radio v-for="(txt,index) in knowTimeTexts" :value="index">{{ txt }}</el-radio>
+            </el-radio-group>
+          </el-space>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px" v-if="knowTimeValue==0">
+        <el-col :span="4">时</el-col>
+        <el-col :span="18">
+          <el-select v-model="curHour">
+            <el-option v-for="opt in range(0,23)" :value="opt">{{ opt }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px" v-if="knowTimeValue==0">
+        <el-col :span="4">分</el-col>
+        <el-col :span="18">
+          <el-select v-model="curMin">
+            <el-option v-for="opt in range(0,59)" :value="opt">{{ opt }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
     </el-row>
-    <el-row align="middle" style="margin-top: 10px">
-      <el-col :span="4">城市</el-col>
-      <el-col :span="18">
-        <el-select v-model="chengshi" @change="onChengShiSelected">
-          <el-option v-for="cs in chengshiOptions" :value="cs">{{ cs }}</el-option>
-        </el-select>
-      </el-col>
+    <!--出生地-->
+    <el-row style="width: 100%; margin-top: 20px">
+      <el-row align="middle" style="margin-top: 10px">
+        <el-col :span="4">省份</el-col>
+        <el-col :span="18">
+          <el-select v-model="shengfen" @change="onShengFenSelected">
+            <el-option v-for="sheng in getShengFens" :value="sheng">{{ sheng }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px">
+        <el-col :span="4">城市</el-col>
+        <el-col :span="18">
+          <el-select v-model="chengshi" @change="onChengShiSelected">
+            <el-option v-for="cs in chengshiOptions" :value="cs">{{ cs }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
+      <el-row align="middle" style="margin-top: 10px">
+        <el-col :span="4">地区</el-col>
+        <el-col :span="18">
+          <el-select v-model="diqu">
+            <el-option v-for="dq in diquOptions" :value="dq">{{ dq }}</el-option>
+          </el-select>
+        </el-col>
+      </el-row>
     </el-row>
-    <el-row align="middle" style="margin-top: 10px">
-      <el-col :span="4">地区</el-col>
-      <el-col :span="18">
-        <el-select v-model="diqu">
-          <el-option v-for="dq in diquOptions" :value="dq">{{ dq }}</el-option>
-        </el-select>
+
+    <el-row align="middle" style="margin-top: 20px">
+      <el-col :span="4"></el-col>
+      <el-col :span="18" align="left">
+        <el-button :disabled="subButtonDisabled" @click="applyInfo" type="primary">提交信息</el-button>
       </el-col>
     </el-row>
-  </el-row>
+  </div>
 
-  <el-row align="middle" style="margin-top: 20px">
-    <el-col :span="4"></el-col>
-    <el-col :span="18" align="left">
-      <el-button @click="applyInfo" type="primary">提交信息</el-button>
-    </el-col>
+  <el-row v-if="disablePage">
+    <el-text :type="tipType" style="font-size: 24px">{{ lastMsg }}</el-text>
   </el-row>
 </template>
 

Неке датотеке нису приказане због велике количине промена