描述:页面修改

This commit is contained in:
SelfRidicule 2024-03-09 14:24:42 +08:00
parent 7631ccedcd
commit e5b4f4eb40
7 changed files with 239 additions and 347 deletions

View File

@ -2,19 +2,19 @@ import {
request
} from '../selfRequest';
// 微信登录接口
export function companyRq(data) {
// 获取所有的企业
export function visitorListRq() {
return request({
url: '/api/visitor/list',
method: "get"
method: "get",
});
}
// 注册用户
export function registerPhone(data) {
// 获取企业下的所有用户
export function visitorSelectUserByCustomerRq(id) {
return request({
url: '/social_user_login/login',
method: "post",
data
url: '/api/visitor/selectUserByCustomer/' + id,
method: "get",
});
}

View File

@ -9,112 +9,6 @@ Page({
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
detail: {},
value: '',
companyShow: false,
usernameShow: false,
cardTypeShow: false,
arriveShow: false,
leaveShow: false,
submitSuccesShow: false,
companyColumns: ['公司1', '公司2', '公司3'],
columns: ['身份证', '护照', '通行证'],
fileList: [],
currentDate: new Date().getTime(),
/** 索引栏*/
indexList: ["A", "B", "C", "D"],
scrollTop: 0,
/** mock客户数据*/
customerList: [{
firstLetter: "A",
list: [{
code: "AB01",
name: "A1客户"
},
{
code: "AB02",
name: "A2客户"
},
{
code: "AB03",
name: "A3客户"
},
],
},
{
firstLetter: "B",
list: [{
code: "BB01",
name: "B1客户"
},
{
code: "BB02",
name: "B2客户"
},
{
code: "BB03",
name: "B3客户"
},
{
code: "BB04",
name: "B4客户"
},
],
},
{
firstLetter: "C",
list: [{
code: "CB01",
name: "C1客户"
},
{
code: "CB02",
name: "C2客户"
},
{
code: "CB03",
name: "C3客户"
},
{
code: "CB04",
name: "C4客户"
},
{
code: "CB05",
name: "C5客户"
},
],
},
{
firstLetter: "D",
list: [{
code: "DB01",
name: "D1客户"
},
{
code: "DB02",
name: "D2客户"
},
{
code: "DB03",
name: "D3客户"
},
{
code: "DB04",
name: "D4客户"
},
{
code: "DB05",
name: "D5客户"
},
{
code: "DB06",
name: "D6客户"
},
],
},
],
},
@ -122,157 +16,74 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('onLoad', options)
let _this = this;
_this.setData({
...options
})
// 页面初始化 options为页面跳转所带来的参数
wx.setNavigationBarTitle({
title: options.title
})
console.log('options.goods_id', options)
companyRq({}).then(res => {
console.log('res', res)
if (res.code == 0) {
// res.row
}
},
// 跳转-索引栏(单位、人员)
jumpIndexBar(e) {
console.log('jumpIndexBar', e);
let title = e.currentTarget.dataset.title
wx.navigateTo({
url: '/pages/meeting/visitorIinvitation/indexBar/indexBar?title=' + title,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
onPullDownRefresh: function () {
},
onChange(event) {
// event.detail 为当前输入的值
console.log(event.detail);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
onShareAppMessage: function () {
},
getUsernameHandle() {
// this.setData({
// usernameShow: true
// });
wx.navigateTo({
url: '/pages/meeting/visitorIinvitation/indexBar/indexBar'
})
},
getCompanyHandle() {
this.setData({
companyShow: true
});
},
getCardTypeHandle() {
this.setData({
cardTypeShow: true
});
},
changeHandler(e) {
console.log(e)
},
// confirmHandle(){
// },
confirmHandle() {
this.setData({
companyShow: false,
usernameShow: false,
cardTypeShow: false,
arriveShow: false,
leaveShow: false
});
},
cancelHandle() {
this.setData({
companyShow: false,
usernameShow: false,
cardTypeShow: false,
arriveShow: false,
leaveShow: false
});
},
getArriveHandle() {
this.setData({
arriveShow: true
});
},
getLeaveHandle() {
this.setData({
leaveShow: true
});
},
onClose() {
this.setData({
usernameShow: true
});
},
afterRead(event) {
const {
file
} = event.detail;
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
wx.uploadFile({
url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
filePath: file.url,
name: 'file',
formData: {
user: 'test'
},
success(res) {
// 上传完成需要更新 fileList
const {
fileList = []
} = this.data;
fileList.push({
...file,
url: res.data
});
this.setData({
fileList
});
},
});
},
onInput(event) {
this.setData({
currentDate: event.detail,
});
},
submitFormFn() {
this.setData({
submitSuccesShow: true,
});
},
submitDialogFn() {
this.setData({
submitSuccesShow: false,
});
setTimeout(() => {
wx.navigateTo({
url: '/pages/meeting/visitorIinvitation/appointmentRecord/appointmentRecord',
})
}, 10);
}
})

View File

@ -3,17 +3,17 @@
<view class="leftLineTitle">预约信息</view>
</view>
<view class="contentView">
<view class="rowView">
<view class="rowView" bind:tap="jumpIndexBar" data-title="单位">
<view class="label must">被访单位</view>
<van-field model:value="{{ }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" input-align="right" border="{{ false }}" bind:tap="getCompanyHandle" />
<van-field model:value="{{ }}" input-class="input" is-link readonly placeholder="请选择" input-align="right" border="{{ false }}"/>
</view>
<view class="rowView">
<view class="rowView" bind:tap="jumpIndexBar" data-title="人员">
<view class="label must">被访人姓名</view>
<van-field model:value="{{ value }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="getUsernameHandle" />
<van-field model:value="{{ value }}" input-class="input" is-link readonly placeholder="请选择" border="{{ false }}" input-align="right"/>
</view>
<view class="rowView">
<view class="label must">被访人电话</view>
<van-field model:value="{{ value }}" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
<van-field model:value="{{ value }}" is-link readonly input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" bind:tap="jumpPerson"/>
</view>
<view class="rowView">
<view class="label must">访客姓名</view>
@ -59,32 +59,4 @@
<!-- 提交 -->
<view class="submitBtnView" bind:click="submitFormFn">提交</view>
<!-- 被访单位弹框 -->
<van-popup show="{{ companyShow }}" round position="bottom">
<van-picker show-toolbar title="被访单位" columns="{{ companyColumns }}" bind:confirm="confirmHandle" bind:cancel="cancelHandle" bind:change="changeHandler" />
</van-popup>
<!-- 被访人姓名弹框 -->
<!-- <van-popup show="{{ usernameShow }}" round position="bottom" closeable custom-style="height: 100%;position:absolute" bind:close="onClose">
<van-index-bar index-list="{{ indexList }}" scroll-top="{{ scrollTop }}" z-index="2">
<van-index-anchor wx:for="{{customerList}}" wx:key="index" index="{{item.firstLetter}}" use-slot="{{true}}">
{{item.firstLetter}}
<van-cell wx:for="{{item.list}}" wx:key="index" data-id="{{item.code}}" data-name="{{item.name}}" title="{{item.name}}" bindtap="getCustomer" />
</van-index-anchor>
</van-index-bar>
</van-popup> -->
<!-- 身份证类型弹框 -->
<van-popup show="{{ cardTypeShow }}" round position="bottom">
<van-picker show-toolbar title="身份证类型" columns="{{ columns }}" bind:confirm="confirmHandle" bind:cancel="cancelHandle" />
</van-popup>
<!-- 到访时间选择弹框 -->
<van-popup show="{{ arriveShow }}" round position="bottom">
<van-datetime-picker type="datetime" value="{{ currentDate }}" bind:input="onInput" bind:confirm="confirmHandle" bind:cancel="cancelHandle" />
</van-popup>
<!-- 离开时间弹框 -->
<van-popup show="{{ arriveShow }}" round position="bottom">
<van-datetime-picker type="datetime" value="{{ currentDate }}" bind:input="onInput" bind:confirm="confirmHandle" bind:cancel="cancelHandle" />
</van-popup>
<!-- 提交成功弹框 -->
<van-dialog title="提交成功" show="{{ submitSuccesShow }}" confirm-button-color="#4187f2" bind:confirm="submitDialogFn" />
</view>

View File

@ -1,68 +1,178 @@
import {
visitorListRq,
visitorSelectUserByCustomerRq,
} from "../../../../api/meeting/visitorIinvitation.js"
Page({
data: {
type: "",
title: '',
/** 索引栏*/
indexList: ["A", "B", "C", "D"],
scrollTop: 0,
/** mock客户数据*/
customerList: [
{
firstLetter: "A",
list: [
{ code: "AB01", name: "A1客户" },
{ code: "AB02", name: "A2客户" },
{ code: "AB03", name: "A3客户" },
],
},
{
firstLetter: "B",
list: [
{ code: "BB01", name: "B1客户" },
{ code: "BB02", name: "B2客户" },
{ code: "BB03", name: "B3客户" },
{ code: "BB04", name: "B4客户" },
],
},
{
firstLetter: "C",
list: [
{ code: "CB01", name: "C1客户" },
{ code: "CB02", name: "C2客户" },
{ code: "CB03", name: "C3客户" },
{ code: "CB04", name: "C4客户" },
{ code: "CB05", name: "C5客户" },
],
},
{
firstLetter: "D",
list: [
{ code: "DB01", name: "D1客户" },
{ code: "DB02", name: "D2客户" },
{ code: "DB03", name: "D3客户" },
{ code: "DB04", name: "D4客户" },
{ code: "DB05", name: "D5客户" },
{ code: "DB06", name: "D6客户" },
],
},
],
indexList: [],
/** 数据*/
dataList: [],
},
//索引栏发生变化事件
onPageScroll(event) {
this.setData({
scrollTop: event.scrollTop,
});
},
/**选择客户发生事件 */
getCustomer: function (event) {
console.log(event.currentTarget.dataset.id);
console.log(event.currentTarget.dataset.name);
const value = event.currentTarget.dataset.name
if(value){
wx.reLaunch({
url: '/pages/meeting/visitorIinvitation/visitorIinvitation?name='+value,
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
_this.setData({
...options
})
wx.setNavigationBarTitle({
title: '请选择' + options.title,
})
//
//
if (_this.data.title == '单位') {
// 获取所有的企业
_this.getVisitorList()
}
if (_this.data.title == '人员') {
// 获取企业下的所有用户
_this.getVisitorSelectUserByCustomer()
}
},
});
// 获取所有的企业
getVisitorList() {
let _this = this;
visitorListRq().then(res => {
console.log('getVisitorList', res);
let filterDataList = res.rows.map(item => {
let otherData = JSON.stringify({
id: item.id,
name: item.name,
mailAddress: item.mailAddress,
})
return {
label: item.name,
value: item.id,
otherData
}
})
// 赋值并且格式化数据
_this.setAndFormatData(filterDataList)
})
},
// 获取企业下的所有用户
getVisitorSelectUserByCustomer() {
visitorSelectUserByCustomerRq().then(res => {
console.log('getVisitorSelectUserByCustomer', res);
})
},
// 格式化数据
setAndFormatData(transferList) {
let _this = this;
// 索引列
let indexList = _this.getFirstCharacterList(transferList)
// 对应每个索引的数据列表
let dataList = indexList.map(item => {
let title = item;
let collectList = [];
for (let i = 0; i < transferList.length; i++) {
let transferData = transferList[i];
if (title == transferData.label.substring(0, 1)) {
collectList.push(transferData)
}
}
return {
title,
list: collectList
}
})
_this.setData({
indexList,
dataList
})
},
// 获取第一个字符数组,不重复
getFirstCharacterList(list) {
let firstNameList = list.map(item => {
return {
name: item.label.substring(0, 1),
exist: false
}
});
for (let i = 0; i < firstNameList.length; i++) {
for (let j = i + 1; j < firstNameList.length; j++) {
// 已重复的数据直接跳过
if (firstNameList[j].exist) {
continue;
}
// 数据重复
if (firstNameList[i].name == firstNameList[j].name) {
firstNameList[j].exist = true;
}
}
}
return firstNameList.filter(item => !item.exist).map(item => item.name)
},
// 选择
selectClick(e) {
console.log('selectClick', e);
let label = e.currentTarget.dataset.label
let value = e.currentTarget.dataset.value
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,5 +1,5 @@
{
"navigationBarTitleText":"选择被访人姓名",
"navigationBarTitleText": "选择",
"usingComponents": {
"van-cell": "@vant/weapp/cell/index",
"van-index-bar": "@vant/weapp/index-bar/index",

View File

@ -1,6 +1,6 @@
<van-index-bar index-list="{{ indexList }}" scroll-top="{{ scrollTop }}">
<van-index-anchor wx:for="{{customerList}}" wx:key="index" index="{{item.firstLetter}}" use-slot="{{true}}">
{{item.firstLetter}}
<van-cell wx:for="{{item.list}}" wx:key="index" data-id="{{item.code}}" data-name="{{item.name}}" title="{{item.name}}" bindtap="getCustomer" />
</van-index-anchor>
<van-index-bar index-list="{{ indexList }}" highlight-color="#4e96f8">
<view wx:for="{{dataList}}" wx:key="*this" wx:for-item="indexData">
<van-index-anchor index="{{indexData.title}}"></van-index-anchor>
<van-cell title="{{data.label}}" wx:for="{{indexData.list}}" wx:key="*this" wx:for-item="data" data-label="{{data.label}}" data-otherData="{{data.otherData}}" bind:tap="selectClick" clickable/>
</view>
</van-index-bar>

View File

@ -1 +0,0 @@
/* pages/meeting/visitorIinvitation/indexBar/indexBar.wxss */