Browse Source

修改头像

master
unknown 3 months ago
parent
commit
5e87066091
  1. 27
      App.vue
  2. 3
      config/api.js
  3. 7
      config/utils.js
  4. 27
      manifest.json
  5. 8
      pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper.vue
  6. 4
      pages/indexEntry/findShcool/screen/screen.vue
  7. 49
      pages/mineEntry/personaInfo/personaInfo.vue
  8. 8
      pages/tabbar/index/index.vue
  9. 2
      pages/userCenter/login/login.vue
  10. 52
      store/modules/user.js

27
App.vue

@ -5,7 +5,6 @@
// location.getLocation(()=>{
// this.$store.dispatch('getCity')
// });
// this.getLocationAuthority()
},
onShow: function() {
console.log('App Show')
@ -14,31 +13,7 @@
console.log('App Hide')
},
methods: {
getLocationAuthority() {
let _this = this
uni.getLocation({
type: 'wgs84',
success: function(res) {
_this.$store.dispatch('getCity')
},
fail: function(err) {
console.log('为什么失败了')
console.log(err)
uni.showModal({
content: '为了能够获取精确的数据,请去手机设置里手动开启app定位权限',
showCancel: false,
confirmText: '知道了,关闭弹窗',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
});
}
}
}
</script>

3
config/api.js

@ -230,6 +230,9 @@ export const periodConfirm = (data) => http.post('app/student-process/periodConf
export const refuse_apply = (data) => http.post('pay/ysb/refuse_apply', data)
// 获取退款申请的金额
export const refund_amount = (data) => http.post('pay/ysb/refund_amount', data)
// 头像修改申请
export const avatarApply = (data) => http.post('app/student-record/avatar_apply', data)

7
config/utils.js

@ -115,7 +115,7 @@ export function uploadImgApi(filePath, imgName, imgLink='image') {
formData: {
path: imgLink+'/'+ uni.$u.date(timer, 'yyyy-mm-dd')+'/'+timer + '-'+ imgName,
type: 1,
fileSuffix: "png"
fileSuffix: "mp4"
},
header: {
Authorization: token,
@ -172,6 +172,7 @@ export function uploadImgApi(filePath, imgName, imgLink='image') {
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
console.log('扫码结果***********')
let obj = JSON.parse(res.result)
console.log(obj)
// 扫教练码去报名的
@ -187,12 +188,12 @@ export function uploadImgApi(filePath, imgName, imgLink='image') {
}
_this.$store.commit('upDateSchoolClass', {})
if(obj.QrType==1) {
// 判断是扫教练码来的还是驾校码来的
if(item.id) {
_this.$store.commit('updateSchool', {})
console.log('扫码结果***********')
console.log(item)
_this.$store.commit('upDateSchoolCoach', item)
}else {
obj.schoolName = decodeURIComponent(obj.schoolName)

27
manifest.json

@ -2,8 +2,8 @@
"name" : "洛阳学车",
"appid" : "__UNI__3347C6E",
"description" : "",
"versionName" : "1.4.0",
"versionCode" : 140,
"versionName" : "1.4.4",
"versionCode" : 144,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -25,9 +25,9 @@
"modules" : {
"Maps" : {},
"Barcode" : {},
"Geolocation" : {},
"VideoPlayer" : {},
"Share" : {}
"Share" : {},
"Camera" : {}
},
/* */
"distribute" : {
@ -67,9 +67,11 @@
"dSYMs" : false,
"UIBackgroundModes" : "location",
"privacyDescription" : {
"NSLocationWhenInUseUsageDescription" : "运行期访问位置",
"NSLocationAlwaysUsageDescription" : "后台运行访问位置",
"NSLocationAlwaysAndWhenInUseUsageDescription" : "访问位置"
"NSPhotoLibraryAddUsageDescription" : "该应用需要读取您的相册,以便扫驾校二维码时读取驾校信息,与咨询投诉时上传照片",
"NSCameraUsageDescription" : "该应用需要读取您的相册,以便扫驾校二维码时读取驾校信息,与咨询投诉时上传照片",
"NSLocationWhenInUseUsageDescription" : "该应用需要读取您的位置,以便查找驾校显示当前位置信息或查找附件数据",
"NSLocationAlwaysAndWhenInUseUsageDescription" : "该应用需要读取您的位置,以便查找驾校显示当前位置信息或查找附件数据",
"NSPhotoLibraryUsageDescription" : "该应用需要读取您的相册,以便扫驾校二维码时读取驾校信息,与咨询投诉时上传照片"
},
"capabilities" : {
"entitlements" : {
@ -101,10 +103,10 @@
"__platform__" : [ "ios", "android" ]
},
"amap" : {
"name" : "amapOV4nNDfa",
"__platform__" : [ "ios", "android" ],
"appkey_ios" : "2839b2b14fdcd2983e0d6247ce9baf7a",
"appkey_android" : "3c5fcc5ee6aaba56e4806f3382399c16",
"name" : "amapOV4nNDfa"
"appkey_android" : "3c5fcc5ee6aaba56e4806f3382399c16"
}
},
"payment" : {
@ -227,8 +229,9 @@
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://www.lyjppt.com/",
// "target" : "http://www.lyjppt.com/",
// "target" : "http://123.6.232.1:8099/",
"target" : "http://192.168.1.106:8318/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {
@ -251,7 +254,9 @@
}
}
},
"_spaceID" : "mp-87b9fa27-0273-48d3-a586-bd058cd2ce3d"
"_spaceID" : "mp-87b9fa27-0273-48d3-a586-bd058cd2ce3d",
"fallbackLocale" : "zh-Hans",
"locale" : "auto"
}
/* ios *//* SDK */

8
pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper.vue

@ -113,9 +113,9 @@ export default {
},
//
// px
destWidth: 147,
destWidth: 240,
// px
rectWidth: 295,
rectWidth: 240,
// 'png'"jpg"
fileType: 'png',
src: '', //
@ -137,7 +137,7 @@ export default {
x: (this.width - rectWidth) / 2,
y: (this.height - rectWidth) / 2,
width: rectWidth,
height: 413
height: 320
};
}
this.rectWidth = this.rectWidth;
@ -179,7 +179,7 @@ export default {
if(!this.src) return this.$u.toast('请先选择图片再裁剪');
let cropper_opt = {
destHeight: 206, // uni.canvasToTempFilePath
destHeight: 320, // uni.canvasToTempFilePath
destWidth: Number(this.destWidth),
fileType: this.fileType
};

4
pages/indexEntry/findShcool/screen/screen.vue

@ -4,14 +4,14 @@
<view class="type">
<view class="h1">驾照类型</view>
<view class="tagFlex">
<view class="tab" v-for="(item,index) in driverList" :class="{active: driverTypeArr.indexOf(item.label)!=-1}" @click="driverTypeClick(item)">{{ item.label }}</view>
<view class="tab" v-for="(item,index) in driverList" :key="index" :class="{active: driverTypeArr.indexOf(item.label)!=-1}" @click="driverTypeClick(item)">{{ item.label }}</view>
</view>
</view>
<view class="region">
<view class="h1">区域</view>
<view class="tagFlex">
<view class="tab" v-for="(item,index) in areList" :class="{active: areTypeArr.indexOf(item.areaCode)!=-1}" @click="areTypeClick(item)">{{ item.areaName }}</view>
<view class="tab" v-for="(item,index) in areList" :key="index" :class="{active: areTypeArr.indexOf(item.areaCode)!=-1}" @click="areTypeClick(item)">{{ item.areaName }}</view>
</view>
</view>

49
pages/mineEntry/personaInfo/personaInfo.vue

@ -1,14 +1,14 @@
<template>
<view class="pageBg">
<view class="pad">
<!-- <view class="avatarBox" @click="editAvatar">
<view class="avatarBox" @click="editAvatar">
<view class="avatar">
<image :src="avatarBase64?avatarBase64:avatarLink" mode=""></image>
<view class="imgMask" v-if="avatarBase64">审核中</view>
<image :src="vuex_userInfo.newPhotoPath?vuex_userInfo.newPhotoPath:vuex_userInfo.photoPath" mode="aspectFill"></image>
<view class="imgMask" v-if="vuex_userInfo.avatarCheckStatus==0&&vuex_userInfo.newPhotoPath">审核中</view>
<view class="imgMask" v-if="vuex_userInfo.avatarCheckStatus==2&&vuex_userInfo.newPhotoPath" style="color: red;">审核失败</view>
</view>
<view class="editBtn" v-if="vuex_userInfo.avatarCheckStatus!=0">修改头像</view>
</view>
<view class="editBtn">修改头像</view>
</view> -->
<view class="card">
<view class="row">
@ -73,25 +73,40 @@
</template>
<script>
import { logOut,deleteTest } from '@/config/api.js'
import { logOut,deleteTest, avatarApply } from '@/config/api.js'
import { uploadImgApi } from '@/config/utils.js'
export default {
data() {
return {
avatarLink: '',
avatarBase64: ''
photoPath: ''
}
},
onLoad() {
uni.$on('uAvatarCropper', (res)=>{
this.avatarLink = res
this.$store.dispatch('getUserInfo')
uni.$on('uAvatarCropper', async (res)=>{
const photoPath = await uploadImgApi(res, 'face')
this.photoPath = photoPath
this.avatarApplyFn()
})
},
onShow() {
if(uni.getStorageSync('avatarBase64')) this.avatarBase64 = uni.getStorageSync('avatarBase64')
},
methods: {
//
async avatarApplyFn() {
const res = await avatarApply({avatarImg: this.photoPath})
if(res.code==0) {
this.$u.toast('申请成功,等待审核')
}
this.$store.dispatch('getUserInfo')
console.log('申请成功')
console.log(res)
},
//
editAvatar() {
if(this.vuex_userInfo.avatarCheckStatus==0) return false
this.uploadTapFn()
},
uploadTapFn() {
@ -104,8 +119,11 @@
let url = res.tempFilePaths[0];
// datasrc
console.log('跳转到哪了?')
// uni.navigateTo({
// url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url)
// })
uni.navigateTo({
url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url)
url: '/pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper?url=' + encodeURIComponent(url)
})
}
});
@ -194,12 +212,11 @@
right: 0;
top: 0;
bottom: 0;
background: rgba(0,0,0,1);
// background-color: rgba(0,0,0,0.4);
// background: rgba(0,0,0,1);
background-color: rgba(0,0,0,0.4);
font-size: 24rpx;
// color: rgba(255,255,255,0.8);
color: #fff;
opacity: 0.4;
color: rgba(255,255,255,0.8);
// opacity: 0.4;
line-height: 104rpx;
text-align: center;
}

8
pages/tabbar/index/index.vue

@ -5,9 +5,9 @@
<!-- 地址 -->
<view class="adrsCon">
<view class="adr" v-if="vuex_cityInfo.city">{{ vuex_cityInfo.city }} </view>
<view class="adr" v-else @click="getLatLngFn" style="display: flex;align-items: center;">
<!-- <view class="adr" v-else @click="getLatLngFn" style="display: flex;align-items: center;">
<text>获取定位信息</text> <image src="@/static/images/icon/down.png" mode="" style="width: 18rpx;height: 18rpx;margin-left: 6rpx;"></image>
</view>
</view> -->
<!-- <view class="adrsIcon">
<image src="@/static/images/icon/down.png" mode=""></image>
</view> -->
@ -136,7 +136,7 @@
import informaItem from './comp/informaItem'
import coachItem from './comp/coachItem'
import { scanCodeFn } from '@/config/utils.js'
import location from '@/common/js/location.js'
// import location from '@/common/js/location.js'
export default {
components: { schoolItem, informaItem, coachItem },
data() {
@ -490,6 +490,8 @@
width: 100%;
height: 300rpx;
display: block;
border-radius: 20rpx;
overflow: hidden;
}
}
}

2
pages/userCenter/login/login.vue

@ -5,7 +5,7 @@
<u-icon name="arrow-left" color="#333" size="28"></u-icon>
</view>
</view> -->
<u-navbar title=" " :bgColor="bgColor" :autoBack="true" :leftIcon="autoBack"></u-navbar>
<u-navbar title=" " :bgColor="bgColor" :autoBack="true" ></u-navbar>
<view class="title">短信验证码登录</view>
<view class="form">
<view class="form-item">

52
store/modules/user.js

@ -1,6 +1,6 @@
import { httpPrefix } from '../../config/site.config.js';
// #ifdef APP-PLUS
import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
// import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
// #endif
let apiOk =true
@ -169,9 +169,10 @@ function gaoDeFn(longitude,latitude,commit,resolve, reject,) {
function getCityInfo(resolve, reject, commit) {
// import { requestSingleFreshLocation } from '@/common/js/qqLatLng.js'
let qqLatLng = require('@/common/js/qqLatLng.js')
try{
requestSingleFreshLocation().then(res=>{
qqLatLng.requestSingleFreshLocation().then(res=>{
let result = res.location
if(result.latitude===0) {
console.log('gogogo来了吗没有获取到经纬度?')
@ -226,48 +227,3 @@ function getCityInfo(resolve, reject, commit) {
}
}
function openGps(){
plus.android.requestPermissions(
['android.permission.ACCESS_FINE_LOCATION'],
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
if (result != 1) {
//如果用户第一次拒绝后,跳转到**应用**的权限页面
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
},
function(error) {
console.log('申请权限错误:' + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
}
Loading…
Cancel
Save