Browse Source

feat: 添加幸运大转盘功能并优化招聘租房模块

- 新增幸运大转盘营销功能,包含抽奖动画和奖品展示
- 优化招聘模块,支持编辑和删除功能
- 优化租房模块,支持编辑和删除功能
- 调整环境配置为开发模式
- 重构组件路径引用方式
- 更新页面路由配置
master
前端-胡立永 2 days ago
parent
commit
65a0c98dff
12 changed files with 1117 additions and 42 deletions
  1. +43
    -1
      api/api.js
  2. +0
    -0
      components/list/renting/rentingItem.vue
  3. +195
    -0
      components/list/work/workItem.vue
  4. +1
    -1
      config.js
  5. +8
    -0
      pages.json
  6. +21
    -2
      pages/index/center.vue
  7. +107
    -0
      pages/index/index.vue
  8. +1
    -1
      pages_order/auth/wxLogin.vue
  9. +447
    -0
      pages_order/marketing/turntable.vue
  10. +152
    -12
      pages_order/renting/addRenting.vue
  11. +1
    -1
      pages_order/renting/rentingList.vue
  12. +141
    -24
      pages_order/work/addWork.vue

+ 43
- 1
api/api.js View File

@ -376,7 +376,49 @@ const config = {
url: '/cashout/getMoney',
method: 'GET',
auth : true,
}
},
// 删除我的招聘
deleteMyJob : {
url: '/token/deleteMyJob',
method: 'POST',
auth : true,
},
// 删除我的租房
deleteMyRent : {
url: '/token/deleteMyRent',
method: 'POST',
auth : true,
},
// 编辑我的招聘
editMyJob : {
url: '/token/editMyJob',
method: 'POST',
auth : true,
},
// 编辑我的租房
editMyRent : {
url: '/token/editMyRent',
method: 'POST',
auth : true,
},
// 查询我的招聘
getMyJob : {
url: '/token/getMyJob',
method: 'GET',
auth : true,
},
// 查询我的租房
getMyRent : {
url: '/token/getMyRent',
method: 'GET',
auth : true,
},
}
const models = ['order']


pages_order/components/list/renting/rentingItem.vue → components/list/renting/rentingItem.vue View File


+ 195
- 0
components/list/work/workItem.vue View File

@ -0,0 +1,195 @@
<template>
<view class="work-item" @click="$emit('click', item)">
<view class="top">
<view class="hire">
<view class="Position">
{{ item.title }}
</view>
</view>
<view class="index">
<view class="Salary">
<text v-if="item.minPrice">{{item.minPrice}}</text>
<!-- - -->
<!-- <text v-if="item.maxPrice">{{item.maxPrice}}</text> -->
</view>
<!-- <view class="gang"
v-if="item.school">
|
</view> -->
<!-- <view class="Cashregister"
v-if="item.school">
{{item.school}}
</view> -->
<view class="gang"
v-if="item.workYear">
|
</view>
<view class="Cashregister"
v-if="item.workYear">
{{item.workYear}}
</view>
<template
v-for="(t, i) in item.iconText && item.iconText.split(',')">
<view class="gang">
|
</view>
<view class="Cashregister">
{{t}}
</view>
</template>
</view>
<addressSpot
:address="item.address"
:latitude="item.latitude"
:longitude="item.longitude"
/>
<view class="address">
<view class="shop">
{{ item.company }}
</view>
<view class="authentication"
v-if="item.isCardOpen">
<!-- 已认证 -->
{{ item.isCardOpen }}
</view>
</view>
<view class="bottom">
<view class="festival"
v-if="item.iconTitle">
<!-- 节假日福利 -->
{{ item.iconTitle }}
</view>
<!-- <view class="Apply"
@click.stop="callPhone">
应聘
</view> -->
<callPhone
style="margin-left: auto;"
:phone="item.userPhone"
type="2"
:phoneTitle="item.title"
:pid="item.id"
title="应聘"/>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
item: {
default: {}
}
},
data() {
return {
}
},
methods: {
callPhone() {
uni.makePhoneCall({
phoneNumber: this.item.userPhone,
success() {
console.log('安卓拨打成功');
},
fail() {
console.log('安卓拨打失败');
}
})
},
}
}
</script>
<style scoped lang="scss">
.work-item {
background-color: #fff;
padding: 20rpx;
border-radius: 20rpx;
box-shadow: 0 0 6rpx 6rpx #00000011;
margin: 24rpx;
position: relative;
}
.hire {
display: flex;
align-items: center;
margin: 10rpx 0rpx;
}
.index {
display: flex;
flex-wrap: wrap;
.Salary {
color: red;
}
.gang {
margin: 0rpx 25rpx 0rpx 25rpx;
color: $uni-color;
}
.Cashregister {
color: #888;
}
}
.address {
display: flex;
margin-top: 10rpx;
color: #fff;
.shop {
color: #888;
}
.authentication {
background-color: $uni-color;
margin-left: 10rpx;
padding: 5rpx 10rpx;
font-size: 25rpx;
flex-shrink: 0;
border-radius: 10rpx;
}
}
.bottom {
display: flex;
margin-top: 10rpx;
justify-content: space-between;
align-items: center;
.festival {
display: flex;
justify-content: center;
align-items: center;
background-color: white;
color: $uni-color;
border: 1px solid $uni-color;
padding: 5rpx 10rpx;
border-radius: 10rpx;
font-size: 23rpx;
}
.Apply {
display: flex;
justify-content: center;
align-items: center;
padding: 10rpx 30rpx;
background-color: $uni-color;
color: #fff;
border-radius: 10rpx;
margin-left: auto;
}
}
</style>

