正在显示
9 个修改的文件
包含
228 行增加
和
109 行删除
| @@ -29,12 +29,16 @@ export default { | @@ -29,12 +29,16 @@ export default { | ||
| 29 | }, | 29 | }, |
| 30 | 30 | ||
| 31 | onLaunch(e) { | 31 | onLaunch(e) { |
| 32 | + if(e.path&&e.path=='pages/student/home/job-detail/job-detail'&&e.query&&e.query.id){ | ||
| 33 | + this.$u.vuex("vuex_alipay",true) | ||
| 34 | + } | ||
| 32 | let colorObj = this.themeList[this.vuex_appId].value; | 35 | let colorObj = this.themeList[this.vuex_appId].value; |
| 33 | let styles = ""; | 36 | let styles = ""; |
| 34 | for (let i in colorObj) { | 37 | for (let i in colorObj) { |
| 35 | styles += colorObj[i].name + ":" + colorObj[i].value + ";"; | 38 | styles += colorObj[i].name + ":" + colorObj[i].value + ";"; |
| 36 | } | 39 | } |
| 37 | 40 | ||
| 41 | + | ||
| 38 | this.$u.vuex("vuex_theme", styles); | 42 | this.$u.vuex("vuex_theme", styles); |
| 39 | this.$u.vuex("vuex_baseImgUrl", this.themeList[this.vuex_appId].imagePath); | 43 | this.$u.vuex("vuex_baseImgUrl", this.themeList[this.vuex_appId].imagePath); |
| 40 | // console.log('vuex_theme----', this.vuex_theme) | 44 | // console.log('vuex_theme----', this.vuex_theme) |
| @@ -53,14 +53,14 @@ let detailByStudentUrl = '/internship/v1/questionnaire/detailByStudent/'; | @@ -53,14 +53,14 @@ let detailByStudentUrl = '/internship/v1/questionnaire/detailByStudent/'; | ||
| 53 | let graduationStatisticsRosterUrl = '/internship/v1/graduationStatisticsRoster/save'; | 53 | let graduationStatisticsRosterUrl = '/internship/v1/graduationStatisticsRoster/save'; |
| 54 | let questionnaireTemplateUrl = '/internship/v1/graduationStatisticsRoster/graduationSurvey/'; | 54 | let questionnaireTemplateUrl = '/internship/v1/graduationStatisticsRoster/graduationSurvey/'; |
| 55 | let myUserStaticsUrl = '/hro/recruit/v1/yxly/user/counts'; | 55 | let myUserStaticsUrl = '/hro/recruit/v1/yxly/user/counts'; |
| 56 | -let positionCollectUrl = '/hro/recruit/v1/user/collects/:id/op/delete'; | 56 | +let positionCollectUrl = '/hro/recruit/v1/yxly/user/collects'; |
| 57 | let positionRecordUrl = '/hro/recruit/v1/yxly/user/delivery-records'; | 57 | let positionRecordUrl = '/hro/recruit/v1/yxly/user/delivery-records'; |
| 58 | let resumeUpdateUrl = '/hro/recruit/v1/yxly/user/resumes/update'; | 58 | let resumeUpdateUrl = '/hro/recruit/v1/yxly/user/resumes/update'; |
| 59 | let resumeDetailUrl = '/hro/recruit/v1/yxly/user/resumes/detail'; | 59 | let resumeDetailUrl = '/hro/recruit/v1/yxly/user/resumes/detail'; |
| 60 | let isJobCollectedUrl = '/hro/recruit/v1/yxly/user/collects/check/' | 60 | let isJobCollectedUrl = '/hro/recruit/v1/yxly/user/collects/check/' |
| 61 | let jobRecommendUrl = '/hro/recruit/v1/yxly/user/positions/recommend'; | 61 | let jobRecommendUrl = '/hro/recruit/v1/yxly/user/positions/recommend'; |
| 62 | let jobReccommendListUrl = '/hro/recruit/v1/yxly/user/candidates/recommends'; | 62 | let jobReccommendListUrl = '/hro/recruit/v1/yxly/user/candidates/recommends'; |
| 63 | -let applyJobUrl = '/hro/recruit/v1/yxly/user/delivery'; | 63 | +let applyJobUrl = '/hro/recruit/v1/yxly/zfb/user-delivery'; |
| 64 | let getAuthUrl = '/user/v1/getAuthUrl'; | 64 | let getAuthUrl = '/user/v1/getAuthUrl'; |
| 65 | let isJobAppliedUrl = '/hro/recruit/v1/yxly/user/delivery/check/'; | 65 | let isJobAppliedUrl = '/hro/recruit/v1/yxly/user/delivery/check/'; |
| 66 | let signstartUrl = '/internship/v1/treaty/sign/start'; | 66 | let signstartUrl = '/internship/v1/treaty/sign/start'; |
| @@ -1244,6 +1244,7 @@ const install = (Vue, vm) => { | @@ -1244,6 +1244,7 @@ const install = (Vue, vm) => { | ||
| 1244 | //C端 投递职位 | 1244 | //C端 投递职位 |
| 1245 | let applyJobUrlApi = (params = {}) => vm.$u.post(applyJobUrl, params).then(res => { | 1245 | let applyJobUrlApi = (params = {}) => vm.$u.post(applyJobUrl, params).then(res => { |
| 1246 | if (res.code >= 300) { | 1246 | if (res.code >= 300) { |
| 1247 | + return res | ||
| 1247 | uni.$u.toast(res.message); | 1248 | uni.$u.toast(res.message); |
| 1248 | } else { | 1249 | } else { |
| 1249 | return res | 1250 | return res |
| @@ -1322,7 +1323,7 @@ const install = (Vue, vm) => { | @@ -1322,7 +1323,7 @@ const install = (Vue, vm) => { | ||
| 1322 | }); | 1323 | }); |
| 1323 | 1324 | ||
| 1324 | //C端 取消收藏 | 1325 | //C端 取消收藏 |
| 1325 | - let cancelJobCollectUrlApi = (params = {}) => vm.$u.put(`/hro/recruit/v1/user/collects/${params.id}/op/delete`, params).then(res => { | 1326 | + let cancelJobCollectUrlApi = (params = {}) => vm.$u.put(`/hro/recruit/v1/yxly/user/collects/${params.id}/op/delete`, params).then(res => { |
| 1326 | if (res.code >= 300) { | 1327 | if (res.code >= 300) { |
| 1327 | uni.$u.toast(res.message); | 1328 | uni.$u.toast(res.message); |
| 1328 | } else { | 1329 | } else { |
| @@ -1995,9 +1996,23 @@ const install = (Vue, vm) => { | @@ -1995,9 +1996,23 @@ const install = (Vue, vm) => { | ||
| 1995 | } | 1996 | } |
| 1996 | }); | 1997 | }); |
| 1997 | 1998 | ||
| 1999 | + const getJobUserAuth = (params) => vm.$u.post(`/hro/recruit/v1/yxly/zfb/resume-agreement-sign`,params).then(res=>{ | ||
| 2000 | + if (res.code >= 300) { | ||
| 2001 | + uni.showToast({ | ||
| 2002 | + title: res.msg, | ||
| 2003 | + icon: 'none', | ||
| 2004 | + duration: 1500 | ||
| 2005 | + }); | ||
| 2006 | + } else { | ||
| 2007 | + return res | ||
| 2008 | + } | ||
| 2009 | + }) | ||
| 2010 | + | ||
| 2011 | + | ||
| 1998 | 2012 | ||
| 1999 | // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 | 2013 | // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 |
| 2000 | vm.$u.api = { | 2014 | vm.$u.api = { |
| 2015 | + getJobUserAuth, | ||
| 2001 | getLoginApi, | 2016 | getLoginApi, |
| 2002 | settingGetApi, | 2017 | settingGetApi, |
| 2003 | getSmsCodeApi, | 2018 | getSmsCodeApi, |
| @@ -101,9 +101,7 @@ | @@ -101,9 +101,7 @@ | ||
| 101 | } | 101 | } |
| 102 | }, | 102 | }, |
| 103 | "quickapp" : {}, | 103 | "quickapp" : {}, |
| 104 | - "mp-weixin" : { | ||
| 105 | - | ||
| 106 | - }, | 104 | + "mp-weixin" : {}, |
| 107 | "mp-alipay" : { | 105 | "mp-alipay" : { |
| 108 | "usingComponents" : true, | 106 | "usingComponents" : true, |
| 109 | "component2" : true, | 107 | "component2" : true, |
| @@ -111,7 +109,7 @@ | @@ -111,7 +109,7 @@ | ||
| 111 | "uniStatistics" : { | 109 | "uniStatistics" : { |
| 112 | "enable" : true | 110 | "enable" : true |
| 113 | }, | 111 | }, |
| 114 | - "allowsBounceVertical": "NO" | 112 | + "allowsBounceVertical" : "NO" |
| 115 | }, | 113 | }, |
| 116 | "mp-qq" : { | 114 | "mp-qq" : { |
| 117 | "optimization" : { | 115 | "optimization" : { |
| @@ -152,5 +150,8 @@ | @@ -152,5 +150,8 @@ | ||
| 152 | } | 150 | } |
| 153 | } | 151 | } |
| 154 | } | 152 | } |
| 153 | + }, | ||
| 154 | + "uniStatistics" : { | ||
| 155 | + "version" : "2" | ||
| 155 | } | 156 | } |
| 156 | } | 157 | } |
| 1 | <template> | 1 | <template> |
| 2 | <view class="page" :style="vuex_theme"> | 2 | <view class="page" :style="vuex_theme"> |
| 3 | <scroll-view | 3 | <scroll-view |
| 4 | - style="position: absolute; left: 0; top: 0; width:33%; height: calc(100% - 200rpx); border-right: 1px solid rgba(0,0,0,0.05);" | ||
| 5 | - scroll-y="true"> | 4 | + style=" width:33%; height: calc(100vh - 200rpx); border-right: 1px solid rgba(0,0,0,0.05);" |
| 5 | + :scroll-y="true"> | ||
| 6 | <view class="list-title" v-for="(item,index) in firstCategorys" :key="index" | 6 | <view class="list-title" v-for="(item,index) in firstCategorys" :key="index" |
| 7 | @click="firstCategorySel(item,index)"> | 7 | @click="firstCategorySel(item,index)"> |
| 8 | <view :class="firstCategoryName == item.name?'item itemSel':'item'"> | 8 | <view :class="firstCategoryName == item.name?'item itemSel':'item'"> |
| @@ -11,8 +11,8 @@ | @@ -11,8 +11,8 @@ | ||
| 11 | </view> | 11 | </view> |
| 12 | </scroll-view> | 12 | </scroll-view> |
| 13 | <scroll-view | 13 | <scroll-view |
| 14 | - style="position: absolute; left: 33%; top: 0; width:33%; height: calc(100% - 200rpx); border-right: 1px solid rgba(0,0,0,0.05);" | ||
| 15 | - scroll-y="true"> | 14 | + style=" width:34%; height: calc(100vh - 200rpx); border-right: 1px solid rgba(0,0,0,0.05);" |
| 15 | + :scroll-y="true"> | ||
| 16 | <view v-if="isAll=='1'" class="list-title" @click="secondCategorySel({name:'全部',sub_categories:[]},-1)"> | 16 | <view v-if="isAll=='1'" class="list-title" @click="secondCategorySel({name:'全部',sub_categories:[]},-1)"> |
| 17 | <view :class="secondCategoryName == '全部'?'item itemSel':'item'"> | 17 | <view :class="secondCategoryName == '全部'?'item itemSel':'item'"> |
| 18 | 全部 | 18 | 全部 |
| @@ -25,8 +25,8 @@ | @@ -25,8 +25,8 @@ | ||
| 25 | </view> | 25 | </view> |
| 26 | </view> | 26 | </view> |
| 27 | </scroll-view> | 27 | </scroll-view> |
| 28 | - <scroll-view style="position: absolute; left: 66%; top: 0; width:33%; height: calc(100% - 200rpx);" | ||
| 29 | - scroll-y="true"> | 28 | + <scroll-view style=" width:32%; height: calc(100vh - 200rpx);" |
| 29 | + :scroll-y="true"> | ||
| 30 | <view v-if="isAll=='1'" class="list-title" @click="expectjobSel({name:'全部',sub_categories:[]},-1)"> | 30 | <view v-if="isAll=='1'" class="list-title" @click="expectjobSel({name:'全部',sub_categories:[]},-1)"> |
| 31 | <view :class="expectJobName == '全部'?'item itemSel':'item'"> | 31 | <view :class="expectJobName == '全部'?'item itemSel':'item'"> |
| 32 | 全部 | 32 | 全部 |
| @@ -121,10 +121,9 @@ | @@ -121,10 +121,9 @@ | ||
| 121 | loadData() { | 121 | loadData() { |
| 122 | this.$u.api.poscategorylistApi().then(res => { | 122 | this.$u.api.poscategorylistApi().then(res => { |
| 123 | if (res) { | 123 | if (res) { |
| 124 | - this.firstCategorys = res | ||
| 125 | if (this.firstCategoryName == '') { | 124 | if (this.firstCategoryName == '') { |
| 126 | - this.firstCategoryName = this.firstCategorys[0].name | ||
| 127 | - this.secondCategorys = this.firstCategorys[0].sub_categories | 125 | + this.firstCategoryName =res[0].name |
| 126 | + this.secondCategorys = res[0].sub_categories | ||
| 128 | // this.secondCategoryName = this.secondCategorys[0].name | 127 | // this.secondCategoryName = this.secondCategorys[0].name |
| 129 | // this.secondCategoryName = '全部' | 128 | // this.secondCategoryName = '全部' |
| 130 | // this.expectJobs = this.secondCategorys[0].sub_categories | 129 | // this.expectJobs = this.secondCategorys[0].sub_categories |
| @@ -150,6 +149,7 @@ | @@ -150,6 +149,7 @@ | ||
| 150 | } | 149 | } |
| 151 | } | 150 | } |
| 152 | } | 151 | } |
| 152 | + this.firstCategorys = res | ||
| 153 | } | 153 | } |
| 154 | }) | 154 | }) |
| 155 | }, | 155 | }, |
| @@ -210,6 +210,7 @@ | @@ -210,6 +210,7 @@ | ||
| 210 | position: relative; | 210 | position: relative; |
| 211 | width: 100%; | 211 | width: 100%; |
| 212 | height: 100%; | 212 | height: 100%; |
| 213 | + display: flex; | ||
| 213 | 214 | ||
| 214 | .list-title { | 215 | .list-title { |
| 215 | margin-top: 72rpx; | 216 | margin-top: 72rpx; |
| @@ -320,8 +320,8 @@ | @@ -320,8 +320,8 @@ | ||
| 320 | </view> | 320 | </view> |
| 321 | <view | 321 | <view |
| 322 | style="width: 100%; height: 100rpx; background-color: #ffffff" | 322 | style="width: 100%; height: 100rpx; background-color: #ffffff" |
| 323 | - ></view | ||
| 324 | - ></view> | 323 | + ></view> |
| 324 | + </view> | ||
| 325 | </u-popup> | 325 | </u-popup> |
| 326 | <u-popup | 326 | <u-popup |
| 327 | v-model="showResume" | 327 | v-model="showResume" |
| @@ -468,6 +468,23 @@ | @@ -468,6 +468,23 @@ | ||
| 468 | @callBack="sucesslogin" | 468 | @callBack="sucesslogin" |
| 469 | ></yxly-login> | 469 | ></yxly-login> |
| 470 | </u-popup> | 470 | </u-popup> |
| 471 | + <u-popup v-model="isClose" mode="center" border-radius="18"> | ||
| 472 | + <view class="callBackAlipay"> | ||
| 473 | + <view class="" style="padding-top: 40rpx"> | ||
| 474 | + <image | ||
| 475 | + mode="widthFix" | ||
| 476 | + style="width: 120rpx; height: 120rpx" | ||
| 477 | + src="/static/img/common/123.png" | ||
| 478 | + > | ||
| 479 | + </image> | ||
| 480 | + </view> | ||
| 481 | + <view class="" style="margin-top: 30rpx"> 您已成功投递该岗位 </view> | ||
| 482 | + <view class="" style="margin-top: 20rpx"> | ||
| 483 | + <c-button type="confirm" @click="alipayBack" text="返回支付宝就业"> | ||
| 484 | + </c-button> | ||
| 485 | + </view> | ||
| 486 | + </view> | ||
| 487 | + </u-popup> | ||
| 471 | </view> | 488 | </view> |
| 472 | </template> | 489 | </template> |
| 473 | 490 | ||
| @@ -484,6 +501,7 @@ export default { | @@ -484,6 +501,7 @@ export default { | ||
| 484 | return { | 501 | return { |
| 485 | analysisArea, | 502 | analysisArea, |
| 486 | formateSalary, | 503 | formateSalary, |
| 504 | + isClose: true, | ||
| 487 | yxlyLoginShow: false, | 505 | yxlyLoginShow: false, |
| 488 | statusBarHeight: 44, | 506 | statusBarHeight: 44, |
| 489 | menuHeight: 32, | 507 | menuHeight: 32, |
| @@ -542,7 +560,6 @@ export default { | @@ -542,7 +560,6 @@ export default { | ||
| 542 | }, | 560 | }, |
| 543 | 561 | ||
| 544 | onLoad(e) { | 562 | onLoad(e) { |
| 545 | - console.log(e); | ||
| 546 | this.id = e.id; | 563 | this.id = e.id; |
| 547 | this.candidate_id = e.candidate_id ? e.candidate_id : ""; | 564 | this.candidate_id = e.candidate_id ? e.candidate_id : ""; |
| 548 | this.statusAbandon = e.from_type && e.from_type == 3 ? true : false; | 565 | this.statusAbandon = e.from_type && e.from_type == 3 ? true : false; |
| @@ -575,6 +592,16 @@ export default { | @@ -575,6 +592,16 @@ export default { | ||
| 575 | this.getStatusDetail(); | 592 | this.getStatusDetail(); |
| 576 | } | 593 | } |
| 577 | }, | 594 | }, |
| 595 | + alipayBack() { | ||
| 596 | + my.exitMiniProgram({ | ||
| 597 | + success:()=>{ | ||
| 598 | + console.log('成功'); | ||
| 599 | + }, | ||
| 600 | + fail:()=>{ | ||
| 601 | + | ||
| 602 | + } | ||
| 603 | + }) | ||
| 604 | + }, | ||
| 578 | 605 | ||
| 579 | timeFormat(value, format = "yyyy-mm-dd") { | 606 | timeFormat(value, format = "yyyy-mm-dd") { |
| 580 | return this.$u.timeFormat(value, format); | 607 | return this.$u.timeFormat(value, format); |
| @@ -831,11 +858,69 @@ export default { | @@ -831,11 +858,69 @@ export default { | ||
| 831 | 858 | ||
| 832 | showApplyPop() { | 859 | showApplyPop() { |
| 833 | if (this.vuex_token != "") { | 860 | if (this.vuex_token != "") { |
| 834 | - if (this.resumeDetailObj && this.resumeDetailObj.id) { | ||
| 835 | - this.showResume = true; | ||
| 836 | - } else { | ||
| 837 | - this.showNoResume = true; | ||
| 838 | - } | 861 | + // if (this.resumeDetailObj && this.resumeDetailObj.id) { |
| 862 | + // this.showResume = true; | ||
| 863 | + // } else { | ||
| 864 | + // this.showNoResume = true; | ||
| 865 | + // } | ||
| 866 | + | ||
| 867 | + const params = { | ||
| 868 | + position_id: this.id, | ||
| 869 | + }; | ||
| 870 | + this.$u.api.getJobUserAuth(params).then((res) => { | ||
| 871 | + console.log(res); | ||
| 872 | + my.getAuthCode({ | ||
| 873 | + scopes: "yingpin", | ||
| 874 | + success: (authRes) => { | ||
| 875 | + my.ap.openCreditEvaluation({ | ||
| 876 | + signStr: res.sign_str, | ||
| 877 | + // 调用成功的回调函数 | ||
| 878 | + success: ({ resultStatus }) => { | ||
| 879 | + // 调用成功/失败,半屏关闭时的回调函数。如果调用方需要半屏关闭后进行一些操作,可以在这个回调函数里处理。 | ||
| 880 | + // 比如页面状态的刷新、页面的跳转等 | ||
| 881 | + if (resultStatus === "9003") { | ||
| 882 | + // 用户取消操作 | ||
| 883 | + } else if (resultStatus === "9000") { | ||
| 884 | + this.$u.api | ||
| 885 | + .applyJobUrlApi({ | ||
| 886 | + position_id: this.id, | ||
| 887 | + auth_code: authRes.authCode, | ||
| 888 | + ...res, | ||
| 889 | + }) | ||
| 890 | + .then((jobRes) => { | ||
| 891 | + console.log(jobRes, "jobRes"); | ||
| 892 | + if (jobRes && jobRes.code > 300) { | ||
| 893 | + uni.showToast({ | ||
| 894 | + title: jobRes.message, | ||
| 895 | + icon: "none", | ||
| 896 | + duration: 1500, | ||
| 897 | + }); | ||
| 898 | + } else { | ||
| 899 | + this.jobStatus = "new"; | ||
| 900 | + if (this.vuex_alipay) { | ||
| 901 | + this.isClose = true; | ||
| 902 | + } else { | ||
| 903 | + uni.showToast({ | ||
| 904 | + title: "投递成功!", | ||
| 905 | + icon: "none", | ||
| 906 | + duration: 1500, | ||
| 907 | + }); | ||
| 908 | + } | ||
| 909 | + } | ||
| 910 | + }); | ||
| 911 | + | ||
| 912 | + // 用户授权成功 | ||
| 913 | + } else if (resultStatus === "4000") { | ||
| 914 | + // 用户授权失败 | ||
| 915 | + } | ||
| 916 | + }, | ||
| 917 | + fail: (res) => { | ||
| 918 | + console.log(res, "slafasjlfjdsajk"); | ||
| 919 | + }, | ||
| 920 | + }); | ||
| 921 | + }, | ||
| 922 | + }); | ||
| 923 | + }); | ||
| 839 | } else { | 924 | } else { |
| 840 | this.goLogin(); | 925 | this.goLogin(); |
| 841 | } | 926 | } |
| @@ -1147,6 +1232,7 @@ export default { | @@ -1147,6 +1232,7 @@ export default { | ||
| 1147 | .tenant_info { | 1232 | .tenant_info { |
| 1148 | flex: 1; | 1233 | flex: 1; |
| 1149 | padding: 0px 16rpx; | 1234 | padding: 0px 16rpx; |
| 1235 | + | ||
| 1150 | .sxyq { | 1236 | .sxyq { |
| 1151 | font-size: 28rpx; | 1237 | font-size: 28rpx; |
| 1152 | font-family: PingFangSC-Medium, PingFang SC; | 1238 | font-family: PingFangSC-Medium, PingFang SC; |
| @@ -1589,4 +1675,12 @@ export default { | @@ -1589,4 +1675,12 @@ export default { | ||
| 1589 | } | 1675 | } |
| 1590 | } | 1676 | } |
| 1591 | } | 1677 | } |
| 1592 | -</style> | 1678 | + |
| 1679 | +.callBackAlipay { | ||
| 1680 | + display: flex; | ||
| 1681 | + flex-direction: column; | ||
| 1682 | + height: 360rpx; | ||
| 1683 | + align-items: center; | ||
| 1684 | + width: 600rpx; | ||
| 1685 | +} | ||
| 1686 | +</style> |
| @@ -246,7 +246,6 @@ | @@ -246,7 +246,6 @@ | ||
| 246 | background: | 246 | background: |
| 247 | 'linear-gradient(to right,var(--primary-color100), #fff)', | 247 | 'linear-gradient(to right,var(--primary-color100), #fff)', |
| 248 | bottom: '10px', | 248 | bottom: '10px', |
| 249 | - left: '-10px', | ||
| 250 | zIndex: '0', | 249 | zIndex: '0', |
| 251 | }" | 250 | }" |
| 252 | :active-item-style="{ | 251 | :active-item-style="{ |
| @@ -309,7 +308,6 @@ | @@ -309,7 +308,6 @@ | ||
| 309 | background: | 308 | background: |
| 310 | 'linear-gradient(to right,var(--primary-color100), #fff)', | 309 | 'linear-gradient(to right,var(--primary-color100), #fff)', |
| 311 | bottom: '10px', | 310 | bottom: '10px', |
| 312 | - left: '50px', | ||
| 313 | zIndex: '0', | 311 | zIndex: '0', |
| 314 | }" | 312 | }" |
| 315 | :active-item-style="{ | 313 | :active-item-style="{ |
static/img/common/123.png
0 → 100644
5.2 KB
| 1 | -import Vue from 'vue' | ||
| 2 | -import Vuex from 'vuex' | ||
| 3 | -import user from './modules/user' | ||
| 4 | -import internship from './modules/internship' | ||
| 5 | -Vue.use(Vuex) | 1 | +import Vue from "vue"; |
| 2 | +import Vuex from "vuex"; | ||
| 3 | +import user from "./modules/user"; | ||
| 4 | +import internship from "./modules/internship"; | ||
| 5 | +Vue.use(Vuex); | ||
| 6 | 6 | ||
| 7 | const appNameData = { | 7 | const appNameData = { |
| 8 | - '2021004125649367': '智用工', | ||
| 9 | - 'wx2a515776284cae17': '新华实习', | ||
| 10 | -} | 8 | + 2021004125649367: "智用工", |
| 9 | + wx2a515776284cae17: "新华实习", | ||
| 10 | +}; | ||
| 11 | 11 | ||
| 12 | let lifeData = {}; | 12 | let lifeData = {}; |
| 13 | -let appId = '2021004125649367'; | 13 | +let appId = "2021004125649367"; |
| 14 | // 新华网 | 14 | // 新华网 |
| 15 | // let appId = 'wx2a515776284cae17'; | 15 | // let appId = 'wx2a515776284cae17'; |
| 16 | 16 | ||
| 17 | try { | 17 | try { |
| 18 | // 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的 | 18 | // 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的 |
| 19 | - lifeData = uni.getStorageSync('lifeData'); | ||
| 20 | -} catch (e) { | ||
| 21 | - | ||
| 22 | -} | 19 | + lifeData = uni.getStorageSync("lifeData"); |
| 20 | +} catch (e) {} | ||
| 23 | 21 | ||
| 24 | // 需要永久存储,且下次APP启动需要取出的,在state中的变量名 | 22 | // 需要永久存储,且下次APP启动需要取出的,在state中的变量名 |
| 25 | let saveStateKeys = [ | 23 | let saveStateKeys = [ |
| 26 | - 'vuex_user', | ||
| 27 | - 'vuex_tenant', | ||
| 28 | - 'vuex_token', | ||
| 29 | - 'workai_vuex_token', | ||
| 30 | - 'vuex_phone', | ||
| 31 | - 'vuex_weixinUserInfo', | ||
| 32 | - 'vuex_role', | ||
| 33 | - 'vuex_userid', | ||
| 34 | - 'vuex_refresh_token', | ||
| 35 | - 'vuex_baseImgUrl', | ||
| 36 | - 'vuex_theme', | ||
| 37 | - 'vuex_expect_job' | 24 | + "vuex_user", |
| 25 | + "vuex_tenant", | ||
| 26 | + "vuex_token", | ||
| 27 | + "workai_vuex_token", | ||
| 28 | + "vuex_phone", | ||
| 29 | + "vuex_weixinUserInfo", | ||
| 30 | + "vuex_role", | ||
| 31 | + "vuex_userid", | ||
| 32 | + "vuex_refresh_token", | ||
| 33 | + "vuex_baseImgUrl", | ||
| 34 | + "vuex_theme", | ||
| 35 | + "vuex_expect_job", | ||
| 38 | ]; | 36 | ]; |
| 39 | 37 | ||
| 40 | // 保存变量到本地存储中 | 38 | // 保存变量到本地存储中 |
| @@ -42,37 +40,35 @@ const saveLifeData = function (key, value) { | @@ -42,37 +40,35 @@ const saveLifeData = function (key, value) { | ||
| 42 | // 判断变量名是否在需要存储的数组中 | 40 | // 判断变量名是否在需要存储的数组中 |
| 43 | if (saveStateKeys.indexOf(key) != -1) { | 41 | if (saveStateKeys.indexOf(key) != -1) { |
| 44 | // 获取本地存储的lifeData对象,将变量添加到对象中 | 42 | // 获取本地存储的lifeData对象,将变量添加到对象中 |
| 45 | - let tmp = uni.getStorageSync('lifeData'); | 43 | + let tmp = uni.getStorageSync("lifeData"); |
| 46 | // 第一次打开APP,不存在lifeData变量,故放一个{}空对象 | 44 | // 第一次打开APP,不存在lifeData变量,故放一个{}空对象 |
| 47 | tmp = tmp ? tmp : {}; | 45 | tmp = tmp ? tmp : {}; |
| 48 | tmp[key] = value; | 46 | tmp[key] = value; |
| 49 | // 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中 | 47 | // 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中 |
| 50 | - uni.setStorageSync('lifeData', tmp); | 48 | + uni.setStorageSync("lifeData", tmp); |
| 51 | } | 49 | } |
| 52 | -} | ||
| 53 | - | ||
| 54 | - | 50 | +}; |
| 55 | 51 | ||
| 56 | -const handleTabBars = function(type) { | 52 | +const handleTabBars = function (type) { |
| 57 | const tabBars = [ | 53 | const tabBars = [ |
| 58 | { | 54 | { |
| 59 | - "pagePath": "/pages/student/tabBar/home/home", | ||
| 60 | - "iconPath": "/static/img/common/home.png", | ||
| 61 | - "selectedIconPath": `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/wx84b71301436652ce/homeHL.png`, | ||
| 62 | - "text": "首页" | ||
| 63 | - }, | ||
| 64 | - // { | ||
| 65 | - // "pagePath": "/pages/student/tabBar/internship/internship", | ||
| 66 | - // "iconPath": "/static/img/common/internship.png", | ||
| 67 | - // "selectedIconPath": `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/${appId}/internshipHL.png`, | ||
| 68 | - // "text": "实习" | ||
| 69 | - // }, | ||
| 70 | - // { | ||
| 71 | - // "pagePath": "/pages/student/tabBar/promote/promote", | ||
| 72 | - // "iconPath": "/static/img/common/promote.png", | ||
| 73 | - // "selectedIconPath": `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/${appId}/promoteHL.png`, | ||
| 74 | - // "text": "提升" | ||
| 75 | - // }, | 55 | + pagePath: "/pages/student/tabBar/home/home", |
| 56 | + iconPath: "/static/img/common/home.png", | ||
| 57 | + selectedIconPath: `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/wx84b71301436652ce/homeHL.png`, | ||
| 58 | + text: "首页", | ||
| 59 | + }, | ||
| 60 | + // { | ||
| 61 | + // "pagePath": "/pages/student/tabBar/internship/internship", | ||
| 62 | + // "iconPath": "/static/img/common/internship.png", | ||
| 63 | + // "selectedIconPath": `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/${appId}/internshipHL.png`, | ||
| 64 | + // "text": "实习" | ||
| 65 | + // }, | ||
| 66 | + // { | ||
| 67 | + // "pagePath": "/pages/student/tabBar/promote/promote", | ||
| 68 | + // "iconPath": "/static/img/common/promote.png", | ||
| 69 | + // "selectedIconPath": `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/${appId}/promoteHL.png`, | ||
| 70 | + // "text": "提升" | ||
| 71 | + // }, | ||
| 76 | // { | 72 | // { |
| 77 | // "pagePath": "/pages/student/tabBar/message/message", | 73 | // "pagePath": "/pages/student/tabBar/message/message", |
| 78 | // "iconPath": "/static/img/common/message.png", | 74 | // "iconPath": "/static/img/common/message.png", |
| @@ -81,13 +77,13 @@ const handleTabBars = function(type) { | @@ -81,13 +77,13 @@ const handleTabBars = function(type) { | ||
| 81 | // 'isDot': true, | 77 | // 'isDot': true, |
| 82 | // 'count': 0, | 78 | // 'count': 0, |
| 83 | // }, | 79 | // }, |
| 84 | - { | ||
| 85 | - "pagePath": "/pages/student/tabBar/my/my", | ||
| 86 | - "iconPath": "/static/img/common/my.png", | ||
| 87 | - "selectedIconPath": `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/wx84b71301436652ce/myHL.png`, | ||
| 88 | - "text": "我的" | ||
| 89 | - } | ||
| 90 | - ] | 80 | + { |
| 81 | + pagePath: "/pages/student/tabBar/my/my", | ||
| 82 | + iconPath: "/static/img/common/my.png", | ||
| 83 | + selectedIconPath: `https://yxlypublic.oss-cn-beijing.aliyuncs.com/WeChat/wx84b71301436652ce/myHL.png`, | ||
| 84 | + text: "我的", | ||
| 85 | + }, | ||
| 86 | + ]; | ||
| 91 | // if (appId == 'wx2a515776284cae17') { | 87 | // if (appId == 'wx2a515776284cae17') { |
| 92 | // tabBars.splice(2, 1) | 88 | // tabBars.splice(2, 1) |
| 93 | // } | 89 | // } |
| @@ -100,9 +96,8 @@ const handleTabBars = function(type) { | @@ -100,9 +96,8 @@ const handleTabBars = function(type) { | ||
| 100 | // if (type == 'student') { | 96 | // if (type == 'student') { |
| 101 | // return tabBars | 97 | // return tabBars |
| 102 | // } | 98 | // } |
| 103 | - return tabBars | ||
| 104 | - | ||
| 105 | -} | 99 | + return tabBars; |
| 100 | +}; | ||
| 106 | 101 | ||
| 107 | const store = new Vuex.Store({ | 102 | const store = new Vuex.Store({ |
| 108 | modules: { | 103 | modules: { |
| @@ -112,46 +107,57 @@ const store = new Vuex.Store({ | @@ -112,46 +107,57 @@ const store = new Vuex.Store({ | ||
| 112 | state: { | 107 | state: { |
| 113 | vuex_appId: appId, | 108 | vuex_appId: appId, |
| 114 | vuex_appName: appNameData[appId], | 109 | vuex_appName: appNameData[appId], |
| 110 | + vuex_alipay: false, | ||
| 115 | // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 | 111 | // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 |
| 116 | // 加上vuex_前缀,是防止变量名冲突,也让人一目了然 | 112 | // 加上vuex_前缀,是防止变量名冲突,也让人一目了然 |
| 117 | vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {}, | 113 | vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {}, |
| 118 | vuex_tenant: lifeData.vuex_tenant ? lifeData.vuex_tenant : {}, | 114 | vuex_tenant: lifeData.vuex_tenant ? lifeData.vuex_tenant : {}, |
| 119 | - vuex_weixinUserInfo: lifeData.vuex_weixinUserInfo ? lifeData.vuex_weixinUserInfo : {}, | ||
| 120 | - vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '', | ||
| 121 | - workai_vuex_token: lifeData.workai_vuex_token ? lifeData.workai_vuex_token : '', | ||
| 122 | - vuex_phone: lifeData.vuex_phone ? lifeData.vuex_phone : '', | ||
| 123 | - vuex_role: lifeData.vuex_role ? lifeData.vuex_role : '', | ||
| 124 | - vuex_userid: lifeData.vuex_userid ? lifeData.vuex_userid : '', | ||
| 125 | - vuex_refresh_token: lifeData.vuex_refresh_token ? lifeData.vuex_refresh_token : '', | 115 | + vuex_weixinUserInfo: lifeData.vuex_weixinUserInfo |
| 116 | + ? lifeData.vuex_weixinUserInfo | ||
| 117 | + : {}, | ||
| 118 | + vuex_token: lifeData.vuex_token ? lifeData.vuex_token : "", | ||
| 119 | + workai_vuex_token: lifeData.workai_vuex_token | ||
| 120 | + ? lifeData.workai_vuex_token | ||
| 121 | + : "", | ||
| 122 | + vuex_phone: lifeData.vuex_phone ? lifeData.vuex_phone : "", | ||
| 123 | + vuex_role: lifeData.vuex_role ? lifeData.vuex_role : "", | ||
| 124 | + vuex_userid: lifeData.vuex_userid ? lifeData.vuex_userid : "", | ||
| 125 | + vuex_refresh_token: lifeData.vuex_refresh_token | ||
| 126 | + ? lifeData.vuex_refresh_token | ||
| 127 | + : "", | ||
| 126 | // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 | 128 | // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 |
| 127 | - vuex_version: '1.0.0', | 129 | + vuex_version: "1.0.0", |
| 128 | vuex_noAuth: true, | 130 | vuex_noAuth: true, |
| 129 | - vuex_demo: '绛紫', | 131 | + vuex_demo: "绛紫", |
| 130 | vuex_baseImgUrl: "", | 132 | vuex_baseImgUrl: "", |
| 131 | vuex_ossUrl: "https://yxly.oss-cn-beijing.aliyuncs.com", | 133 | vuex_ossUrl: "https://yxly.oss-cn-beijing.aliyuncs.com", |
| 132 | vuex_ossUrlPubilc: "https://yxlypublic.oss-cn-beijing.aliyuncs.com", | 134 | vuex_ossUrlPubilc: "https://yxlypublic.oss-cn-beijing.aliyuncs.com", |
| 133 | // vuex_ossUrl: "https://oss.workai.com.cn", | 135 | // vuex_ossUrl: "https://oss.workai.com.cn", |
| 134 | vuex_OssInit: {}, | 136 | vuex_OssInit: {}, |
| 135 | vuex_area: {}, | 137 | vuex_area: {}, |
| 136 | - vuex_theme: '', | 138 | + vuex_theme: "", |
| 137 | // vuex_theme: this.theme, | 139 | // vuex_theme: this.theme, |
| 138 | // 自定义tabbar数据 | 140 | // 自定义tabbar数据 |
| 139 | - vuex_tabbar: handleTabBars('worker'), | ||
| 140 | - vuex_tabbar_inter: handleTabBars('student'), | ||
| 141 | - vuex_expect_job: lifeData.vuex_expect_job ? lifeData.vuex_expect_job : '全部职位', | 141 | + vuex_tabbar: handleTabBars("worker"), |
| 142 | + vuex_tabbar_inter: handleTabBars("student"), | ||
| 143 | + vuex_expect_job: lifeData.vuex_expect_job | ||
| 144 | + ? lifeData.vuex_expect_job | ||
| 145 | + : "全部职位", | ||
| 142 | }, | 146 | }, |
| 143 | 147 | ||
| 144 | getters: { | 148 | getters: { |
| 145 | - doneTenantType: state => { | ||
| 146 | - return state.vuex_tenant && state.vuex_tenant.type ? String(state.vuex_tenant.type) : ''; | ||
| 147 | - } | 149 | + doneTenantType: (state) => { |
| 150 | + return state.vuex_tenant && state.vuex_tenant.type | ||
| 151 | + ? String(state.vuex_tenant.type) | ||
| 152 | + : ""; | ||
| 153 | + }, | ||
| 148 | }, | 154 | }, |
| 149 | 155 | ||
| 150 | mutations: { | 156 | mutations: { |
| 151 | $uStore(state, payload) { | 157 | $uStore(state, payload) { |
| 152 | // 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1 | 158 | // 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1 |
| 153 | - let nameArr = payload.name.split('.'); | ||
| 154 | - let saveKey = ''; | 159 | + let nameArr = payload.name.split("."); |
| 160 | + let saveKey = ""; | ||
| 155 | let len = nameArr.length; | 161 | let len = nameArr.length; |
| 156 | if (len >= 2) { | 162 | if (len >= 2) { |
| 157 | let obj = state[nameArr[0]]; | 163 | let obj = state[nameArr[0]]; |
| @@ -166,14 +172,14 @@ const store = new Vuex.Store({ | @@ -166,14 +172,14 @@ const store = new Vuex.Store({ | ||
| 166 | saveKey = payload.name; | 172 | saveKey = payload.name; |
| 167 | } | 173 | } |
| 168 | // 保存变量到本地,见顶部函数定义 | 174 | // 保存变量到本地,见顶部函数定义 |
| 169 | - saveLifeData(saveKey, state[saveKey]) | 175 | + saveLifeData(saveKey, state[saveKey]); |
| 170 | }, | 176 | }, |
| 171 | 177 | ||
| 172 | setWenxinUserInfo(state, result) { | 178 | setWenxinUserInfo(state, result) { |
| 173 | state.vuex_weixinUserInfo = result.userInfo; | 179 | state.vuex_weixinUserInfo = result.userInfo; |
| 174 | - uni.$u.vuex('vuex_weixinUserInfo', result.userInfo); | 180 | + uni.$u.vuex("vuex_weixinUserInfo", result.userInfo); |
| 175 | }, | 181 | }, |
| 176 | - } | ||
| 177 | -}) | 182 | + }, |
| 183 | +}); | ||
| 178 | 184 | ||
| 179 | -export default store | 185 | +export default store; |
请
注册
或
登录
后发表评论