提交 d69ed7f3725b184085d9e75e52b00a907e87da0f

作者 juvenile
1 个父辈 0de0f498

修改支付宝就业投递简历改为芝麻工作证免密登录

1 1 // 如果没有通过拦截器配置域名的话,可以在这里写上完整的URL(加上域名部分)
2 2 let loginUrl = '/hro/uaa/v1/auth/tokens';
  3 +let resumeUrl = '/hro/uaa/v1/users/op/bind-mobile';
3 4 let settingGetUrl = '/basic/v1/setting/get';
4 5 let userUrl = '/user/v1/detail';
5 6 let smsCodeUrl = '/hro/sms/v1/sms_codes';
... ... @@ -61,6 +62,7 @@ let isJobCollectedUrl = '/hro/recruit/v1/yxly/user/collects/check/'
61 62 let jobRecommendUrl = '/hro/recruit/v1/yxly/user/positions/recommend';
62 63 let jobReccommendListUrl = '/hro/recruit/v1/yxly/user/candidates/recommends';
63 64 let applyJobUrl = '/hro/recruit/v1/yxly/zfb/user-delivery';
  65 +let alipayUrl = '/hro/recruit/v1/yxly/zfb/resume';
64 66 let getAuthUrl = '/user/v1/getAuthUrl';
65 67 let isJobAppliedUrl = '/hro/recruit/v1/yxly/user/delivery/check/';
66 68 let signstartUrl = '/internship/v1/treaty/sign/start';
... ... @@ -143,6 +145,15 @@ const install = (Vue, vm) => {
143 145 }
144 146 });
145 147
  148 + // 登录
  149 + let resumeLogin = (params = {}) => vm.$u.post(resumeUrl, params).then(res => {
  150 + if (res.code >= 300) {
  151 + uni.$u.toast(res.msg);
  152 + } else {
  153 + return res
  154 + }
  155 + });
  156 +
