Browse Source

登录接口调用

master
unknown 1 year ago
parent
commit
f236a73ddd
  1. 21
      components/commentItem/commentItem.vue
  2. 19
      config/api.js
  3. 52
      config/request - 副本.js
  4. 51
      config/request.js
  5. 8
      config/site.config.js
  6. 51
      config/utils.js
  7. 2
      manifest.json
  8. 29
      pages.json
  9. 58
      pages/login/login.vue
  10. 0
      pages/login/loginByPhone.vue
  11. 60
      pages/tabbar/examSimulation/comp/studentComment.vue
  12. 5
      pages/tabbar/examSimulation/index.vue
  13. 2
      pages/userCenter/personaInfo/personaInfo.vue
  14. 1
      pages/userCenter/studentComment/studentComment.vue
  15. 12
      site.config.js
  16. 150
      store/modules/user.js
  17. 3
      uni_modules/uview-ui/components/u-album/u-album.vue

21
components/commentItem/commentItem.vue

@ -9,15 +9,30 @@
<view class="num">4.9</view> <view class="num">4.9</view>
</view> </view>
<view class="text">教学质量高技术好超有耐心有责任心学车就找这个驾校教练都超好满意满意满意</view> <view class="text">教学质量高技术好超有耐心有责任心学车就找这个驾校教练都超好满意满意满意</view>
<view class="imgBox">
<view class="img">
<image src="@/static/images/logo.png" mode=""></image>
<!-- <view class="imgBox">
<view class="img" v-for="(item,index) in urls2" :key="index">
<image :src="item" mode=""></image>
</view> </view>
</view> -->
<view class="imgBox">
<u-album :urls="urls2" :multipleSize="'160rpx'"></u-album>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default {
data() {
return {
urls2: [
'https://cdn.uviewui.com/uview/album/1.jpg',
'https://cdn.uviewui.com/uview/album/2.jpg',
'https://cdn.uviewui.com/uview/album/3.jpg',
'https://cdn.uviewui.com/uview/album/4.jpg',
]
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

19
config/api.js

@ -1,10 +1,21 @@
const http = uni.$u.http
var http = uni.$u.http
// 隐私政策 // 隐私政策
export const getAgreement = (params, config = {}) => http.post('/util/manage/getAgreement.do', params, config) export const getAgreement = (params, config = {}) => http.post('/util/manage/getAgreement.do', params, config)
// 验证码登录 // 验证码登录
export const loginSMS = (data) => http.post('/account/manage/login.do', data)
// 登录发验证码
export const getLoginCode = (data) => http.post('/util/manage/getLoginRegistCode.do', data)
export const loginPwd = (data) => http.post('system/auth/login', data, { custom: { noToken: true , 'Tenant-Id': data['Tenant-Id']}})
// 获取个人信息
export const getUserInfo = (data) => http.post('member/user/get', {header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}})
// 退出登录
export const logOut = (data={}) => http.post('member/auth/logout', data, { custom: { noToken: true }})
// 驾校列表分页
export const schoolPage = (params) => http.get('business/school/page', {params: params})
// 获得租户分页
export const tenantPage = (params) => http.get('system/tenant/pages', {params: params})

52
config/request - 副本.js

@ -0,0 +1,52 @@
// 此vm参数为页面的实例,可以通过它引用vuex中的变量
module.exports = (vm) => {
// 初始化请求配置
uni.$u.http.setConfig((config) => {
/* config 为默认全局配置*/
config.baseURL = 'http://121.41.97.244:8090'; /* 根域名 */
config.header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
return config
})
// 请求拦截
uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
// 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
config.data = config.data || {}
// 根据custom参数中配置的是否需要token,添加对应的请求头
if(config?.custom?.auth) {
// 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中
config.header.token = vm.$store.state.userInfo.token
}
return config
}, config => { // 可使用async await 做异步操作
return Promise.reject(config)
})
// 响应拦截
uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
const data = response.data
console.log('response')
console.log(data)
// 自定义参数
const custom = response.config?.custom
if (data.code !== 0) {
// 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
if (custom.toast !== false) {
uni.$u.toast(data.message)
}
// 如果需要catch返回,则进行reject
if (custom?.catch) {
return Promise.reject(data)
} else {
// 否则返回一个pending中的promise,请求不会进入catch中
return new Promise(() => { })
}
}
return data === undefined ? {} : data
}, (response) => {
// 对响应错误做点什么 (statusCode !== 200)
return Promise.reject(response)
})
}

