AccountAppeal.vue 15 KB

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