index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <ion-page class="list-page">
  3. <ion-header class="header-theme2 header-theme3">
  4. <ion-toolbar>
  5. <ion-title>信息登记</ion-title>
  6. </ion-toolbar>
  7. </ion-header>
  8. <ion-content>
  9. <div class="user_img">
  10. <b-image v-if="user.userID" :file-ref-id="user.userID" :readonly="true" :is-single="true"></b-image>
  11. </div>
  12. <div class="bw-vue-form">
  13. <div class="form-detail">
  14. <ion-label>姓名</ion-label>
  15. <ion-text>{{ user.name }}</ion-text>
  16. </div>
  17. <div class="form-detail">
  18. <ion-label>工号</ion-label>
  19. <ion-text>{{ user.userNo }}</ion-text>
  20. </div>
  21. <!-- <div class="form-detail">-->
  22. <!-- <ion-label>身份证号</ion-label>-->
  23. <!-- <ion-text>{{ user.IDCard }}</ion-text>-->
  24. <!-- </div>-->
  25. <div class="form-detail">
  26. <ion-label>身份</ion-label>
  27. <ion-text>驿站工作人员</ion-text>
  28. </div>
  29. <div class="form-detail">
  30. <ion-label>所属驿站</ion-label>
  31. <ion-text>{{ user.siteName }}</ion-text>
  32. </div>
  33. <div v-if="isDev" class="form-detail">
  34. <ion-label>openId</ion-label>
  35. <ion-text>{{ openId }}</ion-text>
  36. </div>
  37. </div>
  38. <div class="page_button" v-if="qrcodeVerifyResult && openId">
  39. <ion-button shape="round" expand="block" @click="onCompany">我是企业</ion-button>
  40. <ion-button shape="round" expand="block" @click="onJobUser">我是求职者</ion-button>
  41. </div>
  42. <div v-if="!openId" style="color:red;text-align: center;">
  43. 微信授权失败,请重新扫码!
  44. </div>
  45. </ion-content>
  46. </ion-page>
  47. </template>
  48. <script>
  49. import {defineComponent, ref} from "vue";
  50. import {getUrlParams} from "@/utils/urlUtils";
  51. import {alertController, onIonViewDidEnter} from "@ionic/vue";
  52. import {getUserByID} from "@/api/siteUserInfo";
  53. import {useRouter} from "vue-router";
  54. import {useUserStore} from "@/store/modules/user";
  55. import {getConfig} from "@/utils/config";
  56. import {qrcodeVerify} from "@/api/wechat";
  57. import BImage from "@/components/bImage.vue";
  58. const presentAlert = async (message) => {
  59. const alert = await alertController.create({
  60. header: '错误!',
  61. message: message,
  62. buttons: [
  63. '确定'
  64. ],
  65. });
  66. await alert.present();
  67. }
  68. const openId = ref("");
  69. const userId = ref("");
  70. const qrCodeId = ref("");
  71. export default defineComponent({
  72. name: "jobUserInfoIndex",
  73. components:{BImage},
  74. setup() {
  75. const router = useRouter();
  76. const user = ref({userNo: '', name: '', IDCard: '', siteName: ''});
  77. const urlParams = getUrlParams();
  78. const qrcodeVerifyResult = ref(false);
  79. const isDev = ref(false);
  80. /*const userStore = useUserStore();
  81. openId.value = userStore.getOpenId;*/
  82. const getUser = async function () {
  83. const reqData = await getUserByID(userId.value);
  84. user.value = reqData;
  85. console.log("user",user.value);
  86. };
  87. const getQrcodeVerify = () => {
  88. qrcodeVerify(qrCodeId.value, openId.value).then(res => {
  89. qrcodeVerifyResult.value = res;
  90. if (!res) {
  91. presentAlert("二维码无效或已超出扫码次数,请重新打印二维码!");
  92. }
  93. });
  94. };
  95. const onCompany = function () {
  96. router.push({
  97. path: '/jobUserInfo/companyEdit',
  98. query: {reload: 1, openId: openId.value, loginUserId: userId.value, userId: userId.value}
  99. });
  100. };
  101. const onJobUser = function () {
  102. router.push({
  103. path: '/jobUserInfo/userEdit',
  104. query: {reload: 1, openId: openId.value, status: 1, loginUserId: userId.value, userId: userId.value}
  105. });
  106. };
  107. getConfig().then(res => {
  108. isDev.value = res.isDev;
  109. }, () => {
  110. isDev.value = true;
  111. })
  112. onIonViewDidEnter(() => {
  113. openId.value = urlParams["openId"];
  114. userId.value = urlParams["userId"];
  115. qrCodeId.value = urlParams["qrCodeId"];
  116. });
  117. return {
  118. user,
  119. onCompany,
  120. onJobUser,
  121. openId,
  122. isDev,
  123. qrcodeVerifyResult,
  124. userId,
  125. qrCodeId,
  126. getQrcodeVerify,
  127. getUser
  128. }
  129. },
  130. created() {
  131. /*const userStore = useUserStore();*/
  132. const urlParams = getUrlParams();
  133. openId.value = urlParams["openId"];
  134. userId.value = urlParams["userId"];
  135. qrCodeId.value = urlParams["qrCodeId"];
  136. if (!userId.value) {
  137. presentAlert("驿站工作者信息获取失败");
  138. return;
  139. }
  140. if (!qrCodeId.value) {
  141. presentAlert("二维码无效或已超出扫码次数,请重新打印二维码!");
  142. return;
  143. }
  144. this.getUser();
  145. this.getQrcodeVerify();
  146. },
  147. mounted() {
  148. //
  149. }
  150. });
  151. </script>
  152. <style lang="less">
  153. .bw-vue-form {
  154. padding: 20px 10px;
  155. }
  156. .user_img {
  157. .img-list {
  158. width:100%;
  159. }
  160. .img-item:first-child,.img-item:first-child img{
  161. width: 120px;
  162. margin:0 auto;
  163. }
  164. .img-item:not(:first-child){
  165. display: none;
  166. }
  167. }
  168. .page_button {
  169. display: flex;
  170. justify-content: space-around;
  171. padding: 20px;
  172. ion-button {
  173. width: 150px;
  174. }
  175. }
  176. .header-theme3 {
  177. ion-title {
  178. margin-left: 0px !important;
  179. }
  180. }
  181. </style>