index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div>
  3. <div class="content vflex acenter jaround" v-if="flag !== 'null'">
  4. <img :src="img_title" class="img_title" alt="">
  5. <el-input placeholder="请输入提取码" v-model="code" :type="show?'text':'password'" v-if="is_code" maxlength="12">
  6. <div slot="suffix">
  7. <img src="@/assets/image/visible.png" v-if="show" @click="see" class="point" style="width:24px;height: 24px;" alt="">
  8. <img src="@/assets/image/display.png" v-else @click="see" class="point" style="width:24px;height: 24px;" alt="">
  9. </div>
  10. </el-input>
  11. <div>
  12. <div class="btn point" @click="extract">提取文件</div>
  13. <div class="text">该文件<span class="blue">有效期{{ effective }}天</span></div>
  14. </div>
  15. <div>
  16. <FootersWap></FootersWap>
  17. </div>
  18. </div>
  19. <div class="web_box vflex acenter jcenter" v-else>
  20. <img :src="img_title" class="img_title" alt="">
  21. <el-input placeholder="请输入提取码" v-model="code" :type="show?'text':'password'" v-if="is_code" maxlength="12">
  22. <div slot="suffix">
  23. <img src="@/assets/image/visible.png" v-if="show" @click="see" class="point" style="width:24px;height: 24px;" alt="">
  24. <img src="@/assets/image/display.png" v-else @click="see" class="point" style="width:24px;height: 24px;" alt="">
  25. </div>
  26. </el-input>
  27. <div class="btn point" @click="extract">提取文件</div>
  28. <div class="text">该文件<span class="blue">有效期{{ effective }}天</span></div>
  29. <Footers></Footers>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import { baseUrl } from '@/api/http.js'
  35. import Footers from '@/components/footer.vue'
  36. import FootersWap from '@/components/footerWap'
  37. export default{
  38. name: 'index_pc',
  39. components: { Footers,FootersWap },
  40. data() {
  41. return{
  42. img_title: require('@/assets/image/pc_title.png'),
  43. code: '',
  44. show: false,
  45. effective: 14,
  46. is_code: true,
  47. flag: '',
  48. id: '',
  49. }
  50. },
  51. created() {
  52. this.flag = window.localStorage.getItem('flag')
  53. this.id = window.localStorage.getItem('id')
  54. this.getData()
  55. },
  56. methods: {
  57. getData() {
  58. let that = this
  59. let data = {
  60. id: that.id
  61. }
  62. that.$http.getData(data).then((res) => {
  63. if(res.data.code == 0) {
  64. // that.$message.error(res.data.msg)
  65. // that.$router.push('/error_pc')
  66. } else if(res.data.code == 1) {
  67. that.is_code = res.data.data.is_password == 1 ? true : false
  68. that.effective = res.data.data.period_of_validity
  69. window.localStorage.setItem('UUID',res.data.data.uuid)
  70. window.localStorage.setItem('package_name',res.data.data.package_name)
  71. } else if(res.data.code == 2) {
  72. that.effective = res.data.data
  73. that.$router.push({
  74. name:'error_pc',
  75. params:{
  76. effective: that.effective
  77. }
  78. })
  79. }
  80. }).catch(() => {
  81. that.$message.error('系统繁忙')
  82. })
  83. },
  84. see() {
  85. this.show = !this.show
  86. },
  87. ragPwd() {
  88. },
  89. extract() {
  90. let that = this
  91. if(that.is_code && that.code == '') {
  92. that.$message.error({
  93. message: '请输入提取码',
  94. customClass: 'font20'
  95. })
  96. return
  97. }
  98. var reg = /^[a-zA-Z0-9]{1,12}$/; //密码(长度在12,只能包含字母、数字)
  99. var flag = reg.test(this.code);
  100. if(that.is_code && !flag) {
  101. this.$message.error({
  102. message:'提取码必须是字母或数字',
  103. customClass: 'font20'
  104. })
  105. return
  106. }
  107. let data = {
  108. id: that.id,
  109. password: that.code
  110. }
  111. that.$http.getFile(data).then((res) => {
  112. if(res.data.code == 0) {
  113. this.$message.error({
  114. message: res.data.msg,
  115. customClass: 'font20'
  116. })
  117. } else if(res.data.code == 1) {
  118. that.$router.push({
  119. name: 'down_pc',
  120. params: {
  121. effective: that.effective,
  122. code: that.code
  123. }
  124. })
  125. }
  126. })
  127. }
  128. }
  129. }
  130. </script>
  131. <style scoped>
  132. .web_box {
  133. width: 100%;
  134. min-height: 100vh;
  135. background: url('@/assets/image/pc_bg.png') no-repeat;
  136. background-size: 100% 100%;
  137. }
  138. .web_box .img_title {
  139. width: 440px;
  140. height: 89px;
  141. margin-bottom: 165px;
  142. }
  143. .web_box .btn {
  144. width: 272px;
  145. height: 60px;
  146. background: #1677B3;
  147. border-radius: 30px;
  148. margin: 120px 0 20px;
  149. font-size: 16px;
  150. font-family: PingFangSC-Medium, PingFang SC;
  151. font-weight: 500;
  152. color: #FFFFFF;
  153. line-height: 60px;
  154. text-align: center;
  155. }
  156. .web_box .text {
  157. font-size: 16px;
  158. font-family: PingFangSC-Medium, PingFang SC;
  159. font-weight: 500;
  160. color: #999999;
  161. line-height: 22px;
  162. }
  163. .web_box .blue {
  164. color: #1677B3;
  165. }
  166. .web_box /deep/ .el-input {
  167. width: 510px;
  168. height: 60px;
  169. background: #FFFFFF;
  170. border-radius: 30px;
  171. border: 1px solid #CCCCCC;
  172. padding: 0 24px;
  173. box-sizing: border-box;
  174. }
  175. .web_box /deep/ .el-input .el-input__inner {
  176. border: none;
  177. height: 100%;
  178. }
  179. .web_box /deep/ .el-input .el-input__suffix {
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. padding-right: 20px;
  184. }
  185. </style>
  186. <style>
  187. .font20 {
  188. font-size: 20px !important;
  189. }
  190. </style>
  191. <style scoped>
  192. .content {
  193. width: 100%;
  194. min-height: 100vh;
  195. background: #FFFFFF;
  196. }
  197. .content .img_title {
  198. width: 183px;
  199. height: 37px;
  200. }
  201. .content .btn {
  202. width: 192px;
  203. height: 44px;
  204. background: #1677B3;
  205. border-radius: 30px;
  206. font-size: 16px;
  207. font-family: PingFangSC-Medium, PingFang SC;
  208. font-weight: 500;
  209. color: #FFFFFF;
  210. line-height: 44px;
  211. text-align: center;
  212. }
  213. .content .text {
  214. font-size: 16px;
  215. font-family: PingFangSC-Medium, PingFang SC;
  216. font-weight: 500;
  217. color: #999999;
  218. line-height: 22px;
  219. padding-top: 20px;
  220. text-align: center;
  221. }
  222. .content .blue {
  223. color: #1677B3;
  224. }
  225. .content /deep/ .el-input {
  226. width: 272px;
  227. height: 50px;
  228. background: #FFFFFF;
  229. border-radius: 30px;
  230. border: 1px solid #CCCCCC;
  231. padding: 0 24px;
  232. box-sizing: border-box;
  233. }
  234. .content /deep/ .el-input .el-input__inner {
  235. border: none;
  236. height: 100%;
  237. font-size: 15px;
  238. }
  239. .content /deep/ .el-input .el-input__suffix {
  240. display: flex;
  241. align-items: center;
  242. justify-content: center;
  243. padding-right: 20px;
  244. }
  245. </style>