二维码生成页面中心icon没了的bug

一次大型分包更新生产了
合作企业路由
/packageQr/pages/partnership/partnership

员工管理路由
/packageStaff/pages/staff/List/List

油站二维码路由
/packageQr/pages/qrsite/QrCode_xy

加油订单路由改成
/packageOrders/pages/orderList/orderList
This commit is contained in:
xk_guohonglei
2021-01-22 17:19:34 +08:00
parent f1210f1a44
commit d2949e657a
46 changed files with 346 additions and 355 deletions

61
packageStaff/api/staff.js Normal file
View File

@@ -0,0 +1,61 @@
import request from '@/utils/request'
const service_name = "user-service"
const group_name = "oilUser"
const system_name = "systemMenu"
export default {
// 添加用户
addOilUser(data) {
return request({
url: `/${service_name}/${group_name}/addOilSiteUser`,
method: 'post',
data: data
})
},
// 删除用户
unbindingUser(data) {
return request({
url: `/${service_name}/${group_name}/unbindingUser`,
method: 'put',
data:data
})
},
// 更新用户
updateUser(data) {
return request({
url: `/${service_name}/${group_name}/update`,
method: 'put',
data: data
})
},
// 根据用户id查询用户信息
findUserAuthById(id) {
return request({
url: `/${service_name}/${group_name}/findUserAuthById/${id}`,
method: 'get'
})
},
// 员工列表
getByPage(data) {
return request({
url: `/${service_name}/${group_name}/getByPage`,
method: 'post',
data: data
})
},
// 用户已有权限
getCloudSiteAuth(id) {
return request({
url: `/${service_name}/${system_name}/getCloudSiteAuth/${id}`,
method: 'get'
})
},
// 获取云站全部菜单
getOilSiteAllMenu(data) {
return request({
url: `/${service_name}/${system_name}/getOilSiteAllMenu`,
method: 'get',
data: data
})
},
}

View File

@@ -0,0 +1,73 @@
<template>
<view class="cu-item">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'">
<!-- {{staff.cUserName.substring(-1)}} -->
</view>
<!-- <view class="cu-avatar round lg" >
{{staff.cUserName.slice(0,1)}}
</view> -->
<view class="content">
<view class="text-black">{{staff.cUserName}}
<text v-show="loginUser.id===staff.cUserId" class="padding-left-sm text-orange text-sm">
(当前登录账号)
</text>
</view>
<view class="text-gray flex" @tap="callStaff(staff.phone)">
<view class="text-cut text-df">
<text class="cuIcon-phone oil-main-color margin-right-xs"></text>
<text>{{staff.phone}}</text>
</view>
</view>
</view>
<view class="action solid-left" v-show="!staff.cType">
<button class="cu-btn padding-left-xs padding-right-xs bg-white" @tap="toEdit(staff.cUserId)">编辑</button>
</view>
<view class="action" v-show="staff.cType==1">
<view class="cu-tag text-white round my-tag" style="background-color:#FE0505;">超级管理员</view>
</view>
</view>
</template>
<script>
export default {
props: {
staff: {
type: Object,
default () {}
}
},
data() {
return {
mainURL: this.global.mainURL,
loginUser: uni.getStorageSync('loginUser'),
};
},
methods: {
callStaff(phone) {
uni.makePhoneCall({
phoneNumber: phone
})
},
toEdit(Uid) {
uni.setStorageSync('tempUid', {
id: Uid,
type: 'edit'
})
uni.navigateTo({
url: '/pages/staff/editStaff/editStaff'
})
}
},
}
</script>
<style scoped>
.cu-tag {
border-radius: 100upx 0 0 100upx;
position: absolute;
right: 0;
top: 30rpx;
}
</style>

View File

