Commit 05b02f17 authored by gengchunlei's avatar gengchunlei

修改

parent e5752a6e
NODE_ENV=dev NODE_ENV=dev
VUE_APP_PATH=http://123.56.183.13:8889 VUE_APP_BASE_URL=http://123.56.183.13:8889/
NODE_ENV=prod NODE_ENV=prod
VUE_APP_PATH=https://ynfymds-service.yiboshi.com VUE_APP_PATH=https://ynfymds-service.yiboshi.com
VUE_APP_BASE_URL = http://123.56.183.13:8889/
...@@ -24,7 +24,7 @@ const routes = [ ...@@ -24,7 +24,7 @@ const routes = [
] ]
const router = new VueRouter({ const router = new VueRouter({
mode: 'hash', mode: 'history',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes
}) })
......
import axios from 'axios'; import axios from 'axios';
var apiInstance=axios.create({ var apiInstance=axios.create({
baseURL:'', baseURL: process.env.VUE_APP_BASE_URL,
timeout:10000, timeout:10000,
withCredentials:true withCredentials:true
}) })
...@@ -9,7 +9,8 @@ var apiInstance=axios.create({ ...@@ -9,7 +9,8 @@ var apiInstance=axios.create({
/*为请求添加请求头中的token*/ /*为请求添加请求头中的token*/
apiInstance.interceptors.request.use(config=>{ apiInstance.interceptors.request.use(config=>{
if(sessionStorage.token){ if(sessionStorage.token){
config.headers.Authorization="bearer "+sessionStorage.getItem('token'); /*sessionStorage.getItem('tokenMobile')*/
config.headers.Authorization= '';
if(typeof(config.params) == "undefined"){ if(typeof(config.params) == "undefined"){
config.params={} config.params={}
} }
...@@ -21,30 +22,30 @@ apiInstance.interceptors.request.use(config=>{ ...@@ -21,30 +22,30 @@ apiInstance.interceptors.request.use(config=>{
}) })
/*获取网点*/ /*获取网点*/
export const getNetworkInfo = params =>{ export const getNetworkInfo = params =>{
return apiInstance.get(`/api/basic-info/v1/basic-info/basic-network-info/get-network-info`,{params}); return apiInstance.get(`/basic-info/v1/basic-info/basic-network-info/get-network-info`,{params});
}; };
//获取用领取记录 //获取用领取记录
export const getUserCollectRecord = params => { export const getUserCollectRecord = params => {
return apiInstance.get(`/api/stock-info/v1/stock-info/stock-provide-record`, {params}) return apiInstance.get(`/stock-info/v1/stock-info/stock-provide-record`, {params})
} }
//获取库存信息 //获取库存信息
export const getStockInfo = params => { export const getStockInfo = params => {
return apiInstance.get(`/api/stock-info/v1/stock-info/stock-basic-info/basic-info`, {params}) return apiInstance.get(`/stock-info/v1/stock-info/stock-basic-info/basic-info`, {params})
} }
//用户领取次数 //用户领取次数
export const getUserReceiveNum = params => { export const getUserReceiveNum = params => {
return apiInstance.get(`/api/stock-info/v1/stock-info/stock-provide-record/number/${params.residentId}`, {params}) return apiInstance.get(`/stock-info/v1/stock-info/stock-provide-record/number/${params.residentId}`, {params})
} }
//填写随访记录 //填写随访记录
export const addVisitRecord = params => { export const addVisitRecord = params => {
return apiInstance.post(`/api/stock-info/v1/stock-info/stock-visit-info`, params) return apiInstance.post(`/stock-info/v1/stock-info/stock-visit-info`, params)
} }
//确认领取药具 //确认领取药具
export const getMedical = params => { export const getMedical = params => {
return apiInstance.post(`/api/stock-info/v1/stock-info/stock-provide-record`, params) return apiInstance.post(`/stock-info/v1/stock-info/stock-provide-record`, params)
} }
//获取url参数
export function getQueryVariable(variable) {
let url = window.location.href
let i = url.indexOf('?')
let queryStr = url.substr(i+1)
let vars = queryStr.split("&");
for (let i=0;i<vars.length;i++) {
let pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return '';
}
// 判断 // 判断ios还是安卓
export function isIOSWebKit() { export function isIOSWebKit() {
const aa = window.navigator.userAgent; const aa = window.navigator.userAgent;
if (aa.indexOf('client-iOS') !== -1){// ios端 if (aa.indexOf('client-iOS') !== -1) {// ios端
return true; return true;
}else if(aa.indexOf('Android') !== -1 || aa.indexOf('Adr') !== -1){// 安卓端 } else if (aa.indexOf('Android') !== -1 || aa.indexOf('Adr') !== -1) {// 安卓端
return false; return false;
} }
} }
//当前方法传参数两种 字符串或者map //当前方法传参数两种 字符串或者map
export function callMobile(handlerInterface,parameters){ export function callMobile(handlerInterface, parameters) {
let classStr = Object.prototype.toString.call(parameters); let classStr = Object.prototype.toString.call(parameters);
if(classStr === '[object String]' || classStr === '[object Object]'){ if (classStr === '[object String]' || classStr === '[object Object]') {
let param = parameters; let param = parameters;
if(classStr === "[object Object]"){ //判断传参是str ,还是object if (classStr === "[object Object]") { //判断传参是str ,还是object
//handlerInterface由iOS addScriptMessageHandler与andorid addJavascriptInterface 代码注入而来。 //handlerInterface由iOS addScriptMessageHandler与andorid addJavascriptInterface 代码注入而来。
param = JSON.stringify(parameters);//参数必须转化成json格式 param = JSON.stringify(parameters);//参数必须转化成json格式
} }
try { try {
if (isIOSWebKit()){//ios if (isIOSWebKit()) {//ios
if(window.webkit!==undefined){ if (window.webkit !== undefined) {
window.webkit.messageHandlers[handlerInterface].postMessage(param); window.webkit.messageHandlers[handlerInterface].postMessage(param);
} }
}else if(isIOSWebKit() === false){ } else if (isIOSWebKit() === false) {
//安卓传输不了js json对象,只能传输string //安卓传输不了js json对象,只能传输string
window.ecloud[handlerInterface](param); if (param == '{}') {
window.H5page[handlerInterface]();
} else {
window.H5page[handlerInterface](param);
}
} }
}catch (e) { } catch (e) {
} }
} }
......
...@@ -54,11 +54,13 @@ ...@@ -54,11 +54,13 @@
<script> <script>
import {getMedical, getStockInfo} from "../utils/api"; import {getMedical, getStockInfo} from "../utils/api";
import {callMobile} from "../utils/common";
export default { export default {
name: "choiceContraceptives", name: "choiceContraceptives",
data(){ data(){
return{ return{
routerDetail:{},
loading: false, loading: false,
checkedMedical:'', checkedMedical:'',
detailInfo: [], detailInfo: [],
...@@ -72,6 +74,12 @@ ...@@ -72,6 +74,12 @@
}, },
methods:{ methods:{
getStockListInfo(callBack) { getStockListInfo(callBack) {
this.routerDetail = JSON.parse(this.$route.query.info)
Toast({
message: '测试'+ this.routerDetail,
position: 'bottom',
duration: 5000
});
let par = { let par = {
relationId: 4, relationId: 4,
...this.param ...this.param
...@@ -100,8 +108,8 @@ ...@@ -100,8 +108,8 @@
this.getStockListInfo() this.getStockListInfo()
}, },
backHome(){ backHome(){
this.$router.push("/"); callMobile("goIndex", {});
}, },
receiveContraceptives(){ receiveContraceptives(){
let pars = JSON.parse(this.checkedMedical) let pars = JSON.parse(this.checkedMedical)
let par = { let par = {
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<script> <script>
import {getUserCollectRecord} from '../utils/api'; import {getUserCollectRecord} from '../utils/api';
import NoData from "./component/noData"; import NoData from "./component/noData";
import { Toast } from 'mint-ui';
export default { export default {
name: "collectRecords", name: "collectRecords",
...@@ -86,6 +87,12 @@ ...@@ -86,6 +87,12 @@
this.loading = false this.loading = false
} }
callBack && callBack() callBack && callBack()
}).catch(res => {
Toast({
message: res,
position: 'top',
duration: 2000
});
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
}) })
......
...@@ -13,11 +13,13 @@ ...@@ -13,11 +13,13 @@
</template> </template>
<script> <script>
import {callMobile} from "../../utils/common";
export default { export default {
name: "noData", name: "noData",
methods: { methods: {
backHome(){ backHome(){
this.$router.push("/"); callMobile("goIndex", {});
}, },
} }
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<label>人工网点</label> <label>人工网点</label>
</div> </div>
<div class="item"> <div class="item">
<div class="img"> <div class="img" @click="toRealHome">
<img src="../assets/img/homePage.png"/> <img src="../assets/img/homePage.png"/>
</div> </div>
<label>返回首页</label> <label>返回首页</label>
...@@ -41,12 +41,13 @@ ...@@ -41,12 +41,13 @@
import sharpImg from '../assets/img/sharp.png'; import sharpImg from '../assets/img/sharp.png';
import { MessageBox } from 'mint-ui'; import { MessageBox } from 'mint-ui';
import {getNetworkInfo, getUserReceiveNum} from '../utils/api'; import {getNetworkInfo, getUserReceiveNum} from '../utils/api';
import {callMobile} from "../utils/common"; import {callMobile, getQueryVariable} from "../utils/common";
import { Toast } from 'mint-ui'; import { Toast } from 'mint-ui';
export default { export default {
name: "myMap", name: "myMap",
data() { data() {
return { return {
recordNum: 0,
jumpHref: {}, jumpHref: {},
lngLat: [], lngLat: [],
showMap: false, showMap: false,
...@@ -54,6 +55,7 @@ ...@@ -54,6 +55,7 @@
} }
}, },
created() { created() {
this.urltext()
}, },
mounted() { mounted() {
this.createMap(); this.createMap();
...@@ -64,36 +66,45 @@ ...@@ -64,36 +66,45 @@
document.removeEventListener("qrcodeContent",this.subscanQRCallBack); document.removeEventListener("qrcodeContent",this.subscanQRCallBack);
}, },
methods: { methods: {
// 接收url后的数据
urltext() {
let mobileToken = getQueryVariable('token')
let userId = getQueryVariable('userId')
let mobilePhone= getQueryVariable('mobile')
let mobileTokenIno = {
token: mobileToken,
userId: userId,
phone: mobilePhone
}
window.sessionStorage.setItem('mobileTokenIno', JSON.stringify(mobileTokenIno))
},
ScanCode() { ScanCode() {
let pars = { callMobile("qrcode", {});
'callback': 'qrcodeContent', },
} async subscanQRCallBack(result){
// window.android.qrcode()
callMobile("qrcode", pars);
/*先判断是否有没有回访的领取记录*/ /*先判断是否有没有回访的领取记录*/
let par = {residentId: 1} let par = {residentId: 1}//居民id
getUserReceiveNum(par).then(({data}) => { await getUserReceiveNum(par).then(({data}) => {
if (data.data < 0) { this.recordNum = data.data
this.$router.push('/returnVisit');
} else {
this.$router.push('/choiceContraceptives');
// this.$router.push('/returnVisit');
/*打开摄像头扫码*/
/*扫描成功拿到发货机id跳转到选择药具页面*/
/*扫描失败弹出提示信息*/
}
}) })
}, Toast({
subscanQRCallBack(result){ message: 'ceshi'+this.recordNum,
alert('扫码结果:'+result); position: 'top',
Toast({ duration: 100000
message: '测试'+result, });
position: 'bottom', if (this.recordNum = 0) {
duration: 5000 this.$router.push({path: `/choiceContraceptives`,query:{info:result}});
}); } else {
this.$router.push({path: `/returnVisit`,query:{info:result}});
}
}, },
toCollectRecords() { toCollectRecords() {
this.$router.push('/collectRecords'); this.$router.push({path: `/returnVisit`,query:{info:4}});
// this.$router.push('/collectRecords');
},
toRealHome() {
callMobile("goIndex", {});
}, },
createMap() { createMap() {
let geolocation = location.initMap("map-container"); //定位 let geolocation = location.initMap("map-container"); //定位
......
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
</template> </template>
<script> <script>
import {callMobile} from "../utils/common";
export default { export default {
name: "receiveSuccess", name: "receiveSuccess",
methods:{ methods:{
backHome(){ backHome(){
this.$router.push("/"); callMobile("goIndex", {});
} }
} }
} }
...@@ -51,4 +53,4 @@ ...@@ -51,4 +53,4 @@
border-radius: 22px; border-radius: 22px;
box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.1);
} }
</style> </style>
\ No newline at end of file
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
import {getStockInfo} from "../utils/api"; import {getStockInfo} from "../utils/api";
import NoData from "./component/noData"; import NoData from "./component/noData";
import { MessageBox } from 'mint-ui';
export default { export default {
name: "siteDetails", name: "siteDetails",
...@@ -113,7 +114,35 @@ ...@@ -113,7 +114,35 @@
}) })
}, },
clickAddress() { clickAddress() {
console.log(123); let info = this.siteDetail
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isAndroid) {
//这个是安卓操作系统
window.location.href="androidamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0";
//判断是否切出浏览器
setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航')
}
}, 2500);
}
if (isIOS) {
//这个是ios操作系统
window.location.href="iosamap://viewMap?sourceApplication=appname&poiname="+info.netName+"&lat="+info.netLatitude+"&lon="+info.netLongitude+"&dev=0"
//判断是否切出浏览器
setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
if(typeof hidden =="undefined" || hidden ==false){
//应用宝下载地址
MessageBox('提示', '请下载高德地图进行导航')
}
}, 2500);
}
/*this.$router.push({path: '/navigation', query: {Lng: Lng, Lat: Lat}})*/
}, },
clickPhone() { clickPhone() {
console.log(456); console.log(456);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment