landLogin.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view class="login">
  3. <view class="zindex999" @click="href('/pages/login/index')">
  4. <image src="@/static/index/details/arrow_back.png" mode="widthFix"
  5. style="width: 48rpx;margin-left: 20rpx;margin-top: 50rpx;"></image>
  6. </view>
  7. <!-- 返回按钮 -->
  8. <!-- logo部分 -->
  9. <view class="title">
  10. <view class="login_view">
  11. <view class="">
  12. 鲑鱼数藏
  13. </view>
  14. <view class="">
  15. 开启你的数字藏品之旅
  16. </view>
  17. </view>
  18. <view class="text">
  19. <image src="@/static/logo.png" mode="widthFix" style="width: 120rpx;"></image>
  20. </view>
  21. </view>
  22. <!-- logo部分 结束-->
  23. <view class="logincontent">
  24. <!-- 手机号登录 -->
  25. <view class="login_content">
  26. <view class="input_item">
  27. <view class="">
  28. <input type="number" v-model="tel" placeholder="输入手机号">
  29. </view>
  30. </view>
  31. <view class="input_item">
  32. <view class="">
  33. <input type="text" v-model="codeImgVal" placeholder="输入图形验证">
  34. <view @click="graphVer">
  35. <image :src="codeImgData.image" mode="" style="width: 130rpx;height: 50rpx;"></image>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="input_item">
  40. <view class="">
  41. <input type="number" v-model="code" placeholder="输入验证码" style="width: 150px;">
  42. <view class="sendcode systemColor" @click="sendCode" v-if="count<=0">
  43. 获取验证码
  44. </view>
  45. <view class="sendcode systemColor" v-else>
  46. {{count}}秒后重新发送
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="regist">
  52. 还没有账号?<text style="color: #fff;" @click="href('/pages/login/register')">注册账号</text>
  53. </view>
  54. <!-- 登录按钮 -->
  55. <view class="login_btn" @click="login">
  56. 登录
  57. </view>
  58. <!-- 登录按钮 结束-->
  59. <!-- 用户协议 -->
  60. <view class="agreement">
  61. <!-- 是否选中样式 -->
  62. <view class="">
  63. <view class="circle_checked" v-if="confim" @click="confim=false"></view>
  64. <view class="circle" v-else @click="confim=true"></view>
  65. </view>
  66. <view class="">
  67. 已阅读并同意<text class="blue" @click="href('/pages/my/set/relevant?type=1')">《用户协议》</text>和<text
  68. class="blue" @click="href('/pages/my/set/relevant?type=2')">《隐私政策》</text>
  69. </view>
  70. <!-- 是否选中样式 结束-->
  71. </view>
  72. <!-- 用户协议 结束-->
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. //隐私政策弹框
  79. export default {
  80. components: {},
  81. data() {
  82. return {
  83. //是否同意授权登录
  84. confim: false,
  85. //动画类名
  86. add_class: "",
  87. //是否显示隐私弹框
  88. Jur: false,
  89. //是否显示权限谈款
  90. Privacy: false,
  91. // 账号
  92. tel: "",
  93. // 密码
  94. pwd: "",
  95. // 验证码还是密码登录 2 验证码登录 1 密码登录
  96. loginType: 1,
  97. // 手机验证码
  98. code: "",
  99. // 验证码倒计数
  100. count: 0,
  101. time: "",
  102. codeImgData: {},
  103. codeImgVal: '',
  104. }
  105. },
  106. onLoad() {
  107. //判断是否是第一次打开系统
  108. // #ifdef APP
  109. if (!uni.getStorageSync("isInSystem")) {
  110. this.Jur = true
  111. }
  112. // #endif
  113. // #ifdef H5
  114. if (uni.getStorageSync("isInSystemH5") == "" || uni.getStorageSync("isInSystemH5") == null) {
  115. this.Jur = true
  116. }
  117. // #endif
  118. this.getVerify()
  119. },
  120. watch: {
  121. },
  122. onHide() {
  123. clearInterval(this.time)
  124. },
  125. methods: {
  126. getVerify() {
  127. this.api.graphVer().then(res => {
  128. this.codeImgData = res.data
  129. })
  130. },
  131. setInSystem() {
  132. // #ifdef APP
  133. uni.setStorageSync("isInSystem", "true")
  134. // #endif
  135. // #ifdef H5
  136. uni.setStorageSync("isInSystemH5", "true")
  137. // #endif
  138. },
  139. login() {
  140. if (!this.confim) {
  141. this.$api.pop("请选勾选用户协议及隐私政策")
  142. return;
  143. }
  144. this.api.loginVer(this.tel, this.code).then(res => {
  145. console.log(res)
  146. if (res.code == 1) {
  147. uni.setStorageSync("user_info", res.data)
  148. uni.setStorageSync("token", res.data.data.token.token)
  149. this.$api.pop("登录成功")
  150. this.tel = ""
  151. this.code = ""
  152. setTimeout(() => {
  153. this.$api.totabar("/pages/index/index")
  154. }, 500)
  155. }
  156. })
  157. },
  158. // 发送验证码
  159. sendCode() {
  160. if (!this.codeImgVal) {
  161. this.$api.pop("请输入图形验证")
  162. return;
  163. }
  164. this.api.smsCode(this.tel, this.codeImgVal, this.codeImgData.uniqid).then(res => {
  165. console.log(res)
  166. if (res.code == 1) {
  167. if (res.data.time < 115) {
  168. this.$api.pop(res.data.time + 's后重试')
  169. } else {
  170. this.$api.pop(res.info)
  171. this.count = 60
  172. setInterval(() => {
  173. if (this.count <= 0) {
  174. this.count = 0
  175. return
  176. }
  177. --this.count
  178. }, 1000)
  179. }
  180. }
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style scoped lang="less">
  187. .login {
  188. width: 100%;
  189. height: 100vh;
  190. background: #171918;
  191. overflow-x: hidden;
  192. color: #fff;
  193. .title {
  194. display: flex;
  195. align-items: center;
  196. margin: 96rpx 96rpx 164rpx 96rpx ;
  197. .login_view {
  198. margin-right: 158rpx;
  199. >view:first-child {
  200. font-size: 68rpx;
  201. }
  202. >view:last-child {
  203. font-size: 28rpx;
  204. }
  205. }
  206. }
  207. .logincontent {
  208. width: 558rpx;
  209. margin: auto;
  210. .input_item {
  211. border-bottom: 1px solid #333333;
  212. width: 558rpx;
  213. font-size: 32rpx;
  214. color: #fff;
  215. margin-top: 70rpx;
  216. height: 66rpx;
  217. input {
  218. color: #fff;
  219. }
  220. .input-placeholder {
  221. color: #9A9A9A;
  222. font-size: 32rpx;
  223. }
  224. >view:first-child {
  225. font-size: 24rpx;
  226. font-weight: 400;
  227. margin-bottom: 48rpx;
  228. color: #434343;
  229. }
  230. >view:last-child {
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. }
  235. .sendcode {
  236. font-size: 28rpx;
  237. color: #FFFFFF;
  238. }
  239. }
  240. }
  241. .regist {
  242. text-align: center;
  243. font-size: 22rpx;
  244. margin-top: 24rpx;
  245. color: #999;
  246. }
  247. .login_btn {
  248. width: 558rpx;
  249. height: 96rpx;
  250. color: #000;
  251. background: linear-gradient(to bottom, #69FF60, #0C9D5B);
  252. font-size: 28rpx;
  253. line-height: 96rpx;
  254. margin-top: 88rpx;
  255. text-align: center;
  256. border-radius: 138rpx;
  257. }
  258. .agreement {
  259. font-size: 24rpx;
  260. display: flex;
  261. align-items: center;
  262. justify-content: center;
  263. color: #999999;
  264. text-indent: 14rpx;
  265. margin-top: 32rpx;
  266. }
  267. .circle {
  268. width: 24rpx;
  269. height: 24rpx;
  270. border-radius: 50%;
  271. border: 1px solid #999999;
  272. }
  273. .circle_checked {
  274. width: 24rpx;
  275. height: 24rpx;
  276. border-radius: 50%;
  277. background: #0C9D5B;
  278. border: 1px solid #0C9D5B;
  279. }
  280. .blue {
  281. color: #fff;
  282. }
  283. }
  284. </style>