51
config/request.js

@ -1,22 +1,40 @@
import { H5_API, WX_API,httpPrefix } from './site.config.js'
import { checkToken } from './utils'
// 此vm参数为页面的实例,可以通过它引用vuex中的变量 // 此vm参数为页面的实例,可以通过它引用vuex中的变量
module.exports = (vm) => { module.exports = (vm) => {
// 初始化请求配置 // 初始化请求配置
uni.$u.http.setConfig((config) => { uni.$u.http.setConfig((config) => {
let prefix = config.custom.prefix?config.custom.prefix: httpPrefix
/* config 为默认全局配置*/ /* config 为默认全局配置*/
config.baseURL = 'http://121.41.97.244:8090'; /* 根域名 */
config.header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
config.baseURL = H5_API+ WX_API + prefix; /* 根域名 */
console.log(config)
// config.header['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
config.header['tenant-id'] = vm.$store.state.user.vuex_TenantId
return config return config
}) })
// 请求拦截 // 请求拦截
uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作 uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
console.log(config)
// config.header['tenant-id'] = config.custom['Tenant-id']
// 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
config.data = config.data || {} config.data = config.data || {}
// 根据custom参数中配置的是否需要token,添加对应的请求头 // 根据custom参数中配置的是否需要token,添加对应的请求头
if(config?.custom?.auth) {
// 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中
config.header.token = vm.$store.state.userInfo.token
let token = vm.$store.state.user.vuex_loginInfo.accessToken
if(token) {
config.header.Authorization = 'Bearer ' + token
}
let noToken = config.custom?.noToken
if(noToken&&config.header.Authorization) {
delete config.header.Authorization
} }
return config return config
}, config => { // 可使用async await 做异步操作 }, config => { // 可使用async await 做异步操作
@ -26,14 +44,26 @@ module.exports = (vm) => {
// 响应拦截 // 响应拦截
uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/ uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
const data = response.data const data = response.data
console.log('response')
console.log(data)
// console.log('请求结果')
// console.log(data)
if(data.code==406) {
// vm.$store.dispatch('refreshToken')
uni.$u.toast('登录过期,请重新登录')
setTimeout(()=>{
vm.$store.commit('goLogin')
},1500)
return false
}
if(data.code==401) {
vm.$store.commit('goLogin')
}
// 自定义参数 // 自定义参数
const custom = response.config?.custom const custom = response.config?.custom
if (data.code !== 0) { if (data.code !== 0) {
// 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示 // 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
if (custom.toast !== false) { if (custom.toast !== false) {
uni.$u.toast(data.message)
uni.$u.toast(data.msg)
} }
// 如果需要catch返回,则进行reject // 如果需要catch返回,则进行reject
@ -44,6 +74,11 @@ module.exports = (vm) => {
return new Promise(() => { }) return new Promise(() => { })
} }
} }
// 如果不需要token就把header里的token删除,并且不需要去刷新token
let noToken = response.config.custom?.noToken
if(!noToken) {
checkToken(vm)
}
return data === undefined ? {} : data return data === undefined ? {} : data
}, (response) => { }, (response) => {
// 对响应错误做点什么 (statusCode !== 200) // 对响应错误做点什么 (statusCode !== 200)

8
config/site.config.js

@ -0,0 +1,8 @@
const VUE_APP_PLATFORM = process.env.VUE_APP_PLATFORM;
// localIp = false
module.exports = {
H5_API: VUE_APP_PLATFORM === 'h5' ? '/api' : '',//h5代理
WX_API: VUE_APP_PLATFORM === 'h5' ? '' : 'http://192.168.1.26:48080/',//非代理地址
TEMP_HOST: VUE_APP_PLATFORM === 'h5' ? '' : 'http://192.168.1.26:48080/',
httpPrefix: '/admin-api/'
};

51
config/utils.js

@ -0,0 +1,51 @@
export function checkToken(vm) {
let expiresTime = vm.$store.state.user.vuex_loginInfo.expiresTime
let nowTime = new Date() * 1
console.log('超时了')
console.log(expiresTime)
if (nowTime > expiresTime * 1) {
vm.$store.commit('goLogin')
// 如果小于20分钟就刷新一下token &&
} else if ((expiresTime * 1 - nowTime) / 60000 < 30) {
vm.$store.dispatch('refreshToken')
}
}
function dateRangeFn(dateRange) {
let tmp = []
let dateArr = []
dateRange.forEach((date) => {
let dateStr = date.toISOString().split('T')[0]
let dd = dateStr.split('-')[2]
const daysOfWeek = ['日', '一', '二', '三', '四', '五', '六'];
const dayOfWeek = date.getDay();
const weekName = daysOfWeek[dayOfWeek];
console.log(dateStr)
console.log(weekName)
if (tmp.length == 0) {
dateArr.push(tmp)
}
let obj = {
week: weekName,
num: dd,
date: dateStr
}
tmp.push(obj)
if (tmp.length == 5) {
tmp = []
}
});
console.log(dateArr)
return dateArr
}
export function getDates(startDate, endDate) {
const dates = [];
let currentDate = new Date(startDate);
while (currentDate <= endDate) {
dates.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
return dateRangeFn(dates)
}

2
manifest.json

@ -81,7 +81,7 @@
"disableHostCheck" : true, "disableHostCheck" : true,
"proxy" : { "proxy" : {
"/api" : { "/api" : {
"target" : "http://121.41.97.244:8090",
"target" : "http://192.168.1.26:48080/",
"changeOrigin" : true, "changeOrigin" : true,
"secure" : true, "secure" : true,
"pathRewrite" : { "pathRewrite" : {

29
pages.json

@ -1,6 +1,15 @@
{ {
"pages": [ "pages": [
{ {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}
},
{
"path": "pages/tabbar/statistics/index", "path": "pages/tabbar/statistics/index",
"style": { "style": {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
@ -45,6 +54,7 @@
"backgroundTextStyle": "dark" "backgroundTextStyle": "dark"
} }
} }
], ],
"subPackages": [ "subPackages": [
@ -184,24 +194,7 @@
{ {
"root": "pages/userCenter", "root": "pages/userCenter",
"pages": [ "pages": [
{
"path": "login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
}
},
{
"path": "login/loginByPhone",
"style": {
"navigationBarTitleText": "手机号登录",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
}
},
{ {
"path": "forgetPwd/forgetPwd", "path": "forgetPwd/forgetPwd",
"style": { "style": {

58
pages/userCenter/login/login.vue → pages/login/login.vue

@ -10,8 +10,11 @@
</view> </view>
<view class="form"> <view class="form">
<view class="form-item"> <view class="form-item">
<mySelect :value="FormData.tenantName" @click.native="show=true" placeholder="请选择租户编号"/>
</view>
<view class="form-item">
<view class="inputBox my"> <view class="inputBox my">
<u--input placeholder="请输入登录账号" border="none" clearable type="number" maxlength="11" v-model="FormData.phone"></u--input>
<u--input placeholder="请输入登录账号" border="none" clearable v-model="FormData.username"></u--input>
</view> </view>
</view> </view>
<view class="form-item"> <view class="form-item">
@ -30,32 +33,54 @@
</view> </view>
</view> --> </view> -->
</view> </view>
<u-picker :show="show" :columns="columnsArea" keyName="name" @confirm="confirmArea" @close="show=false"></u-picker>
</view> </view>
</template> </template>
<script> <script>
import { getLoginCode } from '@/config/api.js'
import { loginPwd, tenantPage } from '@/config/api.js'
export default { export default {
data() { data() {
return { return {
isCheck: false, isCheck: false,
codeText: '获取验证码', codeText: '获取验证码',
FormData: {},
codeOn: false
FormData: {
username: '',
password: '',
tenantName: ''
},
codeOn: false,
show: false,
columnsArea: []
} }
}, },
onLoad() { onLoad() {
this.tenantPageFn()
}, },
computed: { computed: {
isPhone() {
return uni.$u.test.mobile(this.FormData.phone)
},
btnHighlight() { btnHighlight() {
return this.isPhone&&this.FormData.password
let { FormData } = this
return FormData.username.length>3&&FormData.password.length>3&&FormData.tenantName
} }
}, },
methods: { methods: {
confirmArea(val) {
let item = val.value[0]
this.FormData.tenantName =item.name
this.$store.commit('upDateTenantId', item.id)
this.show = false
},
async tenantPageFn() {
let obj = {
pageNo: 1,
pageSize: 100,
status: 0
}
const {data: res} = await tenantPage(obj)
this.columnsArea.push(res.list)
console.log(res)
},
// //
groupChangeEnvnt(e) { groupChangeEnvnt(e) {
this.isCheck = e.value this.isCheck = e.value
@ -87,7 +112,11 @@
} }
}, 1000); }, 1000);
}, },
submitFn() {
async submitFn() {
if(!this.btnHighlight) return
const {data: res} = await loginPwd(this.FormData)
this.$store.commit('update_vuex_loginInfo')
this.$store.dispatch('getUserInfo')
let val = '' let val = ''
if(this.FormData.phone=='18267103167') { if(this.FormData.phone=='18267103167') {
val = '实操教练' val = '实操教练'
@ -97,6 +126,11 @@
val = '考场模拟教练' val = '考场模拟教练'
}else { }else {
val = '模拟器老师' val = '模拟器老师'
this.$store.commit('upDateIdentity', val)
uni.reLaunch({
url: '/pages/tabbar/examSimulation/index'
})
return false
} }
this.$store.commit('upDateIdentity', val) this.$store.commit('upDateIdentity', val)
uni.reLaunch({ uni.reLaunch({
@ -112,7 +146,7 @@
.main { .main {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
background: url('../../../static/images/userCenter/loginTopBg.png') no-repeat;
background: url('../../static/images/userCenter/loginTopBg.png') no-repeat;
background-size: 100% 360rpx; background-size: 100% 360rpx;
.u-back-top { .u-back-top {
padding: 32rpx 0 0 0; padding: 32rpx 0 0 0;
@ -124,7 +158,7 @@
.title { .title {
width: 658rpx; width: 658rpx;
height: 94rpx; height: 94rpx;
margin: 130rpx auto 114rpx auto;
margin: 100rpx auto 100rpx auto;
} }
.form { .form {

0
pages/userCenter/login/loginByPhone.vue → pages/login/loginByPhone.vue

60
pages/tabbar/examSimulation/comp/studentComment.vue

@ -0,0 +1,60 @@
<template>
<view class="pageBgImg">
<view class="status_bar"></view>
<view class="navH"></view>
<view class="pad">
<view class="searchBox">
<searchRow placeholder="搜索学员姓名"></searchRow>
</view>
<view class="tabs">
<view class="tab active">全部10</view>
<view class="tab">匿名1</view>
<view class="tab">有图2</view>
<view class="tab">有视频6</view>
</view>
<view class="list">
<view class="card">
<commentItem/>
</view>
</view>
</view>
</view>
</template>
<script>
</script>
<style lang="scss" scoped>
.navH {
width: 100%;
height: 90rpx;
}
.card {
padding: 28rpx;
margin-bottom: 20rpx;
}
.tabs {
display: flex;
justify-content: space-between;
padding: 24rpx 12rpx;
.tab {
line-height: 76rpx;
font-size: 28rpx;
color: #fff;
&.active {
position: relative;
&::before {
position: absolute;
content: '';
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 56rpx;
height: 6rpx;
background: #FFFFFF;
border-radius: 3rpx;
}
}
}
}
</style>

5
pages/tabbar/examSimulation/index.vue

@ -4,14 +4,17 @@
<coachIdentity v-if="identity=='实操教练'"/> <coachIdentity v-if="identity=='实操教练'"/>
<!-- 预约记录 --> <!-- 预约记录 -->
<simulation v-if="identity=='考场模拟教练'"/> <simulation v-if="identity=='考场模拟教练'"/>
<!-- 学员评价 -->
<studentComment v-if="identity=='模拟器老师'"/>
</view> </view>
</template> </template>
<script> <script>
import coachIdentity from './comp/coach.vue' import coachIdentity from './comp/coach.vue'
import simulation from './comp/simulation.vue' import simulation from './comp/simulation.vue'
import studentComment from './comp/studentComment.vue'
export default { export default {
components: { coachIdentity,simulation },
components: { coachIdentity,simulation, studentComment },
data() { data() {
return { return {

2
pages/userCenter/personaInfo/personaInfo.vue

@ -36,7 +36,7 @@
</view> </view>
<view class="btnBox"> <view class="btnBox">
<view class="logout" @click="$goPage('/pages/userCenter/login/login')">退出登录</view>
<view class="logout" @click="$goPage('/pages/login/login')">退出登录</view>
<view class="logout" @click="$goPage('/pages/userCenter/forgetPwd/forgetPwd')">修改密码</view> <view class="logout" @click="$goPage('/pages/userCenter/forgetPwd/forgetPwd')">修改密码</view>
</view> </view>

1
pages/userCenter/studentComment/studentComment.vue

@ -24,6 +24,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card { .card {
padding: 28rpx; padding: 28rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;

12
site.config.js

@ -1,12 +0,0 @@
const VUE_APP_PLATFORM = process.env.VUE_APP_PLATFORM;
module.exports = {
APP_API: VUE_APP_PLATFORM === 'h5' ? 'http://121.41.97.244:8090' : '',
APP_HOST: VUE_APP_PLATFORM === 'h5' ? '' : 'https://www.jaxc.cn/api',
TEMP_HOST: VUE_APP_PLATFORM === 'h5' ? '' : 'http://121.41.97.244:8090 https://www.jaxc.cn/api',
ADD_API: VUE_APP_PLATFORM === 'h5' ? '/addApi': 'http://121.41.97.244:48084', //http://121.41.97.244:48084
APP_NAME: '',
VERSION: '1.0.0',
gaodeMapUrl: 'https://webapi.amap.com/maps?v=1.4.15&key=4545202996c625152b7f2c1aa0ffb8ea&plugin=AMap.DistrictSearch,AMap.CustomLayer,AMap.MarkerClusterer',
locationIcon: 'http://3dtest.hzhuishi.cn/images/location.png',
AThreeFace : true, //是否启用人脸识别
};

150
store/modules/user.js

@ -3,7 +3,11 @@ import addApi from '../../common/sdk/qqmap-wx-jssdk.min.js'; // 引入
const user = { const user = {
state: { state: {
identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):1
identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):1,
vuex_cityInfo: uni.getStorageSync('vuex_cityInfo') ? uni.getStorageSync('vuex_cityInfo') : {city: '杭州市'},
vuex_userInfo: uni.getStorageSync('vuex_userInfo') ? uni.getStorageSync('vuex_userInfo') : {},
vuex_loginInfo: uni.getStorageSync('vuex_loginInfo') ? uni.getStorageSync('vuex_loginInfo') : {},
vuex_TenantId: uni.getStorageSync('vuex_TenantId') ? uni.getStorageSync('vuex_TenantId') : '',
}, },
mutations: { mutations: {
// 更新用户身份 // 更新用户身份
@ -11,22 +15,142 @@ const user = {
state.identity = val state.identity = val
uni.setStorageSync('identity', val); uni.setStorageSync('identity', val);
}, },
update_vuex_cityInfo(state, payload) {
state.vuex_cityInfo = payload
uni.setStorageSync('vuex_cityInfo', payload);
},
update_vuex_loginInfo(state, payload) {
state.vuex_loginInfo = payload
uni.setStorageSync('vuex_loginInfo', payload);
},
update_vuex_userInfo(state, payload) {
state.vuex_userInfo = payload
uni.setStorageSync('vuex_userInfo', payload);
},
upDateTenantId(state, val) {
state.vuex_TenantId = val
uni.setStorageSync('vuex_TenantId', val);
uni.$u.http.setConfig((config) => {
config.header['tenant-id'] = val
return config
})
},
goLogin(state) {
uni.clearStorageSync()
state.vuex_loginInfo = {}
state.vuex_userInfo = {}
state.vuex_TenantId = ''
uni.navigateTo({
url: '/pages/userCenter/login/loginByPhone'
})
}
}, },
actions: { actions: {
// 点击广告
async addClick({commit, dispatch}, curAdd) {
// await dispatch('updateStatistics')
curAdd.clicks ++
if(!curAdd.adBannerDO.jumpUrl) {
return false
}
commit('updateWebVeiwUrl', curAdd.adBannerDO.jumpUrl)
uni.navigateTo({
url:'/pages/commeWebView/addWebView'
// 获取用户信息
async getUserInfo({commit}) {
const http = uni.$u.http
let config = { custom: { auth: false }, header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'} }
const res = await http.get('system/user/profile/get',config)
commit('update_vuex_userInfo',res.data)
},
// 刷新token
async refreshToken({state, commit}) {
const http = uni.$u.http
let config = { header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}, custom: { noToken: true } }
let refreshToken = state.vuex_loginInfo.refreshToken
const res = await http.post('member/auth/refresh-token',{refreshToken}, config)
console.log('刷新token结果')
console.log(res)
commit('update_vuex_loginInfo',res.data)
uni.$u.http.setConfig((config) => {
config.header.Authorization = 'Bearer ' + res.data.accessToken
return config
})
},
getCity({commit}) {
return new Promise((resolve, reject) => {
// #ifdef APP-PLUS||H5
getCityInfo(resolve, reject,commit)
// #endif
// #ifdef MP-WEIXIN
uni.authorize({
scope: 'scope.userLocation',
success() {
getCityInfo(resolve, reject,commit)
},
fail: function(res4) {
uni.showModal({
title: '提示',
content: '小程序想要获取您的地里位置',
success: function(res) {
if (res.confirm) {
uni.openSetting({
success(res) {
getCityInfo(resolve, reject,commit)
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
},
})
// #endif
}) })
}, },
} }
} }
export default user
function getCityInfo(resolve, reject, commit) {
uni.showLoading({
title: '加载中...'
})
var qqmapKey = new qqmapWx({
key: '2BTBZ-6BQRB-ZG4UG-NOYYG-KZMH7-B4BYN'
})
uni.getLocation({
type: 'wgs84',
// type: 'gcj02',
success: function(res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
qqmapKey.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success(res2) {
// console.log('城市信息')
// console.log(res2.result)
let result = res2.result
let obj = {
latitude: res.latitude,
longitude: res.longitude,
city: result.address_component.city,
cityCode: result.ad_info.adcode,
province: result.address_component.province,
district: result.address_component.district
}
commit('update_vuex_cityInfo', obj)
resolve(obj)
uni.hideLoading();
},
fail: function(res3) {
reject(res3)
uni.hideLoading();
},
})
},
fail(e) {
console.log(e)
}
})
}
export default user

3
uni_modules/uview-ui/components/u-album/u-album.vue

@ -26,7 +26,8 @@
:style="[ :style="[
{ {
width: imageWidth, width: imageWidth,
height: imageHeight
height: imageHeight,
borderRadius: '8rpx'
} }
]" ]"
></image> ></image>

Loading…
Cancel
Save