AccountAppeal.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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="off" 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 = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  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.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}})
  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. window.location.href = '/cloudcenter'
  380. }
  381. }
  382. }
  383. </script>
  384. <style lang="scss" scoped>
  385. .certification {
  386. margin: 0 auto;
  387. width: 100%;
  388. background: #eee;
  389. .container{
  390. padding-top: 50px;
  391. margin: 0 auto;
  392. width: 980px;
  393. text-align: center;
  394. .content{
  395. padding: 0 50px;
  396. margin: 50px auto 0;
  397. width: 100%;
  398. text-align: center;
  399. background: #fff;
  400. .content-top{
  401. height: 80px;
  402. line-height: 80px;
  403. h3{
  404. margin-bottom: 0;
  405. font-size: 24px;
  406. color: #000;
  407. border-bottom: 1px solid #dcdcdc;
  408. }
  409. .step{
  410. position: relative;
  411. margin-top: 10px;
  412. img{
  413. width: 315px;
  414. height: 46px;
  415. }
  416. .step-item{
  417. position: absolute;
  418. top: 45px;
  419. left: 265px;
  420. span{
  421. margin-right: 85px;
  422. font-size: 14px;
  423. color: #b4b4b4;
  424. }
  425. span.active {
  426. color: #0076ad;
  427. }
  428. }
  429. }
  430. }
  431. form {
  432. padding-bottom: 44px;
  433. margin-top: 36px;
  434. input{
  435. padding: 0 0 0 18px;
  436. width: 360px;
  437. height: 44px;
  438. line-height: 44px;
  439. font-size: 14px;
  440. color: #000;
  441. border-radius: 0;
  442. }
  443. span.tip{
  444. position: absolute;
  445. top: 0;
  446. right: -238px;
  447. font-size: 13px;
  448. color: #8c8c8c;
  449. a{
  450. font-size: 13px;
  451. color: #0076ad;
  452. }
  453. }
  454. span.tip.tip-mobile{
  455. top: 3px;
  456. right: -105px;
  457. color: #ff4949;
  458. font-size: 12px;
  459. }
  460. span.tip.description {
  461. top: 10px;
  462. right: -266px;
  463. width: 245px;
  464. line-height: 18px;
  465. text-align: left;
  466. }
  467. span.tip.codeError-tip {
  468. position: absolute;
  469. top: 3px;
  470. left: 378px;
  471. width: 200px;
  472. text-align: left;
  473. color: #ff4949;
  474. font-size: 12px;
  475. }
  476. i{
  477. position: absolute;
  478. top: 13px;
  479. left: 20px;
  480. font-size: 20px;
  481. color: #a0a0a0;
  482. }
  483. input[type='checkbox']{
  484. margin: 0 14px 0 55px;
  485. float: left;
  486. width: 16px;
  487. height: 16px;
  488. }
  489. span.agree{
  490. float: left;
  491. margin: 1px 0 0 10px;
  492. font-size: 14px;
  493. color: #8b8b8b;
  494. a{
  495. color: #0076ad;
  496. }
  497. }
  498. .form-group.agree{
  499. margin: 20px auto 0 !important;
  500. }
  501. .btn {
  502. margin: 34px 0 16px 0;
  503. width: 360px;
  504. height: 44px;
  505. line-height: 44px;
  506. font-size: 16px;
  507. color: #fff;
  508. background: #0076AD;
  509. border-radius: 3px;
  510. }
  511. }
  512. .content-bottom{
  513. margin-top: 35px;
  514. padding-bottom: 50px;
  515. p{
  516. font-size: 24px;
  517. color: #323232;
  518. img{
  519. margin-right: 20px;
  520. width: 30px;
  521. height: 28px;
  522. }
  523. }
  524. p.pass{
  525. font-size: 24px;
  526. color: #e77405;
  527. img{
  528. height: 30px;
  529. }
  530. }
  531. p.passed {
  532. color: #2ab300;
  533. img{
  534. height: 30px;
  535. }
  536. }
  537. span{
  538. display: inline-block;
  539. margin: 15px 0 140px 0;
  540. font-size: 14px;
  541. color: #8b8b8b;
  542. }
  543. .close-btn{
  544. margin: 0 auto;
  545. width: 200px;
  546. height: 36px;
  547. line-height: 36px;
  548. font-size: 14px;
  549. text-align: center;
  550. color: #323232;
  551. border: 1px solid #d2d2d2;
  552. border-radius: 3px;
  553. cursor: pointer ;
  554. }
  555. }
  556. }
  557. }
  558. }
  559. </style>