146 157 // 隐藏认证
147 158 let settingGetApi = (params = {}) => vm.$u.get(settingGetUrl, params).then(res => {
148 159 if (res.code >= 300) {
... ... @@ -1251,6 +1262,15 @@ const install = (Vue, vm) => {
1251 1262 }
1252 1263 });
1253 1264
  1265 + // 获取支付宝简历
  1266 + let getAlipayApi = (params = {}) => vm.$u.post(alipayUrl, params).then(res => {
  1267 + if (res.code >= 300) {
  1268 + return res
  1269 + uni.$u.toast(res.message);
  1270 + } else {
  1271 + return res
  1272 + }
  1273 + });
1254 1274
1255 1275 let entrustPositionsApi = (params = {}) => vm.$u.get(entrustPositions, params).then(res => {
1256 1276 if (res.code >= 300) {
... ... @@ -2013,6 +2033,7 @@ const install = (Vue, vm) => {
2013 2033 // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
2014 2034 vm.$u.api = {
2015 2035 getJobUserAuth,
  2036 + resumeLogin,
2016 2037 getLoginApi,
2017 2038 settingGetApi,
2018 2039 getSmsCodeApi,
... ... @@ -2174,6 +2195,7 @@ const install = (Vue, vm) => {
2174 2195 positionsOnlinelistApi,
2175 2196 positionsOnlineDropdownlistApi,
2176 2197 tenantCollectslistApi,
  2198 + getAlipayApi,
2177 2199 };
2178 2200 }
2179 2201
... ...
... ... @@ -501,7 +501,7 @@ export default {
501 501 return {
502 502 analysisArea,
503 503 formateSalary,
504   - isClose: true,
  504 + isClose: false,
505 505 yxlyLoginShow: false,
506 506 statusBarHeight: 44,
507 507 menuHeight: 32,
... ... @@ -593,14 +593,12 @@ export default {
593 593 }
594 594 },
595 595 alipayBack() {
596   - my.exitMiniProgram({
597   - success:()=>{
598   - console.log('成功');
599   - },
600   - fail:()=>{
601   -
602   - }
603   - })
  596 + my.exitMiniProgram({
  597 + success: () => {
  598 + console.log("成功");
  599 + },
  600 + fail: () => {},
  601 + });
604 602 },
605 603
606 604 timeFormat(value, format = "yyyy-mm-dd") {
... ... @@ -1127,7 +1125,98 @@ export default {
1127 1125 },
1128 1126
1129 1127 goLogin() {
1130   - this.yxlyLoginShow = true;
  1128 + if(this.vuex_alipay){
  1129 + const params = {
  1130 + position_id: this.id,
  1131 + };
  1132 + this.$u.api.getJobUserAuth(params).then((res) => {
  1133 + my.getAuthCode({
  1134 + scopes: "yingpin",
  1135 + success: (authRes) => {
  1136 + my.ap.openCreditEvaluation({
  1137 + signStr: res.sign_str,
  1138 + // 调用成功的回调函数
  1139 + success: ({ resultStatus }) => {
  1140 + // 调用成功/失败,半屏关闭时的回调函数。如果调用方需要半屏关闭后进行一些操作,可以在这个回调函数里处理。
  1141 + // 比如页面状态的刷新、页面的跳转等
  1142 + if (resultStatus === "9003") {
  1143 + // 用户取消操作
  1144 + } else if (resultStatus === "9000") {
  1145 + this.$u.api
  1146 + .getAlipayApi({
  1147 + position_id: this.id,
  1148 + ...res,
  1149 + })
  1150 + .then((jobRes) => {
  1151 + if(res.code>300){
  1152 + uni.showToast({
  1153 + title:res.message,
  1154 + icon:'none'
  1155 + })
  1156 + }else {
  1157 + this.$store.dispatch(`user/resumePhoneLogin`, {
  1158 + mobile:jobRes.mobile,
  1159 + app_id:this.vuex_appId,
  1160 + source:"zfb_app_yxly"
  1161 + // islangch: '0'
  1162 + })
  1163 + .then((res) => {
  1164 + if(res.code>300) {
  1165 + uni.showToast({
  1166 + title:res.message,
  1167 + icon:'none'
  1168 + })
  1169 + }else {
  1170 + this.$u.api
  1171 + .applyJobUrlApi({
  1172 + position_id: this.id,
  1173 + auth_code: authRes.authCode,
  1174 + resume_detail:jobRes.resume_detail,
  1175 + ...res,
  1176 + })
  1177 + .then((jobRes) => {
  1178 + console.log(jobRes, "jobRes");
  1179 + if (jobRes && jobRes.code > 300) {
  1180 + uni.showToast({
  1181 + title: jobRes.message,
  1182 + icon: "none",
  1183 + duration: 1500,
  1184 + });
  1185 + } else {
  1186 + this.jobStatus = "new";
  1187 + if (this.vuex_alipay) {
  1188 + this.isClose = true;
  1189 + } else {
  1190 + uni.showToast({
  1191 + title: "投递成功!",
  1192 + icon: "none",
  1193 + duration: 1500,
  1194 + });
  1195 + }
  1196 + }
  1197 + });
  1198 +
  1199 + }
  1200 + });
  1201 + }
  1202 + });
  1203 +
  1204 + // 用户授权成功
  1205 + } else if (resultStatus === "4000") {
  1206 + // 用户授权失败
  1207 + }
  1208 + },
  1209 + fail: (res) => {
  1210 + console.log(res, "slafasjlfjdsajk");
  1211 + },
  1212 + });
  1213 + },
  1214 + });
  1215 + });
  1216 + }else {
  1217 + this.yxlyLoginShow = true;
  1218 + }
  1219 +
1131 1220 // this.$u.toast('未登录,请重新登录!');
1132 1221 // setTimeout(() => {
1133 1222 // // 此为uView的方法,详见路由相关文档
... ...
... ... @@ -205,7 +205,24 @@ const actions = {
205 205 const res = await uni.$u.api.getLoginApi({
206 206 ...params,
207 207 });
208   - console.log(res);
  208 + if (res.code && res.code > 300) {
  209 + } else {
  210 + const { user, refresh_token, access_token } = res;
  211 + const { mobile, id: userId } = user;
  212 + let vuex_token = `Bearer ${access_token}`;
  213 + uni.$u.vuex("vuex_token", vuex_token);
  214 + uni.$u.vuex("vuex_phone", mobile);
  215 + uni.$u.vuex("vuex_userid", userId);
  216 + uni.$u.vuex("vuex_refresh_token", refresh_token);
  217 + uni.$u.vuex("vuex_user", user);
  218 + res["loginType"] = "success";
  219 + }
  220 + return res;
  221 + },
  222 + async resumePhoneLogin({ commit, dispatch, state }, params) {
  223 + const res = await uni.$u.api.resumeLogin({
  224 + ...params,
  225 + });
209 226 if (res.code && res.code > 300) {
210 227 } else {
211 228 const { user, refresh_token, access_token } = res;
... ...
注册登录 后发表评论