AccountAppeal.vue 15 KB

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