浏览代码

教学视频添加区县级

JXDS18FUJT 1 年之前
父节点
当前提交
7aa387add9
共有 4 个文件被更改,包括 142 次插入41 次删除
  1. 7 0
      src/api/modules/exam.js
  2. 3 0
      src/manifest.json
  3. 130 41
      src/otherPages/examRoadVideo/index.vue
  4. 2 0
      src/pages/carVideo/index.vue

+ 7 - 0
src/api/modules/exam.js

@@ -273,6 +273,13 @@ const exam = {
 		})
 
 	},
+	//根据城市获取区县
+	studentExamInfoCountyCityId(cityId){
+		return request({
+			url: `student/exam/info/county/${cityId}`,
+			method: "get"
+		})
+	},
 	//根据ip获取你的大致位置
 	studentExamInfoIp() {
 		return request({

+ 3 - 0
src/manifest.json

@@ -20,6 +20,9 @@
     },
     "usingComponents": true,
     "permission": {
+      "scope.userFuzzyLocation":{
+        "desc":"考场推荐定位请求"
+      },
       "scope.userLocation": {
         "desc": "获取位置可以更好地推荐区域信息"
       }

+ 130 - 41
src/otherPages/examRoadVideo/index.vue

@@ -33,6 +33,17 @@
             class="header-city"
             type="text"
           />
+
+          <input
+            disabled
+            readonly
+            @click="isShowCounty()"
+            v-model="county.county"
+            placeholder="区"
+            class="header-area"
+            type="text"
+          />
+          <!-- header-area -->
         </view>
       </view>
       <van-popup round position="bottom" :show="provinceShow">
@@ -63,6 +74,21 @@
           "
         />
       </van-popup>
+
+      <van-popup round position="bottom" :show="countyShow">
+        <van-picker
+          show-toolbar
+          title="考场区县"
+          :columns="examCountyList"
+          value-key="county"
+          @confirm="getCountyName"
+          @cancel="
+            () => {
+              countyShow = false;
+            }
+          "
+        />
+      </van-popup>
     </view>
     <view class="content">
       <view class="list">
@@ -107,8 +133,10 @@ export default {
       query: {},
       cityShow: false,
       provinceShow: false,
+      countyShow: false,
       examProviceList: [],
       examCityList: [],
+      examCountyList: [],
       examRoomList: [],
       province: {
         provinceId: "",
@@ -118,11 +146,26 @@ export default {
         cityId: "",
         city: "",
       },
+      county: {
+        county: "",
+      },
     };
   },
   methods: {
     searchRoadExamRoom(e) {
       console.log(e.detail);
+      //初始化选项
+      this.province = {
+        provinceId: "",
+        province: "",
+      };
+      this.city = {
+        cityId: "",
+        city: "",
+      };
+      this.county = {
+        county: "",
+      };
       api.exam
         .studentExamInfoList({
           name: e.detail,
@@ -150,6 +193,16 @@ export default {
         });
       }
     },
+    isShowCounty() {
+      if (this.city.cityId && this.city.city) {
+        this.countyShow = true;
+      } else {
+        uni.showToast({
+          title: "请先选择城市",
+          icon: "none",
+        });
+      }
+    },
     goCourseCatalog(item) {
       uni.navigateTo({
         url:
@@ -163,6 +216,16 @@ export default {
       this.city = e.detail.value;
       uni.setStorageSync("roadExamCity", e.detail.value);
       this.cityShow = false;
+      //清空选项
+      this.county = {
+        county: "",
+      };
+      //获取区县
+      api.exam
+        .studentExamInfoCountyCityId(e.detail.value.cityId)
+        .then((res) => {
+          this.examCountyList = res.data;
+        });
       api.exam
         .studentExamInfoList({
           ...this.city,
@@ -171,6 +234,19 @@ export default {
           this.examRoomList = res.rows;
         });
     },
+    getCountyName(e) {
+      this.county = e.detail.value;
+      uni.setStorageSync("roadExamCounty", e.detail.value);
+      this.countyShow = false;
+
+      api.exam
+        .studentExamInfoList({
+          ...this.county,
+        })
+        .then((res) => {
+          this.examRoomList = res.rows;
+        });
+    },
     getExamCityAndProviceName(e) {
       this.provinceShow = false;
       this.province = e.detail.value;
@@ -178,6 +254,9 @@ export default {
         cityId: "",
         city: "",
       };
+      this.county = {
+        county: "",
+      };
       uni.setStorageSync("roadExamProvince", e.detail.value);
       api.exam
         .studentExamInfoCityProviceId(e.detail.value.provinceId)
@@ -218,46 +297,47 @@ export default {
               city: result.data.city,
               cityId: result.data.cityCode,
             };
-            if (that.city.cityId && that.province.provinceId) {
-              api.exam.studentExamInfoGetProvice().then((res) => {
-                that.examProviceList = res.data;
-                if (
-                  that.examProviceList.some((item) => {
-                    return that.province.province == item.province;
-                  })
-                ) {
-                  api.exam
-                    .studentExamInfoCityProviceId(that.province.provinceId)
-                    .then((res) => {
-                      that.examCityList = res.data;
+            that.county = { county: result.data.county };
 
-                      api.exam
-                        .studentExamInfoList({
-                          ...that.city,
-                        })
-                        .then((res) => {
-                          that.examRoomList = res.rows;
-                        });
-                    });
-                } else {
-                  that.city = {
-                    city: "",
-                    cityId: "",
-                  };
-                  that.province = {
-                    province: "",
-                    provinceId: "",
-                  };
-                  api.exam
-                    .studentExamInfoList({
-                      ...that.city,
-                    })
-                    .then((res) => {
-                      that.examRoomList = res.rows;
-                    });
-                }
-              });
-            }
+            api.exam.studentExamInfoGetProvice().then((res) => {
+              that.examProviceList = res.data;
+              if (
+                that.examProviceList.some((item) => {
+                  return that.province.province == item.province;
+                })
+              ) {
+                api.exam
+                  .studentExamInfoCityProviceId(that.province.provinceId)
+                  .then((res) => {
+                    that.examCityList = res.data;
+
+                    api.exam
+                      .studentExamInfoList({
+                        ...that.city,
+                      })
+                      .then((res) => {
+                        that.examRoomList = res.rows;
+                      });
+                  });
+              } else {
+                that.city = {
+                  city: "",
+                  cityId: "",
+                };
+                that.province = {
+                  province: "",
+                  provinceId: "",
+                };
+                that.county = { county: "" };
+                api.exam
+                  .studentExamInfoList({
+                    ...that.city,
+                  })
+                  .then((res) => {
+                    that.examRoomList = res.rows;
+                  });
+              }
+            });
           });
       },
       fail(res) {
@@ -320,7 +400,7 @@ export default {
     height: 100rpx;
   }
   .header-province {
-    width: 336rpx;
+    width: 210rpx;
     height: 60rpx;
     background: #fff;
     border-radius: 40rpx;
@@ -329,7 +409,16 @@ export default {
     box-sizing: border-box;
   }
   .header-city {
-    width: 336rpx;
+    width: 210rpx;
+    height: 60rpx;
+    background: #fff;
+    border-radius: 40rpx;
+    font-size: 26rpx;
+    padding-left: 30rpx;
+    box-sizing: border-box;
+  }
+  .header-area {
+    width: 210rpx;
     height: 60rpx;
     background: #fff;
     border-radius: 40rpx;

+ 2 - 0
src/pages/carVideo/index.vue

@@ -88,6 +88,8 @@
     <!-- #ifdef MP-WEIXIN-->
     <!-- (废弃) -->
     <!-- <view class="tab">
+
+      
       <van-tabs animated class="custom-tabs " :active="active" id="tabs" @change="changeSubject" :sticky="true">
         <van-tab class="uni-app-fontsize-paragraph" v-if="xcx_video_open" title="教学视频">
           <subjectVideoSelect></subjectVideoSelect>