合同小程序前端代码仓库
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.

347 lines
7.1 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="login-container">
  3. <!-- 顶部欢迎语 -->
  4. <view class="login_image">
  5. <image class="login_image_img" src="/static/image/组件 3 – 1.png" ></image>
  6. </view>
  7. <view class="welcome">
  8. <text class="welcome-text">欢迎登陆车辆合同生成</text>
  9. </view>
  10. <!-- 账号输入框 -->
  11. <view class="input-container">
  12. <uni-easyinput prefixIcon="person" class="input" placeholder="请输入您的账号" v-model="username" :inputBorder='false' :clearable='false' >
  13. </uni-easyinput>
  14. <view class="underline"></view>
  15. </view>
  16. <!-- 密码输入框 -->
  17. <view class="input-container">
  18. <uni-easyinput prefixIcon="locked" class="input" type="password" placeholder="请输入您的密码" v-model="password" :inputBorder='false' :passwordIcon="false" :clearable='false'></uni-easyinput>
  19. <view class="underline"></view>
  20. </view>
  21. <!-- 协议提示 -->
  22. <view class="agreement">
  23. <radio class = "login-agree" value="r1" :checked="checked" @click="changeCK">登录即代表同意
  24. </radio>
  25. <text class="link" @click="showModals">《用户协议》</text>
  26. <text class="login-agree">与</text>
  27. <text class="link" @click="showModal">《隐私政策》</text>
  28. </view>
  29. <view class = 'button_container'>
  30. <!-- 登录按钮 -->
  31. <view class="login-button" @click="handleLogin">
  32. <button class="login-buttons" >登陆</button>
  33. </view>
  34. </view>
  35. <mosowe-confirm-popup
  36. v-model="popupNoCancelShow"
  37. title="服务协议和隐私政策"
  38. confirmText
  39. cancelText
  40. >
  41. <text v-html="privacy"></text>
  42. <template v-slot:footer>
  43. <view class="mini_container">
  44. <button class="mini-btn" type="primary" size="mini" @click="closeModal">取消</button>
  45. <button class="mini-btn" type="primary" size="mini" @click="getConfirm">确认</button>
  46. </view>
  47. </template>
  48. </mosowe-confirm-popup>
  49. <mosowe-confirm-popup
  50. v-model="popupNoCancelShow1"
  51. title="用户协议"
  52. confirmText
  53. cancelText
  54. >
  55. <text v-html="agreement"></text>
  56. <template v-slot:footer>
  57. <view class="mini_container">
  58. <button class="mini-btn" type="primary" size="mini" @click="closeModals">取消</button>
  59. <button class="mini-btn" type="primary" size="mini" @click="getConfirms">确认</button>
  60. </view>
  61. </template>
  62. </mosowe-confirm-popup>
  63. </view>
  64. </template>
  65. <script>
  66. import {login,getInfoList,getList} from '@/api.uts';
  67. export default {
  68. data() {
  69. return {
  70. username: '', // 账号
  71. password: '', // 密码
  72. isModalVisible: false, // 控制弹窗显示
  73. modalTitle: '', // 弹窗标题
  74. modalContent: '' ,// 弹窗内容
  75. popupNoCancelShow: false,
  76. popupNoCancelShow1:false,
  77. checked:false,
  78. agreement:'',
  79. privacy:''
  80. };
  81. },
  82. mounted() {
  83. getInfoList().then((res)=>{
  84. getApp().aboutUs = res.result[0].aboutUs;
  85. this.privacy = res.result[0].privacy;
  86. this.agreement = res.result[0].agreement;
  87. })
  88. },
  89. methods: {
  90. // 处理登录逻辑
  91. handleLogin() {
  92. if (!this.username || !this.password) {
  93. uni.showToast({ title: '请输入账号和密码', icon: 'none' });
  94. return;
  95. }else{
  96. if(this.checked){
  97. let usr = {
  98. 'username' : this.username,
  99. 'password' :this.password
  100. }
  101. login(usr).then((res)=>{
  102. uni.setStorageSync('token',res.result.token);
  103. console.log(res.result.token);
  104. getApp().usrInfo = res.result.userInfo;
  105. if(res.success){
  106. uni.showToast({
  107. title: '登录成功',
  108. icon: 'success',
  109. success: (res) => {
  110. uni.switchTab({ url: '/pages/home/home' });
  111. }
  112. })
  113. }
  114. }).catch(
  115. (err)=>{
  116. uni.showToast({ title: '账号或密码错误,请重新输入!', icon: 'none' });
  117. }
  118. )
  119. }else{
  120. uni.showToast({ title: '请勾选服务协议', icon: 'none' });
  121. }
  122. }
  123. },
  124. // 显示弹窗
  125. showModal() {
  126. this.popupNoCancelShow = true ;
  127. },
  128. showModals(){
  129. this.popupNoCancelShow1 = true ;
  130. },
  131. // 关闭弹窗
  132. closeModal() {
  133. this.popupNoCancelShow = false ;
  134. },
  135. closeModals() {
  136. this.popupNoCancelShow1 = false ;
  137. },
  138. change(e) {
  139. },
  140. changeCK(){
  141. if(this.checked){
  142. this.checked = false;
  143. }else{
  144. this.checked = true;
  145. }
  146. },
  147. // 处理选中事件
  148. getConfirm(){
  149. if(this.checked){
  150. this.checked = this.checked;
  151. }else{
  152. this.checked = true;
  153. }
  154. this.popupNoCancelShow = false;
  155. },
  156. getConfirms(){
  157. if(this.checked){
  158. this.checked = this.checked;
  159. }else{
  160. this.checked = true;
  161. }
  162. this.popupNoCancelShow1 = false;
  163. }
  164. }
  165. };
  166. </script>
  167. <style>
  168. /* 页面容器 */
  169. .login-container {
  170. display: flex;
  171. flex-direction: column;
  172. align-items: center;
  173. background-color: #ffffff;
  174. height: 100vh;
  175. width: 100%;
  176. }
  177. .button-text {
  178. color: #fff;
  179. font-size: 12rem;
  180. }
  181. /* 登录图片 */
  182. .login_image{
  183. width: 100%;
  184. height: 40%;
  185. }
  186. .login_image_img{
  187. width: 100%;
  188. height: 100%;
  189. }
  190. /* 欢迎语 */
  191. .welcome {
  192. height: 15%;
  193. margin-bottom: 10%;
  194. display: flex;
  195. justify-content: end;
  196. align-items: center;
  197. }
  198. .welcome-text {
  199. font-size: 1.3rem;
  200. font-weight: bold;
  201. color: #044f7a;
  202. }
  203. /* 输入框容器 */
  204. .input-container {
  205. width: 70%;
  206. height: 7%;
  207. /* background-color: #007aff; */
  208. display: flex;
  209. flex-direction: column;
  210. align-items: center;
  211. }
  212. /* 输入框样式 */
  213. .input {
  214. width: 100%;
  215. height: 99%;
  216. font-size: 1rem;
  217. border: none;
  218. outline: none;
  219. background-color: transparent;
  220. /* z-index: 99; */
  221. }
  222. /* 下划线样式 */
  223. .underline {
  224. width: 100%;
  225. height: 0.1%;
  226. background-color: #f2f2f2;
  227. }
  228. /* 协议提示 */
  229. .agreement {
  230. font-size: 1rem;
  231. color: #666;
  232. margin-bottom: 1.2rem;
  233. width: 90%;
  234. left:10%;
  235. display: flex;
  236. flex-direction: row;
  237. align-items: center;
  238. }
  239. .login-agree{
  240. font-size: 0.6rem;
  241. transform: scale(0.9);
  242. }
  243. .link {
  244. color: #007aff;
  245. text-decoration: underline;
  246. font-size: 0.6rem;
  247. }
  248. .button_container{
  249. width: 100%;
  250. height: 40%;
  251. display: flex;
  252. align-items: center;
  253. /* background-color: #007aff; */
  254. }
  255. /* 登录按钮 */
  256. .login-button {
  257. width: 70%;
  258. height: 10%;
  259. line-height: 10%;
  260. background-color: #044f7a;
  261. color: #fff;
  262. border: none;
  263. border-radius: 4rem;
  264. font-size: 1rem;
  265. position: absolute;
  266. top:15%;
  267. left:15%;
  268. display: flex;
  269. justify-content: center;
  270. align-items: center;
  271. }
  272. .login-buttons{
  273. width: 100%;
  274. background-color: #044f7a;
  275. color: #fff;
  276. }
  277. /* 弹窗样式 */
  278. .modal {
  279. position: fixed;
  280. top: 0;
  281. left: 0;
  282. width: 100%;
  283. height: 100%;
  284. background-color: rgba(0, 0, 0, 0.5);
  285. display: flex;
  286. justify-content: center;
  287. align-items: center;
  288. }
  289. .modal-content {
  290. width: 80%;
  291. background-color: #fff;
  292. border-radius: 0.5rem;
  293. padding: 1.5rem;
  294. }
  295. .modal-header {
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. font-size: 1rem;
  300. font-weight: bold;
  301. margin-bottom: 1rem;
  302. }
  303. .close {
  304. font-size: 1.5rem;
  305. cursor: pointer;
  306. }
  307. .modal-body {
  308. font-size: 1rem;
  309. line-height: 1.5;
  310. }
  311. .mini_container{
  312. display: flex;
  313. flex-direction: row;
  314. align-items: center;
  315. }
  316. /* 按钮 */
  317. .mini-btn{
  318. width: 30%;
  319. margin-left: 15%;
  320. }
  321. </style>