apply.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view>
  3. <!-- <image class="img" src="https://xlzx.vvv5g.com/addons/yzd_edu//static/public/img/diy_default/lecture_in_img.png"></image> -->
  4. <view class="box" v-if="state == 0 || state == 3">
  5. <view class="item-submit" v-if="state == 3">
  6. <view>审核未通过, 请重新提交审核</view>
  7. </view>
  8. <!-- <view class="item">
  9. <view class="item-text">姓名</view>
  10. <view class="item-input"><input v-model="title" type="text" placeholder="请输入您的姓名"></view>
  11. </view>
  12. <view class="item">
  13. <view class="item-text">手机号</view>
  14. <view class="item-input"><input v-model="phone" type="text" placeholder="请输入您的手机号"></view>
  15. </view>
  16. <view class="item">
  17. <view class="item-text">账号</view>
  18. <view class="item-input"><input v-model="username" type="text" placeholder="请输入您的账号">
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="item-text">密码</view>
  23. <view class="item-input"><input v-model="password" type="password" placeholder="6-20个字母、数字、特殊字符"></view>
  24. </view>
  25. <view class="item">
  26. <view class="item-text">性别</view>
  27. <view class="item-input">
  28. <picker style="line-height: 44rpx;" @change="bindPickerChange" :value="index" :range="array" range-key="name">
  29. <view class="uni-input">{{array[index].name}}</view>
  30. </picker>
  31. </view>
  32. </view> -->
  33. <view class="item-u">
  34. <view class="item-text">
  35. <text>资质</text>
  36. </view>
  37. <view v-if="!img" class="choose-outer" @click="choodeImage">
  38. <text class="up-label">+</text>
  39. <text class="up-title">证书图片</text>
  40. </view>
  41. <image v-if="img" @click="choodeImage" :src="img" mode="aspectFill"
  42. style="width: 294rpx; height: 198rpx; border-radius: 15rpx;"></image>
  43. </view>
  44. <view class="item">
  45. <view class="item-text">请选择机构</view>
  46. <view class="item-input">
  47. <picker style="line-height: 44rpx;" @change="bindPickerChange" :value="index" :range="institutionList" range-key="nickname">
  48. <view class="uni-input">{{institutionList[index].nickname}}</view>
  49. </picker>
  50. </view>
  51. </view>
  52. <view class="item-submit">
  53. <view></view>
  54. </view>
  55. <view class="item-submit">
  56. <view class="item-button" @click="submit">提交审核</view>
  57. </view>
  58. </view>
  59. <view v-if="state == 1">
  60. <view class="item-submit">
  61. 目前正在审核请耐心等待
  62. </view>
  63. </view>
  64. <view v-if="state == 2">
  65. <view class="item-submit">
  66. 审核已通过
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. title: '',
  76. phone: '',
  77. username: '',
  78. password: '',
  79. img: '',
  80. content: '',
  81. array: [{
  82. name: '男'
  83. }, {
  84. name: '女'
  85. }],
  86. action: '', // 图片上传地址
  87. index: 0,
  88. state: 0,
  89. identity: 0, // 1 咨询师 2机构
  90. page: 1,
  91. limit: 999,
  92. institutionList: [], // 机构列表
  93. }
  94. },
  95. onLoad(option) {
  96. // this.getInstitutionList();
  97. this.identity = option.identity;
  98. this.getInstitutionList();
  99. },
  100. methods: {
  101. //获取机构列表
  102. getInstitutionList(loading = true) {
  103. this.$request.getInstitutionList({
  104. page: this.page,
  105. limit: this.limit
  106. }).then( res =>{
  107. console.log(res)
  108. this.institutionList = res.data
  109. }).catch( e=>{
  110. console.log(e)
  111. })
  112. },
  113. // 选择图片上传
  114. choodeImage() {
  115. uni.chooseImage({
  116. count: 1,
  117. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  118. sourceType: ['album'], //从相册选择
  119. success: (res) => {
  120. // this.img = res.tempFilePaths[0]
  121. uni.showLoading({
  122. title: '上传中...'
  123. })
  124. uni.uploadFile({
  125. url: 'https://ocr.lfwhzb.com/api/upload/image', //接口地址
  126. filePath: res.tempFilePaths[0],
  127. name: 'upfile',
  128. success: (uploadFileRes) => {
  129. uni.hideLoading()
  130. console.log(uploadFileRes, '111111111111111')
  131. console.log(uploadFileRes);
  132. this.img = uploadFileRes.data
  133. }
  134. });
  135. }
  136. })
  137. },
  138. bindPickerChange: function(e) {
  139. console.log('picker发送选择改变,携带值为:' + e.detail.value)
  140. this.index = e.detail.value
  141. },
  142. submit: function(e) {
  143. if (!this.title) {
  144. uni.showToast({
  145. title: '请输入姓名',
  146. icon: 'none'
  147. })
  148. return
  149. }
  150. if (!this.phone) {
  151. uni.showToast({
  152. title: '请输入手机号码',
  153. icon: 'none'
  154. })
  155. return
  156. }
  157. if (!this.username) {
  158. uni.showToast({
  159. title: '请输入账号',
  160. icon: 'none'
  161. })
  162. return
  163. }
  164. var pwdRegex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z]).{6,30}');
  165. if (!pwdRegex.test(this.password)) {
  166. uni.showToast({
  167. title: "您的密码复杂度太低(密码中必须包含字母、数字),请及时修改密码!",
  168. icon: 'none'
  169. })
  170. return
  171. }
  172. if (!this.img) {
  173. uni.showToast({
  174. title: '请上传您的资质',
  175. icon: 'none'
  176. })
  177. return
  178. }
  179. this.$post({
  180. data: {
  181. do: 'LecturerSettled',
  182. data: {
  183. "title": this.title,
  184. "phone": this.phone,
  185. "username": this.username,
  186. "password": this.password,
  187. "img": this.img,
  188. "content": '',
  189. "sex": this.index + 1,
  190. "user_id": uni.getStorageSync('id'),
  191. }
  192. }
  193. }).then(res => {
  194. console.log(res, 'ssssssssssssssssssssss')
  195. uni.showToast({
  196. title: '添加成功',
  197. mask: true
  198. })
  199. setTimeout(() => {
  200. uni.navigateBack()
  201. }, 1500)
  202. })
  203. }
  204. }
  205. }
  206. </script>
  207. <style>
  208. .item {
  209. display: flex;
  210. padding: 27rpx 0;
  211. border-bottom: 1px solid #f3f3f3;
  212. align-items: center;
  213. }
  214. .box {
  215. padding: 10rpx 30rpx;
  216. }
  217. .item-input {
  218. padding-left: 10rpx;
  219. width: 70%;
  220. }
  221. .item-text {
  222. min-width: 115rpx;
  223. }
  224. .img {
  225. width: 100%;
  226. height: 320rpx;
  227. }
  228. .item-button {
  229. width: 247rpx;
  230. max-content: 80rpx;
  231. text-align: center;
  232. line-height: 80rpx;
  233. background-color: #04ba8f;
  234. color: #fff;
  235. border-radius: 94rpx;
  236. box-shadow: 0 6rpx 6rpx rgba(0, 0, 0, .05);
  237. margin: 20rpx 0;
  238. }
  239. .item-submit {
  240. display: flex;
  241. justify-content: center;
  242. align-items: center;
  243. }
  244. .item-u {
  245. display: flex;
  246. padding: 10rpx 0;
  247. align-items: center;
  248. }
  249. .choose-outer {
  250. width: 290rpx;
  251. height: 198rpx;
  252. border: 2px dotted #CCCCCC;
  253. border-radius: 15rpx;
  254. display: flex;
  255. flex-direction: column;
  256. justify-content: center;
  257. align-items: center;
  258. }
  259. </style>