AccountAppeal.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <template>
  2. <div class="certification">
  3. <div class="container">
  4. <div class="content" v-show="goNextStep">
  5. <div class="content-top">
  6. <h3>账号申诉</h3>
  7. </div>
  8. <div>
  9. <el-form :model="account" :rules="rules" ref="account" label-width="100px" class="demo-ruleForm">
  10. <el-form-item prop="mobile">
  11. <el-input v-model="account.mobile"
  12. v-bind:class="{active: mobileExit}"
  13. placeholder="新手机号码"></el-input>
  14. <span class="tip tip-mobile" v-show="mobileExit">该手机已被注册</span>
  15. </el-form-item>
  16. <el-form-item prop="code">
  17. <el-input type="text" v-model="account.code"
  18. v-bind:class="{ active: codeErrorChecked }"
  19. auto-complete="off" class="msg"
  20. placeholder="短信验证码"></el-input>
  21. <el-button type="primary" class="code"
  22. v-show="sendAccountCode"
  23. @click="getCheckCode"
  24. :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
  25. <el-button type="primary" v-show="!sendAccountCode" class="code code-send">已发送({{account_time}}s)</el-button>
  26. <span v-show="codeErrorChecked" class="tip codeError-tip" >{{codeErrorMsg}}</span>
  27. </el-form-item>
  28. <el-form-item prop="password">
  29. <el-input type="password" v-model="account.password" auto-complete="new-password" placeholder="登录密码"></el-input>
  30. </el-form-item>
  31. <el-form-item prop="description">
  32. <el-input type="textarea" v-model="account.description" placeholder="申诉说明"></el-input>
  33. <span class="tip description" v-show="descriptionTip">请描述您申诉的原因,并尽可能多地列举出证明此账号为您所有的证据</span>
  34. </el-form-item>
  35. <el-form-item prop="contactName">
  36. <el-input type="text" v-model="account.contactName" auto-complete="off" placeholder="姓名"></el-input>
  37. </el-form-item>
  38. <el-form-item prop="contactTel">
  39. <el-input type="text" v-model="account.contactTel" auto-complete="off" placeholder="联系电话"></el-input>
  40. </el-form-item>
  41. <el-form-item prop="contactEmail">
  42. <el-input type="text" v-model="account.contactEmail" auto-complete="off" placeholder="电子邮箱"></el-input>
  43. </el-form-item>
  44. <el-form-item>
  45. <a class="btn finish"
  46. @click="submit"
  47. :disabled="!checked || !mobileChecked || !codeChecked || !passwordChecked || !descriptionChecked || !contactNameChecked || !contactTelChecked || !contactEmailChecked">提交</a>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-checkbox name="type" v-model="checked" @click="checkboxChecked"></el-checkbox>
  51. <span class="agree">我已阅读并同意 <a href="/common/agreement">《优软云服务条款》</a></span>
  52. </el-form-item>
  53. </el-form>
  54. </div>
  55. </div>
  56. <div class="content" v-show="!goNextStep">
  57. <div class="content-top">
  58. <h3>账号申诉</h3>
  59. </div>
  60. <div class="content-bottom">
  61. <p class="passed"><img src="/images/all/pass.png" alt=""/>申诉已提交</p>
  62. <span>申诉内容已提交,请耐心等待审核</span>
  63. <div class="close-btn" @click="goCloudCenter">关闭</div>
  64. </div>
  65. </div>
  66. <loading v-show="isShowLoading"/>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import Loading from '~components/common/loading/Loading.vue'
  72. export default {
  73. name: 'AccountAppeal',
  74. components: {
  75. Loading
  76. },
  77. data () {
  78. var validateMobile = (rule, value, callback) => {
  79. if (value === '') {
  80. callback(new Error('请填写正确的手机号'))
  81. this.getCodeBtnIsDisabled = true
  82. this.mobileChecked = false
  83. this.mobileExit = false
  84. } else {
  85. if (this.account.mobile !== '') {
  86. var reg = /^1[0-9]{10}$/
  87. if (!reg.test(value)) {
  88. callback(new Error('请填写正确的手机号'))
  89. this.getCodeBtnIsDisabled = true
  90. this.mobileChecked = false
  91. this.mobileExit = false
  92. } else {
  93. this.$http.get(`/update/user/mobile/hasRegister`, {params: {mobile: this.account.mobile}})
  94. .then(response => {
  95. if (response.data.content.hasRegister) {
  96. this.getCodeBtnIsDisabled = true
  97. this.mobileChecked = false
  98. this.mobileExit = true
  99. } else {
  100. this.getCodeBtnIsDisabled = false
  101. this.mobileChecked = true
  102. this.mobileExit = false
  103. }
  104. })
  105. }
  106. }
  107. callback()
  108. }
  109. }
  110. var validateCode = (rule, value, callback) => {
  111. if (value === '') {
  112. callback(new Error('请填写正确的验证码'))
  113. this.codeErrorChecked = false
  114. this.codeChecked = false
  115. } else {
  116. if (this.account.code !== '') {
  117. if (this.account.mobile === '') {
  118. callback(new Error('请先填写正确的验证码'))
  119. } else {
  120. if (this.token) {
  121. let param = new FormData()
  122. param.append('mobile', this.account.mobile)
  123. param.append('code', this.account.code)
  124. param.append('token', this.token)
  125. let config = {
  126. headers: {'Content-Type': 'multipart/form-data'}
  127. }
  128. this.$http.post(`/appeal/check/mobile`, param, config)
  129. .then(response => {
  130. if (response.data.success) {
  131. this.codeChecked = true
  132. this.codeErrorChecked = false
  133. } else {
  134. this.codeErrorChecked = true
  135. this.codeChecked = false
  136. return Promise.reject(response.data)
  137. }
  138. }).catch(err => {
  139. this.codeErrorMsg = err.errMsg
  140. // this.$message.error(err.errMsg)
  141. })
  142. } else {
  143. callback(new Error('请先获取验证码'))
  144. this.codeChecked = false
  145. this.codeErrorChecked = false
  146. }
  147. }
  148. }
  149. callback()
  150. }
  151. }
  152. var validatePassword = (rule, value, callback) => {
  153. if (value === '') {
  154. callback(new Error('请填写正确的密码'))
  155. this.passwordChecked = false
  156. } else {
  157. if (this.account.password !== '') {
  158. this.passwordChecked = true
  159. }
  160. callback()
  161. }
  162. }
  163. var validateDescription = (rule, value, callback) => {
  164. if (value === '') {
  165. callback(new Error('请填写申诉说明'))
  166. this.descriptionChecked = false
  167. this.descriptionTip = false
  168. } else {
  169. if (this.account.description !== '') {
  170. if (value.length >= 100) {
  171. callback(new Error('输入长度过长,100个字符以内'))
  172. this.descriptionChecked = false
  173. this.descriptionTip = false
  174. } else {
  175. this.descriptionChecked = true
  176. this.descriptionTip = false
  177. }
  178. }
  179. callback()
  180. }
  181. }
  182. var validateContactName = (rule, value, callback) => {
  183. if (value === '') {
  184. callback(new Error('请填写您的姓名'))
  185. this.contactNameChecked = false
  186. } else {
  187. if (this.account.contactName !== '') {
  188. if (value.length >= 20) {
  189. callback(new Error('输入长度过长,20个字符以内'))
  190. this.contactNameChecked = false
  191. } else {
  192. this.contactNameChecked = true
  193. }
  194. }
  195. callback()
  196. }
  197. }
  198. var validateContactTel = (rule, value, callback) => {
  199. if (value === '') {
  200. callback(new Error('请填写正确的联系电话'))
  201. this.contactTelChecked = false
  202. } else {
  203. if (this.account.contactTel !== '') {
  204. var reg = /^1[0-9]{10}$/
  205. if (!reg.test(value)) {
  206. callback(new Error('请填写正确的联系电话'))
  207. this.contactTelChecked = false
  208. } else {
  209. this.contactTelChecked = true
  210. }
  211. }
  212. callback()
  213. }
  214. }
  215. var validateContactEmail = (rule, value, callback) => {
  216. if (value === '') {
  217. callback(new Error('请填写正确的电子邮箱'))
  218. this.contactEmailChecked = false
  219. } else {
  220. if (this.account.contactEmail !== '') {
  221. var reg = /@/
  222. if (!reg.test(value)) {
  223. callback(new Error('请输入正确的邮箱地址格式'))
  224. this.contactEmailChecked = false
  225. } else {
  226. this.contactEmailChecked = true
  227. }
  228. }
  229. callback()
  230. }
  231. }
  232. return {
  233. goNextStep: true,
  234. account: {
  235. mobile: '',
  236. code: '',
  237. password: '',
  238. description: '',
  239. contactName: '',
  240. contactTel: '',
  241. contactEmail: ''
  242. },
  243. isShowLoading: false,
  244. codeErrorMsg: '',
  245. checked: true,
  246. sendAccountCode: true,
  247. account_time: 0,
  248. getCodeBtnIsDisabled: true,
  249. codeErrorChecked: false,
  250. descriptionTip: true,
  251. mobileChecked: false,
  252. codeChecked: false,
  253. passwordChecked: false,
  254. descriptionChecked: false,
  255. contactNameChecked: false,
  256. contactTelChecked: false,
  257. contactEmailChecked: false,
  258. mobileExit: false,
  259. rules: {
  260. mobile: [
  261. {validator: validateMobile, trigger: 'blur'}
  262. ],
  263. code: [
  264. {validator: validateCode, trigger: 'blur'}
  265. ],
  266. password: [
  267. {validator: validatePassword, trigger: 'blur'}
  268. ],
  269. description: [
  270. {validator: validateDescription, trigger: 'blur'}
  271. ],
  272. contactName: [
  273. {validator: validateContactName, trigger: 'blur'}
  274. ],
  275. contactTel: [
  276. {validator: validateContactTel, trigger: 'blur'}
  277. ],
  278. contactEmail: [
  279. {validator: validateContactEmail, trigger: 'blur'}
  280. ]
  281. }
  282. }
  283. },
  284. computed: {
  285. logged () {
  286. return this.$store.state.option.isLogin.data.content
  287. }
  288. },
  289. mounted () {
  290. // 验证是否登录
  291. this.$nextTick(() => {
  292. this.isLogin()
  293. // 刷新统计信息
  294. setInterval(() => {
  295. this.isLogin()
  296. }, 10000)
  297. })
  298. },
  299. methods: {
  300. // 判断我同意是否被选中
  301. checkboxChecked () {
  302. this.checked = !this.checked
  303. },
  304. // 判断用户是否登录
  305. isLogin () {
  306. if (this.logged && !this.logged.isLogin) {
  307. // 未登录跳到登录页面
  308. window.location.href = '/'
  309. }
  310. },
  311. // 获取校验码
  312. getCheckCode () {
  313. this.isShowLoading = true
  314. this.$http.get(`/appeal/check/mobile`, {params: {mobile: this.account.mobile, _operate: 'account'}})
  315. .then(response => {
  316. this.isShowLoading = false
  317. if (response.data.success) {
  318. this.token = response.data.content.token
  319. if (this.token !== '') {
  320. this.$message({
  321. message: '验证码已经发送到您的手机,请注意查收',
  322. type: 'success'
  323. })
  324. this.sendAccountCode = false
  325. this.account_time = 60
  326. var accountTime = setInterval(() => {
  327. this.account_time--
  328. if (this.account_time <= 0) {
  329. this.sendAccountCode = true
  330. clearInterval(accountTime)
  331. }
  332. }, 1000)
  333. }
  334. } else {
  335. return Promise.reject(response.data)
  336. }
  337. }).catch(err => {
  338. this.isShowLoading = false
  339. this.$message.error(err.errMsg)
  340. })
  341. },
  342. // 提交表单
  343. submit () {
  344. if (this.mobileChecked && this.codeChecked && this.passwordChecked && this.descriptionChecked && this.contactNameChecked && this.contactTelChecked && this.contactEmailChecked && this.checked) {
  345. this.isShowLoading = true
  346. let param = new FormData()
  347. param.append('mobile', this.account.mobile)
  348. param.append('code', this.account.code)
  349. param.append('password', this.account.password)
  350. param.append('description', this.account.description)
  351. param.append('contactName', this.account.contactName)
  352. param.append('contactTel', this.account.contactTel)
  353. param.append('contactEmail', this.account.contactEmail)
  354. param.append('token', this.token)
  355. param.append('appId', this.$store.state.option.appId)
  356. let config = {
  357. headers: {'Content-Type': 'multipart/form-data'}
  358. }
  359. this.$http.post('/appeal/account', param, config)
  360. .then(response => {
  361. this.isShowLoading = false
  362. if (response.data.success) {
  363. this.goNextStep = false
  364. } else {
  365. this.goNextStep = true
  366. return Promise.reject(response.data)
  367. }
  368. }).catch(err => {
  369. this.$message.error(err.errMsg)
  370. this.isShowLoading = false
  371. // this.codeErrorChecked = true
  372. // this.codeChecked = false
  373. this.account_time = 0
  374. })
  375. }
  376. },
  377. // 跳转至个人中心页面
  378. goCloudCenter () {
  379. if (this.$route.query.returnURL) {
  380. window.location.href = decodeURIComponent(this.$route.query.returnURL)
  381. } else {
  382. this.$router.push('/cloudcenter')
  383. }
  384. }
  385. }
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. .certification {
  390. margin: 0 auto;
  391. width: 100%;
  392. background: #eee;
  393. .container{
  394. padding-top: 50px;
  395. margin: 0 auto;
  396. width: 980px;
  397. text-align: center;
  398. .content{
  399. padding: 0 50px;
  400. margin: 50px auto 0;
  401. width: 100%;
  402. text-align: center;
  403. background: #fff;
  404. .content-top{
  405. height: 80px;
  406. line-height: 80px;
  407. h3{
  408. margin-bottom: 0;
  409. font-size: 24px;
  410. color: #000;
  411. border-bottom: 1px solid #dcdcdc;
  412. }
  413. .step{
  414. position: relative;
  415. margin-top: 10px;
  416. img{
  417. width: 315px;
  418. height: 46px;
  419. }
  420. .step-item{
  421. position: absolute;
  422. top: 45px;
  423. left: 265px;
  424. span{
  425. margin-right: 85px;
  426. font-size: 14px;
  427. color: #b4b4b4;
  428. }
  429. span.active {
  430. color: #0076ad;
  431. }
  432. }
  433. }
  434. }
  435. form {
  436. padding-bottom: 44px;
  437. margin-top: 36px;
  438. input{
  439. padding: 0 0 0 18px;
  440. width: 360px;
  441. height: 44px;
  442. line-height: 44px;
  443. font-size: 14px;
  444. color: #000;
  445. border-radius: 0;
  446. }
  447. span.tip{
  448. position: absolute;
  449. top: 0;
  450. right: -238px;
  451. font-size: 13px;
  452. color: #8c8c8c;
  453. a{
  454. font-size: 13px;
  455. color: #0076ad;
  456. }
  457. }
  458. span.tip.tip-mobile{
  459. top: 3px;
  460. right: -105px;
  461. color: #ff4949;
  462. font-size: 12px;
  463. }
  464. span.tip.description {
  465. top: 10px;
  466. right: -266px;
  467. width: 245px;
  468. line-height: 18px;
  469. text-align: left;
  470. }
  471. span.tip.codeError-tip {
  472. position: absolute;
  473. top: 3px;
  474. left: 378px;
  475. width: 200px;
  476. text-align: left;
  477. color: #ff4949;
  478. font-size: 12px;
  479. }
  480. i{
  481. position: absolute;
  482. top: 13px;
  483. left: 20px;
  484. font-size: 20px;
  485. color: #a0a0a0;
  486. }
  487. input[type='checkbox']{
  488. margin: 0 14px 0 55px;
  489. float: left;
  490. width: 16px;
  491. height: 16px;
  492. }
  493. span.agree{
  494. float: left;
  495. margin: 1px 0 0 10px;
  496. font-size: 14px;
  497. color: #8b8b8b;
  498. a{
  499. color: #0076ad;
  500. }
  501. }
  502. .form-group.agree{
  503. margin: 20px auto 0 !important;
  504. }
  505. .btn {
  506. margin: 34px 0 16px 0;
  507. width: 360px;
  508. height: 44px;
  509. line-height: 44px;
  510. font-size: 16px;
  511. color: #fff;
  512. background: #0076AD;
  513. border-radius: 3px;
  514. }
  515. }
  516. .content-bottom{
  517. margin-top: 35px;
  518. padding-bottom: 50px;
  519. p{
  520. font-size: 24px;
  521. color: #323232;
  522. img{
  523. margin-right: 20px;
  524. width: 30px;
  525. height: 28px;
  526. }
  527. }
  528. p.pass{
  529. font-size: 24px;
  530. color: #e77405;
  531. img{
  532. height: 30px;
  533. }
  534. }
  535. p.passed {
  536. color: #2ab300;
  537. img{
  538. height: 30px;
  539. }
  540. }
  541. span{
  542. display: inline-block;
  543. margin: 15px 0 140px 0;
  544. font-size: 14px;
  545. color: #8b8b8b;
  546. }
  547. .close-btn{
  548. margin: 0 auto;
  549. width: 200px;
  550. height: 36px;
  551. line-height: 36px;
  552. font-size: 14px;
  553. text-align: center;
  554. color: #323232;
  555. border: 1px solid #d2d2d2;
  556. border-radius: 3px;
  557. cursor: pointer ;
  558. }
  559. }
  560. }
  561. }
  562. }
  563. </style>