作者 dl

修改接口地址

var baseurl = 'http://kindapp.w.bronet.cn/api/';//测试地址
var imgurl = 'http://kindapp.w.bronet.cn/'
// var baseurl = 'http://kindapp.w.bronet.cn/api/';//测试地址
var baseurl='http://wx.cijievip.com/api/' //正式地址
var imgurl = 'http://kindapp.w.bronet.cn/';
var debug=true;
// var baseurl = 'http://192.168.1.3/api/';//本地测试
var mobileReg = /^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\d{8}$/; //手机正则
var id_card = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;//身份证正则
... ...
... ... @@ -132,34 +132,34 @@
</div>
</div>
<div class="photo_re">(选填)</div>
<mt-popup v-model="popupVisible" position="bottom">
<ul class="moreoul">
<li @click="auth1('camera')">拍照</li>
<li @click="auth1('album')">从相册中选择</li>
<li @click="popupVisible=false" style="border-top: 2px solid #f0f0f0">取消</li>
</ul>
</mt-popup>
<mt-popup v-model="popupVisible1" position="bottom">
<ul class="moreoul">
<li @click="auth2('camera')">拍照</li>
<li @click="auth2('album')">从相册中选择</li>
<li @click="popupVisible1=false" style="border-top: 2px solid #f0f0f0">取消</li>
</ul>
</mt-popup>
<mt-popup v-model="popupVisible2" position="bottom">
<ul class="moreoul">
<li @click="auth3('camera')">拍照</li>
<li @click="auth3('album')">从相册中选择</li>
<li @click="popupVisible2=false" style="border-top: 2px solid #f0f0f0">取消</li>
</ul>
</mt-popup>
<mt-popup v-model="popupVisible3" position="bottom">
<ul class="moreoul">
<li @click="auth4('camera')">拍照</li>
<li @click="auth4('album')">从相册中选择</li>
<li @click="popupVisible2=false" style="border-top: 2px solid #f0f0f0">取消</li>
</ul>
</mt-popup>
<!--<mt-popup v-model="popupVisible" position="bottom">-->
<!--<ul class="moreoul">-->
<!--<li @click="auth1('camera')">拍照</li>-->
<!--<li @click="auth1('album')">从相册中选择</li>-->
<!--<li @click="popupVisible=false" style="border-top: 2px solid #f0f0f0">取消</li>-->
<!--</ul>-->
<!--</mt-popup>-->
<!--<mt-popup v-model="popupVisible1" position="bottom">-->
<!--<ul class="moreoul">-->
<!--<li @click="auth2('camera')">拍照</li>-->
<!--<li @click="auth2('album')">从相册中选择</li>-->
<!--<li @click="popupVisible1=false" style="border-top: 2px solid #f0f0f0">取消</li>-->
<!--</ul>-->
<!--</mt-popup>-->
<!--<mt-popup v-model="popupVisible2" position="bottom">-->
<!--<ul class="moreoul">-->
<!--<li @click="auth3('camera')">拍照</li>-->
<!--<li @click="auth3('album')">从相册中选择</li>-->
<!--<li @click="popupVisible2=false" style="border-top: 2px solid #f0f0f0">取消</li>-->
<!--</ul>-->
<!--</mt-popup>-->
<!--<mt-popup v-model="popupVisible3" position="bottom">-->
<!--<ul class="moreoul">-->
<!--<li @click="auth4('camera')">拍照</li>-->
<!--<li @click="auth4('album')">从相册中选择</li>-->
<!--<li @click="popupVisible2=false" style="border-top: 2px solid #f0f0f0">取消</li>-->
<!--</ul>-->
<!--</mt-popup>-->
<div class="save_btn" @click="auth_next">提交</div>
<div class="auth2_tips">为提高审核速度,请最少上传1张清晰的图片</div>
</div>
... ... @@ -176,6 +176,7 @@
</script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script>
var app = new Vue({
el: "#app",
... ... @@ -188,186 +189,82 @@
popupVisible1: false,
popupVisible2: false,
popupVisible3: false,
configinfo: []
},
created: function () {
apiready = function () {
app.getsdk();
if ($api.getStorage('img1') || ($api.getStorage('img2')) || ($api.getStorage('img3')) || ($api.getStorage('img4'))) {
app.img1 = $api.getStorage('img1');
app.img2 = $api.getStorage('img2');
app.img3 = $api.getStorage('img3');
app.img4 = $api.getStorage('img4')
}
}
},
methods: {
// 获取微信配置
getsdk: function () {
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken(),
};
var post = {
apis: 'chooseImage,uploadImage'
};
getRequest('post', 'user/index/getSingture', post, header).then(function (res) {
// alert(JSON.stringify(res))
if (res.data.code == 1) {
app.configinfo = res.data.data;
wx.config({
debug: debug, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: app.configinfo.appId, // 必填,公众号的唯一标识
timestamp: app.configinfo.timestamp, // 必填,生成签名的时间戳
nonceStr: app.configinfo.nonceStr, // 必填,生成签名的随机串
signature: app.configinfo.signature,// 必填,签名,见附录1
jsApiList: app.configinfo.jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
}
loadEnd()
})
},
//诊断证明/医疗处置单
auth1: function (type) {
app.popupVisible = false;
api.getPicture({
sourceType: type,
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
quality: 50,
targetWidth: 300,
targetHeight: 400,
saveToPhotoAlbum: true
}, function (ret, err) {
if (ret && ret.data && ret.data !== "") {
api.ajax({
url: baseurl + 'portal/Goods/uploadProve',
method: 'post',
data: {
values: {
type_id: 1
},
files: {
file: ret.data
}
},
headers: {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
}
}, function (res, erro) {
// alert(JSON.stringify(res));
if (res.code == 1) {
toastMsg(res.msg)
app.img1 = res.data.url;
$api.setStorage('img1', res.data.url);
} else {
toastMsg(res.data.msg)
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
wx.uploadImage({
localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
var serverId = res.serverId; // 返回图片的服务器端ID
app.img1=serverId
}
});
}
});
},
// 药品处方
auth2: function (type) {
app.popupVisible1 = false;
api.getPicture({
sourceType: type,
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
quality: 50,
targetWidth: 300,
targetHeight: 400,
saveToPhotoAlbum: true
}, function (ret, err) {
if (ret && ret.data && ret.data !== "") {
api.ajax({
url: baseurl + 'portal/Goods/uploadProve',
method: 'post',
data: {
values: {
type_id: 2
},
files: {
file: ret.data
}
},
headers: {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
}
}, function (res, erro) {
if (res.code == 1) {
toastMsg(res.msg)
app.img2 = res.data.url;
$api.setStorage('img2', res.data.url);
} else {
toastMsg({msg: JSON.stringify(erro)});
}
});
}
});
},
// 药品照片
auth3: function (type) {
app.popupVisible2 = false;
api.getPicture({
sourceType: type,
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
quality: 50,
targetWidth: 300,
targetHeight: 400,
saveToPhotoAlbum: true
}, function (ret, err) {
if (ret && ret.data && ret.data !== "") {
api.ajax({
url: baseurl + 'portal/Goods/uploadProve',
method: 'post',
data: {
values: {
type_id: 3
},
files: {
file: ret.data
}
},
headers: {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
}
}, function (res, erro) {
if (res.code == 1) {
toastMsg(res.msg)
app.img3 = res.data.url;
$api.setStorage('img3', res.data.url);
} else {
toastMsg({msg: JSON.stringify(erro)});
}
});
}
});
},
// 病例
auth4: function (type) {
app.popupVisible3 = false;
api.getPicture({
sourceType: type,
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
quality: 50,
targetWidth: 300,
targetHeight: 400,
saveToPhotoAlbum: true
}, function (ret, err) {
if (ret && ret.data && ret.data !== "") {
api.ajax({
url: baseurl + 'portal/Goods/uploadProve',
method: 'post',
data: {
values: {
type_id: 4
},
files: {
file: ret.data
}
},
headers: {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
}
}, function (res, erro) {
if (res.code == 1) {
toastMsg(res.msg)
app.img4 = res.data.url;
$api.setStorage('img4', res.data.url);
} else {
toastMsg({msg: JSON.stringify(erro)});
}
});
}
});
},
auth_next: function () {
if (app.img1 == '') {
... ...