123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <view style="background-color: #F0F0F0;">
- <my-requiredetail v-if="showDetail" :item="item" :location="location" :marker="marker" :timeAM="timeAM" :timePM="timePM" :timeEvening="timeEvening" :collect="collect" :isShowCollect="isShowCollect" buttonMessage="邀请" @collecting="collecting" @publishButton="invite"></my-requiredetail>
-
- <my-invite :isShowInvite="isShowInvite" :item11="myCourses" @cancelChosed="cancelChosed" @commitChosed="commitChosed" @clickRadio="clickRadio"></my-invite>
- </view>
- </template>
- <script>
- import { mapState } from 'vuex'
- import formTime from '@/mixins/form-time.js'
- export default {
- mixins: [formTime],
- computed: {
- ...mapState('m_user', ['userinfo'])
- },
- data() {
- return {
- showDetail: false,
- initeCourse: '',
- myCourses: [],
- isShowInvite: false,
- isShowCollect: true,
- collect: false,
- item: {}, // 需求详情
- location: [],
- marker: [{
- id: 1,
- joinCluster:true,
- latitude: 0,
- longitude: 0,
- width: 40,
- height: 40,
- iconPath: '/static/location.png',
- }],
- };
- },
- onLoad(option) {
- if (option.requireId !== undefined) {
- const requireId = decodeURIComponent(option.requireId)
- this.getStuNeedsDetailById(requireId)
- }
- },
- methods: {
- // 获取需求详情
- async getStuNeedsDetailById(id) {
- const {data: result} = await uni.$http.get('/education/student-requirements/getStuNeedsDetailById', {requireId: id})
- this.item = result.data.one
- this.getIsCollection()
- this.formatForm()
- },
- // 上课表格格式化
- formatForm() {
- this.location = this.item.locationAl.split(",")
- this.marker[0].latitude = Number(this.location[0])
- this.marker[0].longitude = Number(this.location[1])
- this.courseWeekday = this.item.courseWeekday.split(",")
- this.parseCourseWeekday()
- this.showDetail = true
- },
- // 查看是否收藏过
- async getIsCollection() {
- const { data: result } = await uni.$http.get('/education/my-favorite-needs/findPersonCollect')
- const list = result.data.requires
- if (list !== undefined) {
- for (let i = 0; i < list.length; i++) {
- if (this.item.requireId === list[i]) {
- this.collect = true
- }
- }
- }
- },
- // 收藏、取消收藏
- async collecting() {
- const queryObj = {
- requireId: this.item.requireId
- }
- if (!this.collect) {
- const { data: result1 } = await uni.$http.get('/education/my-favorite-needs/collect', queryObj)
- if (result1.message === '收藏成功') {
- return this.collect = true
- }
- if (result1.message === '收藏失败') {
- return uni.$showMsg('收藏失败')
- }
- }
- if (this.collect) {
- const { data: result } = await uni.$http.get('/education/my-favorite-needs/cancelCollect', queryObj)
- if (result.message === '取消收藏成功') {
- return this.collect = false
- }
- if (result.message === '取消收藏失败') {
- return uni.$showMsg('取消收藏失败')
- }
- }
- },
- invite() {
- this.isShowInvite = true
- this.showMyCourse()
- },
- async showMyCourse() {
- const { data: result } = await uni.$http.get('/education/teacher-courses/queryPersonSomeInfo')
- this.myCourses = result.data.list
- const name = result.data.name
- if (this.myCourses !== undefined) {
- for (let i = 0; i < this.myCourses.length; i++) {
- this.myCourses[i].fromUname = name
- }
- }
- },
- cancelChosed() {
- this.isShowInvite = false
- },
- async commitChosed() {
- if (this.initeCourse === '') return uni.$showMsg('请选择邀请的课程')
- this.initeCourse.toUid = this.item.uid
- this.initeCourse.requireId = this.item.requireId
- this.initeCourse.salary = this.item.salary
- this.initeCourse.toUname = this.item.name
-
- const {data: result} = await uni.$http.post('/education/invite-info/sendInvite', this.initeCourse)
- uni.$showMsg(result.message)
- this.isShowInvite = false
- },
- clickRadio(item) {
- this.initeCourse = item
- }
- }
- }
- </script>
- <!-- 设置页面背景 -->
- <style lang="scss">
- page{
- height: 100%;
- // background-color: #FFF;
- }
- </style>
- <style lang="scss" scoped>
- </style>
|