+ 1
- 1
config.js View File

@ -7,7 +7,7 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
// 当前环境
const type = 'prod'
const type = 'dev'
// 环境配置


+ 8
- 0
pages.json View File

@ -181,6 +181,14 @@
},
{
"path": "mine/purse"
},
{
"path": "marketing/turntable",
"style": {
"navigationBarTitleText": "幸运大转盘",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "white"
}
}
]
}],


+ 21
- 2
pages/index/center.vue View File

@ -153,6 +153,18 @@
/>
</view>
<!-- 我的租房 -->
<view v-if="isLogin && type == 1">
<rentingItem :key="index" v-for="(item, index) in list" :item="item"
@click="$utils.navigateTo('/pages_order/renting/addRenting?id=' + item.id)" />
</view>
<!-- 我的招聘 -->
<view v-if="isLogin && type == 2">
<workItem :key="index" v-for="(item, index) in list" :item="item"
@click="$utils.navigateTo('/pages_order/work/addWork?id=' + item.id)" />
</view>
<!-- 我的店铺 -->
<view v-if="isLogin && type == 3">
<gourmetItem :key="index" v-for="(item, index) in list" :item="item"
@ -189,6 +201,8 @@
import tabber from '@/components/base/tabbar.vue'
import dynamicItemEdit from '@/components/list/dynamic/dynamicItemEdit.vue'
import gourmetItem from '@/components/list/gourmet/gourmetItem.vue'
import rentingItem from '@/components/list/renting/rentingItem.vue'
import workItem from '@/components/list/work/workItem.vue'
import mixinsList from '@/mixins/list.js'
import mixinsSex from '@/mixins/sex.js'
import { mapState } from 'vuex'
@ -197,6 +211,8 @@
components: {
tabber,
gourmetItem,
rentingItem,
workItem,
dynamicItemEdit,
},
computed: {
@ -211,9 +227,11 @@
},
{
name: '租房',
show : true,
},
{
name: '招聘',
show : true,
},
{
name: '店铺',
@ -224,8 +242,8 @@
mixinsListApi : '',
apiList : [
'getMyPostPage',//
'',
'',
'getMyRent',
'getMyJob',
'myShop',//
],
auth : ['审核中', '个人认证', '店铺认证'],
@ -245,6 +263,7 @@
this.mixinsListApi = 'getMyPostPage'
this.isLogin = true
this.$store.commit('getUserInfo')
this.getData()
} else {
this.isLogin = false
}


+ 107
- 0
pages/index/index.vue View File

