From 1f07d0d2bbf95d52d2b96f0aec3a2284af619b3c Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 13 Nov 2023 10:40:38 +0800
Subject: [PATCH] fix:小程序详情修改
---
pages/login/login.vue | 320 ++++++++++++++++++++++++++++-------------------------
1 files changed, 168 insertions(+), 152 deletions(-)
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 84a4ae3..d253f90 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -10,187 +10,203 @@
</view>
<view class="formConten">
<view>
- <u-form ref="uForm" label-position="left" :model="form">
- <u-form-item label="������" prop="account">
- <u-input v-model="form.account" placeholder="���������������" />
+ <u-form ref="uForm" label-position="left" :model="form" :labelStyle="labelStyle">
+ <u-form-item label="������:" prop="account">
+ <u-input v-model="form.account" color='#fff' placeholder="���������������" />
</u-form-item>
- <u-form-item label="������" prop="password">
- <u-input
- v-model="form.password"
- :password-icon="passwordIcon"
- placeholder="���������������"
- type="password"
- />
+ <u-form-item label="������:" prop="password">
+ <u-input v-model="form.password" :password-icon="passwordIcon" color='#fff' placeholder="���������������"
+ type="password" />
</u-form-item>
</u-form>
</view>
<view class="loginContent">
- <p>
+ <!-- <p>
<navigator style="display: inline-block;" url="/pages/login/register/register">
<text style="text-decoration: underline">������������</text>
</navigator>
- </p>
+ </p> -->
<u-button @click="submit">������</u-button>
</view>
</view>
+ <ws-wx-privacy id="privacy-popup" enableAutoProtocol></ws-wx-privacy>
</view>
</template>
-
<script>
-import { login } from '@/utils/login.js' // ������������
-import { httpPost, httpGet } from '@/utils/http.js'
-export default {
- data() {
- return {
- passwordIcon: false,
- form: {
- account: '',
- password: '',
- },
- rules: {
- account: [
- {
+ import {
+ login,
+ getDic
+ } from '@/utils/login.js' // ������������
+ import {
+ httpPost,
+ httpGet
+ } from '@/utils/http.js'
+ import store from '@/store/index.js'
+ import {
+ subScribeMsg
+ } from '@/utils/subscribe.js'
+ export default {
+ data() {
+ return {
+ titlePrivacy: '������������������������',
+ labelStyle: {
+ color: '#fff'
+ },
+ title: '������������',
+ passwordIcon: false,
+ form: {
+ account: '',
+ password: '',
+ },
+ rules: {
+ account: [{
required: true,
message: '���������������',
// ���������������������������������������������������
trigger: ['change', 'blur'],
- },
- ],
- password: [
- {
+ }, ],
+ password: [{
required: true,
message: '���������������',
trigger: ['change', 'blur'],
- },
- ],
- },
- }
- },
- onReady() {
- //onReady ���uni-app���������������������������
- this.$refs.uForm.setRules(this.rules)
- },
- methods: {
- submit() {
-
- this.$refs.uForm
- .validate()
- .then((res)=> {
- this.getlogin()
- })
- .catch((errors)=> {
- uni.$u.toast('������������')
- })
+ }, ],
+ },
+ }
},
- //������
- getlogin() {
- let openId = this.$storage.get('openId')
- login({ ...this.form, openId})
- .then((response)=> {
- // uni.hideLoading()
- console.log('response', response)
- // console.log('this.$store', this.$store)
- // this.$store.commit('token', token)
- // this.getDic()
- // this.getUserInfor()
- // uni.reLaunch({
- // url: '/pages/actionChange/agencyPage/index',
- // })
- // this.$storage.setJson("accountInFor", this.form);
- // let token = this.$storage.get("token");)
+ onReady() {
+ //onReady ���uni-app���������������������������
+ this.$refs.uForm.setRules(this.rules)
+ },
+ async onLoad(option) {
+ //������������������
+ await this.$onLaunched
+ // ������������������
+ },
+ async onShow() {
+ uni.hideHomeButton()
+ },
+ methods: {
+ // ���������������������������
+ async aClick() {
+ let data = await subScribeMsg()
+ console.log('data', data)
+ if (data['YNqUZ1MgMvwY3G-NENVbcmIBR5dUotSdnwcz96CWrho'] === 'accept') { // ���������������������
+ this.doRequire()
+ } else {
+ this.doRequire()
+ }
+ },
+ doRequire() {
+ uni.requirePrivacyAuthorize({
+ success: () => {
+ console.log('������')
+ // ������������������
+ // ���������������������
+ this.getlogin()
+ },
+ fail: () => {
+ console.log('������')
+ }, // ������������������
+ complete: () => {}
})
- .catch((errors)=> {
+ },
+ submit() {
+ this.$refs.uForm.validate().then(res => {
+ this.aClick()
+ }).catch(errors => {})
+ },
+ //������
+ getlogin() {
+ const value = uni.getStorageSync('openId')
+ console.log('openId', value)
+ if (value) {
+ this.logining(value)
+ }
+ },
+ logining(openId) {
+ login({
+ ...this.form,
+ openId
+ }).then(response => {
+ uni.setStorageSync('userInfor', JSON.stringify(response.data))
+ uni.setStorageSync('tonken', response.data.token)
+ getDic()
+ uni.hideLoading()
+ uni.navigateTo({
+ url: '/pages/index/index',
+ })
+ }).catch(errors => {
uni.showToast({
title: errors,
icon: 'none',
})
})
- },
-
- getUserInfor() {
- let token = this.$storage.get('token', token)
- httpPost('/getUserInfo', { token }).then((result)=> {
-
- this.$storage.setJson('userInfo', result.data)
- })
- },
- getDic() {
- httpGet('/dict/list').then((result)=> {
-
- this.$storage.setJson('dict', result.data)
- this.$storage.setJson('dictObj', this.objToArr(result.data))
- })
- },
- arrToObj(arr) {
-
- return arr.reduce((obj, item)=> {
- obj[item.value] = item.name
- return obj
- }, {})
- },
- objToArr(obj) {
- const objde = {}
- for (const key in obj) {
- objde[key] = this.arrToObj(obj[key])
}
- return objde
},
- },
-}
+ }
</script>
-
<style scoped lang="scss">
-uni-page-body {
- height: 100%;
-}
-.page {
- color: #ffffff;
- background: #3875c5;
- height: 100%;
-}
-.tit {
-padding-top: 307.69rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 53.85rpx;
-}
-.formConten {
- padding: 0 76.92rpx;
- color: #ffffff;
-}
-.u-form-item {
- color: #ffffff;
- font-size: 28.85rpx;
- font-weight: 700;
-}
-// /deep/.uni-input-wrapper {
-// background: #fff;
-// border-radius: 5px;
-// }
-// /deep/.uni-input-placeholder {
-// padding-left: 10px;
-// }
-/deep/.u-form-item__body__left__content__label {
- color: #fff;
-}
-// /deep/.uni-input-input {
-// padding-left: 10px;
-// }
-.loginContent {
- margin-top: 38.46rpx;
- p {
- text-align: right;
- margin-bottom: 20px;
- a {
- color: #fff;
- }
- }
- .u-btn--default {
- width: 80%;
- }
-}
-uni-navigator{
- display: inline-block;
-}
-</style>
+ uni-page-body {
+ height: 100%;
+ }
+
+ .page {
+ color: #ffffff;
+ background: #3875c5;
+ height: 100%;
+ }
+
+ .tit {
+ padding-top: 307.69rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 53.85rpx;
+ }
+
+ .formConten {
+ padding: 0 76.92rpx;
+ color: #ffffff;
+ }
+
+ .u-form-item {
+ color: #ffffff;
+ font-size: 28.85rpx;
+ font-weight: 700;
+ }
+
+ // /deep/.uni-input-wrapper {
+ // background: #fff;
+ // border-radius: 5px;
+ // }
+ // /deep/.uni-input-placeholder {
+ // padding-left: 10px;
+ // }
+ /deep/.u-form-item__body__left__content__label {
+ color: #fff;
+ }
+
+ // /deep/.uni-input-input {
+ // padding-left: 10px;
+ // }
+ .loginContent {
+ margin-top: 38.46rpx;
+
+ p {
+ text-align: right;
+ margin-bottom: 20px;
+
+ a {
+ color: #fff;
+ }
+ }
+
+ .u-btn--default {
+ width: 80%;
+ }
+ }
+
+ uni-navigator {
+ display: inline-block;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.8.0