feat(info): 获取岗位数据并渲染

This commit is contained in:
huangzijian 2020-10-24 02:55:03 +08:00
parent c2f4f0b106
commit 836b2f14dd
No known key found for this signature in database
GPG Key ID: 437D4F23D11788BA
5 changed files with 67 additions and 37 deletions

View File

@ -1,7 +1,7 @@
/*
* @Author: Lamdaer
* @Date: 2020-10-24 01:54:38
* @LastEditTime: 2020-10-24 02:06:25
* @LastEditTime: 2020-10-24 02:41:40
* @Description:
* @FilePath: /opengauss/components/info/index.js
*/
@ -19,10 +19,19 @@ Component({
/**
* 组件的初始数据
*/
data: {},
data: {
index: null,
},
/**
* 组件的方法列表
*/
methods: {},
methods: {
jobChange(e) {
console.log(e)
this.setData({
index: e.detail.value,
})
},
},
})

View File

@ -1,9 +1,13 @@
<!--components/info/index.wxml-->
<!-- components/info/index.wxml -->
<view class="cu-form-group margin-top">
<view class="title">普通选择</view>
<picker bindchange="PickerChange" value="{{index}}" range="{{picker}}">
<view class="picker">
{{index?picker[index]:'禁止换行,超出容器部分会以 ... 方式截断'}}
</view>
<view class="title">岗位</view>
<picker bindchange="jobChange" value="{{index}}" range="{{jobList}}" range-key="name">
<view class="picker">{{index?jobList[index].name:"请选择岗位"}}</view>
</picker>
</view>
</view>
<view class="cu-form-group">
<view class="title">多列选择</view>
<picker mode="multiSelector" bindchange="MultiChange" bindcolumnchange="MultiColumnChange" value="{{multiIndex}}" range="{{multiArray}}">
<view class="picker">{{multiArray[0][multiIndex[0]]}}{{multiArray[1][multiIndex[1]]}}</view>
</picker>
</view>

15
model/job.js Normal file
View File

@ -0,0 +1,15 @@
/*
* @Author: Lamdaer
* @Date: 2020-10-24 02:18:15
* @LastEditTime: 2020-10-24 02:30:08
* @Description:
* @FilePath: /opengauss/model/job.js
*/
import { HTTP } from '../utils/http'
export class JobModel extends HTTP {
getJobList() {
return this.request({
url: '/gauss/job',
})
}
}

View File

@ -1,66 +1,68 @@
/*
* @Author: Lamdaer
* @Date: 2020-10-24 01:58:20
* @LastEditTime: 2020-10-24 02:53:00
* @Description:
* @FilePath: /opengauss/pages/index/index.js
*/
// pages/index/index.js
import { JobModel } from '../../model/job'
const jobModel = new JobModel()
Page({
getJobList() {
jobModel.getJobList().then((response) => {
this.setData({
jobList: response.data.jobList,
})
console.log(response)
})
},
/**
* 页面的初始数据
*/
data: {
jobList: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getJobList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
onShareAppMessage: function () {},
})

View File

@ -1,2 +1,2 @@
<!--pages/index/index.wxml-->
<l-info></l-info>
<!-- pages/index/index.wxml -->
<l-info jobList="{{jobList}}"></l-info>