diff --git a/manifest.json b/manifest.json index e604980..79ac111 100644 --- a/manifest.json +++ b/manifest.json @@ -12,10 +12,10 @@ "src" : "图片路径" } ], - "versionName" : "1.0.40", - "versionCode" : 1040, + "versionName" : "1.0.42", + "versionCode" : 1042, "app-plus" : { - "nvueCompiler" : "weex", + "nvueCompiler" : "uni-app", "compatible" : { "ignoreVersion" : true }, diff --git a/pages.json b/pages.json index cad4a0d..2bf722c 100644 --- a/pages.json +++ b/pages.json @@ -3,6 +3,12 @@ // "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" // }, "pages": [ + { + "path": "pages/peanut/home", + "style": { + "navigationBarTitleText": "首页" + } + }, { "path": "pages/user/login", "style": { @@ -10,12 +16,6 @@ "enablePullDownRefresh": false // 禁止下拉刷新 } }, - { - "path": "pages/peanut/home", - "style": { - "navigationBarTitleText": "首页" - } - }, { "path": "pages/mine/vip/index", "style": { diff --git a/pages/course/index.vue b/pages/course/index.vue index 1c313ae..32b40b6 100644 --- a/pages/course/index.vue +++ b/pages/course/index.vue @@ -2,7 +2,19 @@ - 课程说明 + + + 课程说明 + + + + + {{countryText}} + + + {{item.title}} {{item.des}} - 进入测试 + + 进入测试 + + 进入测试 - @@ -104,7 +118,16 @@ export default { page: 1, flag: true, // 函数是否执行完 //心身量表 - formList: [] + formList: [], + //选择城市弹窗 + cityList: [], + isPicker: false, + countries: [], + multiArray: [[], []], + value: [0, 0], + selectedData: {}, //城市 + countryIndex: 0, //抑郁症文字区分国家展示 + countryText: '' }; }, //第一次加载 @@ -119,6 +142,20 @@ export default { if(this.tagId=='71'){ this.getFormList(); } + + //显示城市数据 + this.getCityList(); + let countryData = uni.getStorageSync('countryData'); + let text= ''; + if(countryData&&countryData.country){ + text = countryData.country + if(countryData.city){ + text = text + countryData.city + } + }else{ + text= '城市'; + } + this.countryText = text; }, onPageScroll(e) { this.scrollTop = e.scrollTop; @@ -157,6 +194,119 @@ export default { }, //方法 methods: { + //获取国家-一级 + getCountryList() { + $http.request({ + url: "common/baseArea/getAllBaseArea", + method: "POST", + data: {}, + header: { + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + this.countries = res.baseAreas; + this.countries.forEach((country, index)=>{ + if(country.code=='86'){ + this.countries[index].cities = this.cityList; + } + }) + + //初始化 picker 数据 + this.initPickerData(); + } + }).catch(e => { + + }); + }, + //获取城市-二级 + getCityList() { + $http.request({ + url: "common/province/getProvinceList", + method: "POST", + data: {}, + header: { + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + const newCityList = res.provinceList.map( city => { + return city.provName; + }); + this.cityList = newCityList; + this.getCountryList(); + } + }).catch(e => { + + }); + }, + //展示城市数据 + initPickerData() { + //第一列是国家名 + const countryNames = this.countries.map(item => item.title); + this.multiArray[0] = countryNames; + //默认选择中国,并加载其省份 + if (this.countries[0].cities&&this.value[0]==0) { //如果默认显示的是第一个-中国,则显示城市列 + this.multiArray[1] = Object.keys(this.countries[0].cities).map(key => this.countries[0].cities[key]); + } else { + this.multiArray[1] = []; + } + //强制更新视图 + this.$set(this, 'multiArray', [...this.multiArray]); + }, + //picker修改值 + bindMultiPickerChange(e) { + this.value = e.detail.value; + this.updateCurrentSelection(); + }, + //修改动作 + bindMultiPickerColumnChange(e) { + let data = { + multiArray: this.multiArray, + value: this.value + }; + if (e.detail.column === 0) { + // 如果是第一列(国家)改变了,则需要更新第二列(城市) + const selectedCountry = this.countries[e.detail.value]; + if (selectedCountry.cities) { + // 如果选择了中国,加载省份 + data.multiArray[1] = Object.keys(selectedCountry.cities).map(key => selectedCountry.cities[key]); + data.value = [e.detail.value, 0]; + } else { + // 否则清空第二列 + data.multiArray[1] = []; + data.value = [e.detail.value, 0]; + } + } + + this.$set(this, 'multiArray', [...data.multiArray]); + this.value = data.value; + }, + updateCurrentSelection() { + const countryIndex = this.value[0]; + this.countryIndex = countryIndex; //判断抑郁结果 标准的定义文字显示 + const cityIndex = this.value[1]; + const selectedCountry = this.multiArray[0][countryIndex]; + const selectedCity = this.multiArray[1][cityIndex]; + + this.selectedData = { + country: selectedCountry + } + this.countryText = selectedCountry; + if(selectedCity){ + this.selectedData.city = selectedCity; + this.countryText = selectedCountry + selectedCity; + }else{ + this.selectedData.city = '' + } + uni.setStorageSync('countryData', this.selectedData) + }, + //点击地理位置修改城市 + changeCountry(){ + this.initPickerData(); + }, handleBack(){ uni.setStorageSync('fixed',true) }, @@ -339,7 +489,7 @@ export default { padding: 0 20rpx; } - .curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;} + .curseSet{margin-right: 12rpx; font-size: 28rpx; display: flex; align-items: center;} .fixed { position: fixed; z-index: 1; width: 100%; background-color: #fff; @@ -514,4 +664,56 @@ export default { background: #258feb; border-radius: 10rpx; } + + .popup_mark{ + width: 100%; + height: 100%; + background: #000; + opacity: 0.5; + position: fixed; + top: 0; + left: 0; + z-index: 99; + } + .popup_block{ + width: 580rpx; + height: 360rpx; + position: fixed; + top: 50%; + left: 50%; + margin-top: -180rpx; + margin-left: -290rpx; + background: #fff; + z-index: 999; + border-radius: 5px; + } + .popup_title{ + display: block; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; + color: #333; + text-align: center; + border-bottom: 1rpx solid #f0f0f0; + } + .popup_con{ + font-size: 28rpx; + padding-top: 50rpx; + text-align: center; + } + .popup_picker{ + position: absolute; + bottom: 0; + width: 100%; + } + .scale_btn{ + width: 100%; + height: 80rpx; + line-height: 80rpx; + color: #fff; + font-size: 28rpx; + background: #258feb; + border: none; + border-radius: 0 0 5px 5px; + } \ No newline at end of file diff --git a/pages/course/scale.vue b/pages/course/scale.vue index 39da755..684aca1 100644 --- a/pages/course/scale.vue +++ b/pages/course/scale.vue @@ -8,11 +8,7 @@ 题目数量:{{data.num}} 测试说明:{{data.tip}} - - - - 进入测试 - + 进入测试 @@ -29,7 +25,7 @@ {{data.title}}-测试结果 {{resultTotal}}分 {{resultContent}} - 回到首页 + 回到测试页 结果解释: @@ -74,117 +70,13 @@ export default { name: item, value: index+1 })); - this.getCityList(); this.getTestData(); //radioHeight this.radioHeight = this.checkList.length*42 +20; }, methods: { - //获取国家-一级 - getCountryList() { - $http.request({ - url: "common/baseArea/getAllBaseArea", - method: "POST", - data: {}, - header: { - 'Content-Type': 'application/json' - }, - }) - .then(res => { - if (res.code == 0) { - this.countries = res.baseAreas; - this.countries.forEach((country, index)=>{ - if(country.code=='86'){ - this.countries[index].cities = this.cityList; - } - }) - - //初始化 picker 数据 - this.initPickerData(); - } - }).catch(e => { - - }); - }, - //获取城市-二级 - getCityList() { - $http.request({ - url: "common/province/getProvinceList", - method: "POST", - data: {}, - header: { - 'Content-Type': 'application/json' - }, - }) - .then(res => { - if (res.code == 0) { - const newCityList = res.provinceList.map( city => { - return city.provName; - }); - this.cityList = newCityList; - this.getCountryList(); - } - }).catch(e => { - - }); - }, - //展示城市数据 - initPickerData() { - //第一列是国家名 - const countryNames = this.countries.map(item => item.title); - this.multiArray[0] = countryNames; - //默认选择中国,并加载其省份 - if (this.countries[0].cities) { - this.multiArray[1] = Object.keys(this.countries[0].cities).map(key => this.countries[0].cities[key]); - } else { - this.multiArray[1] = []; - } - }, - //picker修改值 - bindMultiPickerChange(e) { - this.value = e.detail.value; - this.updateCurrentSelection(); - }, - //修改动作 - bindMultiPickerColumnChange(e) { - let data = { - multiArray: this.multiArray, - value: this.value - }; - - if (e.detail.column === 0) { - // 如果是第一列(国家)改变了,则需要更新第二列(城市) - const selectedCountry = this.countries[e.detail.value]; - if (selectedCountry.cities) { - // 如果选择了中国,加载省份 - data.multiArray[1] = Object.keys(selectedCountry.cities).map(key => selectedCountry.cities[key]); - data.value = [e.detail.value, 0]; - } else { - // 否则清空第二列 - data.multiArray[1] = []; - data.value = [e.detail.value, 0]; - } - } - - this.multiArray = data.multiArray; - this.value = data.value; - //this.updateCurrentSelection(); - }, - updateCurrentSelection() { - const countryIndex = this.value[0]; - this.countryIndex = countryIndex; //判断抑郁结果 标准的定义文字显示 - const cityIndex = this.value[1]; - const selectedCountry = this.multiArray[0][countryIndex]; - const selectedCity = this.multiArray[1][cityIndex]; - - this.selectedData = { - country: selectedCountry - } - if(selectedCity){ - this.selectedData.city = selectedCity - }else{ - this.selectedData.city = '' - } + //开始测试 + startTest(){ //切换界面,进入测试 this.status = 1; this.title = '开始测试题'; @@ -265,10 +157,9 @@ export default { }, //回到首页 back(){ - uni.switchTab({ - url: '/pages/peanut/home' + uni.navigateBack({ + delta: 1 }) - uni.setStorageSync('fixed',true) } } }; @@ -306,8 +197,8 @@ export default { padding: 5rpx 0; } .scale_btn{ - width: 500rpx; - height: 70rpx; + width: 80%; + height: 85rpx; margin: 60rpx auto 0; color: #fff; font-size: 30rpx; diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index cd8a877..fa4ba69 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -502,7 +502,6 @@ }, }) .then(async (res) => { - console.log("res at line 615:", res); if (res.code == 0 && res.list && res.list.length > 0) { this.advertisementList = res.list; diff --git a/unpackage/wumen20241101103101.wgt b/unpackage/wumen20241101103101.wgt deleted file mode 100644 index b5c0cae..0000000 Binary files a/unpackage/wumen20241101103101.wgt and /dev/null differ