|
|
|
@ -26,15 +26,16 @@ |
|
|
|
|
<view class="mb_desc">分享可解锁新面部档案</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="mright"> |
|
|
|
|
<view class="mbItem" @click="goTo('/pages/user/archives/detail')"> |
|
|
|
|
<image src="/static/img/user/have.png" mode="widthFix"></image> |
|
|
|
|
<view class="mbItem" v-for="(item,index) in portraitList" :key="index"> |
|
|
|
|
<image v-if="item.can == true" :src="item.image" mode="widthFix" @click="goTo('/pages/user/archives/detail?id='+item.id)"></image> |
|
|
|
|
<image v-if="item.can == false" :src="item.image" mode="widthFix"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="mbItem"> |
|
|
|
|
<!-- <view class="mbItem"> |
|
|
|
|
<image src="/static/img/user/have_no.png" mode="widthFix"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="mbItem"> |
|
|
|
|
<image src="/static/img/user/have_no.png" mode="widthFix"></image> |
|
|
|
|
</view> |
|
|
|
|
</view> --> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -173,16 +174,18 @@ export default { |
|
|
|
|
}, |
|
|
|
|
tabList: [ |
|
|
|
|
{ |
|
|
|
|
name: 'AI写真', |
|
|
|
|
}, { |
|
|
|
|
name: '证件照合成', |
|
|
|
|
}, { |
|
|
|
|
name: '证件照换色' |
|
|
|
|
name: '证件照换色', |
|
|
|
|
}, { |
|
|
|
|
name: 'AI写真' |
|
|
|
|
}, { |
|
|
|
|
name: '卡通风格' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
current:0, |
|
|
|
|
current:0, |
|
|
|
|
//档案 |
|
|
|
|
portraitList:[], |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
@ -202,7 +205,8 @@ export default { |
|
|
|
|
onShow() { |
|
|
|
|
var _this =this; |
|
|
|
|
_this.getUserInfo(); |
|
|
|
|
|
|
|
|
|
//面部档案 |
|
|
|
|
_this.getPortraitList(); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
onShareAppMessage() { |
|
|
|
@ -231,7 +235,7 @@ export default { |
|
|
|
|
var _this =this; |
|
|
|
|
var post ={}; |
|
|
|
|
_this.$api.get('api/userInfo',post,function(rs){ |
|
|
|
|
console.log('用户信息',rs); |
|
|
|
|
//console.log('用户信息',rs); |
|
|
|
|
var oldToken = _this.$user.session('token'); |
|
|
|
|
//先缓存 |
|
|
|
|
_this.$user.session('userInfo',rs); |
|
|
|
@ -279,118 +283,38 @@ export default { |
|
|
|
|
console.log(e); |
|
|
|
|
_this.current = e.index; |
|
|
|
|
}, |
|
|
|
|
tools(item) |
|
|
|
|
{ |
|
|
|
|
//档案 |
|
|
|
|
getPortraitList(){ |
|
|
|
|
var _this =this; |
|
|
|
|
if(item.type == 'service') |
|
|
|
|
{ |
|
|
|
|
var phone = _this.$user.session('servicePhone'); |
|
|
|
|
uni.makePhoneCall({ |
|
|
|
|
phoneNumber: phone, |
|
|
|
|
success(res) { |
|
|
|
|
console.log(res); |
|
|
|
|
}, |
|
|
|
|
fail(err) { |
|
|
|
|
console.log(err); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
var config = _this.$user.session('app_config'); |
|
|
|
|
var all = config.photo.photo_model_number; //系统总数 |
|
|
|
|
var user = _this.$user.session('userInfo'); |
|
|
|
|
var can_num = user.attach.user_face.available_number; //可使用数量 |
|
|
|
|
var use_num = user.attach.user_face.used_already_number;//已使用数量 |
|
|
|
|
var baseList = []; |
|
|
|
|
for (var i=1; i<= all; i++) |
|
|
|
|
{ |
|
|
|
|
uni.$u.route({ |
|
|
|
|
type:'navigateTo', |
|
|
|
|
url: item.url, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//打开视频 |
|
|
|
|
openVideo(){ |
|
|
|
|
var _this =this; |
|
|
|
|
_this.video_show = true; |
|
|
|
|
}, |
|
|
|
|
videoErrorCallback(e) |
|
|
|
|
{ |
|
|
|
|
console.log(e); |
|
|
|
|
}, |
|
|
|
|
closeVideo(){ |
|
|
|
|
var _this =this; |
|
|
|
|
_this.video_show = false; |
|
|
|
|
_this.videoContext.pause = true; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getPhoneNumber(e){ |
|
|
|
|
var _this =this; |
|
|
|
|
var detail = e.detail; |
|
|
|
|
console.log(detail); |
|
|
|
|
if (detail.errMsg === 'getPhoneNumber:ok') { |
|
|
|
|
|
|
|
|
|
_this.getPhoneApi(detail); |
|
|
|
|
} else { |
|
|
|
|
_this.$com.alert('授权失败') |
|
|
|
|
//console.log(i,can_num); |
|
|
|
|
if(i <= can_num) |
|
|
|
|
{ |
|
|
|
|
baseList.push({id:0,image:'/static/img/user/have.png',can:true}); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
baseList.push({id:0,image:'/static/img/user/have_no.png',can:false}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getPhoneApi(detail){ |
|
|
|
|
var _this = this; |
|
|
|
|
var openid = _this.$user.session('openid'); |
|
|
|
|
var post ={ |
|
|
|
|
|
|
|
|
|
code: detail.code, |
|
|
|
|
}; |
|
|
|
|
_this.$api.post('ycl/user/wx-phone',post,function(rs){ |
|
|
|
|
console.log(rs); |
|
|
|
|
var phoneNumber = rs; |
|
|
|
|
_this.userInfo.phoneNumber = phoneNumber; |
|
|
|
|
if(_this.$com.isNull(openid)) |
|
|
|
|
var post ={}; |
|
|
|
|
_this.$api.get('api/portrait/list',post,function(rs){ |
|
|
|
|
console.log('档案信息',rs); |
|
|
|
|
if(rs.length > 0) |
|
|
|
|
{ |
|
|
|
|
_this.$com.alert('切换失败,请退出并重新进入小程序重试'); |
|
|
|
|
rs.forEach((item, index) => { |
|
|
|
|
baseList[index].id = item.id; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// #ifdef MP |
|
|
|
|
//这里目前微信小程序和抖音功能基本一样 |
|
|
|
|
uni.getProvider({ |
|
|
|
|
service: 'oauth', |
|
|
|
|
success: function (res) { |
|
|
|
|
console.log(res.provider) |
|
|
|
|
var provider = res.provider[0]; |
|
|
|
|
|
|
|
|
|
uni.login({ |
|
|
|
|
provider:provider, |
|
|
|
|
scopes:'auth_base', |
|
|
|
|
success: function (login) { |
|
|
|
|
console.log(login); |
|
|
|
|
//发起网络请求 |
|
|
|
|
var xpost = { |
|
|
|
|
loginCode: login.code, |
|
|
|
|
phoneNumber:phoneNumber, |
|
|
|
|
}; |
|
|
|
|
_this.$api.post('ycl/user/wx-login', xpost,function(resx){ |
|
|
|
|
console.log(resx); |
|
|
|
|
_this.$user.session('openid',resx.wxOpenid); |
|
|
|
|
_this.$user.session('user_id',resx.id); |
|
|
|
|
if(!_this.$com.isNull(resx.token)) |
|
|
|
|
{ |
|
|
|
|
_this.$user.session('token',resx.token); |
|
|
|
|
} |
|
|
|
|
_this.isLogin = true; |
|
|
|
|
_this.getUserInfo(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
fail:function(rs){ |
|
|
|
|
console.log('登录失败'+rs.errMsg); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #endif |
|
|
|
|
},function(err){ |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
_this.portraitList = baseList; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|