@@ -0,0 +1,138 @@
<template>
<view class="page-content my-bg">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">员工管理</block>
</cu-custom>
<view class="cu-bar search">
<view class="search-form radius bg-white">
<text class="cuIcon-search"></text>
<input class="" v-model="value" @confirm="onSearch" @focus="InputFocus" @blur="InputBlur" :adjust-position="false"
type="text" placeholder="搜索员工姓名或手机号" confirm-type="search"></input>
</view>
<view class="action">
<button class="cu-btn bg-white shadow-blur" @tap="toAddUser">添加员工</button>
</view>
</view>
<view>
<staff-item class="cu-list menu-avatar" v-for="item in staffList" :key="item.cUserId" :staff="item" :admin="item.cType==1" />
</view>
<view v-if="staffList.length<1">
<Empty />
</view>
<view v-show="isLoadMore">
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</view>
</template>
<script>
import UniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
import staffApi from '@/packageStaff/api/staff.js'
import StaffItem from '@/packageStaff/components/staff-item.vue'
export default {
components: {
StaffItem,
UniLoadMore
},
data() {
return {
searchCondition: '',
staff: {
data: 'lalall'
},
pageSize: 10,
currentPage: 1,
oilSite: uni.getStorageSync('oilSite'),
staffList: [],
value: '',
isLoadMore: false,
loadStatus: 'loading',
};
},
onShow() {
this.staffList = []
this.currentPage = 1
this.getList()
},
onPullDownRefresh() {
this.staffList = []
this.currentPage = 1
this.getList()
},
onReachBottom() {
if (!this.isLoadMore) {
this.getList()
}
},
methods: {
toAddUser() {
uni.setStorageSync('tempUid', {
id: '',
type: 'add'
})
uni.navigateTo({
url: '/pages/staff/editStaff/addUser'
})
},
InputBlur() {
console.log(this.searchCondition)
},
InputFocus() {
console.log(this.searchCondition)
// uni.getClipboardData({
// success: (res)=> {
// console.log(res.data)
// }
// })
},
onSearch() {
this.staffList = []
this.currentPage = 1
this.getList()
},
getList() {
const data3 = {
pageSize: this.pageSize,
currentPage: this.currentPage,
sorted: { // 排序方式
createTime: 'desc'
},
params: {
netPoint: this.oilSite.oilSiteCode, // 油站编号
siteType: '1',
value: this.value
},
columns: {
}
}
staffApi.getByPage(data3).then(res => {
uni.stopPullDownRefresh();
if (res.code === 20000) {
this.staffList = this.staffList.concat(res.data.list)
if (res.data.list.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.currentPage++
this.isLoadMore = false
}
console.log(this.isLoadMore, this.loadStatus, this.currentPage)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100%;
}
.cu-bar .search-form {
background-color: #fff;
}
</style>

View File

@@ -0,0 +1,236 @@
<template>
<view class="page-content my-bg">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">员工管理</block>
</cu-custom>
<view class="margin radius">
<form>
<view class="cu-form-group">
<view class="title">姓名</view>
<input
:maxlength="8"
@input="getChinese"
:value="userInfo.cUserName"
@blur="showChinese"
placeholder="请输入姓名"
name="input"
/>
</view>
<view class="cu-form-group">
<view class="title">手机号</view>
<input
type="number"
:maxlength="11"
v-model="userInfo.phone"
placeholder="请输入手机号"
name="input"
/>
</view>
<view class="cu-form-group text-right">
<view class="title">权限设置</view>
<view class>请选择以下权限</view>
</view>
<view class="padding bg-white">
<checkbox-group @change="checkboxChange" class="flex flex-wrap justify-between">
<view class="basis-sm margin-bottom-sm" v-for="(item,index) in checkbox" :key="index">
<checkbox
@tap="item.checked=!item.checked"
class="round red"
:class="item.checked?'checked':''"
:checked="item.checked?true:false"
:value="item.value"
></checkbox>
<text class="padding-left-xs">{{item.name}}</text>
</view>
</checkbox-group>
</view>
</form>
<view class="padding-top">
<view class="text-lg">添加说明</view>
<view class="padding-top-sm text-sm text-grey">
<view class="margin-bottom-xs">1员工添加成功后系统会向该员工发送一条短信短信中包含了云站的识别码</view>
<view
class="margin-bottom-xs"
>2用户在收到短信后需要关注星油云站公众号进入小程序输入云站编码后根据页面要求输入对应的手机号姓名身份证信息与管理员添加的信息一致方可绑定成功</view>
<view class>3绑定成功后无需再次登录操作</view>
</view>
</view>
</view>
<view class="margin-left margin-right padding-lg bottom-bg">
<button class="bg-main-oil round" @tap="saveInfo">保存</button>
</view>
</view>
</template>
<script>
import staffApi from '@/packageStaff/api/staff.js'
export default {
data() {
return {
tempUid: uni.getStorageSync('tempUid'),
checkbox: [],
userInfo: {},
mainURL: this.global.mainURL,
authList: [],
lastAuthList: []
}
},
created() {
this.getAllMenu()
if (this.tempUid.type === 'edit') {
setTimeout(() => {
this.getUserInfo()
}, 200);
}
},
methods: {
showChinese() {
const reg = /[\u4e00-\u9fa5]/g
var names = this.userInfo.cUserName.match(reg);
this.userInfo.cUserName = names.join("")
if (names) {
this.$set(this.userInfo, 'cUserName', names.join(""))
}
},
// 中文提取
getChinese(e) {
var value = e.target.value
console.log('e-target-value', value)
if (value !== null && value !== '') {
const reg = /[\u4e00-\u9fa5]/g
var names = value.match(reg);
// console.log(names)
// this.$set(this.userInfo, 'cUserName', names.join(""))
if (names) {
this.$set(this.userInfo, 'cUserName', names.join(""))
}
console.log('v-model-name', this.userInfo.cUserName)
}
},
calcMenuList() {
this.checkbox.forEach(item => {
console.log(item.checked)
if (item.checked) {
this.lastAuthList.push(item.value)
}
})
console.log('计算出来的', this.lastAuthList)
},
checkboxChange(e) {
var items = this.checkbox,
values = e.detail.value;
for (var i = 0, lenI = items.length; i < lenI; ++i) {
const item = items[i]
if (values.includes(item.value)) {
this.$set(item, 'checked', true)
} else {
this.$set(item, 'checked', false)
}
}
},
updateUser(data4) {
staffApi.updateUser(data4).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 2500);
}
})
},
addUser(data4) {
staffApi.addOilUser(data4).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 2500);
}
})
},
saveInfo() {
if (!this.userInfo.cUserName) {
uni.showToast({
title: '请输入员工姓名',
icon: 'none'
})
return false
}
if (!this.userInfo.phone) {
uni.showToast({
title: '请输入员工手机号',
icon: 'none'
})
return false
} else if (!/^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1})|(16[0-9]{1}))+\d{8})$/.test(this.userInfo.phone)) {
uni.showToast({
title: '手机号码不正确',
icon: 'none'
})
return false
}
this.calcMenuList()
const data4 = {
cUserId: this.userInfo.cUserId,
cUserName: this.userInfo.cUserName,
phone: this.userInfo.phone,
menuIdLst: this.lastAuthList,
pushState: 1,
pushProcedureState: 1
}
this.addUser(data4)
},
getAllMenu() {
staffApi.getOilSiteAllMenu(this.tempUid.id).then(res => {
if (res.code === 20000) {
var auths = []
var temp = res.data
temp.forEach(item => {
auths.push({
value: item.menuId,
checked: false,
name: item.menuName
})
})
this.checkbox = auths
}
})
},
getUserInfo() {
staffApi.findUserAuthById(this.tempUid.id).then(res => {
if (res.code === 20000) {
this.userInfo = res.data
this.authList = res.data.authList
if (this.authList && this.authList.length > 0) {
console.log('已有权限', this.authList)
this.authList.forEach((auth, index) => {
this.checkbox.forEach(item => {
if (auth.menuId === item.value) {
this.$set(item, 'checked', true)
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,256 @@
<template>
<view class="page-content my-bg">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">员工管理</block>
</cu-custom>
<view class="margin radius">
<view class="bg-img margin-bottom user-info-container radius flex align-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
<view class="placeholder">
<view class="cu-list no-border menu-avatar ">
<view class="cu-item ">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'"></view>
<view class="content">
<view class="text-white">{{userInfo.cUserName}}</view>
<view class="text-white flex" @tap="callStaff(userInfo.phone)">
<view class="text-cut text-df">
<text class="cuIcon-phone text-white margin-right-xs"></text>
<text>{{userInfo.phone}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="user-info">
<view class="cu-list no-border menu-avatar ">
<view class="cu-item no-border">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'"></view>
<view class="content">
<view class="text-white">{{userInfo.cUserName}}</view>
<view class="text-white flex" @tap="callStaff(userInfo.phone)">
<view class="text-cut text-df">
<text class="cuIcon-phone text-white margin-right-xs"></text>
<text>{{userInfo.phone}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<form class="margin-top-lg ">
<view class="cu-form-group radius text-right">
<view class="title">权限设置</view>
<view class>请选择以下权限</view>
</view>
<view class=" padding bg-white ">
<checkbox-group @change="checkboxChange" class="flex flex-wrap justify-between">
<view class="basis-sm margin-bottom-sm" v-for="(item,index) in checkbox" :key="index">
<checkbox @tap="item.checked=!item.checked" class="round red" :class="item.checked?'checked':''" :checked="item.checked?true:false"
:value="item.value"></checkbox>
<text class="padding-left-xs">{{item.name}}</text>
</view>
</checkbox-group>
</view>
</form>
</view>
<view class="margin-left margin-right padding-lg bottom-bg">
<button class="bg-main-oil round margin-bottom" @tap="saveInfo">保存</button>
<button class="oil-main-btn-color text-white round" @tap="deleteUser">删除该员工</button>
</view>
</view>
</template>
<script>
import StaffItem from '@/packageStaff/components/staff-item.vue'
import staffApi from '@/packageStaff/api/staff.js'
export default {
components: {
StaffItem,
},
data() {
return {
tempUid: uni.getStorageSync('tempUid'),
checkbox: [],
userInfo: {},
mainURL: this.global.mainURL,
authList: [],
lastAuthList: [],
}
},
created() {
this.getAllMenu()
if (this.tempUid.type === 'edit') {
setTimeout(() => {
this.getUserInfo()
}, 200);
}
},
methods: {
callStaff(phone) {
uni.makePhoneCall({
phoneNumber: phone
})
},
calcMenuList() {
this.checkbox.forEach(item => {
console.log(item.checked)
if (item.checked) {
this.lastAuthList.push(item.value)
}
})
console.log('计算出来的', this.lastAuthList)
},
checkboxChange(e) {
var items = this.checkbox,
values = e.detail.value;
for (var i = 0, lenI = items.length; i < lenI; ++i) {
const item = items[i]
if (values.includes(item.value)) {
this.$set(item, 'checked', true)
} else {
this.$set(item, 'checked', false)
}
}
},
updateUser(data4) {
staffApi.updateUser(data4).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
deleteUser() {
staffApi.unbindingUser({
cUserId: this.tempUid.id
}).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
addUser(data4) {
staffApi.addUser(data4).then(res => {
if (res.code === 20000) {
uni.showToast({
title: res.msg,
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 1500);
}
})
},
saveInfo() {
if (!this.userInfo.cUserName) {
uni.showToast({
title: '请输入员工姓名',
icon: 'none'
})
return false
}
if (!this.userInfo.phone) {
uni.showToast({
title: '请输入员工手机号',
icon: 'none'
})
return false
}
this.calcMenuList()
const data4 = {
cUserId: this.userInfo.cUserId,
cUserName: this.userInfo.cUserName,
phone: this.userInfo.phone,
menuIdLst: this.lastAuthList,
pushState: 1,
pushProcedureState: 1
}
if (this.tempUid.type === 'add') {
this.addUser(data4)
} else if (this.tempUid.type === 'edit') {
this.updateUser(data4)
}
},
getAllMenu() {
staffApi.getOilSiteAllMenu(this.tempUid.id).then(res => {
if (res.code === 20000) {
var auths = []
var temp = res.data
temp.forEach(item => {
auths.push({
value: item.menuId,
checked: false,
name: item.menuName
})
})
this.checkbox = auths
}
})
},
getUserInfo() {
staffApi.findUserAuthById(this.tempUid.id).then(res => {
if (res.code === 20000) {
this.userInfo = res.data
this.authList = res.data.authList
if (this.authList && this.authList.length > 0) {
console.log('已有权限', this.authList)
this.authList.forEach((auth, index) => {
this.checkbox.forEach(item => {
if (auth.menuId === item.value) {
this.$set(item, 'checked', true)
}
})
})
}
}
})
}
}
}
</script>
<style scoped lang="scss">
.placeholder {
min-height: 160rpx;
min-width: 100%;
}
.user-info-container {
position: relative;
min-width: 100%;
color: #fff;
.cu-item {
background-color: transparent;
}
.user-info {
position: absolute;
top: 0;
z-index: 1;
min-width: 100%;
}
}
.cu-list.menu-avatar>.cu-item::after {
border: none;
}
</style>