AccountAppeal.vue 16 KB

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