铝交易,微信公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

454 lines
10 KiB

8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="refundsOrExchange">
  3. <navbar :title="titleList[titleIndex]" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="frame">
  5. <!-- 登录和注册 -->
  6. <view class="loginRegister" v-if='titleIndex==1'>
  7. <!-- 标题 -->
  8. <view class="title">{{titleList[titleIndex]}}</view>
  9. <!-- 头像 -->
  10. <view class="userIamge">
  11. <view>
  12. <img src="/static/image/center/11.svg" alt="" style="width: 100%;height: 100%;">
  13. </view>
  14. </view>
  15. <!-- 用户名&密码&隐私条款 -->
  16. <view class="form">
  17. <view>
  18. <uv-input v-model="form.username" placeholder="请输入账号" border="surround" shape='circle' clearable
  19. :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  20. </view>
  21. <view>
  22. <uv-input v-model="form.password" password placeholder="请输入密码" border="surround" shape='circle'
  23. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  24. </view>
  25. <view>
  26. <uv-checkbox-group v-model="checkboxValue" shape="circle">
  27. <view class="content">
  28. <view style="display: flex;">
  29. <uv-checkbox size="30rpx" :name="1"></uv-checkbox>
  30. 请你阅读并同意我们的<span style="color: #fd5100"
  31. @click="$refs.popup.open('getPrivacyPolicy')">隐私条款</span><span
  32. style="color: #fd5100"
  33. @click="$refs.popup.open('getUserAgreement')">服务协议</span>
  34. </view>
  35. </view>
  36. </uv-checkbox-group>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 忘记密码 -->
  41. <view class='forgetPassword' v-if='titleIndex != 1'>
  42. <!-- 标题 -->
  43. <view class="title">{{titleList[titleIndex]}}</view>
  44. <!-- 表单 -->
  45. <view class="form1">
  46. <view class="userName">
  47. <uv-input v-model="form1.username" placeholder="请输入手机号" border="surround" shape='circle'
  48. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  49. </view>
  50. <view class="code">
  51. <view class="left">
  52. <uv-input v-model="form1.captcha" placeholder="请输入验证码" border="surround" shape='circle'
  53. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  54. </view>
  55. <view class="right">
  56. <view>
  57. <uv-toast ref="toast"></uv-toast>
  58. <uv-code :seconds="seconds" @end="end" @start="start" ref="code"
  59. @change="codeChange"></uv-code>
  60. <uv-button @tap="getCode" iconSize='10rpx' color='#1f1c39'
  61. shape='circle'>{{tips}}</uv-button>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="password1">
  66. <uv-input v-model="form1.password" placeholder="设置您的新密码(6到50个字符)" password clearable
  67. border="surround" shape='circle' :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  68. </view>
  69. <view class="password2">
  70. <uv-input v-model="form1.newPassword" placeholder="重新确认密码" password clearable border="surround"
  71. shape='circle' :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 按钮 -->
  76. <view class="btn" @click="submit">
  77. <button class='a'>{{titleList[titleIndex]}}</button>
  78. </view>
  79. <!-- tab -->
  80. <view class="bottomTab">
  81. <span :class="titleIndex==0 ? 'tabbarItemActive' : 'tabbarItemNoActive'"
  82. @click='changePage(0)'>注册账号</span>
  83. <span style="color: #9c9fa4">|</span>
  84. <span :class="titleIndex==1 ? 'tabbarItemActive' : 'tabbarItemNoActive'"
  85. @click='changePage(1)'>账号登录</span>
  86. <span style="color: #9c9fa4">|</span>
  87. <span :class="titleIndex==2 ? 'tabbarItemActive' : 'tabbarItemNoActive'"
  88. @click='changePage(2)'>忘记密码</span>
  89. </view>
  90. </view>
  91. <configPopup ref="popup"></configPopup>
  92. </view>
  93. </template>
  94. <script>
  95. import configPopup from '@/components/config/configPopup.vue';
  96. export default {
  97. components: {
  98. configPopup
  99. },
  100. onLoad(option) {
  101. this.titleIndex = option.index || 1
  102. },
  103. data() {
  104. return {
  105. titleIndex: 0,
  106. titleList: ['注册', '登录', '重置密码'],
  107. checkboxValue: [],
  108. form: {
  109. username: '19330214982',
  110. password: '123456',
  111. loginModel: 0,
  112. captcha: '',
  113. },
  114. form1: {
  115. username: '',
  116. captcha: '',
  117. password: '',
  118. newPassword: '',
  119. },
  120. tips: '获取验证码',
  121. seconds: 60,
  122. }
  123. },
  124. methods: {
  125. submit() {
  126. if (!this.checkboxValue.length && this.titleIndex != 2) {
  127. return uni.showToast({
  128. title: '请先同意隐私协议',
  129. icon: 'none'
  130. })
  131. }
  132. if (this.titleIndex == 0) {
  133. // 注册
  134. this.register()
  135. } else if (this.titleIndex == 1) {
  136. // 登录
  137. this.login()
  138. } else {
  139. // 忘记密码
  140. this.updatePassword()
  141. }
  142. },
  143. // 登录
  144. login(){
  145. if (this.$utils.verificationAll(this.form, {
  146. username: '请输入账号',
  147. password: '请输入密码',
  148. })) {
  149. return
  150. }
  151. if (!this.$utils.verificationPhone(this.form.username)) {
  152. return uni.showToast({
  153. title: '请输入合法的手机号',
  154. icon: 'none'
  155. })
  156. }
  157. // 登录
  158. this.$store.commit('login', this.form)
  159. },
  160. // 注册
  161. register(){
  162. if (this.$utils.verificationAll(this.form1, {
  163. username: '请输入账号',
  164. captcha : '请输入验证码',
  165. password: '请输入密码',
  166. newPassword: '请确认密码',
  167. })) {
  168. return
  169. }
  170. if (!this.$utils.verificationPhone(this.form1.username)) {
  171. return uni.showToast({
  172. title: '请输入合法的手机号',
  173. icon: 'none'
  174. })
  175. }
  176. if (this.form1.password != this.form1.newPassword) {
  177. return uni.showToast({
  178. title: '密码与确认密码不一致',
  179. icon: 'none'
  180. })
  181. }
  182. this.$api('registerUser', this.form1, res => {
  183. if (res.code == 200) {
  184. this.titleIndex = 1
  185. uni.showToast({
  186. title: '注册成功,请登录!',
  187. icon: 'none'
  188. })
  189. }
  190. })
  191. },
  192. updatePassword(){
  193. if (this.$utils.verificationAll(this.form1, {
  194. username: '请输入账号',
  195. captcha : '请输入验证码',
  196. password: '请输入新密码',
  197. newPassword: '请确认密码',
  198. })) {
  199. return
  200. }
  201. if (!this.$utils.verificationPhone(this.form1.username)) {
  202. return uni.showToast({
  203. title: '请输入合法的手机号',
  204. icon: 'none'
  205. })
  206. }
  207. if (this.form1.password != this.form1.newPassword) {
  208. return uni.showToast({
  209. title: '密码与确认密码不一致',
  210. icon: 'none'
  211. })
  212. }
  213. this.$api('newPassword', this.form1, res => {
  214. this.form1 = {}
  215. if (res.code == 200) {
  216. this.titleIndex = 1
  217. uni.showToast({
  218. title: '修改成功,请登录!',
  219. icon: 'none'
  220. })
  221. }
  222. })
  223. },
  224. // 切换页面
  225. changePage(index) {
  226. this.titleIndex = index
  227. },
  228. confirm() {
  229. },
  230. codeChange(text) {
  231. this.tips = text;
  232. },
  233. getCode() {
  234. if (this.$refs.code.canGetCode) {
  235. if (!this.$utils.verificationPhone(this.form1.username)) {
  236. return uni.showToast({
  237. title: '请输入合法的手机号',
  238. icon: 'none'
  239. })
  240. }
  241. uni.showLoading({
  242. title: '正在获取验证码'
  243. })
  244. this.$api('sendSms', {
  245. username: this.form1.username,
  246. }, res => {
  247. if (res.code == 200) {
  248. uni.hideLoading();
  249. // 这里此提示会被this.start()方法中的提示覆盖
  250. uni.$uv.toast('验证码已发送');
  251. // 通知验证码组件内部开始倒计时
  252. this.$refs.code.start();
  253. }
  254. })
  255. } else {
  256. uni.$uv.toast('请勿重复发送');
  257. }
  258. },
  259. end() {
  260. // uni.$uv.toast('倒计时结束');
  261. },
  262. start() {
  263. // uni.$uv.toast('倒计时开始');
  264. }
  265. }
  266. }
  267. </script>
  268. <style lang="scss" scoped>
  269. * {
  270. box-sizing: border-box;
  271. }
  272. .refundsOrExchange {
  273. background-color: #FFF;
  274. height: 100vh;
  275. .frame {
  276. background-color: #FFF;
  277. .loginRegister {
  278. display: flex;
  279. flex-direction: column;
  280. gap: 40rpx;
  281. .title {
  282. display: flex;
  283. justify-content: center;
  284. align-items: flex-end;
  285. height: 10vh;
  286. color: #000;
  287. font-size: 40rpx;
  288. font-weight: 700;
  289. }
  290. .userIamge {
  291. display: flex;
  292. justify-content: center;
  293. height: 10vh;
  294. >view:nth-of-type(1) {
  295. width: 25%;
  296. height: 100%;
  297. border-radius: 50%;
  298. overflow: hidden;
  299. }
  300. }
  301. .form {
  302. height: 12vh;
  303. >view:nth-of-type(1) {
  304. padding: 20rpx 100rpx;
  305. }
  306. >view:nth-of-type(2) {
  307. padding: 0 100rpx;
  308. }
  309. >view:nth-of-type(3) {
  310. display: flex;
  311. padding: 30rpx 100rpx 0 100rpx;
  312. font-size: 22rpx
  313. }
  314. }
  315. }
  316. .btn {
  317. // height: 5vh;
  318. display: flex;
  319. justify-content: center;
  320. margin: 90rpx 0 0 0;
  321. .a {
  322. display: flex;
  323. justify-content: center;
  324. align-items: center;
  325. width: 70%;
  326. height: 80rpx;
  327. color: #FFF;
  328. background-color: $uni-color;
  329. box-shadow: 0 0 4rpx 4rpx rgba($uni-color, 0.2);
  330. border-radius: 100rpx;
  331. font-size: 30rpx;
  332. }
  333. }
  334. .bottomTab {
  335. display: flex;
  336. justify-content: space-between;
  337. height: 10vh;
  338. padding: 0 80rpx;
  339. margin-top: 30rpx;
  340. .tabbarItemActive {
  341. color: $uni-color;
  342. }
  343. .tabbarItemNoActive {
  344. color: #9c9fa4;
  345. }
  346. }
  347. .forgetPassword {
  348. padding: 100rpx 40rpx 0 40rpx;
  349. .title {
  350. display: flex;
  351. justify-content: center;
  352. align-items: flex-end;
  353. height: 10vh;
  354. color: #000;
  355. font-size: 40rpx;
  356. font-weight: 700;
  357. }
  358. .form1 {
  359. display: flex;
  360. flex-direction: column;
  361. gap: 30rpx;
  362. margin-top: 20rpx;
  363. padding: 20rpx 80rpx;
  364. .userName {
  365. // padding: 20rpx 100 rpx;
  366. }
  367. .code {
  368. display: flex;
  369. width: 100%;
  370. .left {
  371. width: 55%;
  372. }
  373. .right {
  374. width: 45%;
  375. height: 100%;
  376. >view:nth-of-type(1) {
  377. display: flex;
  378. justify-content: center;
  379. align-items: center;
  380. width: 100%;
  381. }
  382. }
  383. }
  384. .password1 {}
  385. .password2 {}
  386. }
  387. }
  388. }
  389. }
  390. </style>