@ -107,6 +107,23 @@
</view>
</scroll-view>
<!-- 大转盘抽奖入口 -->
<view class="turntable-entrance" @click="goTurntable">
<view class="turntable-content">
<view class="turntable-icon">
<text class="icon">🎰</text>
<view class="shine"></view>
</view>
<view class="turntable-text">
<text class="title">幸运大转盘</text>
<text class="subtitle">天天有惊喜转一转试试手气</text>
</view>
<view class="turntable-arrow">
<text></text>
</view>
</view>
</view>
<!-- 分类 -->
<view class="LabelOptions">
<uv-tabs :list="category" :activeStyle="{color : '#000', fontWeight : 900, fontSize : '36rpx'}"
@ -350,6 +367,12 @@
this.$store.commit('getUserInfo')
}
},
//
goTurntable() {
uni.navigateTo({
url: '/pages_order/marketing/turntable'
})
},
}
}
</script>
@ -463,6 +486,90 @@
z-index: 9;
overflow: hidden;
//
.turntable-entrance {
margin: 20rpx;
border-radius: 20rpx;
background: linear-gradient(135deg, #ff6b6b 0%, #ffd93d 100%);
box-shadow: 0 8rpx 20rpx rgba(255, 107, 107, 0.3);
overflow: hidden;
position: relative;
&::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
animation: shine 3s infinite;
}
.turntable-content {
display: flex;
align-items: center;
padding: 30rpx;
position: relative;
z-index: 2;
.turntable-icon {
position: relative;
margin-right: 30rpx;
.icon {
font-size: 60rpx;
display: block;
animation: bounce 2s infinite;
}
}
.turntable-text {
flex: 1;
.title {
display: block;
font-size: 32rpx;
font-weight: bold;
color: white;
margin-bottom: 10rpx;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3);
}
.subtitle {
display: block;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.9);
text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.3);
}
}
.turntable-arrow {
font-size: 36rpx;
color: white;
font-weight: bold;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3);
animation: arrow-bounce 1.5s infinite;
}
}
}
@keyframes shine {
0% { left: -100%; }
100% { left: 100%; }
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
40% { transform: translateY(-10rpx); }
60% { transform: translateY(-5rpx); }
}
@keyframes arrow-bounce {
0%, 100% { transform: translateX(0); }
50% { transform: translateX(10rpx); }
}
.life {
display: flex;


+ 1
- 1
pages_order/auth/wxLogin.vue View File

@ -13,7 +13,7 @@
<image src="../static/auth/wx.png" mode=""></image>
</view>
<view class="">
微信授权登录
快捷登录
</view>
</view>
<view class="btn b2"


+ 447
- 0
pages_order/marketing/turntable.vue View File

@ -0,0 +1,447 @@
<template>
<view class="page">
<navbar leftClick
color="#fff"
bgColor="#667eea"
@leftClick="$utils.navigateBack" />
<view class="turntable-container">
<!-- 头部标题 -->
<view class="header">
<text class="title">幸运大转盘</text>
<text class="subtitle">转一转好运来</text>
</view>
<!-- 转盘区域 -->
<view class="turntable-wrapper">
<view class="turntable" :class="{ 'spinning': isSpinning }" :style="{ transform: `rotate(${rotateAngle}deg)` }">
<!-- 使用纯CSS创建转盘 -->
<view class="wheel-bg">
<!-- 8个扇形区域 -->
<view
v-for="(prize, index) in prizes"
:key="index"
class="wheel-sector"
:style="{
backgroundColor: sectorColors[index],
transform: `rotate(${index * 45}deg)`
}"
>
</view>
</view>
<!-- 奖品文字覆盖层 -->
<view class="prizes-overlay">
<view
v-for="(prize, index) in prizes"
:key="index"
class="prize-item"
:style="prizeStyles[index]"
>
<view class="prize-content">
<text class="prize-icon">{{ prize.icon }}</text>
<text class="prize-name">{{ prize.name }}</text>
<text class="prize-value">{{ prize.value }}</text>
</view>
</view>
</view>
</view>
<!-- 中心指针 -->
<view class="pointer">
<view class="pointer-triangle"></view>
</view>
<!-- 中心按钮 -->
<view class="center-button" @click="startSpin" :class="{ disabled: isSpinning }">
<text class="button-text">{{ isSpinning ? '抽奖中...' : '开始抽奖' }}</text>
</view>
</view>
<!-- 抽奖结果弹窗 -->
<view class="result-modal" v-if="showResult" @click="closeResult">
<view class="modal-content" @click.stop>
<text class="result-title">🎉 恭喜您 🎉</text>
<view class="result-prize">
<text class="result-icon">{{ currentPrize.icon }}</text>
<text class="result-name">{{ currentPrize.name }}</text>
<text class="result-value">{{ currentPrize.value }}</text>
</view>
<view class="result-actions">
<button class="confirm-btn" @click="closeResult">确定</button>
</view>
</view>
</view>
<!-- 抽奖次数提示 -->
<view class="spin-info">
<text>今日剩余抽奖次数: {{ remainingSpins }}</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
//
prizes: [
{ name: '现金奖励', value: '¥10', icon: '💰', type: 'money', amount: 10 },
{ name: '精美礼品', value: '小熊', icon: '🧸', type: 'gift', item: 'teddy_bear' },
{ name: '现金奖励', value: '¥5', icon: '💰', type: 'money', amount: 5 },
{ name: '精美礼品', value: '花束', icon: '💐', type: 'gift', item: 'flowers' },
{ name: '现金奖励', value: '¥20', icon: '💰', type: 'money', amount: 20 },
{ name: '精美礼品', value: '巧克力', icon: '🍫', type: 'gift', item: 'chocolate' },
{ name: '现金奖励', value: '¥2', icon: '💰', type: 'money', amount: 2 },
{ name: '精美礼品', value: '香水', icon: '🌸', type: 'gift', item: 'perfume' }
],
sectorColors: [
'#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4',
'#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F'
],
isSpinning: false, //
rotateAngle: 0, //
showResult: false, //
currentPrize: null, //
remainingSpins: 3, //
sectorAngle: 45, // (360/8)
//
prizeStyles: []
}
},
onLoad() {
this.calculatePrizeStyles()
},
methods: {
//
calculatePrizeStyles() {
this.prizeStyles = this.prizes.map((prize, index) => {
//
const angle = (index * 45 + 22.5) * Math.PI / 180; // 22.5
const radius = 150; //
const x = Math.cos(angle - Math.PI/2) * radius; // 900
const y = Math.sin(angle - Math.PI/2) * radius;
return `left: calc(50% + ${x}rpx); top: calc(50% + ${y}rpx); transform: translate(-50%, -50%);`
})
},
//
startSpin() {
if (this.isSpinning || this.remainingSpins <= 0) {
if (this.remainingSpins <= 0) {
uni.showToast({
title: '今日抽奖次数已用完',
icon: 'none'
})
}
return
}
this.isSpinning = true
this.remainingSpins--
//
const prizeIndex = Math.floor(Math.random() * this.prizes.length)
this.currentPrize = this.prizes[prizeIndex]
//
// 4522.5
const targetAngle = 360 - (prizeIndex * this.sectorAngle + this.sectorAngle / 2)
const spinRounds = 5 // 5
const finalAngle = this.rotateAngle + spinRounds * 360 + targetAngle
this.rotateAngle = finalAngle
//
setTimeout(() => {
this.isSpinning = false
this.showResult = true
this.handlePrizeResult()
}, 3000)
},
//
handlePrizeResult() {
if (this.currentPrize.type === 'money') {
//
console.log(`获得现金奖励: ${this.currentPrize.amount}`)
// API
} else if (this.currentPrize.type === 'gift') {
//
console.log(`获得礼品: ${this.currentPrize.item}`)
// API
}
},
//
closeResult() {
this.showResult = false
}
}
}
</script>
<style scoped lang="scss">
.turntable-container {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.header {
text-align: center;
margin-bottom: 60rpx;
color: white;
.title {
font-size: 48rpx;
font-weight: bold;
display: block;
margin-bottom: 20rpx;
}
.subtitle {
font-size: 28rpx;
opacity: 0.9;
}
}
.turntable-wrapper {
position: relative;
width: 600rpx;
height: 600rpx;
margin-bottom: 60rpx;
}
.turntable {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
transition: transform 3s cubic-bezier(0.23, 1, 0.32, 1);
box-shadow: 0 0 40rpx rgba(0, 0, 0, 0.3);
overflow: hidden;
&.spinning {
transition-duration: 3s;
}
}
.wheel-bg {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
}
.wheel-sector {
position: absolute;
width: 50%;
height: 50%;
top: 0%;
left: 50%;
transform-origin: 0% 100%;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: inherit;
clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}
// 线
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-right: 2rpx solid rgba(255,255,255,0.3);
transform-origin: 0% 100%;
}
}
.prizes-overlay {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 990;
}
.prize-item {
position: absolute;
width: 120rpx;
height: 80rpx;
z-index: 10;
}
.prize-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
color: white;
text-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.8);
.prize-icon {
font-size: 32rpx;
display: block;
margin-bottom: 4rpx;
}
.prize-name {
font-size: 18rpx;
display: block;
font-weight: bold;
margin-bottom: 2rpx;
line-height: 1.2;
}
.prize-value {
font-size: 20rpx;
display: block;
font-weight: bold;
line-height: 1.2;
}
}
.pointer {
position: absolute;
top: -20rpx;
left: 50%;
transform: translateX(-50%);
z-index: 100;
.pointer-triangle {
width: 0;
height: 0;
border-left: 20rpx solid transparent;
border-right: 20rpx solid transparent;
border-top: 60rpx solid #FF4757;
filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.3));
}
}
.center-button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 160rpx;
height: 160rpx;
border-radius: 50%;
background: linear-gradient(145deg, #FF6B6B, #FF4757);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 20rpx rgba(255, 71, 87, 0.4);
z-index: 50;
transition: transform 0.2s;
&:active:not(.disabled) {
transform: translate(-50%, -50%) scale(0.95);
}
&.disabled {
opacity: 0.6;
cursor: not-allowed;
}
.button-text {
color: white;
font-size: 24rpx;
font-weight: bold;
text-align: center;
}
}
.result-modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
.modal-content {
background: white;
border-radius: 20rpx;
padding: 60rpx 40rpx;
text-align: center;
box-shadow: 0 20rpx 40rpx rgba(0, 0, 0, 0.3);
min-width: 500rpx;
.result-title {
font-size: 36rpx;
font-weight: bold;
color: #FF6B6B;
margin-bottom: 40rpx;
}
.result-prize {
margin-bottom: 40rpx;
.result-icon {
font-size: 60rpx;
display: block;
margin-bottom: 20rpx;
}
.result-name {
font-size: 32rpx;
color: #333;
display: block;
margin-bottom: 10rpx;
}
.result-value {
font-size: 36rpx;
color: #FF6B6B;
font-weight: bold;
}
}
.confirm-btn {
background: linear-gradient(45deg, #FF6B6B, #FF4757);
color: white;
border: none;
border-radius: 40rpx;
padding: 20rpx 60rpx;
font-size: 28rpx;
font-weight: bold;
}
}
}
.spin-info {
text-align: center;
color: white;
font-size: 28rpx;
background: rgba(255, 255, 255, 0.2);
padding: 20rpx 40rpx;
border-radius: 40rpx;
backdrop-filter: blur(10rpx);
}
</style>

