Commit afb8eec8f371c855645fbb3308960981f6f6ad59
1 parent
148d5280
Exists in
develop
and in
1 other branch
feat: 增加登录
Showing
15 changed files
with
279 additions
and
197 deletions
Show diff stats
.gitignore
api/auth.js
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | const { http } = uni.$u | 2 | const { http } = uni.$u |
3 | 3 | ||
4 | //使用手机 + 密码登录 | 4 | //使用手机 + 密码登录 |
5 | -export const passwordLogin = data => http.post('/member/auth/login', data) | 5 | +export const passwordLogin = data => http.post('/auth/login', data) |
6 | //发送手机验证码 | 6 | //发送手机验证码 |
7 | export const sendSmsCode = data => http.post('/member/auth/send-sms-code', data) | 7 | export const sendSmsCode = data => http.post('/member/auth/send-sms-code', data) |
8 | //使用手机 + 验证码登录 | 8 | //使用手机 + 验证码登录 |
@@ -12,4 +12,4 @@ export const weixinMiniAppLogin = data => http.post('/member/auth/weixin-mini-ap | @@ -12,4 +12,4 @@ export const weixinMiniAppLogin = data => http.post('/member/auth/weixin-mini-ap | ||
12 | //刷新令牌 | 12 | //刷新令牌 |
13 | export const refreshToken = data => http.post('/member/auth/refresh-token', {data}) | 13 | export const refreshToken = data => http.post('/member/auth/refresh-token', {data}) |
14 | //退出登录 | 14 | //退出登录 |
15 | -export const logout = data => http.post('/member/auth/logout', data) | 15 | +export const logout = data => http.delete('/auth/logout', data) |
api/infoMarketInformation.js
1 | const { http } = uni.$u | 1 | const { http } = uni.$u |
2 | // 列表和条件筛选 | 2 | // 列表和条件筛选 |
3 | -export const getInfoMarketInformationlist = params => http.get('/infoMarketInformation/list', { params }) | 3 | +export const getInfoMarketInformationlist = params => http.get('/insight/infoMarketInformation/list', { params }) |
4 | 4 |
api/organize.js
1 | const { http } = uni.$u | 1 | const { http } = uni.$u |
2 | // 列表和条件筛选 | 2 | // 列表和条件筛选 |
3 | -export const getOrganizelist = params => http.get('/organize/list', { params }) | 3 | +export const getOrganizelist = params => http.get('/insight/organize/list', { params }) |
4 | 4 | ||
5 | //居民用户 | 5 | //居民用户 |
6 | -export const getPoolResidentlist = params => http.get('/poolResident/list', { params }) | 6 | +export const getPoolResidentlist = params => http.get('/insight/poolResident/list', { params }) |
7 | 7 | ||
8 | //商业用户 | 8 | //商业用户 |
9 | -export const getPoolCommercelist = params => http.get('/poolCommerce/list', { params }) | 9 | +export const getPoolCommercelist = params => http.get('/insight/poolCommerce/list', { params }) |
10 | 10 | ||
11 | //工业用户 | 11 | //工业用户 |
12 | -export const getPoolIndustrylist = params => http.get('/poolIndustry/list', { params }) | 12 | +export const getPoolIndustrylist = params => http.get('/insight/poolIndustry/list', { params }) |
13 | 13 | ||
14 | /*报告详情*/ | 14 | /*报告详情*/ |
15 | 15 | ||
16 | //报告详情-组织实施落实 1 | 16 | //报告详情-组织实施落实 1 |
17 | -export const getOrganize = params => http.get('/organize/' + params ) | 17 | +export const getOrganize = params => http.get('/insight/organize/' + params ) |
18 | 18 | ||
19 | //报告详情-天然气市场总体概况主表 2 | 19 | //报告详情-天然气市场总体概况主表 2 |
20 | -export const getGeneralOverview = params => http.get('/generalOverview/'+ params) | 20 | +export const getGeneralOverview = params => http.get('/insight/generalOverview/'+ params) |
21 | 21 | ||
22 | //报告详情-天然气市场总体概况附表 3 | 22 | //报告详情-天然气市场总体概况附表 3 |
23 | -export const getGeneralOverviewAttach = params => http.get('/generalOverviewAttach/'+ params) | 23 | +export const getGeneralOverviewAttach = params => http.get('/insight/generalOverviewAttach/'+ params) |
24 | 24 | ||
25 | //报告详情-告详情-重点市场业务分析 4 | 25 | //报告详情-告详情-重点市场业务分析 4 |
26 | -export const getBusinessAnalyze = params => http.get('/businessAnalyze/'+ params) | 26 | +export const getBusinessAnalyze = params => http.get('/insight/businessAnalyze/'+ params) |
27 | 27 | ||
28 | 28 | ||
29 | //报告详情-预计2021财年-2022财年已签约且在2023财年安装确认项目 5 | 29 | //报告详情-预计2021财年-2022财年已签约且在2023财年安装确认项目 5 |
30 | -export const getNewBuildingInfo = params => http.get('/newBuildingInfo/'+ params) | 30 | +export const getNewBuildingInfo = params => http.get('/insight/newBuildingInfo/'+ params) |
31 | 31 | ||
32 | 32 | ||
33 | //报告详情-预计2023-2025财年安装确认项目 6 | 33 | //报告详情-预计2023-2025财年安装确认项目 6 |
34 | -export const getNewBuildingItem = params => http.get('/newBuildingItem/'+ params) | 34 | +export const getNewBuildingItem = params => http.get('/insight/newBuildingItem/'+ params) |
35 | 35 | ||
36 | //报告详情-未来发展规划,所需资源配置 7 | 36 | //报告详情-未来发展规划,所需资源配置 7 |
37 | -export const getDevelopmentPlan = params => http.get('/developmentPlan/'+ params) | 37 | +export const getDevelopmentPlan = params => http.get('/insight/developmentPlan/'+ params) |
38 | 38 | ||
39 | //报告详情-目标思路建议 8 | 39 | //报告详情-目标思路建议 8 |
40 | -export const getTargetSuggestion = params => http.get('/targetSuggestion/'+ params) | 40 | +export const getTargetSuggestion = params => http.get('/insight/targetSuggestion/'+ params) |
41 | 41 | ||
42 | 42 | ||
43 | 43 |
common/config.js
1 | module.exports = { | 1 | module.exports = { |
2 | //后端接口地址 | 2 | //后端接口地址 |
3 | baseUrl: 'http://10.11.38.240:9001', //内网开发环境 | 3 | baseUrl: 'http://10.11.38.240:9001', //内网开发环境 |
4 | - // baseUrl: 'http://127.0.0.1:48080/app-api', | 4 | + // baseUrl: 'http://172.17.56.37:18082/api', |
5 | // baseUrl: 'http://api-dashboard.yudao.iocoder.cn/app-api', | 5 | // baseUrl: 'http://api-dashboard.yudao.iocoder.cn/app-api', |
6 | // 超时 | 6 | // 超时 |
7 | timeout: 30000, | 7 | timeout: 30000, |
manifest.json
@@ -71,11 +71,11 @@ | @@ -71,11 +71,11 @@ | ||
71 | "vueVersion" : "2", | 71 | "vueVersion" : "2", |
72 | "h5" : { | 72 | "h5" : { |
73 | "router" : { | 73 | "router" : { |
74 | - "mode" : "history", | ||
75 | - "base" : "h5" | 74 | + "mode" : "hash", |
75 | + "base" : "./" | ||
76 | }, | 76 | }, |
77 | "devServer" : { | 77 | "devServer" : { |
78 | - "https" : true | 78 | + "https" : false |
79 | } | 79 | } |
80 | } | 80 | } |
81 | } | 81 | } |
pages.json
1 | { | 1 | { |
2 | "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages | 2 | "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
3 | { | 3 | { |
4 | + "path": "pages/login/mobile" | ||
5 | + }, | ||
6 | + { | ||
4 | "path": "pages/market/index", | 7 | "path": "pages/market/index", |
5 | "style": { | 8 | "style": { |
6 | "enablePullDownRefresh": true | 9 | "enablePullDownRefresh": true |
@@ -85,8 +88,8 @@ | @@ -85,8 +88,8 @@ | ||
85 | "globalStyle": { | 88 | "globalStyle": { |
86 | "navigationStyle": "custom", | 89 | "navigationStyle": "custom", |
87 | "navigationBarTextStyle": "black", | 90 | "navigationBarTextStyle": "black", |
88 | - "navigationBarTitleText": "yudao-ui-app", | 91 | + "navigationBarTitleText": "gas-market-h5", |
89 | "navigationBarBackgroundColor": "#ffffff", | 92 | "navigationBarBackgroundColor": "#ffffff", |
90 | "backgroundColor": "#ffffff" | 93 | "backgroundColor": "#ffffff" |
91 | } | 94 | } |
92 | -} | ||
93 | \ No newline at end of file | 95 | \ No newline at end of file |
96 | +} |
pages/login/mobile.vue
1 | <template> | 1 | <template> |
2 | - <view class="container"> | 2 | + <view class="containers"> |
3 | <view class="auth-header"> | 3 | <view class="auth-header"> |
4 | <view class="auth-logo"> | 4 | <view class="auth-logo"> |
5 | - <u-avatar size="100" icon="github-circle-fill" fontSize="100"></u-avatar> | 5 | + <!-- <u-avatar size="100" icon="github-circle-fill" fontSize="100"></u-avatar> --> |
6 | + <image class="imgCss" src="@/static/images/empty/gas-logo.png" mode="widthFix"></image> | ||
7 | + <view class="welcomeTitleCss"> | ||
8 | + 欢迎登录 | ||
9 | + </view> | ||
10 | + <view class="platformCss"> | ||
11 | + 市场洞察平台 | ||
12 | + </view> | ||
6 | </view> | 13 | </view> |
7 | </view> | 14 | </view> |
8 | 15 | ||
9 | <view class="auth-box"> | 16 | <view class="auth-box"> |
10 | <!-- 登录方式选择 --> | 17 | <!-- 登录方式选择 --> |
11 | - <view class="mode-section"> | ||
12 | - <u-subsection class="subsection" mode="subsection" fontSize="15" :list="loginModeList" :current="currentModeIndex" @change="handleModeChange"></u-subsection> | ||
13 | - </view> | ||
14 | - <u-gap height="40"></u-gap> | 18 | + |
15 | 19 | ||
16 | <!-- 登录表单 --> | 20 | <!-- 登录表单 --> |
17 | <u--form labelPosition="left" :model="formData" :rules="rules" ref="form"> | 21 | <u--form labelPosition="left" :model="formData" :rules="rules" ref="form"> |
18 | - <u-form-item label="手机号" prop="mobile" labelWidth="60" borderBottom ref="item-mobile"> | ||
19 | - <u-input type="number" maxlength="11" v-model="formData.mobile" clearable placeholder="请填写手机号" border="none"></u-input> | 22 | + <u-form-item prop="username" ref="item-mobile"> |
23 | + <u-input type="text" prefixIcon="account" maxlength="11" border="surround" shape="circle" | ||
24 | + v-model="formData.username" clearable placeholder="请输入您的用户名"></u-input> | ||
20 | </u-form-item> | 25 | </u-form-item> |
21 | 26 | ||
22 | <u-gap height="20"></u-gap> | 27 | <u-gap height="20"></u-gap> |
23 | 28 | ||
24 | - <u-form-item v-if="currentModeIndex === 0" label="密码" prop="password" labelWidth="60" borderBottom ref="item-password"> | ||
25 | - <u-input :type="inputType" maxlength="16" v-model="formData.password" placeholder="请填写密码" border="none"> | 29 | + <u-form-item prop="password" ref="item-password"> |
30 | + <u-input :type="inputType" prefixIcon="lock" maxlength="16" border="surround" shape="circle" | ||
31 | + v-model="formData.password" placeholder="请输入登录密码"> | ||
26 | <template slot="suffix"> | 32 | <template slot="suffix"> |
27 | - <u-icon v-if="inputType === 'password'" size="20" color="#666666" name="eye-fill" @click="inputType = 'text'"></u-icon> | ||
28 | - <u-icon v-if="inputType === 'text'" size="20" color="#666666" name="eye-off" @click="inputType = 'password'"></u-icon> | 33 | + <u-icon v-if="inputType === 'password'" size="20" color="#666666" name="eye-fill" |
34 | + @click="inputType = 'text'"></u-icon> | ||
35 | + <u-icon v-if="inputType === 'text'" size="20" color="#666666" name="eye-off" | ||
36 | + @click="inputType = 'password'"></u-icon> | ||
29 | </template> | 37 | </template> |
30 | </u-input> | 38 | </u-input> |
31 | </u-form-item> | 39 | </u-form-item> |
32 | 40 | ||
33 | - <u-form-item v-else label="验证码" prop="code" labelWidth="60" borderBottom> | ||
34 | - <u--input type="number" maxlength="4" v-model="formData.code" border="none" placeholder="请填写验证码"></u--input> | ||
35 | - <u-button slot="right" @tap="getCode" :text="codeTips" type="success" size="mini" :disabled="codeDisabled"></u-button> | ||
36 | - <u-code ref="uCode" @change="codeChange" seconds="60" @start="codeDisabled = true" @end="codeDisabled = false"></u-code> | ||
37 | - </u-form-item> | ||
38 | - | ||
39 | <view class="btn-group"> | 41 | <view class="btn-group"> |
40 | - <u-button class="auth-btn" type="primary" customStyle="margin-top: 50px" @click="handleSubmit">立即登录</u-button> | 42 | + <u-button class="auth-btn" customStyle="margin-top: 50px" @click="handleSubmit">登录</u-button> |
41 | </view> | 43 | </view> |
42 | </u--form> | 44 | </u--form> |
43 | </view> | 45 | </view> |
@@ -45,153 +47,150 @@ | @@ -45,153 +47,150 @@ | ||
45 | </template> | 47 | </template> |
46 | 48 | ||
47 | <script> | 49 | <script> |
48 | -import { sendSmsCode } from '../../api/auth' | ||
49 | - | ||
50 | -export default { | ||
51 | - data() { | ||
52 | - return { | ||
53 | - currentModeIndex: 0, | ||
54 | - loginModeList: ['密码登录', '验证码登录'], | ||
55 | - inputType: 'password', | ||
56 | - codeDisabled: false, | ||
57 | - codeTips: '', | ||
58 | - formData: { | ||
59 | - mobile: '', | ||
60 | - password: '', | ||
61 | - code: '' | ||
62 | - }, | ||
63 | - rules: { | ||
64 | - mobile: [ | ||
65 | - { | ||
66 | - type: 'integer', | 50 | + import { |
51 | + passwordLogin | ||
52 | + } from '@/api/auth' | ||
53 | + | ||
54 | + export default { | ||
55 | + data() { | ||
56 | + return { | ||
57 | + currentModeIndex: 0, | ||
58 | + inputType: 'password', | ||
59 | + codeDisabled: false, | ||
60 | + codeTips: '', | ||
61 | + formData: { | ||
62 | + username: '', | ||
63 | + password: '', | ||
64 | + }, | ||
65 | + rules: { | ||
66 | + username: { | ||
67 | + type: 'string', | ||
67 | required: true, | 68 | required: true, |
68 | - message: '请填写手机号', | 69 | + message: '请填写用户名', |
70 | + trigger: ['blur', 'change'] | ||
71 | + }, | ||
72 | + password: { | ||
73 | + type: 'string', | ||
74 | + required: true, | ||
75 | + message: '请填写登录密码', | ||
69 | trigger: ['blur', 'change'] | 76 | trigger: ['blur', 'change'] |
70 | }, | 77 | }, |
71 | - { | ||
72 | - // 自定义验证函数,见上说明 | ||
73 | - validator: (rule, value, callback) => { | ||
74 | - // 上面有说,返回true表示校验通过,返回false表示不通过 | ||
75 | - // uni.$u.test.mobile()就是返回true或者false的 | ||
76 | - return uni.$u.test.mobile(value) | ||
77 | - }, | ||
78 | - message: '手机号码不正确', | ||
79 | - // 触发器可以同时用blur和change | ||
80 | - trigger: ['change', 'blur'] | ||
81 | - } | ||
82 | - ], | ||
83 | - password: { | ||
84 | - type: 'string', | ||
85 | - min: 4, | ||
86 | - max: 16, | ||
87 | - required: true, | ||
88 | - message: '密码长度4-16位密码', | ||
89 | - trigger: ['blur', 'change'] | ||
90 | - }, | ||
91 | - code: { | ||
92 | - type: 'integer', | ||
93 | - len: 4, | ||
94 | - required: true, | ||
95 | - message: '请填写4位验证码', | ||
96 | - trigger: ['blur', 'change'] | ||
97 | } | 78 | } |
98 | } | 79 | } |
99 | - } | ||
100 | - }, | ||
101 | - onLoad() {}, | ||
102 | - onReady() { | ||
103 | - // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则 | ||
104 | - this.$refs.form.setRules(this.rules) | ||
105 | - }, | ||
106 | - methods: { | ||
107 | - handleModeChange(index) { | ||
108 | - if (index !== this.currentModeIndex) { | ||
109 | - this.currentModeIndex = index | ||
110 | - this.$refs.form.clearValidate() | ||
111 | - } | ||
112 | }, | 80 | }, |
113 | - codeChange(text) { | ||
114 | - this.codeTips = text | 81 | + onLoad() {}, |
82 | + onReady() { | ||
83 | + // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则 | ||
84 | + this.$refs.form.setRules(this.rules) | ||
115 | }, | 85 | }, |
116 | - getCode() { | ||
117 | - const mobile = this.formData.mobile | ||
118 | - if (!mobile) { | ||
119 | - uni.$u.toast('请填写手机号') | ||
120 | - } else if (!uni.$u.test.mobile(mobile)) { | ||
121 | - uni.$u.toast('手机号格式不正确') | ||
122 | - } else if (this.$refs.uCode.canGetCode) { | ||
123 | - // 模拟向后端请求验证码 | ||
124 | - uni.showLoading({ | ||
125 | - title: '正在获取验证码' | ||
126 | - }) | 86 | + methods: { |
87 | + handleSubmit() { | ||
88 | + this.$refs.form.validate().then(res => { | ||
89 | + let data = this.formData | ||
90 | + this.mobileLogin(data) | ||
127 | 91 | ||
128 | - //scene:1登陆获取验证码场景 | ||
129 | - sendSmsCode({ mobile: mobile, scene: 1 }).then(res => { | ||
130 | - //console.log(res) | ||
131 | - uni.hideLoading() | ||
132 | - uni.$u.toast('验证码已发送') | ||
133 | - // 通知验证码组件内部开始倒计时 | ||
134 | - this.$refs.uCode.start() | 92 | + // uni.login({ |
93 | + // provider: 'weixin', | ||
94 | + // success: res => { | ||
95 | + // let data = this.formData | ||
96 | + // // data.socialType = 34 //WECHAT_MINI_APP 先指定固定值 | ||
97 | + // // data.socialCode = res.code | ||
98 | + // // data.socialState = Math.random() // 该参数没有实际意义暂时传随机数 | ||
99 | + // this.mobileLogin(data) | ||
100 | + // }, | ||
101 | + // fail: res => { | ||
102 | + // this.mobileLogin(this.formData) | ||
103 | + // } | ||
104 | + // }) | ||
135 | }) | 105 | }) |
136 | - } else { | ||
137 | - uni.$u.toast('倒计时结束后再发送') | ||
138 | - } | ||
139 | - }, | ||
140 | - handleSubmit() { | ||
141 | - this.$refs.form.validate().then(res => { | ||
142 | - uni.login({ | ||
143 | - provider: 'weixin', | ||
144 | - success: res => { | ||
145 | - let data = this.formData | ||
146 | - data.socialType = 34 //WECHAT_MINI_APP 先指定固定值 | ||
147 | - data.socialCode = res.code | ||
148 | - data.socialState = Math.random() // 该参数没有实际意义暂时传随机数 | ||
149 | - this.mobileLogin(data) | ||
150 | - }, | ||
151 | - fail: res => { | ||
152 | - this.mobileLogin(this.formData) | ||
153 | - } | 106 | + }, |
107 | + mobileLogin(data) { | ||
108 | + this.$store.dispatch('Login', { | ||
109 | + type: this.currentModeIndex, | ||
110 | + data: data | ||
111 | + }).then(res => { | ||
112 | + uni.$u.toast('登录成功') | ||
113 | + setTimeout(() => { | ||
114 | + uni.switchTab({ | ||
115 | + url: '/pages/market/index' | ||
116 | + }) | ||
117 | + }, 300) | ||
154 | }) | 118 | }) |
155 | - }) | ||
156 | - }, | ||
157 | - mobileLogin(data){ | ||
158 | - this.$store.dispatch('Login', { type: this.currentModeIndex, data: data }).then(res => { | ||
159 | - uni.$u.toast('登录成功') | ||
160 | - setTimeout(() => { | ||
161 | - uni.switchTab({ | ||
162 | - url: '/pages/user/user' | ||
163 | - }) | ||
164 | - }, 300) | ||
165 | - }) | 119 | + } |
166 | } | 120 | } |
167 | } | 121 | } |
168 | -} | ||
169 | </script> | 122 | </script> |
170 | 123 | ||
171 | <style lang="scss" scoped> | 124 | <style lang="scss" scoped> |
172 | -.auth-header { | ||
173 | - height: 400rpx; | ||
174 | - @include flex-center; | ||
175 | - .auth-logo { | ||
176 | - @include flex-center(column); | ||
177 | - } | ||
178 | -} | 125 | + .auth-header { |
126 | + height: 600rpx; | ||
127 | + display: flex; | ||
128 | + justify-content: flex-start; | ||
129 | + align-items: center; | ||
130 | + | ||
131 | + .auth-logo { | ||
132 | + margin: 200rpx 0 0 54rpx; | ||
179 | 133 | ||
180 | -.auth-box { | ||
181 | - @include flex-center(column); | 134 | + .imgCss { |
135 | + width: 320rpx !important; | ||
136 | + } | ||
137 | + | ||
138 | + .welcomeTitleCss { | ||
139 | + margin-top: 80rpx; | ||
140 | + background-color: rgba(255, 255, 255, 0); | ||
141 | + box-sizing: border-box; | ||
142 | + font-family: '苹方 粗体', '苹方 中等', '苹方', sans-serif; | ||
143 | + font-weight: 700; | ||
144 | + color: #333333; | ||
145 | + text-align: left; | ||
146 | + line-height: normal; | ||
147 | + font-size: 48rpx | ||
148 | + } | ||
182 | 149 | ||
183 | - .mode-section { | ||
184 | - width: 600rpx; | ||
185 | - .subsection { | ||
186 | - height: 60rpx; | 150 | + .platformCss { |
151 | + margin-top: 10rpx; | ||
152 | + background-color: rgba(255, 255, 255, 0); | ||
153 | + box-sizing: border-box; | ||
154 | + font-family: '苹方 中等', '苹方', sans-serif; | ||
155 | + color: #ababab; | ||
156 | + text-align: left; | ||
157 | + line-height: normal; | ||
158 | + font-size: 36rpx | ||
159 | + } | ||
187 | } | 160 | } |
188 | } | 161 | } |
189 | - .btn-group { | ||
190 | - width: 600rpx; | ||
191 | - .auth-btn { | ||
192 | - height: 90rpx; | ||
193 | - font-size: 32rpx; | 162 | + |
163 | + .auth-box { | ||
164 | + @include flex-center(column); | ||
165 | + | ||
166 | + .mode-section { | ||
167 | + width: 600rpx; | ||
168 | + | ||
169 | + .subsection { | ||
170 | + height: 60rpx; | ||
171 | + } | ||
172 | + } | ||
173 | + | ||
174 | + .btn-group { | ||
175 | + width: 600rpx; | ||
176 | + | ||
177 | + .auth-btn { | ||
178 | + height: 90rpx; | ||
179 | + font-size: 32rpx; | ||
180 | + padding: 2px 2px 2px 2px; | ||
181 | + border-radius: 60px; | ||
182 | + background-color: #cf000d; | ||
183 | + box-sizing: border-box; | ||
184 | + font-family: '苹方 中等', '苹方', sans-serif; | ||
185 | + color: #ffffff; | ||
186 | + text-align: center; | ||
187 | + line-height: normal; | ||
188 | + } | ||
194 | } | 189 | } |
195 | } | 190 | } |
196 | -} | 191 | + |
192 | + .u-input { | ||
193 | + height: 54rpx; | ||
194 | + background: #f5f7f7; | ||
195 | + } | ||
197 | </style> | 196 | </style> |
pages/market/index.vue
1 | <template> | 1 | <template> |
2 | <view> | 2 | <view> |
3 | <u-sticky bgColor="#fff" customNavHeight="0" offsetTop="0"> | 3 | <u-sticky bgColor="#fff" customNavHeight="0" offsetTop="0"> |
4 | - <u-search placeholder="搜索感兴趣的内容" v-model="keyword" :show-action="false" margin="30rpx 34rpx 15rpx 34rpx" | ||
5 | - borderColor="rgb(230, 230, 230)" height="74rpx" bgColor="#F5F6FA" @search="search"></u-search> | 4 | + <view class="flexCss"> |
5 | + <view class="leftCss"> | ||
6 | + <u-icon size="15" name="/static/images/empty/login-out.png"></u-icon> | ||
7 | + <view class="loginOutCss" @click="loginOutMethod"> | ||
8 | + 退出登录 | ||
9 | + </view> | ||
10 | + </view> | ||
11 | + <u-search placeholder="搜索感兴趣的内容" v-model="keyword" :show-action="false" margin="30rpx 34rpx 15rpx 34rpx" | ||
12 | + borderColor="rgb(230, 230, 230)" height="74rpx" bgColor="#F5F6FA" @search="search"></u-search> | ||
13 | + </view> | ||
6 | <u-tabs :list="tabList" :activeStyle="{'color': '#cf000d','font-weight':'bold'}" lineWidth="30rpx" | 14 | <u-tabs :list="tabList" :activeStyle="{'color': '#cf000d','font-weight':'bold'}" lineWidth="30rpx" |
7 | lineHeight="4rpx" lineColor="#cf000d" :current="current" @click="tabChange"></u-tabs> | 15 | lineHeight="4rpx" lineColor="#cf000d" :current="current" @click="tabChange"></u-tabs> |
8 | </u-sticky> | 16 | </u-sticky> |
9 | <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="NewsList.length <= 0"></u-empty> | 17 | <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" v-if="NewsList.length <= 0"></u-empty> |
10 | <newsList v-for="(item,index) in NewsList" :key="index" :newItem="item" v-else></newsList> | 18 | <newsList v-for="(item,index) in NewsList" :key="index" :newItem="item" v-else></newsList> |
11 | <u-loadmore :status="status" v-if="NewsList.length > 0" /> | 19 | <u-loadmore :status="status" v-if="NewsList.length > 0" /> |
20 | + <u-modal :show="loginOutShow" title="退出登录" showCancelButton confirmColor="red" @cancel="loginOutShow = false" | ||
21 | + @confirm="loginOut"> | ||
22 | + <view class="slot-content"> | ||
23 | + 您当前确定要退出吗? | ||
24 | + </view> | ||
25 | + </u-modal> | ||
12 | </view> | 26 | </view> |
13 | </template> | 27 | </template> |
14 | 28 | ||
@@ -31,7 +45,7 @@ | @@ -31,7 +45,7 @@ | ||
31 | return { | 45 | return { |
32 | keyword: "", | 46 | keyword: "", |
33 | current: 0, | 47 | current: 0, |
34 | - status:"loadmore", | 48 | + status: "loadmore", |
35 | total: null, | 49 | total: null, |
36 | queryParameter: { | 50 | queryParameter: { |
37 | pageNum: 1, | 51 | pageNum: 1, |
@@ -53,6 +67,8 @@ | @@ -53,6 +67,8 @@ | ||
53 | name: "国际能源", | 67 | name: "国际能源", |
54 | }], | 68 | }], |
55 | NewsList: [], | 69 | NewsList: [], |
70 | + loginOutShow: false, | ||
71 | + loginOutTitle: "退出登录" | ||
56 | } | 72 | } |
57 | }, | 73 | }, |
58 | computed: { | 74 | computed: { |
@@ -87,7 +103,7 @@ | @@ -87,7 +103,7 @@ | ||
87 | initData() { | 103 | initData() { |
88 | this.updateList() | 104 | this.updateList() |
89 | }, | 105 | }, |
90 | - resetQuery(){ | 106 | + resetQuery() { |
91 | this.NewsList = []; | 107 | this.NewsList = []; |
92 | this.queryParameter = { | 108 | this.queryParameter = { |
93 | pageNum: 1, | 109 | pageNum: 1, |
@@ -98,9 +114,9 @@ | @@ -98,9 +114,9 @@ | ||
98 | this.resetQuery(); | 114 | this.resetQuery(); |
99 | this.updateList() | 115 | this.updateList() |
100 | }, | 116 | }, |
101 | - checkTotal(){ | 117 | + checkTotal() { |
102 | let allTotal = this.queryParameter.pageNum * this.queryParameter.pageSize | 118 | let allTotal = this.queryParameter.pageNum * this.queryParameter.pageSize |
103 | - if(this.total < allTotal){ | 119 | + if (this.total < allTotal) { |
104 | this.status = "nomore" | 120 | this.status = "nomore" |
105 | } | 121 | } |
106 | }, | 122 | }, |
@@ -128,9 +144,9 @@ | @@ -128,9 +144,9 @@ | ||
128 | getInfoMarketInformationlist(Params).then(res => { | 144 | getInfoMarketInformationlist(Params).then(res => { |
129 | // console.log(res); | 145 | // console.log(res); |
130 | if (res.code === 200) { | 146 | if (res.code === 200) { |
131 | - if(this.queryParameter.pageSize > 1){ | ||
132 | - this.NewsList = [...this.NewsList,...res.rows] | ||
133 | - }else{ | 147 | + if (this.queryParameter.pageSize > 1) { |
148 | + this.NewsList = [...this.NewsList, ...res.rows] | ||
149 | + } else { | ||
134 | this.NewsList = res.rows | 150 | this.NewsList = res.rows |
135 | } | 151 | } |
136 | this.total = res.total; | 152 | this.total = res.total; |
@@ -145,11 +161,57 @@ | @@ -145,11 +161,57 @@ | ||
145 | this.current = e.index | 161 | this.current = e.index |
146 | console.log(this.current); | 162 | console.log(this.current); |
147 | this.updateList() | 163 | this.updateList() |
164 | + }, | ||
165 | + loginOutMethod() { | ||
166 | + this.loginOutShow = true | ||
167 | + }, | ||
168 | + loginOut() { | ||
169 | + // this.$modal.confirm('确定注销并退出系统吗?').then(() => { | ||
170 | + this.$store.dispatch('Logout').then((res) => { | ||
171 | + this.loginOutShow = false; | ||
172 | + uni.reLaunch({ | ||
173 | + url:'/pages/login/mobile' | ||
174 | + }) | ||
175 | + }) | ||
176 | + // }) | ||
148 | } | 177 | } |
149 | } | 178 | } |
150 | } | 179 | } |
151 | </script> | 180 | </script> |
152 | 181 | ||
153 | <style lang="scss" scoped> | 182 | <style lang="scss" scoped> |
183 | + .flexCss { | ||
184 | + display: flex; | ||
185 | + align-items: center; | ||
186 | + justify-content: space-between; | ||
187 | + } | ||
154 | 188 | ||
189 | + .loginOutCss { | ||
190 | + background-color: rgba(255, 255, 255, 0); | ||
191 | + box-sizing: border-box; | ||
192 | + font-family: '苹方 粗体', '苹方 中等', '苹方', sans-serif; | ||
193 | + font-weight: 700; | ||
194 | + color: #cf000d; | ||
195 | + text-align: left; | ||
196 | + line-height: normal; | ||
197 | + font-size: 28rpx; | ||
198 | + margin-left: 10rpx; | ||
199 | + } | ||
200 | + | ||
201 | + .leftCss { | ||
202 | + display: flex; | ||
203 | + justify-content: space-between; | ||
204 | + align-items: center; | ||
205 | + margin-left: 20rpx; | ||
206 | + } | ||
207 | + | ||
208 | + .slot-content { | ||
209 | + background-color: rgba(255, 255, 255, 0); | ||
210 | + box-sizing: border-box; | ||
211 | + font-family: '苹方 中等', '苹方', sans-serif; | ||
212 | + color: #666666; | ||
213 | + text-align: left; | ||
214 | + line-height: normal; | ||
215 | + font-size: 28rpx | ||
216 | + } | ||
155 | </style> | 217 | </style> |
pages/market/insight.vue
@@ -204,11 +204,11 @@ | @@ -204,11 +204,11 @@ | ||
204 | }, | 204 | }, |
205 | updateList1() { | 205 | updateList1() { |
206 | let Params | 206 | let Params |
207 | - if (this.keyword && this.current1 !== -1 && this.fiscalYear != "") { | 207 | + if (this.keyword && this.current1 !== -1 && this.fiscalYear !== "") { |
208 | Params = { | 208 | Params = { |
209 | - fiscalYear: this.fiscalYear, | ||
210 | reportName: this.keyword, | 209 | reportName: this.keyword, |
211 | - statusCode: this.current1 | 210 | + statusCode: this.current1, |
211 | + fiscalYear: this.fiscalYear, | ||
212 | } | 212 | } |
213 | } else if (this.keyword !== "") { | 213 | } else if (this.keyword !== "") { |
214 | Params = { | 214 | Params = { |
@@ -218,11 +218,12 @@ | @@ -218,11 +218,12 @@ | ||
218 | Params = { | 218 | Params = { |
219 | statusCode: this.current1 - 1 | 219 | statusCode: this.current1 - 1 |
220 | } | 220 | } |
221 | - } else if (this.fiscalYear != "") { | 221 | + } else if (this.fiscalYear !== "") { |
222 | Params = { | 222 | Params = { |
223 | fiscalYear: this.fiscalYear | 223 | fiscalYear: this.fiscalYear |
224 | } | 224 | } |
225 | } | 225 | } |
226 | + console.log(Params); | ||
226 | Params = { | 227 | Params = { |
227 | ...this.queryParameter, | 228 | ...this.queryParameter, |
228 | ...Params | 229 | ...Params |
@@ -339,7 +340,6 @@ | @@ -339,7 +340,6 @@ | ||
339 | this.fiscalYearShow = false; | 340 | this.fiscalYearShow = false; |
340 | console.log(this.fiscalYear); | 341 | console.log(this.fiscalYear); |
341 | this.resetQuery(); | 342 | this.resetQuery(); |
342 | - this.updateList1(); | ||
343 | }) | 343 | }) |
344 | }, | 344 | }, |
345 | resetDate() { | 345 | resetDate() { |
53.6 KB
7.58 KB
store/mudules/user.js
@@ -24,14 +24,15 @@ const user = { | @@ -24,14 +24,15 @@ const user = { | ||
24 | // 更新令牌 | 24 | // 更新令牌 |
25 | SET_TOKEN(state, data) { | 25 | SET_TOKEN(state, data) { |
26 | // 设置令牌 | 26 | // 设置令牌 |
27 | - const { accessToken, refreshToken } = data | ||
28 | - state.accessToken = accessToken | ||
29 | - state.refreshToken = refreshToken | ||
30 | - uni.setStorageSync(AccessTokenKey, accessToken) | ||
31 | - uni.setStorageSync(RefreshTokenKey, refreshToken) | 27 | + console.log(111,data); |
28 | + const { access_token, refresh_token } = data | ||
29 | + state.accessToken = access_token | ||
30 | + state.refreshToken = refresh_token | ||
31 | + uni.setStorageSync(AccessTokenKey, access_token) | ||
32 | + uni.setStorageSync(RefreshTokenKey, refresh_token) | ||
32 | 33 | ||
33 | // 加载用户信息 | 34 | // 加载用户信息 |
34 | - this.dispatch('ObtainUserInfo') | 35 | + // this.dispatch('ObtainUserInfo') |
35 | }, | 36 | }, |
36 | // 更新用户信息 | 37 | // 更新用户信息 |
37 | SET_USER_INFO(state, data) { | 38 | SET_USER_INFO(state, data) { |
utils/request/requestInterceptors.js
@@ -9,7 +9,7 @@ module.exports = vm => { | @@ -9,7 +9,7 @@ module.exports = vm => { | ||
9 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} | 9 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
10 | config.data = config.data || {} | 10 | config.data = config.data || {} |
11 | if (vm.$store.getters.hasLogin) { | 11 | if (vm.$store.getters.hasLogin) { |
12 | - config.header.Authorization = 'Bearer ' + vm.$store.getters.accessToken | 12 | + config.header.Authorization = vm.$store.getters.accessToken |
13 | } | 13 | } |
14 | return config | 14 | return config |
15 | }, | 15 | }, |
vue.config.js
1 | module.exports = { | 1 | module.exports = { |
2 | - // 配置路径别名 | ||
3 | - configureWebpack: { | ||
4 | - devServer: { | ||
5 | - // 调试时允许内网穿透,让外网的人访问到本地调试的H5页面 | ||
6 | - disableHostCheck: true | ||
7 | - } | ||
8 | - } | ||
9 | - // productionSourceMap: false, | 2 | + // 配置路径别名 |
3 | + configureWebpack: { | ||
4 | + devServer: { | ||
5 | + // 调试时允许内网穿透,让外网的人访问到本地调试的H5页面 | ||
6 | + disableHostCheck: true, | ||
7 | + // /本地调试时打开 | ||
8 | + port: '8081', //代理端口,不固定8222,可以是其他的 | ||
9 | + open: false, //项目启动时是否自动打开浏览器 | ||
10 | + proxy: { | ||
11 | + '/api': { | ||
12 | + target: 'http://172.17.56.37/api', //接口地址 | ||
13 | + // ws:true, //允许ws跨域 | ||
14 | + secure:true, //类型:https=false http=true | ||
15 | + changeOrigin: true, //是否跨域 | ||
16 | + pathRewrite:{ // 重写路径 | ||
17 | + '^/api':'' | ||
18 | + } | ||
19 | + } | ||
20 | + }, | ||
21 | + | ||
22 | + // /本地调试时打开 | ||
23 | + } | ||
24 | + }, | ||
25 | + productionSourceMap: false, | ||
10 | } | 26 | } |