瀏覽代碼

真实姓名接口有问题

zhangyujun 3 年之前
父節點
當前提交
b6ffce0fc3
共有 5 個文件被更改,包括 38 次插入8 次删除
  1. 2 1
      src/api/index.ts
  2. 12 0
      src/api/modules/user.ts
  3. 6 1
      src/store/index.ts
  4. 17 5
      src/views/mockTest/components/initMockTest.vue
  5. 1 1
      vite.config.ts

+ 2 - 1
src/api/index.ts

@@ -7,4 +7,5 @@ export * from "./modules/collectionAndWrong";
 export * from "./modules/branch";
 export * from "./modules/cashOut";
 export * from "./modules/lighting";
-export * from "./modules/openApi";
+export * from "./modules/openApi";
+export * from "./modules/user";

+ 12 - 0
src/api/modules/user.ts

@@ -7,4 +7,16 @@ class User {
 			url: "/student/user/info",
 		});
 	}
+
+}
+
+export function studentUserRealname(data: {
+	realName: string
+}) {
+	return request({
+		url: "/student/user/realname",
+		method: "put",
+		data
+	});
+
 }

+ 6 - 1
src/store/index.ts

@@ -7,7 +7,8 @@ const store = createStore({
   state: () => ({
     token: "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjllNTU3NDk1LWQyOGQtNDMyNy1hYTBjLTdjOTk2OTk5NTk1YiJ9.GvGgys5erlFYJMLEhk2S1e7W_9CKDJohfXfW8fZpitkpZ8RWni5u9VvTGjl8dhD1916s-4MTM_7TsNaTNwsuPg",
     userData: {
-      schoolName: ""
+      schoolName: "",
+      realName: ""
     },
     lightAudio: null,
     lightConfig: {
@@ -31,6 +32,10 @@ const store = createStore({
     getSchoolName(state) {
       return state.userData.schoolName
 
+    },
+    getRealName(state) {
+      return state.userData.realName
+
     },
     getCarType(state) {
       return state.carType;

+ 17 - 5
src/views/mockTest/components/initMockTest.vue

@@ -27,7 +27,7 @@
 		<div class="class">
 			<span>学员姓名</span>
 			<span>
-				<input class="class-input" password="您的名字(选填)" type="text">
+				<input v-model="realName" class="class-input" password="您的名字(选填)" type="text" />
 			</span>
 		</div>
 		<div class="remind">答题后不可修改,累计错题扣分导致分数不及格时,系统自动交卷,考试不通过。</div>
@@ -40,9 +40,22 @@ import { useRoute } from "vue-router";
 </script>
 
 <script lang="ts" setup>
-import { defineEmits } from "vue";
+import { defineEmits, ref } from "vue";
+import { studentUserRealname } from "@/api/index";
+import { useStore } from "vuex";
 const emits = defineEmits(["next"]);
-const gotoNextPage = () => void emits("next");
+let realName = ref("");
+const store = useStore()
+realName.value = store.getters.getRealName||""
+const gotoNextPage = () => {
+	if (realName.value&&store.getters.getRealName!==realName.value) {
+		studentUserRealname({
+			realName: realName.value,
+		}).then((res) => {});
+	}
+
+	emits("next");
+};
 const { query } = useRoute();
 </script>
 
@@ -77,13 +90,12 @@ const { query } = useRoute();
 		font-weight: 400;
 	}
 }
-.class-input{
+.class-input {
 	width: 100px;
 	border: none;
 	background: #e2e2e2;
 	border-radius: 15px;
 	padding-left: 8px;
-
 }
 .content {
 	width: 345px;

+ 1 - 1
vite.config.ts

@@ -30,7 +30,7 @@ export default defineConfig({
 		},
 		proxy: {
 			"/dev-api": {
-				target: "https://jpcj-admin1.zzxcx.net/twzd-admin",
+				target: "https://jpcj-admin.zzxcx.net/twzd-admin",
 				changeOrigin: true,
 				rewrite: (path) => path.replace(/^\/dev-api/, ""),
 			},