+ 152
- 12
pages_order/renting/addRenting.vue View File

@ -1,6 +1,6 @@
<template>
<view class="page">
<navbar title="发布租房" leftClick @leftClick="$utils.navigateBack" />
<navbar :title="isEdit ? '编辑租房' : '发布租房'" leftClick @leftClick="$utils.navigateBack" />
<view class="form">
@ -43,6 +43,15 @@
isLink
></uv-cell> -->
<!-- <view class="form-sheet-cell">
<view class="label">
租房地点
</view>
<view class="price">
<input placeholder="请输入租房地点" v-model="form.address" />
</view>
</view> -->
<view class="form-sheet-cell">
<view class="label">
楼层
@ -208,7 +217,13 @@
<view class="uni-color-btn"
@click="submit">
发布
{{ isEdit ? '保存修改' : '发布' }}
</view>
<!-- 编辑模式下显示删除按钮 -->
<view v-if="isEdit" class="delete-btn"
@click="deleteRenting">
删除租房
</view>
</view>
</view>
@ -220,6 +235,8 @@
export default {
data() {
return {
rentingId: '', // ID
isEdit: false, //
form : {
addId : '',//id
address : '',//
@ -230,6 +247,14 @@
deliver : '整租',
floor : '',
decoration : '',
title: '', //
home: '', //
payment: '', //
money: '', //
phone: '', //
titleSub: '', //
latitude: '', //
longitude: '', //
},
showingsRadio : [//
{
@ -272,11 +297,18 @@
pickerKey : '',
}
},
onLoad() {
// for (var i = 0; i < 30; i++) {
// this.picker.workYear.push((i + 1) + '')
// }
this.form.addId = this.cityList[0].id
onLoad(options) {
//
if (options.id) {
this.rentingId = options.id
this.isEdit = true
this.getRentingDetail()
} else {
//
if (this.cityList && this.cityList.length > 0) {
this.form.addId = this.cityList[0].id
}
}
},
computed : {
columns(){
@ -284,7 +316,60 @@
},
...mapState(['cityList', 'category']),
},
watch: {
// cityList
cityList: {
handler(newVal) {
if (newVal && newVal.length > 0 && !this.isEdit && !this.form.addId) {
this.form.addId = newVal[0].id
}
},
immediate: true
}
},
methods: {
//
getRentingDetail() {
this.$api('getRentDetail', { id: this.rentingId }, res => {
if (res.code == 200) {
const data = res.result
//
this.form = {
...this.form,
title: data.title || '',
address: data.address || '',
face: data.face || '',
decoration: data.decoration || '',
floor: data.floor || '',
home: data.home || '',
payment: data.payment || '',
money: data.money || '',
crm: data.crm || '',
showings: data.showings || '随时可看',
lift: data.lift || '有',
deliver: data.deliver || '整租',
phone: data.phone || '',
titleSub: data.titleSub || '',
addId: data.addId || (this.cityList.length > 0 ? this.cityList[0].id : ''),
latitude: data.latitude || '',
longitude: data.longitude || '',
}
//
if (data.image) {
const images = data.image.split(',').filter(img => img.trim())
this.fileList = images.map(url => ({ url: url.trim() }))
}
} else {
uni.showToast({
title: res.msg || '获取租房信息失败',
icon: 'none'
})
}
})
},
openPicker(key){
this.pickerKey = key
this.$refs.picker.open()
@ -307,7 +392,7 @@
},
//
selectAddr() {
Position.selectAddress(0, 0, res => {
Position.selectAddress(this.form.latitude || 0, this.form.longitude || 0, res => {
//
this.form.latitude = res.latitude
this.form.longitude = res.longitude
@ -334,7 +419,6 @@
lift : '请选择电梯',
deliver : '请选择交付方式',
phone: '请输入联系电话',
// titleSub : '',
})) {
return
}
@ -346,16 +430,57 @@
})
}
//
this.form.image = this.fileList.map(n => n.url).join(',')
this.$api('publishRent', this.form, res => {
// API
const apiName = this.isEdit ? 'editMyRent' : 'publishRent'
const params = this.isEdit ? { ...this.form, id: this.rentingId } : this.form
this.$api(apiName, params, res => {
if(res.code == 200){
uni.showToast({
title: '发布成功!',
title: this.isEdit ? '修改成功!' : '发布成功!',
icon: 'none'
})
setTimeout(uni.navigateBack, 1000, -1)
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
uni.showToast({
title: res.msg || (this.isEdit ? '修改失败' : '发布失败'),
icon: 'none'
})
}
})
},
//
deleteRenting() {
uni.showModal({
title: '确认删除',
content: '确定要删除这个租房信息吗?删除后无法恢复。',
confirmColor: '#ff4757',
success: (res) => {
if (res.confirm) {
this.$api('deleteMyRent', { id: this.rentingId }, res => {
if (res.code == 200) {
uni.showToast({
title: '删除成功!',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
uni.showToast({
title: res.msg || '删除失败',
icon: 'none'
})
}
})
}
}
})
},
@ -416,6 +541,21 @@
}
}
.delete-btn {
background: #ff4757;
color: white;
text-align: center;
padding: 20rpx;
margin: 30rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: bold;
&:active {
background: #ff3742;
}
}
.category{
padding: 20rpx;
.title{


+ 1
- 1
pages_order/renting/rentingList.vue View File

@ -25,7 +25,7 @@
<script>
import mixinsList from '@/mixins/list.js'
import screenSearch from '../components/screen/screenSearch.vue'
import rentingItem from '../components/list/renting/rentingItem.vue'
import rentingItem from '@/components/list/renting/rentingItem.vue'
export default {
mixins: [mixinsList],
components: {


+ 141
- 24
pages_order/work/addWork.vue View File

@ -1,6 +1,6 @@
<template>
<view class="page">
<navbar title="发布招工" leftClick @leftClick="$utils.navigateBack" />
<navbar :title="isEdit ? '编辑招工' : '发布招工'" leftClick @leftClick="$utils.navigateBack" />
<view class="form">
@ -193,7 +193,13 @@
<view class="uni-color-btn"
@click="submit">
发布
{{ isEdit ? '保存修改' : '发布' }}
</view>
<!-- 编辑模式下显示删除按钮 -->
<view v-if="isEdit" class="delete-btn"
@click="deleteJob">
删除招工
</view>
</view>
@ -209,16 +215,23 @@
export default {
data() {
return {
jobId: '', // ID
isEdit: false, //
form : {
school : '',
workYear : '',
minPrice : '',
maxPrice : '',
address : '',
addId : '',
company : '',
gsContext : '',
jobContext : '',
title: '', //
school : '', //
workYear : '', //
minPrice : '', //
maxPrice : '', //
address : '', //
addId : '', // ID
company : '', //
gsContext : '', //
jobContext : '', //
jobDetails: '', //
iconText: '', //
userName: '', //
userPhone: '', //
},
radiovalue : '',
priceList : [
@ -254,11 +267,23 @@
pickerKey : 'workYear',
}
},
onLoad() {
onLoad(options) {
//
for (var i = 0; i < 30; i++) {
this.picker.workYear.push((i + 1) + '年')
}
this.form.addId = this.cityList[0].id
//
if (options.id) {
this.jobId = options.id
this.isEdit = true
this.getJobDetail()
} else {
//
if (this.cityList && this.cityList.length > 0) {
this.form.addId = this.cityList[0].id
}
}
},
computed : {
columns(){
@ -266,7 +291,51 @@
},
...mapState(['cityList', 'category']),
},
watch: {
// cityList
cityList: {
handler(newVal) {
if (newVal && newVal.length > 0 && !this.isEdit && !this.form.addId) {
this.form.addId = newVal[0].id
}
},
immediate: true
}
},
methods: {
//
getJobDetail() {
this.$api('getJobDetail', { id: this.jobId }, res => {
if (res.code == 200) {
const data = res.result
//
this.form = {
...this.form,
title: data.title || '',
school: data.school || '',
workYear: data.workYear || '',
minPrice: data.minPrice || '',
maxPrice: data.maxPrice || '',
address: data.address || '',
addId: data.addId || (this.cityList.length > 0 ? this.cityList[0].id : ''),
company: data.company || '',
gsContext: data.gsContext || '',
jobContext: data.jobContext || '',
jobDetails: data.jobDetails || '',
iconText: data.iconText || '',
userName: data.userName || '',
userPhone: data.userPhone || '',
}
} else {
uni.showToast({
title: res.msg || '获取工作信息失败',
icon: 'none'
})
}
})
},
openPicker(key){
this.pickerKey = key
this.$refs.picker.open()
@ -277,16 +346,8 @@
//
submit(){
// if(this.fileList.length == 0){
// return uni.showToast({
// title: '',
// icon : 'none'
// })
// }
if (this.$utils.verificationAll(this.form, {
title: '请输入招工标题',
address : '请选择工作地点',
workYear : '请选择工龄要求',
company : '请输入招聘公司',
minPrice : '请输入薪资范围',
@ -301,14 +362,55 @@
return
}
this.$api('publishJob', this.form, res => {
// API
const apiName = this.isEdit ? 'editMyJob' : 'publishJob'
const params = this.isEdit ? { ...this.form, id: this.jobId } : this.form
this.$api(apiName, params, res => {
if(res.code == 200){
uni.showToast({
title: '发布成功!',
title: this.isEdit ? '修改成功!' : '发布成功!',
icon: 'none'
})
setTimeout(uni.navigateBack, 1000, -1)
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
uni.showToast({
title: res.msg || (this.isEdit ? '修改失败' : '发布失败'),
icon: 'none'
})
}
})
},
//
deleteJob() {
uni.showModal({
title: '确认删除',
content: '确定要删除这个招工信息吗?删除后无法恢复。',
confirmColor: '#ff4757',
success: (res) => {
if (res.confirm) {
this.$api('deleteMyJob', { id: this.jobId }, res => {
if (res.code == 200) {
uni.showToast({
title: '删除成功!',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
uni.showToast({
title: res.msg || '删除失败',
icon: 'none'
})
}
})
}
}
})
},
@ -389,5 +491,20 @@
}
}
}
.delete-btn {
background: #ff4757;
color: white;
text-align: center;
padding: 20rpx;
margin: 30rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: bold;
&:active {
background: #ff3742;
}
}
}
</style>

Loading…
Cancel
Save