工单小程序2024-11-20
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.

391 lines
8.4 KiB

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