Commit 18538b5b authored by Facius's avatar Facius

improvement: 省份选择;首页notic

parent 6b2adf0a
...@@ -131,17 +131,19 @@ export default { ...@@ -131,17 +131,19 @@ export default {
var a1 = this.$u.random(0, 49) var a1 = this.$u.random(0, 49)
var a2 = this.$u.random(0, 49) var a2 = this.$u.random(0, 49)
var a3 = this.$u.random(0, 49) var a3 = this.$u.random(0, 49)
console.log(a0, a1, a2, a3, this.defaultUrl)
this.avatars = [ this.avatars = [
this.defaultUrl + a0 > 9 ? 'a' : 'a0' + a0 + '.png', this.defaultUrl + (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg',
this.defaultUrl + a1 > 9 ? 'a' : 'a0' + a1 + '.png', this.defaultUrl + (a1 > 9 ? 'a' : 'a0') + String(a1) + '.jpeg',
this.defaultUrl + a2 > 9 ? 'a' : 'a0' + a2 + '.png', this.defaultUrl + (a2 > 9 ? 'a' : 'a0') + String(a2) + '.jpeg',
this.defaultUrl + a3 > 9 ? 'a' : 'a0' + a3 + '.png', this.defaultUrl + (a3 > 9 ? 'a' : 'a0') + String(a3) + '.jpeg',
] ]
console.log('----avatars------', this.avatars)
// this.avatars = [ // this.avatars = [
// this.defaultUrl + 'xunzhang.png', // this.defaultUrl + 'xunzhang.jpeg',
// this.defaultUrl + 'xunzhang.png', // this.defaultUrl + 'xunzhang.jpeg',
// this.defaultUrl + 'xunzhang.png', // this.defaultUrl + 'xunzhang.jpeg',
// this.defaultUrl + 'xunzhang.png', // this.defaultUrl + 'xunzhang.jpeg',
// ] // ]
this.list = [this.noticeText] this.list = [this.noticeText]
setInterval(() => { setInterval(() => {
...@@ -164,9 +166,9 @@ export default { ...@@ -164,9 +166,9 @@ export default {
var a0 = this.$u.random(0, 49) var a0 = this.$u.random(0, 49)
this.avatars = [ this.avatars = [
...array, ...array,
this.defaultUrl + a0 > 9 ? 'a' : 'a0' + a0 + '.png', this.defaultUrl + a0 > 9 ? 'a' : 'a0' + a0 + '.jpeg',
] ]
// this.avatars = [...array, this.defaultUrl + 'xunzhang.png'] // this.avatars = [...array, this.defaultUrl + 'xunzhang.jpeg']
console.log(this.avatars.length) console.log(this.avatars.length)
this.list = [this.noticeText] this.list = [this.noticeText]
......
...@@ -36,16 +36,33 @@ ...@@ -36,16 +36,33 @@
<text class="rea-title-view">包括区域</text> <text class="rea-title-view">包括区域</text>
<text>请确认与所在考试省份一致</text> <text>请确认与所在考试省份一致</text>
</view> </view>
<view class="select-area"> <picker
@change="handleConform"
range-key="label"
:value="index"
:range="range"
>
<view class="select-area">
<view @click="handleClickArea" class="area-text-view">
<text>{{ currentProvince.label }}</text>
<u-icon name="arrow-down"></u-icon>
</view>
<view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
</view>
</picker>
<!-- <view class="select-area">
<view @click="handleClickArea" class="area-text-view"> <view @click="handleClickArea" class="area-text-view">
<text>{{ selectedProvince.label }}</text> <text>{{ currentProvince.label }}</text>
<u-icon name="arrow-down"></u-icon> <u-icon name="arrow-down"></u-icon>
</view> </view>
<view class="loading-view" v-if="loading"> <view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading> <u-loading mode="flower"></u-loading>
</view> </view>
<u-picker <u-picker
mode="region" mode="selector"
:range="range"
v-model="show" v-model="show"
:params="params" :params="params"
safe-area-inset-bottom safe-area-inset-bottom
...@@ -54,7 +71,7 @@ ...@@ -54,7 +71,7 @@
:default-region="defaultRegion" :default-region="defaultRegion"
@confirm="handleConform" @confirm="handleConform"
></u-picker> ></u-picker>
</view> </view> -->
</view> </view>
<view class="bottom-view"> <view class="bottom-view">
<u-button <u-button
...@@ -106,9 +123,11 @@ export default { ...@@ -106,9 +123,11 @@ export default {
{ id: '1', name: '初训(初次考试)', selected: false }, { id: '1', name: '初训(初次考试)', selected: false },
{ id: '2', name: '复训(年审或换证)', selected: false }, { id: '2', name: '复训(年审或换证)', selected: false },
], ],
selectedProvince: { label: '北京市', value: 11 }, currentProvince: { label: '北京市' },
loading: true, loading: true,
showPop: false, showPop: false,
range: [],
index: 0,
} }
}, },
computed: { computed: {
...@@ -120,9 +139,6 @@ export default { ...@@ -120,9 +139,6 @@ export default {
province: true, province: true,
} }
}, },
defaultRegion() {
return [this.selectedProvince.label]
},
buttonStyle() { buttonStyle() {
return this.buttonDisabled return this.buttonDisabled
? { ? {
...@@ -141,7 +157,7 @@ export default { ...@@ -141,7 +157,7 @@ export default {
} }
}, },
buttonDisabled() { buttonDisabled() {
return !(this.selectedProvince.label && this.selectedTypeId) return !(this.currentProvince.label && this.selectedTypeId)
}, },
selectedType() { selectedType() {
for (var item of this.types) { for (var item of this.types) {
...@@ -181,8 +197,8 @@ export default { ...@@ -181,8 +197,8 @@ export default {
} }
}, },
handleConform(e) { handleConform(e) {
console.log(e) this.index = e.detail.value
this.selectedProvince = e.province this.currentProvince = this.range[this.index]
}, },
getLocation() { getLocation() {
this.loading = true this.loading = true
...@@ -202,35 +218,35 @@ export default { ...@@ -202,35 +218,35 @@ export default {
async getProvinceList() { async getProvinceList() {
let res = await this.$u.api.getProvinceList() let res = await this.$u.api.getProvinceList()
console.log(res) console.log(res)
this.range = res
}, },
async handleClickSubmit() { async handleClickSubmit() {
if (this.buttonDisabled) return if (this.buttonDisabled) return
if (this.index == 0) {
this.changeIndex()
}
let param = { let param = {
provinceId: this.selectedProvince.value, provinceId: this.range[this.index].id,
type: this.selectedTypeId, type: this.selectedTypeId,
} }
let res = await this.$u.api.getQuestionWarehouse(this.category.id, param) let res = await this.$u.api.getQuestionWarehouse(this.category.id, param)
this.setPageInfo(res) this.setPageInfo(res[0])
this.showPop = false this.showPop = false
uni.switchTab({ uni.switchTab({
url: '/pages/index/index', url: '/pages/index/index',
}) })
},
console.log(res) changeIndex() {
return for (var i = 0; i < this.range.length; i++) {
var selected = { if (
key: 0, this.currentProvince.label == this.range[i].fullName ||
name: 'abc', this.currentProvince.label == this.range[i].label
location: 'aaa题', ) {
count: '899', this.index = i
pass: '96%', break
}
} }
selected.free = true
this.setPageInfo(selected)
this.showPop = false
uni.switchTab({
url: '/pages/index/index',
})
}, },
baiduLocation(long, lat) { baiduLocation(long, lat) {
let a = this, let a = this,
...@@ -238,8 +254,9 @@ export default { ...@@ -238,8 +254,9 @@ export default {
let t = { let t = {
success: function(res) { success: function(res) {
let e = res.originalData.result let e = res.originalData.result
a.selectedProvince.label = e.addressComponent.province a.currentProvince.label = e.addressComponent.province
a.loading = false a.loading = false
a.changeIndex()
}, },
fail: function(a) { fail: function(a) {
a.loading = false a.loading = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment