头像采集

main
zhangqun 3 years ago
parent d5b0dcf56d
commit ad221d318c
  1. 20
      src/api/hospital.js
  2. 2
      src/main.js
  3. 2
      src/utils/aisdapp.js
  4. 191
      src/views/Guidance.vue
  5. 2
      src/views/HomeView.vue
  6. 4
      vue.config.js

@ -53,7 +53,25 @@ export const recordCancel = (id) => {
//系统时间 //系统时间
export const getSystemTime = () => { export const getSystemTime = () => {
return request({ return request({
url: '/api//blade-business/common-api/get-system-datetime', url: '/api/blade-business/common-api/get-system-datetime',
method: 'get' method: 'get'
}) })
}; };
//获取预约用户头像
export const getCupImg = (cupCardNo) => {
return request({
url: '/api/blade-business/common-api/get-cup-img',
method: 'get',
params: {
cupCardNo,
}
})
};
//存储用户头像
export const saveCupImg = (data) => {
return request({
url: '/api/blade-business/common-api/save-cup-img',
method: 'post',
data,
})
};

@ -9,7 +9,7 @@ import GlobalConfig from "./utils/aisdapp";
import { Base64 } from "js-base64"; import { Base64 } from "js-base64";
import VConsole from "vconsole"; import VConsole from "vconsole";
// let vConsole = new VConsole(); let vConsole = new VConsole();
Vue.use(vant); Vue.use(vant);

@ -5,7 +5,7 @@ export const appword = "aKd20dbGdFvmuwrt"
const appid = 'cgstjyyxuwxt'; const appid = 'cgstjyyxuwxt';
const appMode = true;//是否开启爱山东中控台接口调用方式 const appMode = false;//是否开启爱山东中控台接口调用方式
export default { export default {
appid, appid,

@ -6,11 +6,23 @@
<div class="guide_actBtn" @click="doCancel">取消</div> <div class="guide_actBtn" @click="doCancel">取消</div>
<div class="guide_actBtn blue" @click="doRead">已阅读</div> <div class="guide_actBtn blue" @click="doRead">已阅读</div>
</div> </div>
<!-- 采集头像弹框 -->
<van-overlay :show="isShowAvatar">
<div class="wrapper" @click.stop>
<div class="img_box">
<img :src="avatar" alt="">
</div>
<div class="tips">头像采集</div>
<div class="tip_txt">上传近期半身本人照片</div>
<div class="btn" @click="chooseAvatar">上传照片</div>
</div>
<div class="close_box" @click="isShowAvatar = false"><img src="~@/assets/image/close.png" alt=""></div>
</van-overlay>
</div> </div>
</template> </template>
<script> <script>
import { queryArticleDetail } from "@/api/hospital"; import { queryArticleDetail, getCupImg, saveCupImg } from "@/api/hospital";
export default { export default {
data() { data() {
return { return {
@ -19,14 +31,120 @@ export default {
title: '', title: '',
content: '' content: ''
},// },//
isShowAvatar: false,//
avatar: '',//
userInfo: null,//
} }
}, },
mounted() { mounted() {
if (this.$route.query.deptId) { if (this.$route.query.deptId) {
this.queryAticle(this.$route.query.deptId); this.queryAticle(this.$route.query.deptId);
} }
let userInfo = sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')) : null;
if (userInfo) {
this.userInfo = userInfo;
this.queryCupImg();//
}
}, },
methods: { methods: {
//
queryCupImg() {
this.$toast.loading({
message: '加载中',
duration: 0,
})
if (this.GlobalConfig.appMode) {
vaildInterfacefn("cgstjyyxuwxt", "qdsgajjtjczdhqwzxq", JSON.stringify({ cupCardNo: this.Base64.encode(this.userInfo.papersnumber) }), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway).then((value) => {
this.$toast.clear();
let retData = JSON.parse(value);
if (retData.code == 200) {
this.avatar = retData.data;
}
}, err => {
this.$toast.clear();
})
} else {
getCupImg(this.Base64.encode(this.userInfo.papersnumber)).then(res => {
this.$toast.clear();
if (res.code == 200) {
this.avatar = res.data;
}
}, err => {
this.$toast.clear();
})
}
},
//
chooseAvatar() {
lightAppJssdk.media.chooseImage({
arg: '200',
type: '1',
success: (data) => {
//
if (data.picPath.length > 1) {
this.$toast('头像只能选择一张');
}
else {
// if (this.calcBaseSze(data.picPath[0]) > 1024) {
// } else {
// this.avatar = 'data:image/jpg;base64,' + data.picPath[0];
// }
//
let avatar = 'data:image/jpg;base64,' + data.picPath[0];
this.saveCupImg(avatar);
}
},
fail: (data) => {
//
}
});
},
//
saveCupImg(avatar) {
let param = { data: { cupCardNo: this.Base64.encode(this.userInfo.papersnumber), cupImg: avatar } };
this.$toast.loading({
message: '请求中',
duration: 0,
})
try {
if (this.GlobalConfig.appMode) {
vaildInterfacefn("cgstjyyxuwxt", "qdsgajjtjczdhqwzxq", JSON.stringify(param), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway).then((value) => {
this.$toast.clear();
let retData = JSON.parse(value);
if (retData.code == 200) {
this.$toast('采集成功');
this.avatar = avatar;
} else {
this.$toast(retData.msg);
}
}, err => {
this.$toast.clear();
})
}
else {
saveCupImg(JSON.stringify(param)).then(res => {
this.$toast.clear();
if (res.code == 200) {
this.$toast('采集成功');
this.avatar = avatar;
} else {
this.$toast(res.msg);
}
}, err => {
this.$toast.clear();
})
}
} catch (error) {
this.$toast.clear();
}
},
//base64
calcBaseSze(base64) {
const kb = Math.ceil(parseInt(base64.length - (base64.length / 8) * 2) / 1024);
console.log('chooseimage', base64.length / 1024, kb);
return kb;
},
// //
queryAticle(id) { queryAticle(id) {
this.$toast.loading({ this.$toast.loading({
@ -67,7 +185,12 @@ export default {
}, },
// //
doRead() { doRead() {
//
if (this.avatar == '') {
this.isShowAvatar = true;
} else {
this.$router.replace({ name: 'examination', query: { id: this.$route.query.deptId } }); this.$router.replace({ name: 'examination', query: { id: this.$route.query.deptId } });
}
// let readBox = this.$refs.scrollView; // let readBox = this.$refs.scrollView;
// console.log(readBox.scrollHeight, parseInt(readBox.scrollTop), readBox.clientHeight) // console.log(readBox.scrollHeight, parseInt(readBox.scrollTop), readBox.clientHeight)
// if (readBox.scrollHeight - parseInt(readBox.scrollTop) !== readBox.clientHeight) { // if (readBox.scrollHeight - parseInt(readBox.scrollTop) !== readBox.clientHeight) {
@ -166,5 +289,71 @@ export default {
} }
} }
} }
.wrapper {
width: 5.98rem;
height: 6.66rem;
background: #FFFFFF;
border-radius: 0.16rem;
margin: 0 auto;
margin-top: 2.76rem;
.img_box {
display: flex;
justify-content: center;
img {
width: 2.4rem;
height: 2.4rem;
margin-top: 0.6rem;
}
}
.tips {
display: flex;
justify-content: center;
font-size: 0.34rem;
color: #000;
font-weight: bold;
margin: 0.56rem 0 0.2rem 0;
font-family: PingFang SC-Regular, PingFang SC;
}
.tip_txt {
width: 3.8rem;
color: #666;
font-size: 0.24rem;
text-align: center;
font-family: PingFang SC-Regular, PingFang SC;
margin: 0 auto;
}
.btn {
width: 3rem;
height: 0.8rem;
background: #1677FF;
border-radius: 0.08rem;
margin: 0 auto;
margin-top: 0.6rem;
font-size: 0.3rem;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-family: PingFang SC-Regular, PingFang SC;
}
}
.close_box {
display: flex;
justify-content: center;
margin-top: 0.6rem;
img {
width: 0.5rem;
height: 0.5rem;
}
}
} }
</style> </style>

@ -15,7 +15,7 @@
</div> </div>
<!-- 黑名单等错误提示 --> <!-- 黑名单等错误提示 -->
<van-overlay :show="isShowError"> <van-overlay :show="isShowError">
<div class="wrapper" @click.sto> <div class="wrapper" @click.stop>
<div class="img_box"> <div class="img_box">
<img src="~@/assets/image/fail_tip.png" alt=""> <img src="~@/assets/image/fail_tip.png" alt="">
</div> </div>

@ -9,8 +9,8 @@ module.exports = defineConfig({
proxy: { proxy: {
"/api": { "/api": {
//本地服务接口地址 //本地服务接口地址
target: "http://192.168.1.3:8080", // target: "http://192.168.1.3:8080",
// target: "http://192.168.1.106", target: "http://192.168.1.106",
//远程演示服务地址,可用于直接启动项目 //远程演示服务地址,可用于直接启动项目
// target: 'https://saber.bladex.vip/api', // target: 'https://saber.bladex.vip/api',
ws: true, ws: true,

Loading…
Cancel
Save