AccountAppeal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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. margin: 0 auto;
  323. width: 100%;
  324. background: #eee;
  325. .container{
  326. padding-top: 50px;
  327. margin: 0 auto;
  328. width: 980px;
  329. text-align: center;
  330. .content{
  331. padding: 0 50px;
  332. margin: 50px auto 0;
  333. width: 100%;
  334. text-align: center;
  335. background: #fff;
  336. .content-top{
  337. height: 80px;
  338. line-height: 80px;
  339. h3{
  340. margin-bottom: 0;
  341. font-size: 24px;
  342. color: #000;
  343. border-bottom: 1px solid #dcdcdc;
  344. }
  345. .step{
  346. position: relative;
  347. margin-top: 10px;
  348. img{
  349. width: 315px;
  350. height: 46px;
  351. }
  352. .step-item{
  353. position: absolute;
  354. top: 45px;
  355. left: 265px;
  356. span{
  357. margin-right: 85px;
  358. font-size: 14px;
  359. color: #b4b4b4;
  360. }
  361. span.active {
  362. color: #0076ad;
  363. }
  364. }
  365. }
  366. }
  367. form {
  368. padding-bottom: 44px;
  369. margin-top: 36px;
  370. input{
  371. padding: 0 0 0 18px;
  372. width: 360px;
  373. height: 44px;
  374. line-height: 44px;
  375. font-size: 14px;
  376. color: #000;
  377. border-radius: 0;
  378. }
  379. span.tip{
  380. position: absolute;
  381. top: 0;
  382. right: -238px;
  383. font-size: 13px;
  384. color: #8c8c8c;
  385. a{
  386. font-size: 13px;
  387. color: #0076ad;
  388. }
  389. }
  390. span.tip.description {
  391. top: 10px;
  392. right: -266px;
  393. width: 245px;
  394. line-height: 18px;
  395. text-align: left;
  396. }
  397. span.tip.codeError-tip {
  398. right: -112px;
  399. color: #f56c6c;
  400. }
  401. i{
  402. position: absolute;
  403. top: 13px;
  404. left: 20px;
  405. font-size: 20px;
  406. color: #a0a0a0;
  407. }
  408. input[type='checkbox']{
  409. margin: 0 14px 0 55px;
  410. float: left;
  411. width: 16px;
  412. height: 16px;
  413. }
  414. span.agree{
  415. float: left;
  416. margin: 1px 0 0 10px;
  417. font-size: 14px;
  418. color: #8b8b8b;
  419. a{
  420. color: #0076ad;
  421. }
  422. }
  423. .form-group.agree{
  424. margin: 20px auto 0 !important;
  425. }
  426. .btn {
  427. margin: 34px 0 16px 0;
  428. width: 360px;
  429. height: 44px;
  430. line-height: 44px;
  431. font-size: 16px;
  432. color: #fff;
  433. background: #0076AD;
  434. border-radius: 3px;
  435. }
  436. }
  437. .content-bottom{
  438. margin-top: 35px;
  439. padding-bottom: 50px;
  440. p{
  441. font-size: 24px;
  442. color: #323232;
  443. img{
  444. margin-right: 20px;
  445. width: 30px;
  446. height: 28px;
  447. }
  448. }
  449. p.pass{
  450. font-size: 24px;
  451. color: #e77405;
  452. img{
  453. height: 30px;
  454. }
  455. }
  456. p.passed {
  457. color: #2ab300;
  458. img{
  459. height: 30px;
  460. }
  461. }
  462. span{
  463. display: inline-block;
  464. margin: 15px 0 140px 0;
  465. font-size: 14px;
  466. color: #8b8b8b;
  467. }
  468. .close-btn{
  469. margin: 0 auto;
  470. width: 200px;
  471. height: 36px;
  472. line-height: 36px;
  473. font-size: 14px;
  474. text-align: center;
  475. color: #323232;
  476. border: 1px solid #d2d2d2;
  477. border-radius: 3px;
  478. cursor: pointer ;
  479. }
  480. }
  481. }
  482. }
  483. }
  484. </style>