邀请统一处理
26
App.vue
|
@ -3,12 +3,12 @@
|
|||
import requst from '@/jsFile/requst.js';
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
// 全局域名配置
|
||||
uni.setStorageSync('hostapi','https://hengmei.scdxtc.cn/api/');
|
||||
// uni.setStorageSync('hostapi','https://hm.hmzfyy.cn/api/');
|
||||
// toolAll.tools.clearClog();//去除体验版和正式版的所有输出日志
|
||||
// 主题颜色
|
||||
// toolAll.tools.zhuColorT();
|
||||
// 检测当前运行环境并缓存域名
|
||||
toolAll.tools.currentContext();
|
||||
// 设置电量栏和导航栏的高度
|
||||
uni.setStorageSync('electric_nav_height',uni.getSystemInfoSync().statusBarHeight + 54);
|
||||
|
||||
toolAll.tools.isVedio();
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}index/mini-program-setting`,
|
||||
method: 'GET',
|
||||
|
@ -31,23 +31,19 @@
|
|||
onShow: function() {
|
||||
// uni.clearStorageSync()
|
||||
if(uni.getStorageSync('token')!='') {
|
||||
toolAll.tools.daoTime();
|
||||
toolAll.tools.networkStatus();//检查当前网络状态
|
||||
toolAll.tools.updaX();//检测版本更新
|
||||
// 刷新token
|
||||
toolAll.tools.refrshTokenEv();
|
||||
}
|
||||
setTimeout(()=>{
|
||||
toolAll.tools.overdue();//查询是否第一次授权
|
||||
},5000)
|
||||
toolAll.tools.isVedio();
|
||||
toolAll.tools.checkQuan();
|
||||
},
|
||||
onHide: function() {
|
||||
toolAll.tools.closeTimer();//清空埋点倒计时
|
||||
uni.removeStorageSync('isQuan');
|
||||
uni.removeStorageSync('quanImg');
|
||||
uni.removeStorageSync('quanId');
|
||||
uni.removeStorageSync('isQuan');
|
||||
uni.removeStorageSync('firstTime');
|
||||
uni.removeStorageSync('quanImg'); // 清空优惠券图片缓存
|
||||
uni.removeStorageSync('quanId'); // 清空优惠券id缓存
|
||||
uni.removeStorageSync('isVedio'); // 清空是否是视频缓存
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
<template>
|
||||
<view v-if="showPhone" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view class="tc tank-box-itemone">请授权绑定手机号</view>
|
||||
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
|
||||
<view class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
|
||||
<view class="pad-sx10 radius10 tank-btn posir pbackc">
|
||||
立即绑定
|
||||
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo">立即绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"wx_auth_phone",
|
||||
data() {
|
||||
return {
|
||||
showPhone:true
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
moveHandle(){//禁止底层滑动
|
||||
return false
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
// console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.showPhone = false;
|
||||
this.$toolAll.tools.overdue();
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success');
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
console.log('用户拒绝');
|
||||
this.showPhone = true;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view v-if="visible">
|
||||
<view v-if="showAuth">
|
||||
<!-- 用户信息授权 -->
|
||||
<view v-if="userInfo_mobile" @touchmove.stop.prevent="moveHandle" :class="isAnimation==2?'card-box-userinfo':''" class="auth-box">
|
||||
<view @touchmove.stop.prevent="moveHandle" :class="isAnimation==2?'card-box-userinfo':''" class="auth-box">
|
||||
<view :class="isAnimation==1?'card-box-userinfo':''">
|
||||
<view class="auth-top">
|
||||
<image :src="appletImg" mode=""></image>
|
||||
|
@ -13,16 +13,16 @@
|
|||
</view>
|
||||
<view class="auth-center">申请 获取你的昵称、头像、地区及性别</view>
|
||||
<view class="auth-bottom">
|
||||
<view @tap="chooseBtn(0)" :class="isNo?'isNyin':'noyin'" class="btn btn-no">暂不授权</view>
|
||||
<view @tap="chooseBtn(1)" :class="isOk?'isOyin':'noyin'" class="btn btn-yes">
|
||||
<view @tap="chooseBtn" :class="noAuthBtn?'isNyin':'noyin'" class="btn btn-no">暂不授权</view>
|
||||
<view :class="yesAuthBtn?'isOyin':'noyin'" class="btn btn-yes">
|
||||
<text>立即授权</text>
|
||||
<button open-type="getUserInfo" @tap="shouq" class="auth-btn">立即授权</button>
|
||||
<button open-type="getUserInfo" @tap="authEv" class="auth-btn">立即授权</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 手机号授权 -->
|
||||
<view v-if="!userInfo_mobile" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
|
||||
<view v-if="showMobile" @touchmove.stop.prevent="moveHandle" class="disjcac posAll" style="z-index: 1001;">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view class="tc tank-box-itemone">请授权绑定手机号</view>
|
||||
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
|
||||
|
@ -39,9 +39,9 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name:"empower",
|
||||
name:"auth-userInfo-mobileInfo",
|
||||
props:{
|
||||
optionObj:{
|
||||
optionObj:{//参数
|
||||
type:Object,
|
||||
default:()=>{
|
||||
return {}
|
||||
|
@ -54,165 +54,138 @@
|
|||
appletName:{//小程序名称
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
url:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
isWhere:{
|
||||
type:Number,
|
||||
default:0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isOk:false,
|
||||
isNo:false,
|
||||
isAnimation:0,
|
||||
visible:false,
|
||||
userInfo_mobile:true,
|
||||
currentPage:''//当前页面路径
|
||||
yesAuthBtn:false, // 是否点击立即授权按钮
|
||||
noAuthBtn:false, // 是否点击暂不授权按钮
|
||||
isAnimation:0, // 动画
|
||||
showAuth:false, // 是否显示授权弹框
|
||||
currentPage:'', // 当前页面路径
|
||||
showMobile:false // 是否显示手机授权弹框
|
||||
};
|
||||
},
|
||||
destroyed() {
|
||||
console.log('清除路径缓存');
|
||||
uni.removeStorageSync('urlparams');
|
||||
},
|
||||
mounted() {
|
||||
if(uni.getStorageSync('phone_active')==0){this.visible = true;}
|
||||
if(this.optionObj.invite_code!='' && this.optionObj.invite_code!=undefined){
|
||||
this.loginEv(this.optionObj.invite_code);
|
||||
} else if(this.optionObj.source_code!='' && this.optionObj.source_code!=undefined){
|
||||
this.loginEv('',this.optionObj.source_code,this.optionObj.channel);
|
||||
}
|
||||
//转发进入
|
||||
// 转发进入:获取页面路径
|
||||
let pages = getCurrentPages(); //获取加载的页面
|
||||
let currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
||||
this.currentPage = currentPage.route ;//当前页面url
|
||||
console.log(this.currentPage,'当前页面路径');
|
||||
// console.log(currentPage.route,'获取当前页面路径');
|
||||
console.log(currentPage.$page.fullPath,'获取当前页面完整路径带参数');
|
||||
// console.log(currentPage.options,'获取当前页面参数');
|
||||
if(uni.getStorageSync('token')==''){
|
||||
uni.setStorageSync('urlparams',currentPage.$page.fullPath);
|
||||
this.loginEv(currentPage.options);
|
||||
this.showAuth = true;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
loginEv(data){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
code: res.code,
|
||||
invite_code: data.invite_code || '', // 用户邀请码
|
||||
source_code: data.source_code || '', // 渠道
|
||||
channel: data.channel || ''
|
||||
}
|
||||
// 调用登录事件
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.visible = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
if(res.code==0){console.log(params,101);} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error => {
|
||||
this.$toolAll.tools.showToast(error.msg);
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({url:'/pages/login/login'})
|
||||
},2000)
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// 当弹框出现时,禁止底层滑动
|
||||
moveHandle(){
|
||||
return false
|
||||
},
|
||||
tiaoZ(){//跳转方式
|
||||
if(this.isWhere==0) uni.navigateBack({delta:1}) //返回上一页
|
||||
if(this.isWhere==1) uni.navigateTo({url:this.url})//跳转到指定页面
|
||||
if(this.isWhere!=0 && this.isWhere!=1) return//不跳转
|
||||
this.isOk = false;
|
||||
chooseBtn(){//暂不授权点击事件
|
||||
this.noAuthBtn = true;
|
||||
},
|
||||
chooseBtn(index){//暂不授权、立即授权
|
||||
this.$emit('cancleEv',index)//继承事件
|
||||
if(index==0){//暂不授权
|
||||
// this.tiaoZ()
|
||||
uni.navigateTo({
|
||||
url:`/${this.currentPage}`
|
||||
})
|
||||
this.isOk = false
|
||||
} else {
|
||||
this.isOk = !this.isOk
|
||||
this.isNo = false
|
||||
}
|
||||
},
|
||||
shouq(){//立即授权事件
|
||||
let ya = this;
|
||||
this.$toolAll.tools.showToast('正在调起授权...')
|
||||
let code = ''//声明code
|
||||
uni.login({// 获取登录用户code
|
||||
provider: 'weixin',
|
||||
success: function(result) {
|
||||
uni.hideToast()
|
||||
code = result.code
|
||||
},
|
||||
});
|
||||
authEv(){//立即授权事件
|
||||
this.$toolAll.tools.showToast('正在调起授权...');
|
||||
this.yesAuthBtn = true;
|
||||
uni.getUserProfile({//调起微信授权弹框
|
||||
desc: '登录',
|
||||
lang: 'zh_CN',
|
||||
success: (res) => {
|
||||
ya.updateUserInfo(code,res.userInfo);
|
||||
uni.login({// 获取登录用户code
|
||||
provider: 'weixin',
|
||||
success: (result)=> {
|
||||
uni.hideToast()
|
||||
// 调用更新用户信息事件
|
||||
this.updateUserInfo(result.code,res.userInfo);
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('用户拒绝授权');
|
||||
this.tiaoZ()
|
||||
this.$emit('cancleEv',0)
|
||||
this.isOk = false;
|
||||
fail: (err) => {
|
||||
// console.log('用户拒绝授权');
|
||||
this.yesAuthBtn = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
//调用登录接口
|
||||
// 更新用户信息事件
|
||||
updateUserInfo(code,userInfo) {
|
||||
let ya = this;
|
||||
uni.showToast({title: '授权中...',icon:'loading',})
|
||||
var params = {
|
||||
code:code,
|
||||
nickname: userInfo.nickName,//用户昵称
|
||||
headimgurl: userInfo.avatarUrl,//用户头像
|
||||
country: userInfo.country,//用户所在国家
|
||||
province: userInfo.province,//用户所在省份
|
||||
city: userInfo.city,//用户所在城市
|
||||
gender: userInfo.gender,//用户性别
|
||||
language:userInfo.language,//语言
|
||||
is_active:1,
|
||||
channel:uni.getStorageSync('channel')
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('授权成功...','success')
|
||||
uni.setStorageSync('params',params);
|
||||
uni.setStorageSync('userId',res.data.account_id);
|
||||
uni.setStorageSync('token',res.data.token);//缓存token
|
||||
uni.setStorageSync('expire',res.data.expire);//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.is_active);//是否第一次授权
|
||||
uni.setStorageSync('invite_code',res.data.invite_code);
|
||||
ya.successAfterEv(userInfo);
|
||||
ya.isAnimation++;
|
||||
ya.userInfo_mobile = false;
|
||||
ya.$emit('onload');
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
successAfterEv(userInfo){//缓存信息
|
||||
let ya = this
|
||||
uni.hideToast();
|
||||
// console.log(uni.getStorageSync('headImg'));
|
||||
ya.$toolAll.tools.showToast('授权成功','success')
|
||||
ya.$emit('cancleEv',0)
|
||||
ya.$emit('buttonH',true)
|
||||
if(ya.url!=''){
|
||||
setTimeout(()=>{uni.navigateTo({url:ya.url})},1000)
|
||||
}
|
||||
uni.setStorageSync('userId',res.data.account_id); // 缓存用户id
|
||||
uni.setStorageSync('token',res.data.token); // 缓存token
|
||||
uni.setStorageSync('expire',res.data.expire); // 缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('invite_code',res.data.invite_code); // 缓存用户邀请码
|
||||
uni.setStorageSync('phone_active',res.data.phone_active); // 是否第一次授权
|
||||
this.isAnimation++;
|
||||
if(res.data.phone_active==1){
|
||||
// 如果手机号已经存在,取消手机授权弹框
|
||||
this.showAuth = false;
|
||||
uni.setStorageSync('outside',6);//表示外界进来授权的
|
||||
uni.reLaunch({ // 重新进入当前页面
|
||||
url:uni.getStorageSync('urlparams')
|
||||
})
|
||||
} else {
|
||||
// 如果手机号不存在,调起手机号授权弹框
|
||||
this.showMobile = true;
|
||||
}
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error => {this.$toolAll.tools.showToast(error.msg)})
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
// console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success');
|
||||
this.visible = false;
|
||||
uni.reLaunch({
|
||||
url:`/${this.currentPage}`
|
||||
uni.setStorageSync('phone_active',1);//是否第一次授权
|
||||
uni.setStorageSync('outside',6);//表示外界进来授权的
|
||||
this.showAuth = false; // 关闭手机号授权弹框
|
||||
uni.reLaunch({ // 重新进入当前页面
|
||||
url:uni.getStorageSync('urlparams')
|
||||
})
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg)})
|
||||
} else {
|
||||
console.log('用户拒绝');
|
||||
// console.log('用户拒绝');
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -220,7 +193,7 @@
|
|||
</script>
|
||||
|
||||
<style>
|
||||
.auth-box {position: fixed;top: 0;right: 0;left: 0;bottom: 0;display: flex;justify-content: center;align-items: center;z-index: 3;}
|
||||
.auth-box {position: fixed;top: 0;right: 0;left: 0;bottom: 0;display: flex;justify-content: center;align-items: center;z-index: 1000;}
|
||||
.auth-box > view {background-color: #FFFFFF;border-radius: 10rpx;padding: 30rpx;box-shadow: 0rpx 0rpx 20rpx rgba(0,0,0,.5);margin: 0 100rpx;}
|
||||
.auth-top {display: flex;}
|
||||
.auth-top image {width: 96rpx;height: 96rpx;flex-shrink: 0;}
|
|
@ -1,411 +0,0 @@
|
|||
<template>
|
||||
<view :class="modal?'show-qrcode':'hide-qrcode'">
|
||||
<view class="box-qrcode" :style="{'margin-left': marginLeft + 'px'}" @longtap="longtapCode">
|
||||
<!-- style="width: 550rpx;height: 550rpx;" -->
|
||||
|
||||
<canvas class="canvas-qrcode" :style="style_w_h" :canvas-id="qrcode_id">
|
||||
|
||||
<!-- #ifndef MP -->
|
||||
<view v-if="modal&&is_themeImg" :style="style_w_h" class="box-img-qrcode">
|
||||
<image :style="style_w_h_img" mode="scaleToFill" :src="themeImg"></image>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
</canvas>
|
||||
|
||||
<!-- <image mode="scaleToFill" :src="imagePath"></image> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var qr_we = require("./qrcode_wx.js");
|
||||
const qrCode = require('./weapp-qrcode.js')
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isAndroid : false ,
|
||||
show: true,
|
||||
imagePath: '',
|
||||
// qrcode_id: 'qrcode_id',
|
||||
marginLeft: 0,
|
||||
//一般的安卓app只需加30就能显示全
|
||||
//苹果app的不加就能显示全,加了就要弄margin-left
|
||||
//有些安卓app显示不全
|
||||
add_num : 30 ,
|
||||
add_num_key : 'rectify_code_key',
|
||||
}
|
||||
},
|
||||
props: {
|
||||
modal: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 260
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 260
|
||||
},
|
||||
themeColor: {
|
||||
type: String,
|
||||
default: '#333333',
|
||||
},
|
||||
qrcode_id: {
|
||||
type: String,
|
||||
default: 'qrcode_id',
|
||||
},
|
||||
is_themeImg: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
themeImg: {
|
||||
type: String,
|
||||
default: 'https://cdn.pixabay.com/photo/2016/11/29/13/24/balloons-1869816__340.jpg',
|
||||
},
|
||||
h_w_img: {
|
||||
type: Number,
|
||||
default: 30
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
watch:{
|
||||
|
||||
},
|
||||
computed: {
|
||||
style_w_h() {
|
||||
return this.set_style_w_h();
|
||||
},
|
||||
style_w_h_img() {
|
||||
let that = this;
|
||||
var height = parseInt(that.h_w_img);
|
||||
var width = parseInt(that.h_w_img);
|
||||
var style = '';
|
||||
if (height > 0) {
|
||||
style = `height:${height*2}rpx;`;
|
||||
}
|
||||
if (width > 0) {
|
||||
style += `width:${width*2}rpx;z-index: 2;`;
|
||||
}
|
||||
|
||||
return style;
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
let that = this;
|
||||
try {
|
||||
//app苹果二维码不居中
|
||||
//#ifndef MP
|
||||
let isAndroid = false ;
|
||||
const res = uni.getSystemInfoSync();
|
||||
if(res.platform == 'android'){
|
||||
isAndroid = true ;
|
||||
}else{
|
||||
isAndroid = false ;
|
||||
}
|
||||
|
||||
|
||||
if (!isAndroid) {
|
||||
that.marginLeft = 46;
|
||||
}
|
||||
|
||||
that.isAndroid = isAndroid ;
|
||||
try {
|
||||
const add_num = uni.getStorageSync(that.add_num_key);
|
||||
if (add_num) {
|
||||
that.add_num = add_num;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// error
|
||||
|
||||
}
|
||||
// #endif
|
||||
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
|
||||
//#ifdef MP
|
||||
//that.marginLeft = 40;
|
||||
// #endif
|
||||
|
||||
},
|
||||
methods: {
|
||||
set_style_w_h(){
|
||||
|
||||
let that = this;
|
||||
var height = parseInt(that.height);
|
||||
var width = parseInt(that.width);
|
||||
var style = '';
|
||||
var height = height*2 ;
|
||||
var width = width*2 ;
|
||||
|
||||
//#ifndef MP
|
||||
var add = that.add_num ;
|
||||
|
||||
height += add;
|
||||
width += add;
|
||||
// #endif
|
||||
|
||||
if (height > 0) {
|
||||
style = `height:${height}rpx;`;
|
||||
}
|
||||
if (width > 0) {
|
||||
style += `width:${width}rpx;`;
|
||||
}
|
||||
|
||||
return style;
|
||||
},
|
||||
hideQrcode() {
|
||||
this.$emit("hideQrcode")
|
||||
},
|
||||
// 二维码生成工具
|
||||
crtQrCode() {
|
||||
let that = this;
|
||||
//#ifndef MP
|
||||
new qrCode(that.qrcode_id, {
|
||||
text: this.url,
|
||||
width: that.width,
|
||||
height: that.height,
|
||||
colorDark: that.themeColor,//#333333
|
||||
colorLight: "#FFFFFF",
|
||||
correctLevel: qrCode.CorrectLevel.H,
|
||||
})
|
||||
// #endif
|
||||
//#ifdef MP
|
||||
that.createQrCode(this.url, that.qrcode_id, that.width, that.height,that.themeColor,that.is_themeImg,that.themeImg,that.h_w_img);
|
||||
// #endif
|
||||
|
||||
//that.createQrCode(this.url, that.qrcode_id, that.width, that.height);
|
||||
},
|
||||
//#ifdef MP
|
||||
|
||||
createQrCode: function(url, canvasId, cavW, cavH,cavColor,haveImg,imgurl,imgsize) {
|
||||
//调用插件中的draw方法,绘制二维码图片
|
||||
qr_we.api.draw(url, canvasId, cavW, cavH,cavColor,haveImg,imgurl,imgsize, this, this.canvasToTempImage);
|
||||
// setTimeout(() => { this.canvasToTempImage();},100);
|
||||
|
||||
},
|
||||
|
||||
// #endif
|
||||
//获取临时缓存照片路径,存入data中
|
||||
canvasToTempImage: function() {
|
||||
var that = this;
|
||||
},
|
||||
saveImage: function() {
|
||||
var that = this;
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: that.qrcode_id,
|
||||
success: function(res) {
|
||||
var tempFilePath = res.tempFilePath;
|
||||
// console.log(tempFilePath);
|
||||
that.imagePath = tempFilePath;
|
||||
|
||||
//保存到相册
|
||||
// uni.saveFile({
|
||||
// tempFilePath: tempFilePath,
|
||||
// success: function (res2) {
|
||||
// var savedFilePath = res2.savedFilePath;
|
||||
|
||||
|
||||
// }
|
||||
// });
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath : tempFilePath ,
|
||||
success: function (res3) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '保存成功',
|
||||
confirmText: '确定',
|
||||
showCancel: false,
|
||||
confirmColor: '#33CCCC',
|
||||
success(res4) {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
// console.log(res);
|
||||
}
|
||||
}, that);
|
||||
},
|
||||
//微信小程序支持:长按二维码,提示是否保存相册
|
||||
//安卓APP长按校正二维码
|
||||
longtapCode(){
|
||||
var that = this;
|
||||
|
||||
//#ifndef MP
|
||||
uni.showModal({
|
||||
title: '校正二维码',
|
||||
content: '二维码是否异常',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#33CCCC',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
that.rectify_code();
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
//#ifdef MP-WEIXIN
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否保存到相册',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#33CCCC',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
that.saveImage();
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
//安卓有些手机不正常,长按可选择矫正
|
||||
rectify_code(){
|
||||
var that = this;
|
||||
let add_num = that.add_num ;
|
||||
add_num += 30 ;
|
||||
that.add_num = add_num;
|
||||
that.crtQrCode();//重新生成才会立即覆盖
|
||||
try {
|
||||
//第一次长按校正设置了就不用在设置
|
||||
uni.setStorage({
|
||||
key: that.add_num_key,
|
||||
data: add_num,
|
||||
success: function() {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// error
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// .qrcode-box {
|
||||
// position: fixed;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// height: 100vh;
|
||||
// width: 100vw;
|
||||
// background-color: rgba(59, 59, 59, 0.6);
|
||||
// // opacity: 0.8;
|
||||
// text-align: center;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// display: none;
|
||||
|
||||
// .qrcode-item {
|
||||
// flex: 1;
|
||||
// position: relative;
|
||||
// text-align: center;
|
||||
|
||||
// .item-box {
|
||||
// width: 90%;
|
||||
// margin: auto;
|
||||
// display: inline-block;
|
||||
// margin-top: 30%;
|
||||
// padding-bottom: 30rpx;
|
||||
|
||||
// // animation: show 0.7s;
|
||||
// .title {
|
||||
// font-size: 46rpx;
|
||||
// text-align: center;
|
||||
// margin-bottom: 24rpx;
|
||||
// }
|
||||
|
||||
// .canvas {
|
||||
// margin: auto;
|
||||
// display: inline-block;
|
||||
// margin: auto;
|
||||
// }
|
||||
|
||||
// background-color: #FFFFFF;
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
.box-qrcode{
|
||||
text-align: center;
|
||||
position: relative;
|
||||
.box-img-qrcode{
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
image{
|
||||
width: 60upx;
|
||||
height: 60upx;
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
.canvas-qrcode {
|
||||
|
||||
margin: auto;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
.opacity-qrcode {
|
||||
opacity: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.show-qrcode {
|
||||
display: block;
|
||||
animation: fade 0.7s;
|
||||
|
||||
// -moz-animation: fade 0.5s; /* Firefox */
|
||||
// -webkit-animation: fade 0.5s; /* Safari 和 Chrome */
|
||||
// -o-animation: fade 0.5s;
|
||||
}
|
||||
|
||||
.hide-qrcode {
|
||||
animation: hide 0.7s;
|
||||
}
|
||||
|
||||
@keyframes fade {
|
||||
from {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes hide {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,872 +0,0 @@
|
|||
!(function() {
|
||||
|
||||
// alignment pattern
|
||||
var adelta = [
|
||||
0, 11, 15, 19, 23, 27, 31,
|
||||
16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,
|
||||
26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28
|
||||
];
|
||||
|
||||
// version block
|
||||
var vpat = [
|
||||
0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d,
|
||||
0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9,
|
||||
0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75,
|
||||
0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64,
|
||||
0x541, 0xc69
|
||||
];
|
||||
|
||||
// final format bits with mask: level << 3 | mask
|
||||
var fmtword = [
|
||||
0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L
|
||||
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M
|
||||
0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q
|
||||
0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H
|
||||
];
|
||||
|
||||
// 4 per version: number of blocks 1,2; data width; ecc width
|
||||
var eccblocks = [
|
||||
1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,
|
||||
1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,
|
||||
1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,
|
||||
1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,
|
||||
1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,
|
||||
2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,
|
||||
2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,
|
||||
2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,
|
||||
2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,
|
||||
2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,
|
||||
4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,
|
||||
2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,
|
||||
4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,
|
||||
3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,
|
||||
5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,
|
||||
5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,
|
||||
1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,
|
||||
5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,
|
||||
3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,
|
||||
3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,
|
||||
4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,
|
||||
2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,
|
||||
4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,
|
||||
6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,
|
||||
8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,
|
||||
10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,
|
||||
8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,
|
||||
3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,
|
||||
7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,
|
||||
5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,
|
||||
13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,
|
||||
17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,
|
||||
17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,
|
||||
13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,
|
||||
12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,
|
||||
6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,
|
||||
17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,
|
||||
4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,
|
||||
20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,
|
||||
19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30
|
||||
];
|
||||
|
||||
// Galois field log table
|
||||
var glog = [
|
||||
0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,
|
||||
0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,
|
||||
0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,
|
||||
0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,
|
||||
0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88,
|
||||
0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40,
|
||||
0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d,
|
||||
0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57,
|
||||
0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18,
|
||||
0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e,
|
||||
0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61,
|
||||
0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2,
|
||||
0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6,
|
||||
0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a,
|
||||
0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7,
|
||||
0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
|
||||
];
|
||||
|
||||
// Galios field exponent table
|
||||
var gexp = [
|
||||
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
|
||||
0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
|
||||
0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
|
||||
0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
|
||||
0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,
|
||||
0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,
|
||||
0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,
|
||||
0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,
|
||||
0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,
|
||||
0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,
|
||||
0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,
|
||||
0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,
|
||||
0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,
|
||||
0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,
|
||||
0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,
|
||||
0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00
|
||||
];
|
||||
|
||||
// Working buffers:
|
||||
// data input and ecc append, image working buffer, fixed part of image, run lengths for badness
|
||||
var strinbuf = [],
|
||||
eccbuf = [],
|
||||
qrframe = [],
|
||||
framask = [],
|
||||
rlens = [];
|
||||
// Control values - width is based on version, last 4 are from table.
|
||||
var version, width, neccblk1, neccblk2, datablkw, eccblkwid;
|
||||
var ecclevel = 2;
|
||||
// set bit to indicate cell in qrframe is immutable. symmetric around diagonal
|
||||
function setmask(x, y) {
|
||||
var bt;
|
||||
if (x > y) {
|
||||
bt = x;
|
||||
x = y;
|
||||
y = bt;
|
||||
}
|
||||
// y*y = 1+3+5...
|
||||
bt = y;
|
||||
bt *= y;
|
||||
bt += y;
|
||||
bt >>= 1;
|
||||
bt += x;
|
||||
framask[bt] = 1;
|
||||
}
|
||||
|
||||
// enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask)
|
||||
function putalign(x, y) {
|
||||
var j;
|
||||
|
||||
qrframe[x + width * y] = 1;
|
||||
for (j = -2; j < 2; j++) {
|
||||
qrframe[(x + j) + width * (y - 2)] = 1;
|
||||
qrframe[(x - 2) + width * (y + j + 1)] = 1;
|
||||
qrframe[(x + 2) + width * (y + j)] = 1;
|
||||
qrframe[(x + j + 1) + width * (y + 2)] = 1;
|
||||
}
|
||||
for (j = 0; j < 2; j++) {
|
||||
setmask(x - 1, y + j);
|
||||
setmask(x + 1, y - j);
|
||||
setmask(x - j, y - 1);
|
||||
setmask(x + j, y + 1);
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Reed Solomon error correction
|
||||
// exponentiation mod N
|
||||
function modnn(x) {
|
||||
while (x >= 255) {
|
||||
x -= 255;
|
||||
x = (x >> 8) + (x & 255);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
var genpoly = [];
|
||||
|
||||
// Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given.
|
||||
function appendrs(data, dlen, ecbuf, eclen) {
|
||||
var i, j, fb;
|
||||
|
||||
for (i = 0; i < eclen; i++)
|
||||
strinbuf[ecbuf + i] = 0;
|
||||
for (i = 0; i < dlen; i++) {
|
||||
fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]];
|
||||
if (fb != 255) /* fb term is non-zero */
|
||||
for (j = 1; j < eclen; j++)
|
||||
strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])];
|
||||
else
|
||||
for (j = ecbuf; j < ecbuf + eclen; j++)
|
||||
strinbuf[j] = strinbuf[j + 1];
|
||||
strinbuf[ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])];
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Frame data insert following the path rules
|
||||
|
||||
// check mask - since symmetrical use half.
|
||||
function ismasked(x, y) {
|
||||
var bt;
|
||||
if (x > y) {
|
||||
bt = x;
|
||||
x = y;
|
||||
y = bt;
|
||||
}
|
||||
bt = y;
|
||||
bt += y * y;
|
||||
bt >>= 1;
|
||||
bt += x;
|
||||
return framask[bt];
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Apply the selected mask out of the 8.
|
||||
function applymask(m) {
|
||||
var x, y, r3x, r3y;
|
||||
|
||||
switch (m) {
|
||||
case 0:
|
||||
for (y = 0; y < width; y++)
|
||||
for (x = 0; x < width; x++)
|
||||
if (!((x + y) & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
break;
|
||||
case 1:
|
||||
for (y = 0; y < width; y++)
|
||||
for (x = 0; x < width; x++)
|
||||
if (!(y & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
break;
|
||||
case 2:
|
||||
for (y = 0; y < width; y++)
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!r3x && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = r3y, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!r3x && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (y = 0; y < width; y++)
|
||||
for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3) {
|
||||
r3x = 0;
|
||||
r3y = !r3y;
|
||||
}
|
||||
if (!r3y && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Badness coefficients.
|
||||
var N1 = 3,
|
||||
N2 = 3,
|
||||
N3 = 40,
|
||||
N4 = 10;
|
||||
|
||||
// Using the table of the length of each run, calculate the amount of bad image
|
||||
// - long runs or those that look like finders; called twice, once each for X and Y
|
||||
function badruns(length) {
|
||||
var i;
|
||||
var runsbad = 0;
|
||||
for (i = 0; i <= length; i++)
|
||||
if (rlens[i] >= 5)
|
||||
runsbad += N1 + rlens[i] - 5;
|
||||
// BwBBBwB as in finder
|
||||
for (i = 3; i < length - 1; i += 2)
|
||||
if (rlens[i - 2] == rlens[i + 2] &&
|
||||
rlens[i + 2] == rlens[i - 1] &&
|
||||
rlens[i - 1] == rlens[i + 1] &&
|
||||
rlens[i - 1] * 3 == rlens[i]
|
||||
// white around the black pattern? Not part of spec
|
||||
&&
|
||||
(rlens[i - 3] == 0 // beginning
|
||||
||
|
||||
i + 3 > length // end
|
||||
||
|
||||
rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4)
|
||||
)
|
||||
runsbad += N3;
|
||||
return runsbad;
|
||||
}
|
||||
|
||||
// Calculate how bad the masked image is - blocks, imbalance, runs, or finders.
|
||||
function badcheck() {
|
||||
var x, y, h, b, b1;
|
||||
var thisbad = 0;
|
||||
var bw = 0;
|
||||
|
||||
// blocks of same color.
|
||||
for (y = 0; y < width - 1; y++)
|
||||
for (x = 0; x < width - 1; x++)
|
||||
if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y] &&
|
||||
qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black
|
||||
||
|
||||
!(qrframe[x + width * y] || qrframe[(x + 1) + width * y] ||
|
||||
qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white
|
||||
thisbad += N2;
|
||||
|
||||
// X runs
|
||||
for (y = 0; y < width; y++) {
|
||||
rlens[0] = 0;
|
||||
for (h = b = x = 0; x < width; x++) {
|
||||
if ((b1 = qrframe[x + width * y]) == b)
|
||||
rlens[h]++;
|
||||
else
|
||||
rlens[++h] = 1;
|
||||
b = b1;
|
||||
bw += b ? 1 : -1;
|
||||
}
|
||||
thisbad += badruns(h);
|
||||
}
|
||||
|
||||
// black/white imbalance
|
||||
if (bw < 0)
|
||||
bw = -bw;
|
||||
|
||||
var big = bw;
|
||||
var count = 0;
|
||||
big += big << 2;
|
||||
big <<= 1;
|
||||
while (big > width * width)
|
||||
big -= width * width, count++;
|
||||
thisbad += count * N4;
|
||||
|
||||
// Y runs
|
||||
for (x = 0; x < width; x++) {
|
||||
rlens[0] = 0;
|
||||
for (h = b = y = 0; y < width; y++) {
|
||||
if ((b1 = qrframe[x + width * y]) == b)
|
||||
rlens[h]++;
|
||||
else
|
||||
rlens[++h] = 1;
|
||||
b = b1;
|
||||
}
|
||||
thisbad += badruns(h);
|
||||
}
|
||||
return thisbad;
|
||||
}
|
||||
|
||||
function genframe(instring) {
|
||||
var x, y, k, t, v, i, j, m;
|
||||
|
||||
// find the smallest version that fits the string
|
||||
t = instring.length;
|
||||
version = 0;
|
||||
do {
|
||||
version++;
|
||||
k = (ecclevel - 1) * 4 + (version - 1) * 16;
|
||||
neccblk1 = eccblocks[k++];
|
||||
neccblk2 = eccblocks[k++];
|
||||
datablkw = eccblocks[k++];
|
||||
eccblkwid = eccblocks[k];
|
||||
k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9);
|
||||
if (t <= k)
|
||||
break;
|
||||
} while (version < 40);
|
||||
|
||||
// FIXME - insure that it fits insted of being truncated
|
||||
width = 17 + 4 * version;
|
||||
|
||||
// allocate, clear and setup data structures
|
||||
v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
|
||||
for (t = 0; t < v; t++)
|
||||
eccbuf[t] = 0;
|
||||
strinbuf = instring.slice(0);
|
||||
|
||||
for (t = 0; t < width * width; t++)
|
||||
qrframe[t] = 0;
|
||||
|
||||
for (t = 0; t < (width * (width + 1) + 1) / 2; t++)
|
||||
framask[t] = 0;
|
||||
|
||||
// insert finders - black to frame, white to mask
|
||||
for (t = 0; t < 3; t++) {
|
||||
k = 0;
|
||||
y = 0;
|
||||
if (t == 1)
|
||||
k = (width - 7);
|
||||
if (t == 2)
|
||||
y = (width - 7);
|
||||
qrframe[(y + 3) + width * (k + 3)] = 1;
|
||||
for (x = 0; x < 6; x++) {
|
||||
qrframe[(y + x) + width * k] = 1;
|
||||
qrframe[y + width * (k + x + 1)] = 1;
|
||||
qrframe[(y + 6) + width * (k + x)] = 1;
|
||||
qrframe[(y + x + 1) + width * (k + 6)] = 1;
|
||||
}
|
||||
for (x = 1; x < 5; x++) {
|
||||
setmask(y + x, k + 1);
|
||||
setmask(y + 1, k + x + 1);
|
||||
setmask(y + 5, k + x);
|
||||
setmask(y + x + 1, k + 5);
|
||||
}
|
||||
for (x = 2; x < 4; x++) {
|
||||
qrframe[(y + x) + width * (k + 2)] = 1;
|
||||
qrframe[(y + 2) + width * (k + x + 1)] = 1;
|
||||
qrframe[(y + 4) + width * (k + x)] = 1;
|
||||
qrframe[(y + x + 1) + width * (k + 4)] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// alignment blocks
|
||||
if (version > 1) {
|
||||
t = adelta[version];
|
||||
y = width - 7;
|
||||
for (;;) {
|
||||
x = width - 7;
|
||||
while (x > t - 3) {
|
||||
putalign(x, y);
|
||||
if (x < t)
|
||||
break;
|
||||
x -= t;
|
||||
}
|
||||
if (y <= t + 9)
|
||||
break;
|
||||
y -= t;
|
||||
putalign(6, y);
|
||||
putalign(y, 6);
|
||||
}
|
||||
}
|
||||
|
||||
// single black
|
||||
qrframe[8 + width * (width - 8)] = 1;
|
||||
|
||||
// timing gap - mask only
|
||||
for (y = 0; y < 7; y++) {
|
||||
setmask(7, y);
|
||||
setmask(width - 8, y);
|
||||
setmask(7, y + width - 7);
|
||||
}
|
||||
for (x = 0; x < 8; x++) {
|
||||
setmask(x, 7);
|
||||
setmask(x + width - 8, 7);
|
||||
setmask(x, width - 8);
|
||||
}
|
||||
|
||||
// reserve mask-format area
|
||||
for (x = 0; x < 9; x++)
|
||||
setmask(x, 8);
|
||||
for (x = 0; x < 8; x++) {
|
||||
setmask(x + width - 8, 8);
|
||||
setmask(8, x);
|
||||
}
|
||||
for (y = 0; y < 7; y++)
|
||||
setmask(8, y + width - 7);
|
||||
|
||||
// timing row/col
|
||||
for (x = 0; x < width - 14; x++)
|
||||
if (x & 1) {
|
||||
setmask(8 + x, 6);
|
||||
setmask(6, 8 + x);
|
||||
}
|
||||
else {
|
||||
qrframe[(8 + x) + width * 6] = 1;
|
||||
qrframe[6 + width * (8 + x)] = 1;
|
||||
}
|
||||
|
||||
// version block
|
||||
if (version > 6) {
|
||||
t = vpat[version - 7];
|
||||
k = 17;
|
||||
for (x = 0; x < 6; x++)
|
||||
for (y = 0; y < 3; y++, k--)
|
||||
if (1 & (k > 11 ? version >> (k - 12) : t >> k)) {
|
||||
qrframe[(5 - x) + width * (2 - y + width - 11)] = 1;
|
||||
qrframe[(2 - y + width - 11) + width * (5 - x)] = 1;
|
||||
}
|
||||
else {
|
||||
setmask(5 - x, 2 - y + width - 11);
|
||||
setmask(2 - y + width - 11, 5 - x);
|
||||
}
|
||||
}
|
||||
|
||||
// sync mask bits - only set above for white spaces, so add in black bits
|
||||
for (y = 0; y < width; y++)
|
||||
for (x = 0; x <= y; x++)
|
||||
if (qrframe[x + width * y])
|
||||
setmask(x, y);
|
||||
|
||||
// convert string to bitstream
|
||||
// 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported)
|
||||
v = strinbuf.length;
|
||||
|
||||
// string to array
|
||||
for (i = 0; i < v; i++)
|
||||
eccbuf[i] = strinbuf.charCodeAt(i);
|
||||
strinbuf = eccbuf.slice(0);
|
||||
|
||||
// calculate max string length
|
||||
x = datablkw * (neccblk1 + neccblk2) + neccblk2;
|
||||
if (v >= x - 2) {
|
||||
v = x - 2;
|
||||
if (version > 9)
|
||||
v--;
|
||||
}
|
||||
|
||||
// shift and repack to insert length prefix
|
||||
i = v;
|
||||
if (version > 9) {
|
||||
strinbuf[i + 2] = 0;
|
||||
strinbuf[i + 3] = 0;
|
||||
while (i--) {
|
||||
t = strinbuf[i];
|
||||
strinbuf[i + 3] |= 255 & (t << 4);
|
||||
strinbuf[i + 2] = t >> 4;
|
||||
}
|
||||
strinbuf[2] |= 255 & (v << 4);
|
||||
strinbuf[1] = v >> 4;
|
||||
strinbuf[0] = 0x40 | (v >> 12);
|
||||
} else {
|
||||
strinbuf[i + 1] = 0;
|
||||
strinbuf[i + 2] = 0;
|
||||
while (i--) {
|
||||
t = strinbuf[i];
|
||||
strinbuf[i + 2] |= 255 & (t << 4);
|
||||
strinbuf[i + 1] = t >> 4;
|
||||
}
|
||||
strinbuf[1] |= 255 & (v << 4);
|
||||
strinbuf[0] = 0x40 | (v >> 4);
|
||||
}
|
||||
// fill to end with pad pattern
|
||||
i = v + 3 - (version < 10);
|
||||
while (i < x) {
|
||||
strinbuf[i++] = 0xec;
|
||||
// buffer has room if (i == x) break;
|
||||
strinbuf[i++] = 0x11;
|
||||
}
|
||||
|
||||
// calculate and append ECC
|
||||
|
||||
// calculate generator polynomial
|
||||
genpoly[0] = 1;
|
||||
for (i = 0; i < eccblkwid; i++) {
|
||||
genpoly[i + 1] = 1;
|
||||
for (j = i; j > 0; j--)
|
||||
genpoly[j] = genpoly[j] ?
|
||||
genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1];
|
||||
genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)];
|
||||
}
|
||||
for (i = 0; i <= eccblkwid; i++)
|
||||
genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step
|
||||
|
||||
// append ecc to data buffer
|
||||
k = x;
|
||||
y = 0;
|
||||
for (i = 0; i < neccblk1; i++) {
|
||||
appendrs(y, datablkw, k, eccblkwid);
|
||||
y += datablkw;
|
||||
k += eccblkwid;
|
||||
}
|
||||
for (i = 0; i < neccblk2; i++) {
|
||||
appendrs(y, datablkw + 1, k, eccblkwid);
|
||||
y += datablkw + 1;
|
||||
k += eccblkwid;
|
||||
}
|
||||
// interleave blocks
|
||||
y = 0;
|
||||
for (i = 0; i < datablkw; i++) {
|
||||
for (j = 0; j < neccblk1; j++)
|
||||
eccbuf[y++] = strinbuf[i + j * datablkw];
|
||||
for (j = 0; j < neccblk2; j++)
|
||||
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
|
||||
}
|
||||
for (j = 0; j < neccblk2; j++)
|
||||
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
|
||||
for (i = 0; i < eccblkwid; i++)
|
||||
for (j = 0; j < neccblk1 + neccblk2; j++)
|
||||
eccbuf[y++] = strinbuf[x + i + j * eccblkwid];
|
||||
strinbuf = eccbuf;
|
||||
|
||||
// pack bits into frame avoiding masked area.
|
||||
x = y = width - 1;
|
||||
k = v = 1; // up, minus
|
||||
/* inteleaved data and ecc codes */
|
||||
m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
|
||||
for (i = 0; i < m; i++) {
|
||||
t = strinbuf[i];
|
||||
for (j = 0; j < 8; j++, t <<= 1) {
|
||||
if (0x80 & t)
|
||||
qrframe[x + width * y] = 1;
|
||||
do { // find next fill position
|
||||
if (v)
|
||||
x--;
|
||||
else {
|
||||
x++;
|
||||
if (k) {
|
||||
if (y != 0)
|
||||
y--;
|
||||
else {
|
||||
x -= 2;
|
||||
k = !k;
|
||||
if (x == 6) {
|
||||
x--;
|
||||
y = 9;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (y != width - 1)
|
||||
y++;
|
||||
else {
|
||||
x -= 2;
|
||||
k = !k;
|
||||
if (x == 6) {
|
||||
x--;
|
||||
y -= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
v = !v;
|
||||
} while (ismasked(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
// save pre-mask copy of frame
|
||||
strinbuf = qrframe.slice(0);
|
||||
t = 0; // best
|
||||
y = 30000; // demerit
|
||||
// for instead of while since in original arduino code
|
||||
// if an early mask was "good enough" it wouldn't try for a better one
|
||||
// since they get more complex and take longer.
|
||||
for (k = 0; k < 8; k++) {
|
||||
applymask(k); // returns black-white imbalance
|
||||
x = badcheck();
|
||||
if (x < y) { // current mask better than previous best?
|
||||
y = x;
|
||||
t = k;
|
||||
}
|
||||
if (t == 7)
|
||||
break; // don't increment i to a void redoing mask
|
||||
qrframe = strinbuf.slice(0); // reset for next pass
|
||||
}
|
||||
if (t != k) // redo best mask - none good enough, last wasn't t
|
||||
applymask(t);
|
||||
|
||||
// add in final mask/ecclevel bytes
|
||||
y = fmtword[t + ((ecclevel - 1) << 3)];
|
||||
// low byte
|
||||
for (k = 0; k < 8; k++, y >>= 1)
|
||||
if (y & 1) {
|
||||
qrframe[(width - 1 - k) + width * 8] = 1;
|
||||
if (k < 6)
|
||||
qrframe[8 + width * k] = 1;
|
||||
else
|
||||
qrframe[8 + width * (k + 1)] = 1;
|
||||
}
|
||||
// high byte
|
||||
for (k = 0; k < 7; k++, y >>= 1)
|
||||
if (y & 1) {
|
||||
qrframe[8 + width * (width - 7 + k)] = 1;
|
||||
if (k)
|
||||
qrframe[(6 - k) + width * 8] = 1;
|
||||
else
|
||||
qrframe[7 + width * 8] = 1;
|
||||
}
|
||||
return qrframe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var _canvas = null;
|
||||
|
||||
var api = {
|
||||
|
||||
get ecclevel() {
|
||||
return ecclevel;
|
||||
},
|
||||
|
||||
set ecclevel(val) {
|
||||
ecclevel = val;
|
||||
},
|
||||
|
||||
get size() {
|
||||
return _size;
|
||||
},
|
||||
|
||||
set size(val) {
|
||||
_size = val
|
||||
},
|
||||
|
||||
get canvas() {
|
||||
return _canvas;
|
||||
},
|
||||
|
||||
set canvas(el) {
|
||||
_canvas = el;
|
||||
},
|
||||
|
||||
getFrame: function(string) {
|
||||
return genframe(string);
|
||||
},
|
||||
//这里的utf16to8(str)是对Text中的字符串进行转码,让其支持中文
|
||||
utf16to8: function(str) {
|
||||
var out, i, len, c;
|
||||
|
||||
out = "";
|
||||
len = str.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
c = str.charCodeAt(i);
|
||||
if ((c >= 0x0001) && (c <= 0x007F)) {
|
||||
out += str.charAt(i);
|
||||
} else if (c > 0x07FF) {
|
||||
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||
} else {
|
||||
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
},
|
||||
/**
|
||||
* 新增$this参数,传入组件的this,兼容在组件中生成
|
||||
*/
|
||||
draw: function(str, canvas, cavW, cavH, cavColor, haveImg, imageUrl, imageSize, $this, cb = function() {}, ecc) {
|
||||
var that = this;
|
||||
ecclevel = ecc || ecclevel;
|
||||
canvas = canvas || _canvas;
|
||||
if (!canvas) {
|
||||
console.warn('No canvas provided to draw QR code in!')
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let pre_background = "#ffffff";
|
||||
var size = Math.min(cavW, cavH);
|
||||
str = that.utf16to8(str); //增加中文显示
|
||||
|
||||
var frame = that.getFrame(str);
|
||||
// 组件中生成qrcode需要绑定this
|
||||
var ctx = uni.createCanvasContext(canvas, $this);
|
||||
var px = Math.round(size / (width ));
|
||||
|
||||
var roundedSize = px * (width);
|
||||
// var px = 1 ;
|
||||
// var roundedSize = px * (width + 8) ;
|
||||
|
||||
//var roundedSize = 0 ;
|
||||
//var offset = Math.floor((size - roundedSize) / 2);
|
||||
var offset = 0 ;
|
||||
size = roundedSize;
|
||||
//ctx.clearRect(0, 0, cavW, cavW);
|
||||
ctx.setFillStyle(pre_background)
|
||||
ctx.fillRect(0, 0, cavW, cavW);
|
||||
ctx.setFillStyle(cavColor);
|
||||
for (var i = 0; i < width; i++) {
|
||||
for (var j = 0; j < width; j++) {
|
||||
if (frame[j * width + i]) {
|
||||
ctx.fillRect(px * ( i) + offset, px * ( j) + offset, px, px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//画图片
|
||||
if (haveImg) {
|
||||
try {
|
||||
var x = Number(((cavW - imageSize - 14) / 2).toFixed(2));
|
||||
var y = Number(((cavH - imageSize -14) / 2).toFixed(2));
|
||||
drawRoundedRect(ctx, x, y, imageSize, imageSize, imageSize / 2, 6, true, true)
|
||||
|
||||
let isNetImg = false;
|
||||
|
||||
isNetImg = imageUrl.substr(0, 4) == 'http' ? true : false;
|
||||
|
||||
if (isNetImg) {
|
||||
//网络图片下载到本地
|
||||
uni.getImageInfo({
|
||||
src: imageUrl,
|
||||
success: function(res) {
|
||||
ctx.drawImage(res.path, x, y, imageSize, imageSize);
|
||||
//--增加绘制完成回调
|
||||
ctx.draw(false, function() {
|
||||
cb();
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ctx.drawImage(imageUrl, x, y, imageSize, imageSize);
|
||||
//--增加绘制完成回调
|
||||
ctx.draw(false, function() {
|
||||
cb();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 画圆角矩形
|
||||
function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) {
|
||||
ctxi.setLineWidth(lineWidth);
|
||||
ctxi.setFillStyle(pre_background);
|
||||
ctxi.setStrokeStyle(pre_background);
|
||||
ctxi.beginPath(); // draw top and top right corner
|
||||
ctxi.moveTo(x + r, y);
|
||||
ctxi.arcTo(x + width, y, x + width, y + r, r); // draw right side and bottom right corner
|
||||
ctxi.arcTo(x + width, y + height, x + width - r, y + height, r); // draw bottom and bottom left corner
|
||||
ctxi.arcTo(x, y + height, x, y + height - r, r); // draw left and top left corner
|
||||
ctxi.arcTo(x, y, x + r, y, r);
|
||||
ctxi.closePath();
|
||||
if (fill) {
|
||||
ctxi.fill();
|
||||
}
|
||||
if (stroke) {
|
||||
ctxi.stroke();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
} else {
|
||||
//--增加绘制完成回调
|
||||
ctx.draw(false, function() {
|
||||
cb();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
api
|
||||
}
|
||||
})();
|
|
@ -1,424 +0,0 @@
|
|||
//Core code comes from https://github.com/davidshimjs/qrcodejs
|
||||
|
||||
var QRCode;
|
||||
|
||||
(function () {
|
||||
/**
|
||||
* Get the type by string length
|
||||
*
|
||||
* @private
|
||||
* @param {String} sText
|
||||
* @param {Number} nCorrectLevel
|
||||
* @return {Number} type
|
||||
*/
|
||||
function _getTypeNumber(sText, nCorrectLevel) {
|
||||
var nType = 1;
|
||||
var length = _getUTF8Length(sText);
|
||||
|
||||
for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
|
||||
var nLimit = 0;
|
||||
|
||||
switch (nCorrectLevel) {
|
||||
case QRErrorCorrectLevel.L:
|
||||
nLimit = QRCodeLimitLength[i][0];
|
||||
break;
|
||||
case QRErrorCorrectLevel.M:
|
||||
nLimit = QRCodeLimitLength[i][1];
|
||||
break;
|
||||
case QRErrorCorrectLevel.Q:
|
||||
nLimit = QRCodeLimitLength[i][2];
|
||||
break;
|
||||
case QRErrorCorrectLevel.H:
|
||||
nLimit = QRCodeLimitLength[i][3];
|
||||
break;
|
||||
}
|
||||
|
||||
if (length <= nLimit) {
|
||||
break;
|
||||
} else {
|
||||
nType++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nType > QRCodeLimitLength.length) {
|
||||
throw new Error("Too long data");
|
||||
}
|
||||
|
||||
return nType;
|
||||
}
|
||||
|
||||
function _getUTF8Length(sText) {
|
||||
var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
|
||||
return replacedText.length + (replacedText.length != sText ? 3 : 0);
|
||||
}
|
||||
|
||||
function QR8bitByte(data) {
|
||||
this.mode = QRMode.MODE_8BIT_BYTE;
|
||||
this.data = data;
|
||||
this.parsedData = [];
|
||||
|
||||
// Added to support UTF-8 Characters
|
||||
for (var i = 0, l = this.data.length; i < l; i++) {
|
||||
var byteArray = [];
|
||||
var code = this.data.charCodeAt(i);
|
||||
|
||||
if (code > 0x10000) {
|
||||
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
|
||||
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
|
||||
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[3] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x800) {
|
||||
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
|
||||
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[2] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x80) {
|
||||
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
|
||||
byteArray[1] = 0x80 | (code & 0x3F);
|
||||
} else {
|
||||
byteArray[0] = code;
|
||||
}
|
||||
|
||||
this.parsedData.push(byteArray);
|
||||
}
|
||||
|
||||
this.parsedData = Array.prototype.concat.apply([], this.parsedData);
|
||||
|
||||
if (this.parsedData.length != this.data.length) {
|
||||
this.parsedData.unshift(191);
|
||||
this.parsedData.unshift(187);
|
||||
this.parsedData.unshift(239);
|
||||
}
|
||||
}
|
||||
|
||||
QR8bitByte.prototype = {
|
||||
getLength: function (buffer) {
|
||||
return this.parsedData.length;
|
||||
},
|
||||
write: function (buffer) {
|
||||
for (var i = 0, l = this.parsedData.length; i < l; i++) {
|
||||
buffer.put(this.parsedData[i], 8);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// QRCodeModel
|
||||
function QRCodeModel(typeNumber, errorCorrectLevel) {
|
||||
this.typeNumber = typeNumber;
|
||||
this.errorCorrectLevel = errorCorrectLevel;
|
||||
this.modules = null;
|
||||
this.moduleCount = 0;
|
||||
this.dataCache = null;
|
||||
this.dataList = [];
|
||||
}
|
||||
QRCodeModel.prototype = {
|
||||
addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) {
|
||||
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); }
|
||||
return this.modules[row][col];
|
||||
}, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) {
|
||||
this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } }
|
||||
this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); }
|
||||
if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); }
|
||||
this.mapData(this.dataCache, maskPattern);
|
||||
}, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () {
|
||||
var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } }
|
||||
return pattern;
|
||||
}, createMovieClip: function (target_mc, instance_name, depth) {
|
||||
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } }
|
||||
return qr_mc;
|
||||
}, setupTimingPattern: function () {
|
||||
for (var r = 8; r < this.moduleCount - 8; r++) {
|
||||
if (this.modules[r][6] != null) { continue; }
|
||||
this.modules[r][6] = (r % 2 == 0);
|
||||
}
|
||||
for (var c = 8; c < this.moduleCount - 8; c++) {
|
||||
if (this.modules[6][c] != null) { continue; }
|
||||
this.modules[6][c] = (c % 2 == 0);
|
||||
}
|
||||
}, setupPositionAdjustPattern: function () {
|
||||
var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) {
|
||||
for (var j = 0; j < pos.length; j++) {
|
||||
var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; }
|
||||
for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } }
|
||||
}
|
||||
}
|
||||
}, setupTypeNumber: function (test) {
|
||||
var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; }
|
||||
for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; }
|
||||
}, setupTypeInfo: function (test, maskPattern) {
|
||||
var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } }
|
||||
for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } }
|
||||
this.modules[this.moduleCount - 8][8] = (!test);
|
||||
}, mapData: function (data, maskPattern) {
|
||||
var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) {
|
||||
if (col == 6) col--; while (true) {
|
||||
for (var c = 0; c < 2; c++) {
|
||||
if (this.modules[row][col - c] == null) {
|
||||
var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); }
|
||||
var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; }
|
||||
this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; }
|
||||
}
|
||||
}
|
||||
row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
QRCodeModel.PAD0 = 0xEC;
|
||||
QRCodeModel.PAD1 = 0x11;
|
||||
QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) {
|
||||
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); }
|
||||
var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; }
|
||||
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
||||
throw new Error("code length overflow. ("
|
||||
+ buffer.getLengthInBits()
|
||||
+ ">"
|
||||
+ totalDataCount * 8
|
||||
+ ")");
|
||||
}
|
||||
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); }
|
||||
while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); }
|
||||
while (true) {
|
||||
if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
|
||||
buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
|
||||
buffer.put(QRCodeModel.PAD1, 8);
|
||||
}
|
||||
return QRCodeModel.createBytes(buffer, rsBlocks);
|
||||
};
|
||||
QRCodeModel.createBytes = function (buffer, rsBlocks) {
|
||||
var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) {
|
||||
var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; }
|
||||
offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; }
|
||||
}
|
||||
var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; }
|
||||
var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } }
|
||||
for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } }
|
||||
return data;
|
||||
};
|
||||
var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 };
|
||||
var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 };
|
||||
var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 };
|
||||
var QRUtil = {
|
||||
PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) {
|
||||
var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); }
|
||||
return ((data << 10) | d) ^ QRUtil.G15_MASK;
|
||||
}, getBCHTypeNumber: function (data) {
|
||||
var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); }
|
||||
return (data << 12) | d;
|
||||
}, getBCHDigit: function (data) {
|
||||
var digit = 0; while (data != 0) { digit++; data >>>= 1; }
|
||||
return digit;
|
||||
}, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) {
|
||||
var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); }
|
||||
return a;
|
||||
}, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) {
|
||||
var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) {
|
||||
for (var col = 0; col < moduleCount; col++) {
|
||||
var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) {
|
||||
if (row + r < 0 || moduleCount <= row + r) { continue; }
|
||||
for (var c = -1; c <= 1; c++) {
|
||||
if (col + c < 0 || moduleCount <= col + c) { continue; }
|
||||
if (r == 0 && c == 0) { continue; }
|
||||
if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; }
|
||||
}
|
||||
}
|
||||
if (sameCount > 5) { lostPoint += (3 + sameCount - 5); }
|
||||
}
|
||||
}
|
||||
for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } }
|
||||
for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } }
|
||||
for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } }
|
||||
var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } }
|
||||
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint;
|
||||
}
|
||||
};
|
||||
var QRMath = {
|
||||
glog: function (n) {
|
||||
if (n < 1) { throw new Error("glog(" + n + ")"); }
|
||||
return QRMath.LOG_TABLE[n];
|
||||
}, gexp: function (n) {
|
||||
while (n < 0) { n += 255; }
|
||||
while (n >= 256) { n -= 255; }
|
||||
return QRMath.EXP_TABLE[n];
|
||||
}, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256)
|
||||
}; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; }
|
||||
for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; }
|
||||
for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; }
|
||||
function QRPolynomial(num, shift) {
|
||||
if (num.length == undefined) { throw new Error(num.length + "/" + shift); }
|
||||
var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; }
|
||||
this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; }
|
||||
}
|
||||
QRPolynomial.prototype = {
|
||||
get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) {
|
||||
var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } }
|
||||
return new QRPolynomial(num, 0);
|
||||
}, mod: function (e) {
|
||||
if (this.getLength() - e.getLength() < 0) { return this; }
|
||||
var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); }
|
||||
for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); }
|
||||
return new QRPolynomial(num, 0).mod(e);
|
||||
}
|
||||
};
|
||||
function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; }
|
||||
QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
|
||||
QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
|
||||
var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); }
|
||||
var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } }
|
||||
return list;
|
||||
};
|
||||
QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } };
|
||||
function QRBitBuffer() { this.buffer = []; this.length = 0; }
|
||||
QRBitBuffer.prototype = {
|
||||
get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) {
|
||||
var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); }
|
||||
if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); }
|
||||
this.length++;
|
||||
}
|
||||
};
|
||||
var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
|
||||
|
||||
// QRCode object
|
||||
QRCode = function (canvasId, vOption) {
|
||||
this._htOption = {
|
||||
width: 256,
|
||||
height: 256,
|
||||
typeNumber: 4,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRErrorCorrectLevel.H
|
||||
};
|
||||
|
||||
if (typeof vOption === 'string') {
|
||||
vOption = {
|
||||
text: vOption
|
||||
};
|
||||
}
|
||||
|
||||
// Overwrites options
|
||||
if (vOption) {
|
||||
for (var i in vOption) {
|
||||
this._htOption[i] = vOption[i];
|
||||
}
|
||||
}
|
||||
|
||||
this._oQRCode = null;
|
||||
this.canvasId = canvasId
|
||||
|
||||
if (this._htOption.text && this.canvasId) {
|
||||
this.makeCode(this._htOption.text);
|
||||
}
|
||||
};
|
||||
|
||||
QRCode.prototype.makeCode = function (sText) {
|
||||
this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
|
||||
this._oQRCode.addData(sText);
|
||||
this._oQRCode.make();
|
||||
this.makeImage();
|
||||
};
|
||||
|
||||
QRCode.prototype.makeImage = function () {
|
||||
var _oContext
|
||||
if (this._htOption.usingIn) {
|
||||
_oContext = wx.createCanvasContext(this.canvasId, this._htOption.usingIn)
|
||||
}
|
||||
else {
|
||||
_oContext = wx.createCanvasContext(this.canvasId)
|
||||
}
|
||||
var _htOption = this._htOption;
|
||||
var oQRCode = this._oQRCode
|
||||
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = _htOption.width / nCount;
|
||||
var nHeight = _htOption.height / nCount;
|
||||
var nRoundedWidth = Math.round(nWidth);
|
||||
var nRoundedHeight = Math.round(nHeight);
|
||||
|
||||
if (_htOption.image && _htOption.image != '') {
|
||||
_oContext.drawImage(_htOption.image, 0, 0, _htOption.width, _htOption.height)
|
||||
}
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
var bIsDark = oQRCode.isDark(row, col);
|
||||
var nLeft = col * nWidth;
|
||||
var nTop = row * nHeight;
|
||||
_oContext.setStrokeStyle(bIsDark ? _htOption.colorDark : _htOption.colorLight)
|
||||
// _oContext.setStrokeStyle('yellow')
|
||||
_oContext.setLineWidth(1)
|
||||
_oContext.setFillStyle(bIsDark ? _htOption.colorDark : _htOption.colorLight)
|
||||
// _oContext.setFillStyle('red')
|
||||
// if (bIsDark) {
|
||||
_oContext.fillRect(nLeft, nTop, nWidth, nHeight);
|
||||
// }
|
||||
|
||||
// 안티 앨리어싱 방지 처리
|
||||
// if (bIsDark) {
|
||||
_oContext.strokeRect(
|
||||
Math.floor(nLeft) + 0.5,
|
||||
Math.floor(nTop) + 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
|
||||
_oContext.strokeRect(
|
||||
Math.ceil(nLeft) - 0.5,
|
||||
Math.ceil(nTop) - 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
// }
|
||||
// _oContext.fillRect(
|
||||
// Math.floor(nLeft) + 0.5,
|
||||
// Math.floor(nTop) + 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
// _oContext.fillRect(
|
||||
// Math.ceil(nLeft) - 0.5,
|
||||
// Math.ceil(nTop) - 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
// _oContext.clearRect(
|
||||
// Math.floor(nLeft) + 0.5,
|
||||
// Math.floor(nTop) + 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
// _oContext.clearRect(
|
||||
// Math.ceil(nLeft) - 0.5,
|
||||
// Math.ceil(nTop) - 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
_oContext.draw()
|
||||
};
|
||||
|
||||
// 保存为图片,将临时路径传给回调
|
||||
QRCode.prototype.exportImage = function (callback) {
|
||||
if (!callback) {
|
||||
return
|
||||
}
|
||||
wx.canvasToTempFilePath({
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: this._htOption.width,
|
||||
height: this._htOption.height,
|
||||
destWidth: this._htOption.width,
|
||||
destHeight: this._htOption.height,
|
||||
canvasId: this.canvasId,
|
||||
success: function (res) {
|
||||
// console.log(res.tempFilePath)
|
||||
callback(res.tempFilePath)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
QRCode.CorrectLevel = QRErrorCorrectLevel;
|
||||
})();
|
||||
|
||||
module.exports = QRCode
|
|
@ -41,11 +41,8 @@
|
|||
action: 'ask',
|
||||
id: 0
|
||||
}).then(res => {}, error => {})
|
||||
let maiOjb = {
|
||||
e: 5, //内容咨询
|
||||
t: new Date().getTime() //当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb);
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(5);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,162 +0,0 @@
|
|||
<template>
|
||||
<view @touchmove.stop.prevent="moveHandle" v-if="vision" class="auth-box">
|
||||
<view>
|
||||
<view class="auth-top">
|
||||
<image :src="appletImg" mode=""></image>
|
||||
<view class="auth-top-content">
|
||||
<view>恒美植发客服代表提醒您:</view>
|
||||
<view>您当前是游客身份</view>
|
||||
<view>是否选择授权登录</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="auth-center">申请 获取你的昵称、头像、地区及性别</view>
|
||||
<view class="auth-bottom">
|
||||
<view @tap="chooseBtn(0)" :class="isNo?'isNyin':'noyin'" class="btn btn-no">暂不授权</view>
|
||||
<view @tap="chooseBtn(1)" :class="isOk?'isOyin':'noyin'" class="btn btn-yes">
|
||||
<text>立即授权</text>
|
||||
<button open-type="getUserInfo" @tap="shouq" class="auth-btn">立即授权</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"empower",
|
||||
props:{
|
||||
vision:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
appletImg:{//小程序头像
|
||||
type:String,
|
||||
default:'/static/public/like.png'
|
||||
},
|
||||
appletName:{//小程序名称
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
url:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
isWhere:{
|
||||
type:Number,
|
||||
default:0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isOk:false,
|
||||
isNo:false,
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
moveHandle(){
|
||||
return false
|
||||
},
|
||||
tiaoZ(){//跳转方式
|
||||
if(this.isWhere==0) uni.navigateBack({delta:1}) //返回上一页
|
||||
if(this.isWhere==1) uni.navigateTo({url:this.url})//跳转到指定页面
|
||||
if(this.isWhere!=0 && this.isWhere!=1) return//不跳转
|
||||
this.isOk = false
|
||||
},
|
||||
chooseBtn(index){//暂不授权、立即授权
|
||||
this.$emit('cancleEv',index)//继承事件
|
||||
if(index==0){//暂不授权
|
||||
// this.tiaoZ()
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
this.isOk = false
|
||||
} else {
|
||||
this.isOk = !this.isOk
|
||||
this.isNo = false
|
||||
}
|
||||
},
|
||||
shouq(){//立即授权事件
|
||||
let ya = this;
|
||||
this.$toolAll.tools.showToast('正在调起授权...')
|
||||
let code = ''//声明code
|
||||
uni.login({// 获取登录用户code
|
||||
provider: 'weixin',
|
||||
success: function(result) {
|
||||
uni.hideToast()
|
||||
code = result.code
|
||||
},
|
||||
});
|
||||
uni.getUserProfile({//调起微信授权弹框
|
||||
desc: '登录',
|
||||
lang: 'zh_CN',
|
||||
success: (res) => {
|
||||
ya.updateUserInfo(code,res.userInfo)
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('用户拒绝授权');
|
||||
this.tiaoZ()
|
||||
this.$emit('cancleEv',0)
|
||||
this.isOk = false
|
||||
}
|
||||
});
|
||||
},
|
||||
//调用登录接口
|
||||
updateUserInfo(code,userInfo) {
|
||||
let ya = this;
|
||||
uni.showToast({title: '授权中...',icon:'loading',})
|
||||
var params = {
|
||||
code:code,
|
||||
nickname: userInfo.nickName,//用户昵称
|
||||
headimgurl: userInfo.avatarUrl,//用户头像
|
||||
country: userInfo.country,//用户所在国家
|
||||
province: userInfo.province,//用户所在省份
|
||||
city: userInfo.city,//用户所在城市
|
||||
gender: userInfo.gender,//用户性别
|
||||
language:userInfo.language,//语言
|
||||
is_active:1
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
uni.setStorageSync('params',params)
|
||||
uni.setStorageSync('userId',res.data.account_id)
|
||||
uni.setStorageSync('token',res.data.token)//缓存token
|
||||
uni.setStorageSync('expire',res.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('phone_active',res.data.phone_active)//是否绑定手机号
|
||||
uni.setStorageSync('invite_code',res.data.invite_code)
|
||||
ya.successAfterEv(userInfo)
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
successAfterEv(userInfo){//缓存信息
|
||||
let ya = this
|
||||
uni.hideToast()
|
||||
// console.log(uni.getStorageSync('headImg'));
|
||||
ya.$toolAll.tools.showToast('授权成功','success')
|
||||
ya.$emit('cancleEv',0)
|
||||
ya.$emit('buttonH',true)
|
||||
if(ya.url!=''){
|
||||
setTimeout(()=>{uni.navigateTo({url:ya.url})},1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.auth-box {position: fixed;top: 0;right: 0;left: 0;bottom: 0;display: flex;justify-content: center;align-items: center;z-index: 3;}
|
||||
.auth-box > view {background-color: #FFFFFF;border-radius: 10rpx;padding: 30rpx;box-shadow: 0rpx 0rpx 20rpx rgba(0,0,0,.5);margin: 0 100rpx;}
|
||||
.auth-top {display: flex;}
|
||||
.auth-top image {width: 96rpx;height: 96rpx;flex-shrink: 0;}
|
||||
.auth-top-content {margin-left: 20rpx;}
|
||||
.auth-top-content view {font-size: 28rpx;margin-top: 20rpx;color: #999999;}
|
||||
.auth-top-content view:nth-child(1) {font-size: 30rpx;font-weight: bold;margin-top: 0;}
|
||||
.auth-center {font-size: 28rpx;margin: 30rpx 0;border-bottom: 1rpx solid #F5F5F5;border-top: 1rpx solid #F5F5F5;padding: 20rpx 0;}
|
||||
.auth-bottom {display: flex;justify-content: center;align-items: center;font-size: 24rpx;}
|
||||
.btn {padding: 12rpx 40rpx;border-radius: 4rpx;}
|
||||
.btn-no {color: #07ad60;background-color: #FFFFFF;border: 1rpx solid #CCCCCC;}
|
||||
.btn-yes {color: #FFFFFF;background-color: #07ad60;border: 1rpx solid #07ad60;position: relative;margin-left: 20rpx;}
|
||||
.auth-btn {position: absolute;top: 0;left: 0;right: 0;bottom: 0;opacity: 0;}
|
||||
.isNyin{box-shadow: 0rpx 3rpx 6rpx rgba(0,0,0,.5);}
|
||||
.isOyin{box-shadow: 0rpx 3rpx 6rpx rgba(0,0,0,1);}
|
||||
</style>
|
|
@ -30,16 +30,10 @@
|
|||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :comfrimVal="'好的'" :contentVal="'暂未开放此功能,请耐心等候'"
|
||||
:isCenter="true" @comfirmev="comfirmev"></pu-po>
|
||||
<!-- 弹框授权 -->
|
||||
<empower :vision="vision" @cancleEv="cancleEv"></empower>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import empower from '@/components/empower.vue';
|
||||
export default {
|
||||
components:{
|
||||
empower
|
||||
},
|
||||
name:'footTab',
|
||||
props:{
|
||||
newcurrent:{
|
||||
|
@ -87,7 +81,6 @@
|
|||
vision:false,
|
||||
isShowT:false,
|
||||
isKef:true,
|
||||
jieDuan:false
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -98,57 +91,38 @@
|
|||
if(e==0) this.vision = false
|
||||
},
|
||||
choosefoot(index){
|
||||
let existMobile = uni.getStorageSync('phone_active');
|
||||
// this.current = index
|
||||
switch (index){
|
||||
case 0:
|
||||
// console.log(this.imgList[index].selectedIcoPath);
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
break;
|
||||
case 1:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.reLaunch({url:'/pages/tabbar/cate/cate'})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
existMobile!='' ? uni.reLaunch({url:'/pages/tabbar/cate/cate'}) : this.goLogin();
|
||||
break;
|
||||
case 2:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
this.$requst.post('user/rand-bind-service').then(res=>{})
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
// uni.navigateTo({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
if(existMobile!=''){
|
||||
this.$requst.post('user/rand-bind-service').then(res=>{})
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(5);
|
||||
} else this.goLogin()
|
||||
break;
|
||||
case 3:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.reLaunch({url:'/pages/tabbar/shop/shop'})
|
||||
// this.isShowT = true
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
// uni.navigateTo({url:'/pages/tabbar/shop/shop'})
|
||||
existMobile!='' ? uni.reLaunch({url:'/pages/tabbar/shop/shop'}) : this.goLogin();
|
||||
break;
|
||||
case 4:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
// uni.reLaunch({url:'/pages/tabbar/my/my'})
|
||||
uni.reLaunch({url:'/pages/tabbar/my/staffDuan'})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
existMobile!='' ? uni.reLaunch({url:'/pages/tabbar/my/staffDuan'}) : this.goLogin();
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 前往登录页
|
||||
goLogin(){
|
||||
uni.reLaunch({
|
||||
url:'/pages/login/login'
|
||||
})
|
||||
},
|
||||
comfirmev(){
|
||||
this.isShowT = false
|
||||
}
|
||||
|
|
|
@ -6,12 +6,23 @@
|
|||
<view @tap="goDetail(index)" v-if="index%2==0" :class="radiu?'radius15 mar-x10':'radius30 mar-x30'" class="posir colf zou" v-for="(item,index) in list" :key="index">
|
||||
<!-- 背景图 -->
|
||||
<image :class="radiu?'radius15':'radius30'" class=" width100 list-min" :src="item.main_img" mode="widthFix"></image>
|
||||
<view class="posia list-like-box" @tap.stop="chooseLike(index)">
|
||||
<!-- 不喜欢 -->
|
||||
<image v-if="item.is_collected!=1" src="/static/public/no-like.png" mode="aspectFill"></image>
|
||||
<!-- 喜欢 -->
|
||||
<image v-else :class="item.is_collected==1?'bounceIn':'bounceOut'" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
<view class="posia disjbac fon24" :style="{borderRadius: radiu ? '15rpx 15rpx 0 0' : '30rpx 30rpx 0 0',padding:radiu ? '10rpx' : '17rpx 25rpx' }" style="background-color: rgba(56,117,246,.8);top: 0;left: 0;right: 0;">
|
||||
<view @tap.stop="chooseLike(index)" class="disac" style="width: 48%;justify-content: flex-start;">
|
||||
<image :style="{width: radiu ?'30rpx':'40rpx',height: radiu ?'30rpx':'40rpx'}" :src="['/static/public/cnllection-no.png','/static/public/yconllection.png'][item.is_collected]" mode="aspectFill"></image>
|
||||
<view class="mar-z10">{{['收藏','已收藏'][item.is_collected]}}</view>
|
||||
</view>
|
||||
<view style="width: 2rpx;height: 30rpx;background-color: #FFFFFF;"></view>
|
||||
<view @tap.stop="praiseEv(index)" class="disac" style="width: 48%;justify-content: flex-end;">
|
||||
<image :style="{width: radiu ?'30rpx':'40rpx',height: radiu ?'30rpx':'40rpx'}" :src="['/static/public/list-nlike.png','/static/public/detail-like.png'][item.is_liked]" mode="aspectFill"></image>
|
||||
<view class="mar-z10">{{['喜欢',item.likes][item.is_liked]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="posia list-like-box" @tap.stop="chooseLike(index)"> -->
|
||||
<!-- 不喜欢 -->
|
||||
<!-- <image v-if="item.is_collected!=1" src="/static/public/no-like.png" mode="aspectFill"></image> -->
|
||||
<!-- 喜欢 -->
|
||||
<!-- <image v-else :class="item.is_collected==1?'bounceIn':'bounceOut'" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
</view> -->
|
||||
<view v-if="item.main_img!=''" :class="radiu?'list-cont-box15':'list-cont-box'" class="posia fon20">
|
||||
<!-- 视频标题 -->
|
||||
<view class="fon30 bold mar-x10 disac" :style="{fontSize:nFon+'px'}">
|
||||
|
@ -38,12 +49,23 @@
|
|||
<view @tap="goDetail(index)" v-if="index%2!=0" :class="radiu?'radius15 mar-x10':'radius30 mar-x30'" class="posir colf zou" v-for="(item,index) in list" :key="index">
|
||||
<!-- 背景图 -->
|
||||
<image :class="radiu?'radius15':'radius30'" class="width100 list-min" :src="item.main_img" mode="widthFix"></image>
|
||||
<view class="posia list-like-box" @tap.stop="chooseLike(index)">
|
||||
<!-- 不喜欢 -->
|
||||
<image v-if="item.is_collected!=1" src="/static/public/no-like.png" mode="aspectFill"></image>
|
||||
<!-- 喜欢 -->
|
||||
<image v-else :class="item.is_collected==1?'bounceIn':'bounceOut'" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
<view class="posia disjbac fon24" :style="{borderRadius: radiu ? '15rpx 15rpx 0 0' : '30rpx 30rpx 0 0',padding:radiu ? '10rpx' : '17rpx 25rpx'}" style="background-color: rgba(56,117,246,.8);top: 0;left: 0;right: 0;">
|
||||
<view @tap.stop="chooseLike(index)" class="disac" style="width: 48%;justify-content: flex-start;">
|
||||
<image :style="{width: radiu ?'30rpx':'40rpx',height: radiu ?'30rpx':'40rpx'}" :src="['/static/public/cnllection-no.png','/static/public/yconllection.png'][item.is_collected]" mode="aspectFill"></image>
|
||||
<view class="mar-z10">{{['收藏','已收藏'][item.is_collected]}}</view>
|
||||
</view>
|
||||
<view style="width: 2rpx;height: 30rpx;background-color: #FFFFFF;"></view>
|
||||
<view @tap.stop="praiseEv(index)" class="disac" style="width: 48%;justify-content: flex-end;">
|
||||
<image :style="{width: radiu ?'30rpx':'40rpx',height: radiu ?'30rpx':'40rpx'}" :src="['/static/public/list-nlike.png','/static/public/detail-like.png'][item.is_liked]" mode="aspectFill"></image>
|
||||
<view class="mar-z10">{{['喜欢',item.likes][item.is_liked]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="posia list-like-box" @tap.stop="chooseLike(index)"> -->
|
||||
<!-- 不喜欢 -->
|
||||
<!-- <image v-if="item.is_collected!=1" src="/static/public/no-like.png" mode="aspectFill"></image> -->
|
||||
<!-- 喜欢 -->
|
||||
<!-- <image v-else :class="item.is_collected==1?'bounceIn':'bounceOut'" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
</view> -->
|
||||
<view v-if="item.main_img!=''" :class="radiu?'list-cont-box15':'list-cont-box'" class="posia fon20 ">
|
||||
<!-- 视频标题 -->
|
||||
<view class="fon30 bold mar-x10 disac" :style="{fontSize:nFon+'px'}">
|
||||
|
@ -72,17 +94,11 @@
|
|||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :contentVal="pu_content" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 弹框授权 -->
|
||||
<empower :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import empower from '@/components/empower.vue';
|
||||
export default {
|
||||
components:{
|
||||
empower
|
||||
},
|
||||
name:"list-pu",
|
||||
props:{
|
||||
list:{//数据
|
||||
|
@ -127,33 +143,30 @@
|
|||
if(e==0) this.vision = false
|
||||
},
|
||||
goDetail(index){//查看详情
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/problemDetail/problemDetail?id='+this.list[index].id+'&category_id='+this.list[index].category_id
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/problemDetail/problemDetail?id='+this.list[index].id+'&category_id='+this.list[index].category_id
|
||||
})
|
||||
}
|
||||
},
|
||||
chooseLike(index){//喜欢不喜欢事件
|
||||
// console.log('喜欢不喜欢:',index);
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
this.$emit('chooseLike',index)
|
||||
this.current = index
|
||||
if(this.list[index].is_collected==1) {
|
||||
this.isShowT = true
|
||||
} else {
|
||||
let maiOjb = {
|
||||
e:3,//内容收藏
|
||||
c:this.list[index].id,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
} else this.jieDuan = true
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
this.$emit('chooseLike',index)
|
||||
this.current = index
|
||||
if(this.list[index].is_collected==1) {
|
||||
this.isShowT = true
|
||||
} else {
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(3,this.list[index].id);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 点赞事件
|
||||
praiseEv(index){
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
this.$emit('praise',index)
|
||||
this.current = index
|
||||
}
|
||||
},
|
||||
comfirmev(){
|
||||
|
|
|
@ -39,11 +39,8 @@
|
|||
this.$requst.post('user/rand-bind-service').then(res=>{})
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:this.nid}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,13 @@
|
|||
// console.log('状态栏+标题栏:',rect.height);
|
||||
uni.setStorageSync('statusHNH',rect.height)
|
||||
}).exec()
|
||||
|
||||
// 转发进入:获取页面路径
|
||||
let pages = getCurrentPages(); //获取加载的页面
|
||||
let currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
||||
// console.log(currentPage.route,'获取当前页面路径');
|
||||
uni.setStorageSync('url',currentPage.route);
|
||||
console.log(uni.getStorageSync('url'),64);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -63,20 +70,27 @@
|
|||
},
|
||||
methods:{
|
||||
backEvent(){//返回事件
|
||||
if(this.whereCome==0 && uni.getStorageSync('firstTime')==''){
|
||||
if(uni.getStorageSync('outside')*1==6){
|
||||
this.whereCome = uni.getStorageSync('outside')*1;
|
||||
}
|
||||
switch (this.whereCome){
|
||||
case 0:
|
||||
uni.navigateBack({delta:1})
|
||||
break;
|
||||
case 1:
|
||||
case 6:
|
||||
uni.removeStorageSync('outside');
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
} else if(this.whereCome==1){
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
} else if(this.whereCome==2){
|
||||
break;
|
||||
case 2:
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/my/my'
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack({delta:1})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="list.length==0" class="" style="display: flex;flex-direction: column;align-items: center;">
|
||||
<image src="/static/public/nothing.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col3" style="margin-bottom: 60rpx;">暂无内容</view>
|
||||
</view>
|
||||
<view class="list-container">
|
||||
<view id="wf-list" class="list" v-for="(list,listIndex) of viewList" :key="listIndex">
|
||||
<view @tap="goDetail(listIndex,index)" class="item" style="position: relative;" v-for="(item,index) of list.list" :key="index">
|
||||
<image style="border-radius: 30rpx;min-height: 260rpx;" @load="handleViewRender(listIndex,index)" @error="handleViewRender(listIndex,index)" :src="item.main_img" mode="widthFix"></image>
|
||||
<view style="position: absolute;top: 18rpx;right: 18rpx;z-index: 3;" @tap.stop="chooseLike(listIndex,index)">
|
||||
<!-- <image src="/static/public/like.png" style="width: 69rpx;height: 69rpx;border-radius: 100%;" mode=""></image> -->
|
||||
<!-- 不喜欢 -->
|
||||
<image v-if="item.is_collected!=1" style="width: 69rpx;height: 69rpx;border-radius: 100%;" src="/static/public/no-like.png"></image>
|
||||
<!-- 喜欢 -->
|
||||
<image v-if="item.is_collected==1" :class="item.is_collected==1?'bounceIn':'bounceOut'" style="width: 69rpx;height: 69rpx;border-radius: 100%;" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view style="position: absolute;z-index: 1;bottom: 8rpx;color: #FFFFFF;background: -webkit-linear-gradient(bottom,rgba(0,0,0,0.79),rgba(255,255,255,0));width: 100%;padding-top: 100rpx;border-bottom-left-radius: 30rpx;border-bottom-right-radius: 30rpx;">
|
||||
<view style="margin: 20rpx;font-size: 22rpx;line-height: 40rpx;">
|
||||
<view style="display: flex;align-items: center;font-size: 30rpx;">
|
||||
<view class="clips1 mar-y10">{{item.title}}</view>
|
||||
<text v-if="item.isVideo" :style="{fontSize:(nFon-2)+'px',marginLeft:nmarz+'px'}" style="border-radius: 5rpx;padding: 0 6rpx;text-align: center;" class="pbackc flexs fon30">视频</text>
|
||||
</view>
|
||||
<view class="clips1" style="opacity: .7;">{{item.content}}</view>
|
||||
<view style="display: flex;align-items: center;">
|
||||
<image :src="item.head_img" style="width: 28rpx;height: 28rpx;border-radius: 100%;" mode=""></image>
|
||||
<view class="mar-z10" style="opacity: .7;">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<image v-if="item.isVideo" :style="{width:nWidth+'rpx',height:nHeight+'rpx'}" class="posia" style="top: 50%;left: 50%;transform: translate(-50%,-50%);z-index: 3;" src="/static/public/video.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :contentVal="pu_content" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
list:{
|
||||
type:Array, //实际请求获取的列表数据
|
||||
},
|
||||
nWidth:{
|
||||
type:String,
|
||||
default:'120'
|
||||
},
|
||||
nHeight:{
|
||||
type:String,
|
||||
default:'120'
|
||||
},
|
||||
nFon:{
|
||||
type:String,
|
||||
default:'15'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
viewList:[{list:[]},{list:[]}], //展示到视图的列表数据
|
||||
everyNum:2,
|
||||
jieDuan:false,
|
||||
pu_content:'是否需要取消收藏?',
|
||||
isShowT:false,
|
||||
current:{}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
list(oldVal,newVal){
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
comfirmev(){
|
||||
// console.log('取消收藏成功');
|
||||
this.$emit('comfirmev',this.current)
|
||||
this.isShowT = false
|
||||
},
|
||||
cancleev(){
|
||||
// console.log('关闭弹框');
|
||||
this.isShowT = false
|
||||
},
|
||||
chooseLike(index,indext){//喜欢不喜欢事件
|
||||
// console.log('喜欢不喜欢:',index);
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
this.$emit('chooseLike',this.viewList[index].list[indext].id)
|
||||
this.current = this.viewList[index].list[indext].id
|
||||
if(this.viewList[index].list[indext].is_collected==1) {
|
||||
this.isShowT = true
|
||||
} else {
|
||||
let maiOjb = {
|
||||
e:3,//内容收藏
|
||||
c:this.viewList[index].list[indext].id,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
goDetail(index,indext){//查看详情
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
// url:'/pagesB/problemDetail/problemDetail?isCate='+this.list[index].isCate
|
||||
url:'/pagesB/problemDetail/problemDetail?id='+this.viewList[index].list[indext].id+'&category_id='+this.viewList[index].list[indext].category_id
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
init(){
|
||||
this.viewList = [{list:[]},{list:[]}];
|
||||
setTimeout(()=>{
|
||||
this.handleViewRender(0,0)
|
||||
},0)
|
||||
},
|
||||
handleViewRender(x,y){
|
||||
const index = this.viewList.reduce((total,current)=>total + current.list.length,0)
|
||||
if(index>this.list.length-1) {
|
||||
// 加载完成触发事件并返回加载过的图片数
|
||||
return
|
||||
};
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
let listFlag = 0;
|
||||
query.selectAll('#wf-list').boundingClientRect(data => {
|
||||
listFlag = data[0].bottom - data[1].bottom<=0?0:1;
|
||||
this.viewList[listFlag].list.push(this.list[index])
|
||||
}).exec()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if(this.list.length){
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.list-container
|
||||
display flex
|
||||
justify-content space-between
|
||||
align-items:flex-start
|
||||
padding-top 20rpx
|
||||
.list
|
||||
width calc(48%)
|
||||
display flex
|
||||
flex-direction column
|
||||
.item
|
||||
margin-bottom 30rpx
|
||||
image
|
||||
width 100%
|
||||
.desc
|
||||
padding 20rpx
|
||||
font-size 22rpx
|
||||
</style>
|
|
@ -83,23 +83,34 @@ const request = (method, url, options) => {
|
|||
data: dataObj(url, options),
|
||||
header: headers,
|
||||
success: res => {
|
||||
// console.log('反的结果===>',res);
|
||||
console.log('反的结果===>',res);
|
||||
if (res.statusCode == 200) {
|
||||
if (res.data.code == 0) {
|
||||
resolve(res.data)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title:res.data.msg,
|
||||
icon:'none'
|
||||
})
|
||||
resolve(res.data)
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title:'系统错误',
|
||||
icon:'none'
|
||||
})
|
||||
reject(res.data)
|
||||
}
|
||||
},
|
||||
fail: e => {
|
||||
uni.showToast({
|
||||
title:'系统错误',
|
||||
icon:'none'
|
||||
})
|
||||
checkError(e, reject)
|
||||
},
|
||||
complete: rest => {
|
||||
// console.log(rest);
|
||||
!hideLoading && uni.hideToast()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
export default {
|
||||
onShareAppMessage(res) { //发送给朋友
|
||||
return {}
|
||||
return {
|
||||
title: '', // 默认是小程序的名称(可以写slogan等)
|
||||
path: `${uni.getStorageSync('url')}?invite_code=${uni.getStorageSync('invite_code')}` // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
}
|
||||
},
|
||||
onShareTimeline(res) {//分享到朋友圈
|
||||
return {}
|
||||
|
|
247
jsFile/tools.js
|
@ -1,4 +1,4 @@
|
|||
import {buriedPoint,reportBuriedPoint,zhuColor,checkQuan} from './publicAPI.js';
|
||||
import {buriedPoint,reportBuriedPoint,checkQuan} from './publicAPI.js';
|
||||
const tools = {
|
||||
timer:'',
|
||||
// 埋点倒计时
|
||||
|
@ -36,13 +36,11 @@ const tools = {
|
|||
},1000)
|
||||
}
|
||||
},
|
||||
// 关闭埋点倒计时
|
||||
closeTimer(){
|
||||
clearInterval(this.timer)//关闭倒计时
|
||||
clearInterval(this.timer);
|
||||
console.log('倒计时清空了');
|
||||
},
|
||||
zhuColorT(){//调用主色调
|
||||
zhuColor()
|
||||
},
|
||||
// 查券
|
||||
checkQuan(){
|
||||
checkQuan();
|
||||
|
@ -62,7 +60,18 @@ const tools = {
|
|||
buriedPointAll(){//查询埋点类型事件
|
||||
buriedPoint()
|
||||
},
|
||||
maiDian(data){//埋点事件
|
||||
// 种植埋点
|
||||
plantPoint(num, id=''){
|
||||
console.log(num,id,67);
|
||||
let maiOjb = {
|
||||
e: num, //内容访问
|
||||
c: id * 1,
|
||||
t: new Date().getTime() //当前时间戳
|
||||
}
|
||||
this.maiDian(maiOjb);
|
||||
},
|
||||
// 设置埋点数据事件
|
||||
maiDian(data){
|
||||
let maiList = uni.getStorageSync('maiList')
|
||||
// console.log(maiList);
|
||||
if(maiList==''){
|
||||
|
@ -93,23 +102,19 @@ const tools = {
|
|||
hideMPhone(phone){
|
||||
return `${phone.substr(0, 3)}****${phone.substr(7)}`
|
||||
},
|
||||
// 只显示姓,名使用"*"代替
|
||||
// hideName(name,num){//苹果手机运行不起
|
||||
// let hname = ''
|
||||
// let reg = /(?<=.)./g;
|
||||
// if(num==1) hname = name.replace(reg, '*')
|
||||
// if(num==2) hname = `${name.substr(0, 1)}****${name.substr(name.length-1)}`
|
||||
// return hname
|
||||
// },
|
||||
// 显示中文第一个字,其余的使用"*"代替
|
||||
hideName(name,num){
|
||||
let hname = ''
|
||||
hname = `${name.substr(0, 1)}****${name.substr(name.length-1)}`
|
||||
return hname
|
||||
return `${name.substr(0, 1)}****${name.substr(name.length-1)}` || ''
|
||||
},
|
||||
// 整数添加.00,小数就不添加
|
||||
addXiaoShu(num){
|
||||
let str = num.toString();
|
||||
return str.includes('.') ? num : num = num + '.00';
|
||||
if(str.length > 9){
|
||||
str = str*1;
|
||||
str = str.toFixed(2);
|
||||
str = str+'';
|
||||
}
|
||||
return str.includes('.') ? str*1 : str = num + '.00';
|
||||
},
|
||||
// 时间戳===>日期
|
||||
timestampToTime(timestamp) {
|
||||
|
@ -188,7 +193,8 @@ const tools = {
|
|||
duration:newTime
|
||||
})
|
||||
},
|
||||
formatDuring: function(mss) {
|
||||
// 格式化时间
|
||||
formatTime: function(mss) {
|
||||
// let dangTime = Math.round(new Date()/1000)//获取当前时间戳
|
||||
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
@ -198,21 +204,15 @@ const tools = {
|
|||
seconds = seconds < 10 && seconds >= 1 ? ('0' + seconds) : seconds;
|
||||
return hours + ' : ' + minutes + ' : ' + seconds;
|
||||
},
|
||||
escape2Html(str) {//富文本
|
||||
// 富文本转换
|
||||
escape2Html(str) {
|
||||
var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' };
|
||||
return str.replace(/&(lt|gt|nbsp|amp|quot|src);/ig, function (all, t) { return arrEntities[t]; }).replace('<section', '<div').replace(/\<img/g, '<img @tap="pre" style="max-width:100%!important;height:auto" ').replace(/src=\"/g,'src="https://oss.hmzfyy.cn');
|
||||
},
|
||||
setTime(url,title,time){
|
||||
// console.log(url,title,time);
|
||||
if(url=='' && title==''){
|
||||
setTimeout(function(){uni.navigateBack({delta:1,})},time)
|
||||
} else if(title==''){
|
||||
setTimeout(function(){
|
||||
uni.navigateTo({
|
||||
url:url
|
||||
})
|
||||
},time)
|
||||
}
|
||||
return str.replace(/&(lt|gt|nbsp|amp|quot|src);/ig, function (all, t) {
|
||||
return arrEntities[t];
|
||||
})
|
||||
.replace('<section', '<div')
|
||||
.replace(/\<img/g, '<img @tap="pre" style="max-width:100%!important;height:auto" ')
|
||||
.replace(/src=\"/g,'src="https://oss.hmzfyy.cn');
|
||||
},
|
||||
updaX(){//检测小程序版本以及更新小程序
|
||||
// 获取小程序的运行环境、版本号、appId 注意:线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
|
||||
|
@ -242,97 +242,18 @@ const tools = {
|
|||
// console.log('新版本下载失败:',res);
|
||||
})
|
||||
},
|
||||
clearClog(){//去除某环境下的所有console.log()//输出信息
|
||||
// console.log(uni.getSystemInfoSync(),248);
|
||||
// console.log(wx.getAccountInfoSync(),249);
|
||||
// uniapp性能优化
|
||||
// #ifdef APP-PLUS
|
||||
if(uni.getSystemInfoSync().platform != "devtools"){//devtools:开发版 值域为:ios、android、mac(3.1.10+)、windows(3.1.10+)、linux(3.1.10+)
|
||||
console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
// 微信小程序原生API性能优化
|
||||
// #ifdef MP-WEIXIN
|
||||
let hInfo = wx.getAccountInfoSync();
|
||||
// console.log(hInfo.envVersion);//develop:开发版 trial:体验版 release:正式版
|
||||
if(hInfo.miniProgram.envVersion != "develop"){
|
||||
console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
overdue(){//查询过期时间和是否有token,并调用登录事件
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
if((uni.getStorageSync('expire')*1000) - 10000 < timestamp){
|
||||
this.loginEv()
|
||||
} else if(uni.getStorageSync('token')==''){
|
||||
this.loginEv()
|
||||
} else if(uni.getStorageSync('is_active')=='' || uni.getStorageSync('is_active')==0){
|
||||
this.loginEv()
|
||||
}
|
||||
},
|
||||
loginEv(){//执行登录事件
|
||||
let that = this;
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function(res) {
|
||||
if (res.code) {
|
||||
let code = res.code;
|
||||
let obj = uni.getStorageSync('params')
|
||||
var params = {
|
||||
invite_code:'',
|
||||
code:code,
|
||||
nickname: obj.nickname,
|
||||
avatar: obj.avatarUrl,
|
||||
country: obj.country,
|
||||
province: obj.province,
|
||||
city: obj.city,
|
||||
gender: obj.gender,
|
||||
language:obj.language
|
||||
}
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}user/login`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
// "content-type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: res => {
|
||||
if(res.data.data.token!=''){
|
||||
uni.setStorageSync('token',res.data.data.token)//缓存token
|
||||
uni.setStorageSync('openid',res.data.data.openid)//缓存Openid
|
||||
uni.setStorageSync('expire',res.data.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('phone_active',res.data.data.phone_active)//是否绑定手机号
|
||||
uni.setStorageSync('userId',res.data.data.account_id)
|
||||
uni.setStorageSync('invite_code',res.data.data.invite_code)
|
||||
// console.log('is_active',uni.getStorageSync('is_active'));
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
returnAuth(){//是否第一次授权
|
||||
let auth = false
|
||||
// if(uni.getStorageSync('is_active')==0 || uni.getStorageSync('phone_active')==0) {
|
||||
// 判断是否授权,没授权,前往登录页面授权
|
||||
judgeAuth(){
|
||||
let auth = true;
|
||||
if(uni.getStorageSync('phone_active')==0) {
|
||||
// this.showToast('您目前是游客,请授权登录')
|
||||
// setTimeout(()=>{
|
||||
uni.navigateTo({url:'/pages/login/login'})
|
||||
// },1500)
|
||||
uni.navigateTo({url:'/pages/login/login'});
|
||||
auth = false
|
||||
} else {
|
||||
auth = true
|
||||
}
|
||||
return auth
|
||||
},
|
||||
isLogin(){//是否已经登录
|
||||
if(uni.getStorageSync('is_active')!='' && uni.getStorageSync('is_active') !=0 && uni.getStorageSync('phone_active') !=0){
|
||||
this.overdue()
|
||||
}
|
||||
},
|
||||
// 复制内容
|
||||
clickCopy(data){
|
||||
uni.setClipboardData({
|
||||
data: data,
|
||||
|
@ -345,7 +266,8 @@ const tools = {
|
|||
}
|
||||
});
|
||||
},
|
||||
dayTime(endTime,startTime=''){//开启倒计时
|
||||
// 订单开启倒计时
|
||||
dayTime(endTime,startTime=''){
|
||||
let totalSecond = '';
|
||||
// 本地倒计时
|
||||
// if(startTime=='') totalSecond = Math.floor((new Date(endTime).getTime() - new Date().getTime())/1000);
|
||||
|
@ -381,26 +303,95 @@ const tools = {
|
|||
}
|
||||
return newTime;
|
||||
},
|
||||
isVedio(){//是否显示视频内容
|
||||
isVedio(){//是否显示视频相关内容
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}index/base-config`,
|
||||
method: 'get',
|
||||
header: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
// "content-type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: res => {
|
||||
if(res.data.code==0){
|
||||
if(res.data.data.v==0) {
|
||||
uni.setStorageSync('isVedio',false);
|
||||
} else {
|
||||
uni.setStorageSync('isVedio',true);
|
||||
}
|
||||
console.log(uni.getStorageSync('isVedio'));
|
||||
res.data.data.v==0 ? uni.setStorageSync('isVedio',false) : uni.setStorageSync('isVedio',true);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 判断当前环境
|
||||
currentContext(){
|
||||
// #ifdef APP-PLUS
|
||||
if(uni.getSystemInfoSync().platform != "devtools"){//devtools:开发版 值域为:ios、android、mac(3.1.10+)、windows(3.1.10+)、linux(3.1.10+)
|
||||
console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
// 微信小程序原生API性能优化
|
||||
// #ifdef MP-WEIXIN
|
||||
let hInfo = wx.getAccountInfoSync();
|
||||
// console.log(hInfo.envVersion);//develop:开发版 trial:体验版 release:正式版
|
||||
if(hInfo.miniProgram.envVersion == "develop" || hInfo.miniProgram.envVersion == "trial"){
|
||||
// (开发版,体验版)-配置全局域名
|
||||
uni.setStorageSync('hostapi','https://hengmei.scdxtc.cn/api/');
|
||||
} else {
|
||||
// 清除所有输出日志
|
||||
console.log = () =>{};
|
||||
// 正式版-配置全局域名
|
||||
uni.setStorageSync('hostapi','https://hm.hmzfyy.cn/api/');
|
||||
// 开启埋点倒计时
|
||||
this.daoTime();//开启埋点倒计时
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
isLogin(){//是否已经登录
|
||||
if(uni.getStorageSync('phone_active') !=0){
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
// 调用登录事件
|
||||
this.loginEv();
|
||||
}
|
||||
console.log('进入了检测是否登录过期事件');
|
||||
}
|
||||
},
|
||||
// 定义刷新token定时器
|
||||
refreshToken:null,
|
||||
// 刷新token事件
|
||||
refrshTokenEv(){
|
||||
// 清除token定时器
|
||||
clearInterval(this.refreshToken);
|
||||
// 开启定时器
|
||||
this.refreshToken = setInterval(()=>{
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
// 调用登录事件
|
||||
this.loginEv();
|
||||
}
|
||||
},300000)//五分钟执行一次
|
||||
// },5000)//五秒钟执行一次
|
||||
},
|
||||
// 登录事件
|
||||
loginEv(){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {code:res.code}
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}user/login`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
success: res => {
|
||||
if(res.data.data.token!=''){
|
||||
uni.setStorageSync('token',res.data.data.token); // 缓存token
|
||||
uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('phone_active',res.data.data.phone_active); // 是否绑定手机号
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
20
main.js
|
@ -1,27 +1,33 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
|
||||
import statusNav from './components/status-nav.vue';//引入状态栏组件
|
||||
Vue.component('status-nav',statusNav)//全局注册状态栏组件
|
||||
|
||||
import footTab from './components/foot-tab.vue';//引入底部tab组件
|
||||
Vue.component('foot-tab',footTab)//全局注册底部tab组件
|
||||
|
||||
import backTop from './components/backTop.vue';//引入返回顶部组件
|
||||
Vue.component('back-top',backTop)//全局注册返回顶部组件
|
||||
|
||||
import catePu from './components/cate-items/cate-pu.vue';//引入分类组件
|
||||
Vue.component('cate-pu',catePu)//全局注册分类组件
|
||||
|
||||
import listPu from './components/list-pu.vue';//引入视频、图片列表组件
|
||||
Vue.component('list-pu',listPu)//全局注册视频、图片列表组件
|
||||
|
||||
import pupo from './components/pupo.vue';//引入弹框组件
|
||||
Vue.component('pu-po',pupo)//全局注册弹框组件
|
||||
|
||||
import nothingPage from './components/nothing-page.vue'//引入无内容组件
|
||||
Vue.component('nothing-page',nothingPage)//全局注册无内容组件
|
||||
|
||||
import publicCustomer from './components/public-customer.vue'//引入客服组件
|
||||
Vue.component('public-customer',publicCustomer)//全局注册客服组件
|
||||
import authPhone from './components/auth-phone.vue'//引入手机授权组件
|
||||
Vue.component('auth-phone',authPhone)//全局注册手机授权组件
|
||||
import empower from './components/empower.vue'//引入用户授权组件
|
||||
Vue.component('empower',empower)//全局注册用户授权组件
|
||||
import authUserInfoMobile from './components/auth-userInfo-mobile.vue'//引入授权用户信息,授权手机号组件
|
||||
Vue.component('auth-userInfo-mobile',authUserInfoMobile)//全局注册授权用户信息,授权手机号组件
|
||||
|
||||
import authUserInfoMobileInfo from './components/auth/auth-userInfo-mobileInfo.vue'//引入授权用户信息,授权手机号组件
|
||||
Vue.component('auth-userInfo-mobileInfo',authUserInfoMobileInfo)//全局注册授权用户信息,授权手机号组件
|
||||
|
||||
// 全局注册分享事件
|
||||
import share from './jsFile/share.js'
|
||||
Vue.mixin(share)
|
||||
|
@ -33,9 +39,7 @@ Vue.prototype.$toolAll = tools;
|
|||
import requst from '@/jsFile/requst.js'
|
||||
Vue.prototype.$requst = requst;
|
||||
// 域名,专治后台仔没有返回http/https的图片
|
||||
// Vue.prototype.$http = 'https://hm.hmzfyy.cn'
|
||||
Vue.prototype.$http = 'https://oss.hmzfyy.cn';
|
||||
Vue.prototype.$hostapi = 'https://hengmei.scdxtc.cn/api/';
|
||||
|
||||
const {log} = console;
|
||||
Vue.prototype.$log = log
|
||||
|
|
|
@ -57,11 +57,6 @@
|
|||
this.canIGetUserProfile = true;
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
refuse(){//暂不绑定事件
|
||||
this.isShowP=false;
|
||||
|
@ -71,7 +66,6 @@
|
|||
getphonenumber(e){//授权绑定手机号
|
||||
let ya = this;
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
console.log(e);
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
|
@ -81,8 +75,7 @@
|
|||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{})
|
||||
} else {
|
||||
// this.$toolAll.tools.showToast('登录成功','success')
|
||||
// uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
// console.log('取消授权手机号')
|
||||
}
|
||||
},
|
||||
goXie(){
|
||||
|
@ -98,34 +91,24 @@
|
|||
desc: '登录',
|
||||
lang: 'zh_CN',
|
||||
success: (res) => {
|
||||
console.log('res',res);
|
||||
ya.userInfo = res.userInfo;
|
||||
// console.log('可用用户信息:',ya.userInfo);
|
||||
try {
|
||||
ya.login();
|
||||
} catch (e) {}
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
ya.updateUserInfo(res.code);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败!',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: (res) => {}
|
||||
});
|
||||
},
|
||||
login() {
|
||||
let ya = this;
|
||||
// 获取登录用户code
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function(res) {
|
||||
if (res.code) {
|
||||
let code = res.code;
|
||||
ya.updateUserInfo(code);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败!',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
//调用登录接口
|
||||
updateUserInfo(code) {
|
||||
let ya = this;
|
||||
|
@ -146,17 +129,21 @@
|
|||
is_active:1
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
// console.log(res);
|
||||
if(res.data.token!=''){
|
||||
uni.setStorageSync('params',params)
|
||||
uni.setStorageSync('userId',res.data.account_id)
|
||||
uni.setStorageSync('token',res.data.token)//缓存token
|
||||
uni.setStorageSync('expire',res.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('phone_active',res.data.phone_active)//是否第一次授权
|
||||
uni.setStorageSync('invite_code',res.data.invite_code)
|
||||
uni.hideToast()
|
||||
this.isShowP = true;
|
||||
if(res.data.phone_active!=1){
|
||||
this.isShowP = true;
|
||||
} else {
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<view :style="{width:cateW+'px'}" class="flexs" style="height: 10px;"></view>
|
||||
<view v-show="isLoading" class="pad-x260" style="width: 74%;">
|
||||
<!-- 热门推荐 -->
|
||||
<template v-if="ccurrent==0">
|
||||
<template>
|
||||
<!-- 自定义轮播 -->
|
||||
<swiper-pu :bannerList="bannerList" :isplay="isAutoPlay" :newHeight="'154'" :newRadius="'10'" :newBottom="'10'"></swiper-pu>
|
||||
<!-- 自定义二级分类 -->
|
||||
|
@ -25,10 +25,10 @@
|
|||
<!-- 列表 -->
|
||||
<block v-if="!isHot">
|
||||
<view v-if="dataList.length!=0">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :nFon="'14'" :radiu="true" :nmarz="'6'" :nWidth="'90'" :nHeight="'90'" :list="dataList"></list-pu>
|
||||
<list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmev" :nFon="'14'" :radiu="true" :nmarz="'6'" :nWidth="'90'" :nHeight="'90'" :list="dataList"></list-pu>
|
||||
</view>
|
||||
<view v-else style="padding-top: 150rpx;">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
<list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
|
@ -119,7 +119,7 @@
|
|||
</block>
|
||||
</template>
|
||||
<!-- 秃顶种植 -->
|
||||
<template v-if="ccurrent!=0">
|
||||
<!-- <template v-if="ccurrent!=0">
|
||||
<view v-if="tuList.length!=0">
|
||||
<cate-tu :isDetail="true" :list="tuList"></cate-tu>
|
||||
</view>
|
||||
|
@ -127,7 +127,7 @@
|
|||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</template>
|
||||
</template> -->
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
@ -135,8 +135,8 @@
|
|||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='1'></foot-tab>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<auth-userInfo-mobile :optionObj="optionObj"></auth-userInfo-mobile>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -151,7 +151,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
ccurrent:0,
|
||||
cateList:[],
|
||||
|
@ -203,67 +203,62 @@
|
|||
onHide() {
|
||||
this.isAutoPlay = false;
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pages/tabbar/cate/cate?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
this.optionObj = options;
|
||||
this.checkBZ()//调用病种列表事件
|
||||
let maiOjb = {
|
||||
e:7,//进入分类
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(7);
|
||||
this.checkSwi()
|
||||
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkBZ()//调用病种列表事件
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
// console.log(this.category_id);
|
||||
if(this.category_id!='') this.checkCate(this.category_id)//调用左侧列表点击事件
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.isAutoPlay = true;
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
if(this.category_id!='') this.checkCate(this.category_id)//调用左侧列表点击事件
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},error=>{})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkSwi(){
|
||||
|
@ -294,6 +289,16 @@
|
|||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
praiseEv(e){ // 点赞事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_liked==0){
|
||||
this.dataList[e].is_liked = 1;
|
||||
this.dataList[e].likes++;
|
||||
if(this.dataList[e].likes>1000) this.dataList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
|
@ -310,7 +315,8 @@
|
|||
id:item.id,
|
||||
title:item.name,
|
||||
pid:item.pid,
|
||||
sort:item.sort
|
||||
sort:item.sort,
|
||||
children: item.children
|
||||
}
|
||||
this.cateList.push(obj)
|
||||
})
|
||||
|
@ -384,7 +390,9 @@
|
|||
content:item.subtitle,//副标题
|
||||
head_img: fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
isVideo:item.video.includes(".mp4"),//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
this.dataList.push(tObj);
|
||||
})
|
||||
|
@ -431,9 +439,67 @@
|
|||
},
|
||||
chooseCate(index){//分类选中事件
|
||||
this.ccurrent = index
|
||||
this.checkData(this.cateList[index].id)
|
||||
if(this.ccurrent!=0){
|
||||
// this.checkData(this.cateList[index].id);
|
||||
if(this.cateList[index].children.length){
|
||||
this.cateListTwo = []
|
||||
this.cateList[index].children.forEach(item=>{
|
||||
let cateObj = {
|
||||
id:item.id,
|
||||
title:item.name
|
||||
}
|
||||
this.cateListTwo.push(cateObj)
|
||||
})
|
||||
this.cateListTwo.push({title:'筛选'})
|
||||
this.category_id = this.cateListTwo[0].id
|
||||
this.otherEv(this.cateList[index].children[0].id);
|
||||
} else {
|
||||
this.cateListTwo = [];
|
||||
this.dataList = [];
|
||||
}
|
||||
} else {
|
||||
this.checkCate(this.cateListTwo[0].id);
|
||||
}
|
||||
// console.log('分类选中:',index);
|
||||
},
|
||||
otherEv(id){
|
||||
this.$requst.post('archives/disease-second-question',{disease_second_id:id}).then(res=>{
|
||||
// 获取列表
|
||||
if(this.page==1) {
|
||||
this.dataList = [];
|
||||
uni.pageScrollTo({
|
||||
scrollTop:0,
|
||||
duration:0
|
||||
})
|
||||
}
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let fabImg = '';
|
||||
if(item.published_headimgurl!='' && item.published_headimgurl!=null) fabImg = this.$http + item.published_headimgurl;
|
||||
let tObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img: fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4"),//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
this.dataList.push(tObj);
|
||||
})
|
||||
} else {
|
||||
this.dataList = [];
|
||||
}
|
||||
})
|
||||
},
|
||||
chooseTwo(index){//二级分类选择
|
||||
this.newCurrent = index
|
||||
this.isZanw = true;
|
||||
|
@ -449,7 +515,11 @@
|
|||
this.isHot = true;
|
||||
this.checkSotList()
|
||||
} else {
|
||||
this.checkCate(this.cateListTwo[index].id)
|
||||
if(this.ccurrent==0){
|
||||
this.checkCate(this.cateListTwo[index].id)
|
||||
} else {
|
||||
this.otherEv(this.cateListTwo[index].id);
|
||||
}
|
||||
}
|
||||
},
|
||||
checkSotList(){
|
||||
|
|
|
@ -81,8 +81,8 @@
|
|||
</view>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='4'></foot-tab>
|
||||
<!-- 弹框授权 -->
|
||||
<empower :vision="vision" @cancleEv="cancleEv"></empower>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<view v-if="isQian" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);">
|
||||
<view style="padding: 20rpx 40rpx;background-color: rgba(0,0,0,.6);color: #FFFFFF;border-radius: 6rpx;">签到成功</view>
|
||||
</view>
|
||||
|
@ -91,10 +91,8 @@
|
|||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
import {checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{empower},
|
||||
data() {
|
||||
return {
|
||||
vision:false,
|
||||
|
|
|
@ -150,20 +150,18 @@
|
|||
<view v-if="isQian" class="sigin-box">
|
||||
<view>{{contentVal}}</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<auth-userInfo-mobile :optionObj="optionObj"></auth-userInfo-mobile>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
import {checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{empower},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
tongList:[
|
||||
{num:'0',title:'我的积分'},
|
||||
|
@ -229,7 +227,6 @@
|
|||
customerInfo:'',
|
||||
times:0,
|
||||
openSettingBtnHidden: true,//是否授权
|
||||
optionObj:{},
|
||||
}
|
||||
},
|
||||
onUnload: function() {
|
||||
|
@ -240,61 +237,58 @@
|
|||
onShow() {
|
||||
uni.removeStorageSync('uinfo')//清空用户缓存信息
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkInfo();
|
||||
uni.removeStorageSync('shareAll')//清空分享中心里的统计信息
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
setTimeout(()=>{
|
||||
this.checkInfo();
|
||||
},6000)
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},error=>{})
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
// 关闭我的二维码弹框
|
||||
this.closeqr();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pages/tabbar/my/staffDuan?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
this.optionObj = options;
|
||||
uni.setStorageSync('channel',options.channel);
|
||||
if(uni.getStorageSync('gao')==''){
|
||||
const query = wx.createSelectorQuery()
|
||||
|
|
|
@ -62,8 +62,7 @@
|
|||
<cate-pu :activeb="publicColor" :newcateList="ktList" :isMinW="true" :newCurrent="newCurrent*1" @choosecateEv="choosecateEv" :newbmo="'#E0E0E0'"></cate-pu>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<!-- <wfalls-flow @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList" ref="wfalls"></wfalls-flow> -->
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" @praise="praiseEv" :list="dataList"></list-pu>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -87,14 +86,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const {log} = console;
|
||||
import swiperPu from '@/components/swiper-pu.vue';
|
||||
import wfallsFlow from '@/components/wfalls-flow'
|
||||
import {collectionEV,cancleCollectionEV,checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{
|
||||
swiperPu,
|
||||
wfallsFlow
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -131,7 +127,6 @@
|
|||
reNum:0,
|
||||
bannerList:[],//轮播图
|
||||
isAutoPlay:false,
|
||||
jieDuan:false,
|
||||
isNewRenderDone:false ,//锁的作用
|
||||
isQuan:uni.getStorageSync('isQuan'),
|
||||
quanImg:uni.getStorageSync('quanImg'),
|
||||
|
@ -155,39 +150,32 @@
|
|||
onUnload() {
|
||||
this.isAutoPlay = false;
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(6);
|
||||
console.log(`/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}`,156);
|
||||
return {
|
||||
title: '', // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}` // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
uni.setStorageSync('firstTime',1);
|
||||
log('输出的解构')
|
||||
this.checkNet()
|
||||
this.$toolAll.tools.isLogin()
|
||||
let maiOjb = {
|
||||
e:6,//进入首页
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
if(uni.getStorageSync('token')!='' && uni.getStorageSync('chu')=='') {
|
||||
uni.setStorageSync('chu',1)
|
||||
}
|
||||
this.checkKT()//恒美课堂列表
|
||||
// 调用网络检测事件
|
||||
this.checkNet();
|
||||
this.$toolAll.tools.isLogin();
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(6);
|
||||
this.checkKT();//恒美课堂列表
|
||||
this.isAutoPlay = true;
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
let maiOjb = {
|
||||
e:6,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
var shareObj = {
|
||||
title: '成都恒美毛发', // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}` // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(options.source_code!='' && options.source_code!=undefined){
|
||||
if(uni.getStorageSync('token')!='' ) {
|
||||
this.checkUserInfo();
|
||||
}
|
||||
if(uni.getStorageSync('token')=='' || uni.getStorageSync('phone_active')=='' || uni.getStorageSync('phone_active')==0){
|
||||
this.loginEv(options);
|
||||
} else if(options.q!=undefined){
|
||||
}
|
||||
if(options.q!=undefined){
|
||||
// 解码一:unescape("http%3A//www.baidu.com%3Fname%3Dzhang@xiao@jie%26order%3D1");
|
||||
// 解码二:decodeURIComponent("http%3A%2F%2Fwww.baidu.com%3Fname%3Dzhang%40xiao%40jie%26order%3D1")
|
||||
let str = unescape(options.q);
|
||||
|
@ -214,10 +202,6 @@
|
|||
this.$requst.post('user/login',params).then(res => {console.log('调用成功');},error => {})
|
||||
},
|
||||
});
|
||||
} else if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options);
|
||||
} else {
|
||||
this.$toolAll.tools.overdue()
|
||||
}
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.statusHNH').boundingClientRect((rect) => {
|
||||
|
@ -225,8 +209,8 @@
|
|||
uni.setStorageSync('statusHNH',rect.height)
|
||||
this.statusHNH = rect.height
|
||||
}).exec()
|
||||
this.checkBCate();
|
||||
this.checkKey();
|
||||
this.checkBCate();//查询底部导航
|
||||
this.checkKey();//查询热门关键词
|
||||
this.checkSwi();//查询轮播图
|
||||
// this.checkBanner()//调用轮播图查询事件
|
||||
this.$toolAll.tools.buriedPointAll();//查询需要埋点的事件id
|
||||
|
@ -235,11 +219,9 @@
|
|||
this.quanImg= uni.getStorageSync('quanImg');
|
||||
this.quanId = uni.getStorageSync('quanId');
|
||||
},3000)
|
||||
this.checkUserInfo();
|
||||
},
|
||||
methods: {
|
||||
loginEv(option){
|
||||
console.log(option,'option');
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
|
@ -249,29 +231,28 @@
|
|||
source_code:option.source_code || '',
|
||||
channel:option.channel || ''
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {console.log('调用成功');},error => {})
|
||||
console.log(params,234);
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
uni.setStorageSync('phone_active',res.data.phone_active);
|
||||
uni.setStorageSync('invite_code',res.data.invite_code);
|
||||
uni.setStorageSync('token',res.data.token);
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
checkUserInfo(){
|
||||
this.$requst.post('user/info').then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.phone_active!=0){
|
||||
uni.setStorageSync('phone_active',res.data.phone_active);
|
||||
}
|
||||
} else {
|
||||
this.$toolAll.tools.isLogin()
|
||||
if(res.data.phone_active!=0){
|
||||
uni.setStorageSync('phone_active',res.data.phone_active);
|
||||
}
|
||||
})
|
||||
},
|
||||
checkQ(){//查询优惠券
|
||||
this.$requst.post('user/home-coupon').then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.has_coupon==1){
|
||||
this.isQuan = true;
|
||||
this.quanImg = this.$http + res.data.home_coupon.cover;
|
||||
this.quanId = res.data.home_coupon.id;
|
||||
}
|
||||
if(res.data.has_coupon==1){
|
||||
this.isQuan = true;
|
||||
this.quanImg = this.$http + res.data.home_coupon.cover;
|
||||
this.quanId = res.data.home_coupon.id;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -303,20 +284,18 @@
|
|||
// 顶部轮播查询事件
|
||||
checkSwi(){
|
||||
checkBanner({position:'home-banner'}).then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let isVideo = false
|
||||
if(item.type!='img') isVideo = true
|
||||
let banObj = {
|
||||
imgSrc:this.$http + item.src,
|
||||
url:item.url,
|
||||
isVideo:isVideo,
|
||||
poster:this.$http + item.src,
|
||||
}
|
||||
this.bannerList.push(banObj)
|
||||
})
|
||||
}
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let isVideo = false
|
||||
if(item.type!='img') isVideo = true
|
||||
let banObj = {
|
||||
imgSrc:this.$http + item.src,
|
||||
url:item.url,
|
||||
isVideo:isVideo,
|
||||
poster:this.$http + item.src,
|
||||
}
|
||||
this.bannerList.push(banObj)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -353,17 +332,14 @@
|
|||
this.$requst.post('').then(res=>{log('绑定客服:',res);},error=>{})
|
||||
},
|
||||
tapChoose(index){//宫格下的,三张图点击事件
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
let newUrl = ''
|
||||
if(index==0) newUrl = this.gaoone.url
|
||||
if(index==1) newUrl = this.gaotwo.url
|
||||
if(index==2) newUrl = this.gaothree.url
|
||||
uni.navigateTo({
|
||||
url:newUrl
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
let newUrl = ''
|
||||
if(index==0) newUrl = this.gaoone.url
|
||||
if(index==1) newUrl = this.gaotwo.url
|
||||
if(index==2) newUrl = this.gaothree.url
|
||||
uni.navigateTo({
|
||||
url:newUrl
|
||||
})
|
||||
}
|
||||
},
|
||||
checkKey(){//查询热搜关键词事件
|
||||
|
@ -382,69 +358,67 @@
|
|||
checkBCate(){//查询底部事件、八宫格、
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.recommend.length!=0){//宫格
|
||||
res.data.recommend.forEach(item=>{
|
||||
let bcObj = {
|
||||
src:this.$http + item.icon,
|
||||
url:item.link,
|
||||
title:item.name
|
||||
}
|
||||
this.gonggList.push(bcObj)
|
||||
})
|
||||
this.gonggList.push({src:this.$http + res.data.recommendMore,title:'更多'})
|
||||
}
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
}
|
||||
if(res.data.ad.length!=0){//三张图
|
||||
this.gaoone = {
|
||||
imgSrc:this.$http + res.data.ad[0].img,
|
||||
url:res.data.ad[0].link,
|
||||
if(res.data.length!=0){
|
||||
if(res.data.recommend.length!=0){//宫格
|
||||
res.data.recommend.forEach(item=>{
|
||||
let bcObj = {
|
||||
src:this.$http + item.icon,
|
||||
url:item.link,
|
||||
title:item.name
|
||||
}
|
||||
this.gaotwo = {
|
||||
imgSrc:this.$http + res.data.ad[1].img,
|
||||
url:res.data.ad[1].link,
|
||||
}
|
||||
this.gaothree = {
|
||||
imgSrc:this.$http + res.data.ad[2].img,
|
||||
url:res.data.ad[2].link,
|
||||
}
|
||||
}
|
||||
// this.publicColor = res.data.mainColor
|
||||
this.publicColor = uni.getStorageSync('publicColor')
|
||||
this.gonggList.push(bcObj)
|
||||
})
|
||||
this.gonggList.push({src:this.$http + res.data.recommendMore,title:'更多'})
|
||||
}
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
}
|
||||
if(res.data.ad.length!=0){//三张图
|
||||
this.gaoone = {
|
||||
imgSrc:this.$http + res.data.ad[0].img,
|
||||
url:res.data.ad[0].link,
|
||||
}
|
||||
this.gaotwo = {
|
||||
imgSrc:this.$http + res.data.ad[1].img,
|
||||
url:res.data.ad[1].link,
|
||||
}
|
||||
this.gaothree = {
|
||||
imgSrc:this.$http + res.data.ad[2].img,
|
||||
url:res.data.ad[2].link,
|
||||
}
|
||||
}
|
||||
// this.publicColor = res.data.mainColor
|
||||
this.publicColor = uni.getStorageSync('publicColor')
|
||||
}
|
||||
},error=>{})
|
||||
})
|
||||
},
|
||||
checkKT(){//查询恒美小课堂
|
||||
let parmas = {
|
||||
|
@ -454,46 +428,56 @@
|
|||
}
|
||||
this.$requst.post('archives/course',parmas).then(res=>{
|
||||
// log('恒美小课堂列表:',res);
|
||||
if(res.code==0){
|
||||
// 课堂栏目
|
||||
if(res.data.course.length!=0){
|
||||
this.ktList = []
|
||||
res.data.course.forEach(item=>{
|
||||
let lObj = {
|
||||
id:item.id,
|
||||
title:item.title,
|
||||
active:item.active
|
||||
}
|
||||
this.ktList.push(lObj)
|
||||
})
|
||||
}
|
||||
// 课堂列表
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let fabImg = '';
|
||||
if(item.published_headimgurl!='' && item.published_headimgurl!=null) fabImg = this.$http + item.published_headimgurl;
|
||||
let ktObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏数量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//内容标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img: fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
this.dataList.push(ktObj)
|
||||
})
|
||||
}
|
||||
this.isLoading = true
|
||||
// 课堂栏目
|
||||
if(res.data.course.length!=0){
|
||||
this.ktList = []
|
||||
res.data.course.forEach(item=>{
|
||||
let lObj = {
|
||||
id:item.id,
|
||||
title:item.title,
|
||||
active:item.active
|
||||
}
|
||||
this.ktList.push(lObj)
|
||||
})
|
||||
}
|
||||
},error=>{})
|
||||
// 课堂列表
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let fabImg = '';
|
||||
if(item.published_headimgurl!='' && item.published_headimgurl!=null) fabImg = this.$http + item.published_headimgurl;
|
||||
let ktObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏数量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//内容标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img: fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4"),//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
this.dataList.push(ktObj)
|
||||
})
|
||||
}
|
||||
this.isLoading = true
|
||||
})
|
||||
},
|
||||
praiseEv(e){ // 点赞事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_liked==0){
|
||||
this.dataList[e].is_liked = 1;
|
||||
this.dataList[e].likes++;
|
||||
if(this.dataList[e].likes>1000) this.dataList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
|
@ -509,44 +493,15 @@
|
|||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
},
|
||||
// chooseLike(e){//收藏事件
|
||||
// // log(this.dataList[e].is_collected);
|
||||
// let active = ''
|
||||
// this.dataList.forEach((item,index)=>{
|
||||
// if(e==item.id){
|
||||
// active = index
|
||||
// }
|
||||
// })
|
||||
// if(this.dataList[active].is_collected==0){
|
||||
// this.dataList[active].is_collected = 1
|
||||
// // 调用收藏事件
|
||||
// collectionEV({action:'collect',archive_id:e})
|
||||
// }
|
||||
// },
|
||||
// comfirmev(e){//确认取消收藏事件
|
||||
// let active = ''
|
||||
// this.dataList.forEach((item,index)=>{
|
||||
// if(e==item.id){
|
||||
// active = index
|
||||
// }
|
||||
// })
|
||||
// this.dataList[active].is_collected = 0
|
||||
// this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// // 调用取消收藏事件
|
||||
// cancleCollectionEV({action:'collect',archive_id:e})
|
||||
// },
|
||||
chooseGon(index){//宫格事件
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
if(index==(this.gonggList.length-1)){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/cate/cate'
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({url:this.gonggList[index].url})
|
||||
}
|
||||
} else this.jieDuan = true
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
if(index==(this.gonggList.length-1)){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/cate/cate'
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({url:this.gonggList[index].url})
|
||||
}
|
||||
}
|
||||
},
|
||||
choosecateEv(e){//恒美小课堂选择事件
|
||||
|
@ -565,24 +520,24 @@
|
|||
},
|
||||
searchEv(){//搜索事件
|
||||
// log(this.searchVal);
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage?keyWorld='+this.searchVal
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage?keyWorld='+this.searchVal
|
||||
})
|
||||
}
|
||||
},
|
||||
chooseReEv(index){
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage?keyWorld='+this.fwList[index].title
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
if(this.$toolAll.tools.judgeAuth()){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage?keyWorld='+this.fwList[index].title
|
||||
})
|
||||
}
|
||||
},
|
||||
// 前往授权页
|
||||
goAuthPage(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/login/login'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'商城'" :statusBack="false" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义轮播 -->
|
||||
<view :style="{marginTop:statusHNH+'px'}">
|
||||
<swiper-pu :bannerList="bannerList" :isplay="isAutoPlay"></swiper-pu>
|
||||
</view>
|
||||
<!-- 搜索输入框 -->
|
||||
<view class="search-input-box bacf shop-nav-box" :style="{top: statusHNH+'px',position:positionMode}" style="padding-top: 10rpx;left: 0;right: 0;z-index: 3;">
|
||||
<view class="disac pad-zy30 mar-s20">
|
||||
<view class="bacf shop-nav-box" :style="{marginTop:statusHNH+'px'}">
|
||||
<view class="disac pad-zy30 mar-sx20">
|
||||
<!-- 输入框 -->
|
||||
<input class="width100 fon34 radius10" type="text" @confirm="searchEv" v-model="searchVal" placeholder="请输入商品名称"/>
|
||||
<!-- 搜索 -->
|
||||
<view class="flexs mar-z30 radius10 pad-zy40 fon34 colf" @tap="searchEv" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
<!-- 自定义轮播 -->
|
||||
<swiper-pu :bannerList="bannerList" :isplay="isAutoPlay"></swiper-pu>
|
||||
</view>
|
||||
<!-- 搜索输入框 -->
|
||||
<view class="search-input-box bacf shop-nav-box" :style="{top: statusHNH+'px',position:positionMode}" style="padding-top: 10rpx;left: 0;right: 0;z-index: 3;">
|
||||
<!-- 分类标题 -->
|
||||
<view style="background: #FFFFFF;font-size: 24rpx;" class="disjbac pad-zy20 pad-s20">
|
||||
<view v-for="(item,index) in shopCate" @tap="chooseShopCate(index)" :class="activeIndex==index?'activecate':'shopMo'" :style="{background:activeIndex==index?publicColor:'#F2F2F2'}" :key="index"><span>{{item}}</span></view>
|
||||
|
@ -54,7 +54,7 @@
|
|||
<view v-if="isXiao" @tap="isXiao=false" class="moban"></view>
|
||||
<!-- 数据列表 -->
|
||||
<!-- <view v-if="loading" :style="{marginTop:statusHNH+titleHeight+(isClick?52:0)+'px'}"> -->
|
||||
<view v-if="loading" :style="{marginTop:(gaodu==200?titleHeight : 0)+'px'}">
|
||||
<view v-if="loading" :style="{marginTop:(gaodu==242?titleHeight : 0)+'px'}">
|
||||
<view v-if="dataList.length!=0 && search_result" class="pad20 ">
|
||||
<view style="width: 48.6%;float: left;" class="pad-x180">
|
||||
<view v-if="index1%2==0" v-for="(item1,index1) in dataList" :key="index1" class="bacf radius15 mar-x20 animated fadeIn posir" @tap="goPage(item1.id,index1)">
|
||||
|
@ -156,8 +156,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<!-- 弹框授权 -->
|
||||
<auth-userInfo-mobile :optionObj="optionObj"></auth-userInfo-mobile>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -174,7 +174,7 @@
|
|||
return {
|
||||
titleList:[],
|
||||
imgList:[],
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
activeIndex:'-1',
|
||||
shopCate:['全部分类','全部医生','全部活动'],
|
||||
|
@ -221,20 +221,14 @@
|
|||
this.isAutoPlay = true;
|
||||
},
|
||||
onPageScroll(e) {
|
||||
if(e.scrollTop>=200){
|
||||
if(e.scrollTop>=242){
|
||||
this.positionMode = "fixed";
|
||||
this.gaodu = 200;
|
||||
this.gaodu = 242;
|
||||
} else {
|
||||
this.positionMode = "sticky";
|
||||
this.gaodu = 0;
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pages/tabbar/shop/shop?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
this.optionObj = options;
|
||||
// 缓存状态栏+标题栏的高度
|
||||
|
@ -243,54 +237,56 @@
|
|||
// console.log('状态栏+标题栏:',rect.height);
|
||||
this.titleHeight = rect.height;
|
||||
}).exec()
|
||||
this.checkSX();
|
||||
let maiOjb = {
|
||||
e:12,//进入商城
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb);
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(12);
|
||||
|
||||
// 调用查询轮播事件
|
||||
this.checkSwi();
|
||||
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkSX();
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 顶部轮播查询事件
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<auth-userInfo-mobile :optionObj="optionObj"></auth-userInfo-mobile>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isScreenshot:false,
|
||||
upImg:'',
|
||||
|
@ -85,22 +85,15 @@
|
|||
isNum:0,
|
||||
siginVal:'立即签到',
|
||||
partakeVal:'立即完成',
|
||||
optionObj:{},
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkList();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pages/tabbar/shop/shop?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
this.optionObj = options;
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkList();
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {
|
||||
btnEv(index){
|
||||
this.chooseIndex = index;
|
||||
|
|
|
@ -38,12 +38,14 @@
|
|||
<view class="fon28 col3">体验券使用</view>
|
||||
<view class="mar-sx30">
|
||||
<!-- <image :src="tyImg" class="quan-tk-em" style="width: 325rpx;height: 325rpx;" mode="aspectFill"></image> -->
|
||||
<yz-qr ref="qrPath" :text="text" :size="size" :colorDark="colorDark" :colorLight="colorLight"></yz-qr>
|
||||
<yz-qr ref="qrPath" :text="text" :size="sizeq" :colorDark="colorDark" :colorLight="colorLight"></yz-qr>
|
||||
</view>
|
||||
<view class="fon24 col3 mar-s40 mar-x20">工作人员扫码使用体验券</view>
|
||||
<image @tap.stop="closeQuanEv" src="/static/public/closequan.png" class="posia quan-tk-btn" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -55,7 +57,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
chuTop:'',
|
||||
navList:['未使用','已使用','可领取','已过期'],
|
||||
|
@ -70,7 +72,7 @@
|
|||
tyImg:'',//立即使用体验券时,弹框中的img
|
||||
canvasQrPath: '',
|
||||
text: 'hello',
|
||||
size: 162,
|
||||
sizeq: 162,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
timer:null,
|
||||
|
@ -86,7 +88,9 @@
|
|||
// console.log('状态栏+标题栏:',rect);
|
||||
this.chuTop = rect.height;
|
||||
}).exec()
|
||||
this.checkAllList(0);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkAllList(0);
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
this.closeQuanEv();
|
||||
|
|
|
@ -173,10 +173,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -184,7 +182,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isExpress:false,
|
||||
switchQuan:true,
|
||||
|
@ -238,12 +236,8 @@
|
|||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record',{type:'content',action:'share',id:this.orderList[0].id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.orderList[0].id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb);
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(4,this.orderList[0].id);
|
||||
if(ya.addressInfo.share_img==null) ya.addressInfo.share_img = ya.addressInfo.cover;
|
||||
var shareObj = {
|
||||
title: `${ya.orderList[0].title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
|
@ -638,8 +632,6 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.totalEv();
|
||||
}
|
||||
},
|
||||
expressEv(index){//快递自取切换事件
|
||||
|
@ -660,7 +652,7 @@
|
|||
if(this.isNei!=3 && !this.isExpress){//普通商品无运费
|
||||
this.allPrice = this.zanAllPrice - this.youQuan.youPrice - this.delPrice;//合计 = 总价 - 优惠券 - 立减券
|
||||
}
|
||||
this.allPrice = parseInt(this.$toolAll.tools.addXiaoShu(this.allPrice));
|
||||
// this.allPrice = parseInt(this.$toolAll.tools.addXiaoShu(this.allPrice));
|
||||
if(this.isNei ==3 && this.isExpress){//积分商品,有运费
|
||||
this.allPrice = this.zanAllPrice - this.youQuan.youPrice - this.delPrice;//合计 = 总价 - 优惠券 - 立减券 + 快递费
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isSuccess:false,
|
||||
orderList:uni.getStorageSync('orderList'),
|
||||
|
|
|
@ -49,10 +49,8 @@
|
|||
<button class="posia-op" open-type="share"></button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -60,7 +58,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
activeJF:true,
|
||||
dataList:[
|
||||
|
@ -77,8 +75,6 @@
|
|||
isZanw:true,
|
||||
ntype:'in',
|
||||
isHave:false,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
|
@ -90,54 +86,16 @@
|
|||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesA/integralManage/integralManage?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkInfo();
|
||||
this.checkList();
|
||||
}
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkInfo();
|
||||
this.checkList();
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkList(){//查询积分列表
|
||||
this.$requst.post('user/score-log',{page:this.page,size:this.size,type:this.ntype}).then(res=>{
|
||||
if(res.code==0){
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
<pu-po :isShowT="isShowT" :contentVal="'是否取消当前预约?'" :clearVal="'否'" :comfrimVal="'是'" @comfirmev="comfirmev" @cancleev="isShowT=false"></pu-po>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer></public-customer>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -44,7 +46,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
failColor:'#CCCCCC',//失败背景颜色
|
||||
ingColor:'#FFBE4D',//审核中背景颜色
|
||||
|
@ -75,8 +77,10 @@
|
|||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.checkPoint()//调用自主预约列表事件
|
||||
this.$toolAll.tools.showToast('加载中...','loading')
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.$toolAll.tools.showToast('加载中...','loading')
|
||||
this.checkPoint()//调用自主预约列表事件
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkPoint(){//查询自主预约列表事件
|
||||
|
|
|
@ -43,10 +43,8 @@
|
|||
<view class="fon30 bold tc mar-s50 mar-x30" :style="{color:publicColor}">积分兑换</view>
|
||||
</view>
|
||||
<scoreList :dataList="dataList"></scoreList>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -58,8 +56,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
vision:false,
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
huiList:[
|
||||
{src:'/static/public/ru-hui50.png',title:'入会权益',ntype:'membership_interests'},
|
||||
|
@ -71,58 +68,18 @@
|
|||
dataList:[],
|
||||
levelInfo:{},
|
||||
detailInfo:'',//富文本
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesA/member/member?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkList();
|
||||
this.checkInfo();
|
||||
}
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkList();
|
||||
this.checkInfo();
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkInfo(){
|
||||
this.$requst.post('level/index').then(res=>{
|
||||
if(res.code==0){
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- <auth-userInfo-mobile :optionObj="optionObj"></auth-userInfo-mobile> -->
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'写日记'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy20">
|
||||
|
@ -76,18 +75,18 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
import {checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{empower},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
optionObj:'',
|
||||
diary_title:'',//日记标题
|
||||
|
@ -106,19 +105,18 @@
|
|||
imgArr:[],
|
||||
placeholder: '开始输入...'
|
||||
}
|
||||
},
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
onShow() {
|
||||
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
this.diseaseEv();
|
||||
this.chooseEv();
|
||||
// 查询要编辑日记的信息
|
||||
if(options.id!=undefined){
|
||||
this.checkDiaryInfo(options.id);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
// 查询要编辑日记的信息
|
||||
if(options.id!=undefined){
|
||||
this.checkDiaryInfo(options.id);
|
||||
}
|
||||
this.diseaseEv();
|
||||
this.chooseEv();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- <auth-userInfo-mobile :optionObj="optionObj"></auth-userInfo-mobile> -->
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'我的日记'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 160rpx;">
|
||||
|
@ -25,18 +24,18 @@
|
|||
<view class="posixzy pad-sx25">
|
||||
<view @tap="goAddDiary" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">添加日记</view>
|
||||
</view>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
import {checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{empower},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
optionObj:'',
|
||||
dataList:[],
|
||||
|
@ -59,8 +58,10 @@
|
|||
|
||||
},
|
||||
onShow() {
|
||||
console.log(123);
|
||||
this.checkDiaryEv();
|
||||
this.$toolAll.tools.isLogin()
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkDiaryEv();
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
</view>
|
||||
</view>
|
||||
<view @tap.stop="obtainLngLat" class="posixzy address_add" style="bottom: 20rpx;">添加地址</view>
|
||||
<nothing-page v-if="dataList.length==0" :content="'暂无可用地址'"></nothing-page>
|
||||
<view style="margin-top: 50%;">
|
||||
<nothing-page v-if="dataList.length==0" :content="'暂无可用地址'"></nothing-page>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 添加地址、修改地址 -->
|
||||
|
@ -84,6 +86,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -92,7 +96,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[],
|
||||
idEdit:false,
|
||||
|
@ -117,8 +121,10 @@
|
|||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad(options) {
|
||||
this.checkList();
|
||||
this.isWhere = options.isWhere;
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack(index){//返回到订单准备页
|
||||
|
|
|
@ -107,6 +107,8 @@
|
|||
</view>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='-1'></foot-tab>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -118,7 +120,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
chuTop:'',//导航高度
|
||||
activeIndex:'',
|
||||
|
@ -156,20 +158,10 @@
|
|||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
let orderIndex = res.target.dataset.id;
|
||||
this.orderInfo = this.orderList[orderIndex];
|
||||
this.$requst.post('user/record',{type:'content',action:'share',id:this.orderInfo.childrenList[0].spu_id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.orderInfo.childrenList[0].spu_id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb);
|
||||
var shareObj = {
|
||||
title: `${ya.orderInfo.childrenList[0].title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesB/shopDetail/shopDetail?id=${ya.orderInfo.childrenList[0].spu_activity_id}&category_id=0&share_id=${ya.orderInfo.group_id}&invite_code=${uni.getStorageSync('invite_code')}&shareCate=1&checkGrounpId=${ya.orderInfo.childrenList[0].spu_activity_id}&is_activity=1`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ya.orderInfo.childrenList[0].imgSrc//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
title: ``, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesA/myOrder/myOrder?invite_code=${uni.getStorageSync('invite_code')}&index=${this.activeIndex}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ''//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
|
@ -187,16 +179,18 @@
|
|||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkZT(this.activeIndex);
|
||||
this.checkList(this.activeIndex);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkZT(this.activeIndex);
|
||||
this.checkList(this.activeIndex);
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
options.index==undefined ? this.activeIndex = 0 : this.activeIndex = options.index;
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#daoh').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect);
|
||||
this.chuTop = rect.height
|
||||
}).exec()
|
||||
options.index==undefined ? this.activeIndex = 0 : this.activeIndex = options.index;
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
<simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm" themeColor="#007AFF"></simple-address>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -74,7 +76,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
moHead:'/static/public/logo.png',
|
||||
dataList:[
|
||||
|
@ -134,7 +136,6 @@
|
|||
let firstObj = uni.getStorageSync('firstInfo')
|
||||
if(firstObj==''){
|
||||
let obj = uni.getStorageSync('uinfo')
|
||||
console.log(obj);
|
||||
if(obj!='') this.uinfo = obj
|
||||
this.dataList[0].imgSrc = obj.headimgurl//用户头像
|
||||
this.dataList[1].content = obj.nickname//用户昵称
|
||||
|
|
|
@ -55,10 +55,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -66,7 +64,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
activeJF:true,
|
||||
kNum:'',//输入框孔雀币数量
|
||||
|
@ -88,8 +86,6 @@
|
|||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
realPrice:0,//实际的钱
|
||||
limit_price:0//最低限制金额
|
||||
}
|
||||
|
@ -103,54 +99,16 @@
|
|||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesA/peacockCoin/peacockCoin?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkInfo();
|
||||
this.checkList(this.ntype);
|
||||
}
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkInfo();
|
||||
this.checkList(this.ntype);
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
confrimT(){//确定提现事件、
|
||||
this.realPrice = this.whatPrice / this.kqbl * this.kNum;
|
||||
if(this.kNum=='' || this.kNum<=0){
|
||||
|
|
|
@ -37,10 +37,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -54,7 +52,7 @@
|
|||
return {
|
||||
titleList:[],
|
||||
imgList:[],
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
activeIndex:0,
|
||||
shopCate:['综合','最新','兑换量','积分'],
|
||||
|
@ -66,73 +64,31 @@
|
|||
sort_value:'asc',//排序值 asc=升序 desc=降序
|
||||
cishu:0,
|
||||
cartNum:0,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.cartNumEv();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesA/pointsMall/pointsMall?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
// 缓存状态栏+标题栏的高度
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.search-input-box').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect.height);
|
||||
this.titleHeight = rect.height
|
||||
}).exec()
|
||||
this.checkList();
|
||||
let maiOjb = {
|
||||
e:12,//进入商城
|
||||
t:new Date().getTime()//当前时间戳
|
||||
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(12);
|
||||
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkList();
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cartNumEv(){//购物车数量
|
||||
this.$requst.post('order/shopping-cart-count',{type:'score'}).then(res=>{
|
||||
if(res.code==0){
|
||||
|
|
|
@ -76,6 +76,8 @@
|
|||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nright="20"></public-customer>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -83,7 +85,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
timeCurrent:0,
|
||||
dataList:[],//日期
|
||||
|
@ -110,14 +112,15 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad() {
|
||||
this.category = this.xialone[0]
|
||||
this.categoryT = this.xialTwo[0]
|
||||
this.checkZParmas();
|
||||
this.lphone = uni.getStorageSync('phone');
|
||||
// this.$toolAll.tools.weekDate()
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkZParmas();
|
||||
this.lphone = uni.getStorageSync('phone');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
gtimeD(id,gday){
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<view class="order-sy">{{item.sku_name}}</view>
|
||||
</view>
|
||||
<view class="disjbac width100 mar-s10">
|
||||
<view class="order-item-price"><span v-if="item.is_score!=1">¥</span><span v-else>积分:</span>{{item.price}}</view>
|
||||
<view class="order-item-price"><span v-if="item.is_score!=1">¥</span><span v-else>积分:</span>{{item.price}} <span class="fon20 mar-z10" :style="{color:publicColor}" style="font-weight: 400;">{{item.mch_type_text}}</span></view>
|
||||
<view class="fon26 col3 disac bold cart-input-box">
|
||||
<image @tap="deladdEvent(index , 0)" src="/static/public/del.png" mode=""></image>
|
||||
<input type="text" @input="inputNum($event,index)" v-model="item.num"/>
|
||||
|
@ -55,10 +55,8 @@
|
|||
<view @tap="delBtn" v-else class="colf fon28 bold goBuy-btn" style="background: #F85050;">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -66,7 +64,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
showDel:false,
|
||||
startX:'',//开始位置
|
||||
|
@ -80,8 +78,6 @@
|
|||
page:1,
|
||||
size:10,
|
||||
isScore:'',
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
timeout:null
|
||||
}
|
||||
},
|
||||
|
@ -89,21 +85,11 @@
|
|||
this.$toolAll.tools.isLogin();
|
||||
uni.removeStorageSync('orderList');
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesA/shopCart/shopCart?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
options.isScore=='score' ? this.isScore = 'score' : ''
|
||||
this.checkList();
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkList();
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
allPrice(){
|
||||
|
@ -125,36 +111,6 @@
|
|||
}
|
||||
},500)
|
||||
},
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkList(){//查询列表事件
|
||||
this.$requst.post('order/shopping-cart',{page:this.page,size:this.size,type:this.isScore}).then(res=>{
|
||||
if(res.code==0){
|
||||
|
@ -174,7 +130,9 @@
|
|||
num:item.num,
|
||||
isActive:false,
|
||||
is_score:item.is_score,//是否是积分
|
||||
group_id:0//0发起拼团 1参与拼团 2单独购买
|
||||
group_id:0,//0发起拼团 1参与拼团 2单独购买
|
||||
mch_type:item.spu.mch_type,//商品类型
|
||||
mch_type_text:item.spu.mch_type_text//商品类型描述
|
||||
}
|
||||
this.cartList.push(obj)
|
||||
})
|
||||
|
@ -277,16 +235,31 @@
|
|||
})
|
||||
}
|
||||
if(this.cartList.length > 0) {
|
||||
uni.setStorageSync('orderList',this.newList);
|
||||
if(this.newList.length==0){
|
||||
this.$toolAll.tools.showToast('请选择要支付的商品');
|
||||
console.log(this.isAllEqual(this.newList));
|
||||
if(this.isAllEqual(this.newList) || this.newList.length==1){
|
||||
uni.setStorageSync('orderList',this.newList);
|
||||
if(this.newList.length==0){
|
||||
this.$toolAll.tools.showToast('请选择要支付的商品');
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url:`/pagesA/getReadyDan/getReadyDan?isNei=${isNei}`
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url:`/pagesA/getReadyDan/getReadyDan?isNei=${isNei}`
|
||||
})
|
||||
this.$toolAll.tools.showToast('请选择相同类型的商品下单')
|
||||
}
|
||||
}
|
||||
},
|
||||
// 判断数组对象中的某个字段的值是否都相等
|
||||
isAllEqual(array) {
|
||||
if (array.length > 0) {
|
||||
return !array.some(function(value, index) {
|
||||
return value.mch_type !== array[0].mch_type;
|
||||
});
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
goShoptDetail(id,is_activity){
|
||||
// &isIntegral=${this.dataList[index].isIntegral}
|
||||
if(this.isScore=='score'){
|
||||
|
|
|
@ -43,10 +43,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -54,7 +52,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
timeList:[],
|
||||
dataList:[
|
||||
|
@ -67,8 +65,6 @@
|
|||
isZanw:true,
|
||||
isSigin:0,
|
||||
loading:false,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
|
@ -80,54 +76,16 @@
|
|||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesA/signIn/signIn?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.checkTime();
|
||||
this.checkList();
|
||||
},
|
||||
onLoad() {
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkTime();
|
||||
this.checkList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
siginEv(){
|
||||
this.$toolAll.tools.showToast('正在签到...');
|
||||
this.$requst.post('sign/online-singIn').then(res=>{
|
||||
|
@ -177,7 +135,6 @@
|
|||
this.loading = true;
|
||||
},1000)
|
||||
}
|
||||
// console.log(res);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
<!-- <public-customer :nright="20" :nbottom="100"></public-customer> -->
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='-1'></foot-tab>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -74,7 +76,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isShowT:false,
|
||||
category:'',
|
||||
|
@ -94,48 +96,50 @@
|
|||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkCate();
|
||||
this.tphone = uni.getStorageSync('phone');
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkCate();
|
||||
this.tphone = uni.getStorageSync('phone');
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},error=>{})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeCate(e){
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'关于我们'" :whereCome="whereCome*1" :statusTitle="true"></status-nav>
|
||||
<status-nav :titleVal="'关于我们'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy32 pad-x180">
|
||||
<!-- 自定义轮播 -->
|
||||
<view class="mar-s20">
|
||||
|
@ -30,10 +30,8 @@
|
|||
<!-- <public-customer :nbottom="100"></public-customer> -->
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<!-- 底部导航 -->
|
||||
<view class="posixzy">
|
||||
<bottom-tab></bottom-tab>
|
||||
|
@ -52,7 +50,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
cateListTwo:[
|
||||
// {title:'热门问题'},
|
||||
|
@ -78,9 +76,6 @@
|
|||
isZanw:true,
|
||||
bannerList:[],
|
||||
isAutoPlay:false,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
whereCome:0
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
|
@ -97,6 +92,7 @@
|
|||
},
|
||||
onShow() {
|
||||
this.isAutoPlay = true;
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onUnload() {
|
||||
this.isAutoPlay = false;
|
||||
|
@ -104,53 +100,13 @@
|
|||
onHide() {
|
||||
this.isAutoPlay = false;
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/aboutUs/aboutUs?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;this.whereCome = 2;} else {this.$toolAll.tools.isLogin();}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
this.checkAbout(this.category_id)
|
||||
this.checkSwi()
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkAbout(this.category_id)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkSwi(){
|
||||
checkBanner({position:'about-banner'}).then(res=>{
|
||||
if(res.code==0){
|
||||
|
|
|
@ -48,20 +48,17 @@
|
|||
<view @tap="lianK" class="disac posir lianShare" style="background-color: #3875F6; border-top-left-radius: 51rpx;border-bottom-left-radius: 51rpx;">
|
||||
<image src="/static/public/bottom-customer.png" class="mar-zy20" style="width: 47rpx;height: 47rpx;" mode="aspectFill"></image>
|
||||
<view>联系客服</view>
|
||||
<button v-if="haveImg" class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact">客服</button>
|
||||
<button class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact">客服</button>
|
||||
</view>
|
||||
<view @tap="shareEv" class="disac posir lianShare" style="background-color: #38CE51;border-top-right-radius: 51rpx;border-bottom-right-radius: 51rpx;">
|
||||
<view class="disac posir lianShare" style="background-color: #38CE51;border-top-right-radius: 51rpx;border-bottom-right-radius: 51rpx;">
|
||||
<image src="/static/public/bottom-shear.png" style="width: 47rpx;height: 47rpx;margin-left: 15rpx;margin-right: 8rpx;" mode="aspectFill"></image>
|
||||
<view>分享给好友</view>
|
||||
<button v-if="haveImg" class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
<button class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -69,7 +66,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
headImg:'/static/public/like.png',
|
||||
name:'恒美植发',
|
||||
|
@ -78,7 +75,6 @@
|
|||
detailObj:{},//详情
|
||||
content:'',//富文本详情
|
||||
isLoading:false,
|
||||
haveImg:true,
|
||||
detailId:'',//当前关于我们新闻ID
|
||||
invite_code:'',
|
||||
newCurrent:0,
|
||||
|
@ -89,19 +85,13 @@
|
|||
page:1,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record',{type:'content',action:'share',id:this.detailObj.id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.detailObj.id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(4,this.detailObj.id);
|
||||
var shareObj = {
|
||||
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesB/articleDetail/articleDetail?id=${this.detailId}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
|
@ -109,18 +99,16 @@
|
|||
};
|
||||
return shareObj;
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
this.checkDetail(options.id)
|
||||
this.detailId = options.id
|
||||
this.category_id = options.category_id
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin()}
|
||||
console.log(options,'参数');
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkDetail(options.id);
|
||||
this.checkAbout(this.category_id);
|
||||
}
|
||||
this.checkAbout(this.category_id)
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
|
@ -132,36 +120,6 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkAbout(category_id){
|
||||
let params = {
|
||||
category_id:category_id,
|
||||
|
@ -216,59 +174,16 @@
|
|||
url:'/pagesB/articleDetail/articleDetail?id='+this.dataList[index].id +"&category_id="+this.category_id
|
||||
})
|
||||
},
|
||||
moveHandle(){//禁止底层滑动
|
||||
return false
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
// console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.isShowP = false
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success')
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
this.isShowP = false
|
||||
}
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cancleEv(e){//取消授权
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
backHome(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
},
|
||||
lianK(){//客服
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
} else {
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
shareEv(){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
}
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(5);
|
||||
},
|
||||
checkDetail(id){
|
||||
this.$requst.post('archives/detail',{id:id}).then(res=>{
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -16,7 +18,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
imgSrc:'',
|
||||
isBtn:false
|
||||
|
@ -26,7 +28,9 @@
|
|||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkImg()
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkImg()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkImg(){
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</view>
|
||||
<!-- 列表 -->
|
||||
<view class="bacf radius10 pad20 mar-x20 fon28" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="col3 bold">客户信息</view>
|
||||
<view class="col3 bold disjbac">客户信息 <image :src="item.headImg" mode="aspectFill" style="width: 60rpx;height: 60rpx;border-radius: 50%;"></image></view>
|
||||
<view class="mar-sx20 fon24 disjbac col6">
|
||||
<text class="clips1">昵称:{{item.customer_name}}</text>
|
||||
<text class="flexs mar-z20"><text v-if="item.customer_phone!=''">手机号:{{item.customer_phone}}</text><text v-else>暂未绑定手机号</text></text>
|
||||
|
@ -39,10 +39,8 @@
|
|||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -50,7 +48,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[],//数据列表
|
||||
showTop:false,//是否显示返回顶部的箭头
|
||||
|
@ -60,8 +58,6 @@
|
|||
total:'',//总数
|
||||
isZanw:true,
|
||||
ntype:'',//类型 mine=自己绑定的客户 否则是全部
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
|
@ -77,52 +73,14 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/customerCheck/customerCheck?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkList()
|
||||
}
|
||||
this.checkList()
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
searchEv(){//搜索事件
|
||||
if(this.keyword!='') this.ntype = ''
|
||||
this.page = 1
|
||||
|
@ -144,6 +102,7 @@
|
|||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let obj = {
|
||||
headImg:item.headimgurl,//客户头像
|
||||
id:item.account_id,
|
||||
customer_name:item.nickname,
|
||||
customer_phone:item.mobile,
|
||||
|
|
|
@ -37,7 +37,12 @@
|
|||
</view>
|
||||
</view>
|
||||
<!-- 真实姓名 -->
|
||||
<view class="posia col3 fon24 radius10 tc" style="left: 20rpx;bottom: 100rpx;">姓名:{{item.real_name || '暂无'}}</view>
|
||||
<view class="posia col3 fon24 radius10 tc disac" style="left: 20rpx;bottom: 100rpx;">
|
||||
姓名:
|
||||
<input v-if="item.allow" :auto-focus="item.allow" type="text" v-model="realName" style="width: 100rpx;text-align: left;" />
|
||||
<text v-else>{{item.real_name || '暂无'}}</text>
|
||||
<text @tap="updateName(item.id,item.real_name,index)" class="mar-z10 mar-y20 pcol flexs">{{item.updateText}}</text>
|
||||
</view>
|
||||
<!-- 分配客服 -->
|
||||
<!-- <view @tap="fenCustomer(index)" class="posia colf fon24 radius10 tc customer-btn" style="right: 20rpx;top: 80rpx;z-index: 1;" v-if="item.customer=='' || item.customer==null" :style="{background:publicColor}">分配客服</view> -->
|
||||
<view @tap="fenCustomer(index)" class="posia colf fon24 radius10 tc customer-btn" style="right: 20rpx;top: 80rpx;z-index: 1;" v-if="isFen" :style="{background:publicColor}">分配客服</view>
|
||||
|
@ -93,6 +98,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -100,7 +107,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
category:'',
|
||||
dataList:[],
|
||||
|
@ -127,7 +134,8 @@
|
|||
tagIds:[],
|
||||
tagVal:[],
|
||||
tagStr:'',
|
||||
isFen:uni.getStorageSync('isFen')
|
||||
isFen:uni.getStorageSync('isFen'),
|
||||
realName:'',//姓名
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
|
@ -147,15 +155,38 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad() {
|
||||
this.checkKF()//查询客服列表
|
||||
this.checkCL()//客户列表
|
||||
this.checkLY()//渠道来源
|
||||
this.obtainTag();//获取标签列表
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkKF()//查询客服列表
|
||||
this.checkCL()//客户列表
|
||||
this.checkLY()//渠道来源
|
||||
this.obtainTag();//获取标签列表
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 修改客户昵称
|
||||
updateName(id,name,index){
|
||||
if(this.dataList[index].updateText=='修改'){
|
||||
this.dataList.forEach(item=>item.allow=false)
|
||||
this.dataList[index].allow = true;
|
||||
this.dataList[index].updateText = '确认修改';
|
||||
this.realName = name;
|
||||
} else {
|
||||
if(this.dataList[index].real_name != this.realName) {
|
||||
this.$requst.post('user/update-info',{customer_id:id,field:'real_name',value:this.realName}).then(res=>{
|
||||
this.$toolAll.tools.showToast('修改成功');
|
||||
this.dataList.forEach(item=>item.allow=false)
|
||||
this.dataList[index].updateText = '修改';
|
||||
this.checkCL();
|
||||
})
|
||||
} else {
|
||||
this.dataList.forEach(item=>item.allow=false)
|
||||
this.dataList[index].updateText = '修改';
|
||||
}
|
||||
}
|
||||
},
|
||||
// 复制电话号码
|
||||
copyPhone(e){
|
||||
uni.setClipboardData({
|
||||
|
@ -300,7 +331,9 @@
|
|||
source_detail:item.source_detail,
|
||||
tags:item.tag,
|
||||
isTag:!item.tag.includes('员工'),
|
||||
real_name:item.real_name
|
||||
real_name:item.real_name,
|
||||
allow:false,
|
||||
updateText:'修改'
|
||||
}
|
||||
this.dataList.push(cuObj);
|
||||
})
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30">
|
||||
<view class="radius20 fon28 col3 mar-s20">
|
||||
<view class="disac">
|
||||
<view class="disjbac width100 radius10 pad-zy20 xialak bacf">
|
||||
<input class="fon28 width100" @confirm="searchEv" type="text" v-model="keyword" placeholder="请输入问题/病种/医生姓名" placeholder-style="color: #B3B3B3;" />
|
||||
<view class="disjbac width100 radius10 pad-zy20 xialak bacf posir">
|
||||
<input @input="inputSearch" class="fon28 width100" @confirm="searchEv" type="text" v-model="keyword" placeholder="请输入问题/病种/医生姓名" placeholder-style="color: #B3B3B3;" />
|
||||
<scroll-view scroll-y v-if="dataList.length && keyword!='' && isSearch" style="position: absolute; background-color: #FFFFFF;left: 0;top: 32px; max-height: 200rpx;border-radius: 10rpx;border: 1rpx solid #e0e0e0;">
|
||||
<view class="pad-zy20" @tap="chooseName(item.name)" v-for="(item,index) in dataList" :key="index">{{item.name}}</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
|
@ -31,10 +34,8 @@
|
|||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<!-- <public-customer :nbottom="120"></public-customer> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<!-- 底部导航 -->
|
||||
<view class="posixzy">
|
||||
<bottom-tab></bottom-tab>
|
||||
|
@ -52,7 +53,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[
|
||||
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
|
||||
|
@ -67,16 +68,10 @@
|
|||
total:'',//总数
|
||||
isZanw:true,
|
||||
keyword:'',
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
isSearch:false,
|
||||
searchTime:null
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/doctor/doctor?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
|
@ -90,48 +85,12 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin()}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
this.checkDor()
|
||||
this.checkDor();
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkDor(){//查询医生列表事件
|
||||
this.$requst.post('user/doctor-list',{page:this.page,size:this.size,keyword:this.keyword}).then(res=>{
|
||||
// console.log('医生列表:',res);
|
||||
|
@ -166,7 +125,27 @@
|
|||
duration: 300
|
||||
});
|
||||
},
|
||||
chooseName(name){
|
||||
this.keyword = name;
|
||||
this.isSearch = false;
|
||||
this.checkDor();
|
||||
},
|
||||
inputSearch(e){
|
||||
let val = e.target.value;
|
||||
this.dataList = [];
|
||||
clearTimeout(this.searchTime);
|
||||
if(val!=''){
|
||||
this.isSearch = true;
|
||||
this.searchTime = setTimeout(()=>{
|
||||
this.checkDor()
|
||||
},500)
|
||||
} else {
|
||||
this.isSearch = false;
|
||||
this.checkDor();
|
||||
}
|
||||
},
|
||||
searchEv(){
|
||||
this.dataList = [];
|
||||
this.checkDor()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" @choosecateEv="chooseTwo" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mar-zy32 mar-s20" v-if="dataList.length!=0"><list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList"></list-pu></view>
|
||||
<view style="margin-top: 8%;" v-if="dataList.length==0"><list-pu :list="dataList"></list-pu></view>
|
||||
<view class="mar-zy32 mar-s20" v-if="dataList.length!=0"><list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmev" :list="dataList"></list-pu></view>
|
||||
<view style="margin-top: 8%;" v-if="dataList.length==0"><list-pu :list="dataList" @praise="praiseEv"></list-pu></view>
|
||||
</view>
|
||||
<view class="pad-zy20 mar-sx30">
|
||||
<!-- 返回顶部 -->
|
||||
|
@ -52,10 +52,8 @@
|
|||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<!-- <public-customer :nbottom="100"></public-customer> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<!-- 底部导航 -->
|
||||
<view class="posixzy">
|
||||
<bottom-tab></bottom-tab>
|
||||
|
@ -97,8 +95,6 @@
|
|||
isLoading:false,
|
||||
detailInfo:'',
|
||||
peopleJian:'',
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
doctorId:''//医生id
|
||||
}
|
||||
},
|
||||
|
@ -125,51 +121,22 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
this.checkConList(this.category_id)
|
||||
this.$toolAll.tools.isLogin();
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkConList(this.category_id)
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.doctorId = options.doctor_id;
|
||||
this.checkDoD(this.doctorId)
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin()}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#daoh').boundingClientRect((rect) => {
|
||||
this.chuTop = rect.top
|
||||
}).exec()
|
||||
this.doctorId = options.doctor_id;
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkDoD(this.doctorId)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_collected==0){
|
||||
|
@ -178,6 +145,16 @@
|
|||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
praiseEv(e){ // 点赞事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_liked==0){
|
||||
this.dataList[e].is_liked = 1;
|
||||
this.dataList[e].likes++;
|
||||
if(this.dataList[e].likes>1000) this.dataList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
|
@ -228,10 +205,6 @@
|
|||
// 获取列表
|
||||
if(this.page==1) {
|
||||
this.dataList = [];
|
||||
// uni.pageScrollTo({
|
||||
// scrollTop:0,
|
||||
// duration:0
|
||||
// })
|
||||
}
|
||||
this.total = res.data.list.total
|
||||
if(res.data.list.list.length!=0){
|
||||
|
@ -250,7 +223,9 @@
|
|||
content:item.subtitle,//副标题
|
||||
head_img:fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
isVideo:item.video.includes(".mp4"),//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
this.dataList.push(tObj);
|
||||
})
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -41,24 +43,7 @@
|
|||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
searchVal:'',//输入框的值
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[
|
||||
// {
|
||||
// time:'2021-07-15 14:25',
|
||||
// list:[
|
||||
// {is_read:0,title:'系统消息',content:''},
|
||||
// {is_read:0,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// {is_read:0,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// time:'2021-07-10 22:36',
|
||||
// list:[
|
||||
// {is_read:1,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// {is_read:1,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// {is_read:1,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// ]
|
||||
// }
|
||||
],
|
||||
dataList:[],
|
||||
showTop:false,//是否显示返回顶部
|
||||
chuTop:'',
|
||||
isWen:true,
|
||||
|
@ -94,52 +79,54 @@
|
|||
this.chuTop = rect.height
|
||||
}).exec()
|
||||
if(options.index==undefined){this.isWen = false;this.ntype = 'message';}
|
||||
this.checkMsg();
|
||||
let that = this ;
|
||||
wx.showModal({
|
||||
title: '温馨提示',
|
||||
content: '为及时通知到您,需要向您申请消息发送权限,不会骚扰您的生活!',
|
||||
confirmText:"同意",
|
||||
cancelText:"拒绝",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
//调用订阅消息
|
||||
console.log('用户点击确定', '订阅消息授权成功');
|
||||
//调用订阅
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['d0efR-Ga27c6eIvx9mAwJcnAqzhM_Sq68XiFvjvlBJM','eyxvInLLF3L_wmcSQc_O7XLKF7RoGK1dM3OwKj5fHio'],
|
||||
success: (res) => {
|
||||
console.log(res, 'success')
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res, 'fail')
|
||||
},
|
||||
complete: (res) => {
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkMsg();
|
||||
let that = this ;
|
||||
wx.showModal({
|
||||
title: '温馨提示',
|
||||
content: '为及时通知到您,需要向您申请消息发送权限,不会骚扰您的生活!',
|
||||
confirmText:"同意",
|
||||
cancelText:"拒绝",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
//调用订阅消息
|
||||
console.log('用户点击确定', '订阅消息授权成功');
|
||||
//调用订阅
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['d0efR-Ga27c6eIvx9mAwJcnAqzhM_Sq68XiFvjvlBJM','eyxvInLLF3L_wmcSQc_O7XLKF7RoGK1dM3OwKj5fHio'],
|
||||
success: (res) => {
|
||||
console.log(res, 'success')
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res, 'fail')
|
||||
},
|
||||
complete: (res) => {
|
||||
wx.getSetting({
|
||||
withSubscriptions: true,
|
||||
success: (res) => {
|
||||
console.log(res, '获取设置信息')
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(res, 'complete')
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消', '订阅消息授权');
|
||||
///显示第二个弹说明一下
|
||||
wx.showModal({
|
||||
title: '温馨提示',
|
||||
content: '拒绝后您将无法获得及时的消息通知哦',
|
||||
confirmText:"知道了",
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
///点击知道了的后续操作
|
||||
///如跳转首页面
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(res, 'complete')
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消', '订阅消息授权');
|
||||
///显示第二个弹说明一下
|
||||
wx.showModal({
|
||||
title: '温馨提示',
|
||||
content: '拒绝后您将无法获得及时的消息通知哦',
|
||||
confirmText:"知道了",
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
///点击知道了的后续操作
|
||||
///如跳转首页面
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
readMsg(index1,index2){
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" :isCenter="false" :newbmo="'#F2F2F2'" @choosecateEv="chooseTwo" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
<view v-if="dataList.length!=0" class="pad-zy20 pad-s20">
|
||||
<list-pu :radiu="true" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
<list-pu @comfirmev="comfirmev" @praise="praiseEv" :list="dataList"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 50%;">
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/collection.png" style="" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">您还没有收藏,快去收藏吧</view>
|
||||
</view>
|
||||
|
@ -122,10 +122,8 @@
|
|||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -146,9 +144,6 @@
|
|||
cateList:[//所以二级分类
|
||||
|
||||
],
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
category_id:0,//栏目ID
|
||||
chuTop:'',
|
||||
|
@ -159,9 +154,8 @@
|
|||
pu_content:'是否需要取消收藏?',
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
timeList:[],//时间列表
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
collectionTime:null
|
||||
}
|
||||
},
|
||||
|
@ -185,22 +179,13 @@
|
|||
clearInterval(this.collectionTime);
|
||||
},
|
||||
onShow() {
|
||||
this.checkConList(this.category_id);
|
||||
this.shopCollection();
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/myCollection/myCollection?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
this.$toolAll.tools.isLogin()
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkConList(this.category_id);
|
||||
this.shopCollection();
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin()}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#daoh').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect);
|
||||
|
@ -208,34 +193,14 @@
|
|||
}).exec()
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
praiseEv(e){ // 点赞事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_liked==0){
|
||||
this.dataList[e].is_liked = 1;
|
||||
this.dataList[e].likes++;
|
||||
if(this.dataList[e].likes>1000) this.dataList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
shopCollection(index){//查询商品的收藏列表
|
||||
|
@ -383,7 +348,9 @@
|
|||
content:item.subtitle,//副标题
|
||||
head_img: fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
isVideo:item.video.includes(".mp4"),//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
this.dataList.push(tObj);
|
||||
})
|
||||
|
|
|
@ -39,10 +39,8 @@
|
|||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -67,8 +65,6 @@
|
|||
size:20,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
|
@ -83,19 +79,10 @@
|
|||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/mysharer/mysharer?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin()}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
if(uni.getStorageSync('navHeight')==''){
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.navHeight').boundingClientRect((rect) => {
|
||||
|
@ -103,50 +90,23 @@
|
|||
this.navH = rect.height
|
||||
}).exec()
|
||||
}
|
||||
this.checkShare()//查询一二级分享总人数
|
||||
this.checkPeople()//查询分享一二级列表人数
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkShare()//查询一二级分享总人数
|
||||
this.checkPeople()//查询分享一二级列表人数
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkShare(){//查询一二级分享总人数
|
||||
this.$requst.post('user/share-count').then(res=>{
|
||||
// console.log('查询用户的分享统计记录:',res);
|
||||
if(res.code==0){
|
||||
this.cateList[0].num = res.data.user_count.first
|
||||
this.cateList[1].num = res.data.user_count.second
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
checkPeople(){//查询分享一二级列表人数
|
||||
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
|
||||
console.log('查询分享一二级列表人数列表:',res);
|
||||
if(this.flag){
|
||||
this.dataList[1] = [];
|
||||
} else {
|
||||
|
@ -166,7 +126,7 @@
|
|||
})
|
||||
this.total = res.data.total
|
||||
}
|
||||
}
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
|
|
|
@ -109,10 +109,8 @@
|
|||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -124,7 +122,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
loading:false,
|
||||
isExpress:true,
|
||||
|
@ -146,71 +144,37 @@
|
|||
timer:null,
|
||||
daoTime:'',
|
||||
timerDao:null,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
let maiOjb = {
|
||||
e:6,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(6);
|
||||
var shareObj = {
|
||||
title: '成都恒美毛发', // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}}` // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
path: `/pagesB/orderDetail/orderDetail?invite_code=${uni.getStorageSync('invite_code')}` // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onUnload() {
|
||||
this.closeEv();
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin();}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkInfo(options.id);
|
||||
}
|
||||
this.checkInfo(options.id);
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
comeing(coding){
|
||||
this.$requst.post('user/open-one',{order_coding:coding}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('免拼成功');
|
||||
this.checkInfo(this.orderInfo.id);
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
||||
},
|
||||
confirmReceipt(id){//确认收货事件
|
||||
this.$requst.post('order/accepted',{order_id:id}).then(res=>{
|
||||
|
@ -218,7 +182,7 @@
|
|||
this.$toolAll.tools.showToast('收货成功');
|
||||
this.checkInfo(this.orderInfo.id);
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
})
|
||||
}).catch(error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
make(index){
|
||||
this.isHeyan = true;
|
||||
|
@ -237,8 +201,8 @@
|
|||
this.checkInfo(this.orderInfo.id);
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},3000)
|
||||
},
|
||||
closeEv(){
|
||||
|
@ -254,8 +218,8 @@
|
|||
this.$toolAll.tools.showToast('取消订单成功');
|
||||
this.checkInfo(this.orderInfo.id);
|
||||
this.times = 0;
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
} else {
|
||||
setTimeout(()=>{
|
||||
this.times = 0;
|
||||
|
@ -288,8 +252,8 @@
|
|||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
}
|
||||
},
|
||||
checkInfo(id){//查询订单信息
|
||||
|
@ -335,8 +299,8 @@
|
|||
}
|
||||
}
|
||||
this.loading = true;
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
copyCont(){//复制快递单号
|
||||
if(this.times==0){
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<view v-if="showBtn" @tap.stop="showBtn=false" class="posAll disjcac fc pad-zy50" style="z-index: 11;">
|
||||
<image :src="imgSrc" @tap.stop="showBtn=true" class="radius20" style="width: 80%;" mode="widthFix"></image>
|
||||
<!-- 分享按钮 -->
|
||||
<view v-if="haved" @tap.stop="shareEv" class="disjcac radius20 posixzy" style="height: 90rpx;margin: 20rpx 80rpx;background-color: #38CE51;line-height: 90rpx;bottom: 40rpx;">
|
||||
<view @tap.stop="shareEv" class="disjcac radius20 posixzy" style="height: 90rpx;margin: 20rpx 80rpx;background-color: #38CE51;line-height: 90rpx;bottom: 40rpx;">
|
||||
<view class="disac">
|
||||
<image src="/static/public/sharef.png" style="width: 54rpx;height: 54rpx;" mode=""></image>
|
||||
<view class="fon40 bold colf mar-z10">分享给好友</view>
|
||||
|
@ -31,10 +31,8 @@
|
|||
<pu-po :isShowT="imgList.length==0 && isHaib" :contentVal="'立即生成创意海报'" :clearVal="'暂不生成'" :comfrimVal="'立即生成'" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 底部客服 -->
|
||||
<!-- <public-customer :nbottom="100"></public-customer> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="tabimgList" :newcurrent='-1'></foot-tab>
|
||||
</view>
|
||||
|
@ -45,108 +43,68 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isShowT:true,
|
||||
imgList:uni.getStorageSync('imgSrcList'),
|
||||
imgSrc:'',
|
||||
showBtn:false,
|
||||
isHaib:false,
|
||||
haved:true,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
titleList:[],//tab标题
|
||||
tabimgList:[],//tab图标
|
||||
shareFlag:true//是否允许点击分享
|
||||
}
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/personalPoster/personalPoster?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin() ;this.haved = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
// uni.removeStorageSync('imgSrcList')
|
||||
//如果还没有生成海报
|
||||
if(uni.getStorageSync('imgSrcList')!='') this.imgSrcList = uni.getStorageSync('imgSrcList')//弹框关闭
|
||||
else this.imgList = []
|
||||
this.checkPoster();
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.tabimgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.tabimgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.tabimgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.tabimgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.tabimgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.tabimgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.tabimgList = uni.getStorageSync('footimg')
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.$toolAll.tools.isLogin() ;
|
||||
//如果还没有生成海报
|
||||
if(uni.getStorageSync('imgSrcList')!='') this.imgSrcList = uni.getStorageSync('imgSrcList')//弹框关闭
|
||||
else this.imgList = []
|
||||
this.checkPoster();
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.tabimgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.tabimgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.tabimgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.tabimgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.tabimgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.tabimgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.tabimgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkPoster(){//查询海报模板
|
||||
this.$requst.get('user/poster').then(res=>{
|
||||
if(res.code==0){
|
||||
|
@ -155,12 +113,12 @@
|
|||
this.imgList.push(this.$http + item);
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
chooseImg(index){//选择海报模板,并生成海报
|
||||
this.imgSrc = '';
|
||||
this.haved = this.showBtn = true;
|
||||
this.showBtn = true;
|
||||
this.$toolAll.tools.showToast('正在生成海报...','loading',10000);
|
||||
this.$requst.post('user/poster-info',{poster_src:this.imgList[index]}).then(res=>{
|
||||
if(res.code==0){
|
||||
|
@ -170,26 +128,27 @@
|
|||
this.$toolAll.tools.showToast('海报生成成功','none',1500);
|
||||
} else {
|
||||
this.$toolAll.tools.showToast('海报生成失败','none',1500);
|
||||
this.haved = this.showBtn = false;
|
||||
this.showBtn = false;
|
||||
}
|
||||
})
|
||||
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
||||
},
|
||||
shareEv(){
|
||||
this.haved = false;
|
||||
wx.showShareImageMenu({
|
||||
path: this.imgSrc,
|
||||
success:(res=>{
|
||||
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb);
|
||||
}),
|
||||
fail:(res=>{//取消分享
|
||||
this.haved = true
|
||||
this.$toolAll.tools.showToast('正在调起分享...');
|
||||
if(this.shareFlag){
|
||||
this.shareFlag = false;
|
||||
wx.showShareImageMenu({
|
||||
path: this.imgSrc,
|
||||
success:(res=>{
|
||||
this.shareFlag = true;
|
||||
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(4);
|
||||
}),
|
||||
fail:(err=>{
|
||||
this.shareFlag = true;
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {this.$toolAll.tools.showToast('请勿重复点击');}
|
||||
},
|
||||
comfirmev(){//立即生成事件
|
||||
this.$toolAll.tools.showToast('生成中...')
|
||||
|
@ -209,8 +168,8 @@
|
|||
})
|
||||
this.$toolAll.tools.showToast('生成海报成功');
|
||||
this.isHaib = false
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
cancleev(){//暂不生成事件
|
||||
uni.navigateBack({delta:1})
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
<view class="pad-zy20">
|
||||
<view class="fon30 bold tc mar-sx40" :style="{color:publicColor}">相关推荐</view>
|
||||
<!-- 相关推荐列表 -->
|
||||
<list-pu @chooseLike="chooseLikex" @comfirmev="comfirmevx" :list="xgList"></list-pu>
|
||||
<list-pu @chooseLike="chooseLikex" @praise="praisexgEv" @comfirmev="comfirmevx" :list="xgList"></list-pu>
|
||||
</view>
|
||||
<view class="tc fon28 bold" style="color: #fff;background-color: #3875f6;padding: 20rpx;" @tap="backEv">更多{{contentVal}}>></view>
|
||||
<view class="pad-zy20">
|
||||
|
@ -84,7 +84,7 @@
|
|||
</view>
|
||||
<view v-if="cateCurrent!=isNum">
|
||||
<view v-if="allList.length!=0" class="pad-zy20">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="allList"></list-pu>
|
||||
<list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmev" :list="allList"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
|
@ -94,10 +94,8 @@
|
|||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<!-- 底部导航 -->
|
||||
<view class="posixzy">
|
||||
<bottom-tab></bottom-tab>
|
||||
|
@ -118,17 +116,15 @@
|
|||
components: {
|
||||
listDoctor,
|
||||
swiperPu,
|
||||
bottomTab
|
||||
bottomTab,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
|
||||
isLoading: false,
|
||||
vision: false,
|
||||
statusHNH: uni.getStorageSync('statusHNH'),
|
||||
publicColor: uni.getStorageSync('publicColor') || '#3875F6', //主题颜色
|
||||
cateCurrent: 0,
|
||||
haveImg: true,
|
||||
cateList: [],
|
||||
bannerList: [], //轮播
|
||||
xgList: [ //相关推荐
|
||||
|
@ -151,11 +147,8 @@
|
|||
detailInfo: '', //富文本
|
||||
category_id: '', //栏目ID
|
||||
active: '', //是否是详情页
|
||||
// jieDuan:false,
|
||||
share_id: 0,
|
||||
invite_code: '',
|
||||
isShowP: false,
|
||||
bcurrent: 0,
|
||||
isAutoPlay: false,
|
||||
fabImg: '' ,//发布者头像
|
||||
allArr:[],
|
||||
|
@ -182,7 +175,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
onShareTimeline() {},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record', {
|
||||
|
@ -192,12 +184,8 @@
|
|||
}).then(res => {
|
||||
console.log('分享成功:', res);
|
||||
}, error => {})
|
||||
let maiOjb = {
|
||||
e: 4, //内容分享
|
||||
c: this.detailObj.id * 1,
|
||||
t: new Date().getTime() //当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(4,this.detailObj.id);
|
||||
var shareObj = {
|
||||
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesB/problemDetail/problemDetail?id=${this.detailObj.id}&category_id=${this.category_id}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
|
@ -207,6 +195,7 @@
|
|||
return shareObj;
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin();
|
||||
this.isAutoPlay = true;
|
||||
},
|
||||
onHide() {
|
||||
|
@ -216,47 +205,18 @@
|
|||
this.isAutoPlay = false;
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.category_id != undefined) {
|
||||
this.category_id = options.category_id
|
||||
if(options.invite_code!=undefined){this.invite_code = options.invite_code;}
|
||||
if (options.share_id != undefined){this.share_id = options.share_id;}
|
||||
this.checkDetail(options.id);
|
||||
let maiOjb = {
|
||||
e: 1, //内容访问
|
||||
c: options.id * 1,
|
||||
t: new Date().getTime() //当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb);
|
||||
if(uni.getStorageSync('phone_active')!=1){
|
||||
this.vision = true;
|
||||
this.loginEv(options);
|
||||
} else {
|
||||
//查询过期时间和是否有token,并调用登录事件
|
||||
this.$toolAll.tools.overdue();
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
if (options.category_id != undefined) {
|
||||
this.category_id = options.category_id
|
||||
if(options.invite_code!=undefined){this.invite_code = options.invite_code;}
|
||||
if (options.share_id != undefined){this.share_id = options.share_id;}
|
||||
this.checkDetail(options.id);
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(1,options.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(options) {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res) => {
|
||||
var params = {
|
||||
code: res.code,
|
||||
invite_code: options.invite_code || '', //用户邀请码
|
||||
source_code: options.source_code || '',
|
||||
channel: options.channel || ''
|
||||
}
|
||||
this.$requst.post('user/login', params).then(res => {
|
||||
if (res.data.token != '') {
|
||||
if (res.data.is_active == 0) {
|
||||
this.haveImg = false;
|
||||
}
|
||||
}
|
||||
}, error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
chooseLike(e) { //收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if (this.allList[e].is_collected == 0) {
|
||||
|
@ -296,16 +256,6 @@
|
|||
archive_id: this.xgList[e].id
|
||||
})
|
||||
},
|
||||
buttonH(e) { //授权成功
|
||||
this.haveImg = e
|
||||
if (e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cancleEv(e) { //取消授权
|
||||
if (e == 0) this.vision = false
|
||||
},
|
||||
checkDetail(newId) {
|
||||
this.$requst.post('archives/detail', {
|
||||
id: newId,
|
||||
|
@ -350,12 +300,6 @@
|
|||
if (this.detailObj.published_headimgurl != '') {
|
||||
this.fabImg = this.$http + this.detailObj.published_headimgurl;
|
||||
}
|
||||
let maiOjb = {
|
||||
e: 1, //内容访问
|
||||
c: this.detailObj.id * 1,
|
||||
t: new Date().getTime() //当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
if (this.detailObj.is_liked == 1) {
|
||||
if (this.detailObj.likes >= 1000) this.likeCon = '999+'
|
||||
else this.likeCon = this.detailObj.likes
|
||||
|
@ -409,7 +353,9 @@
|
|||
content: item.subtitle, //副标题
|
||||
head_img: fabImg || '/static/public/logo.png', //发布者头像
|
||||
name: item.published_by || '恒美植发', //发布者昵称
|
||||
isVideo: item.video.includes(".mp4") //是否是视频
|
||||
isVideo: item.video.includes(".mp4"), //是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
if (item.cover != '' && item.video == '') {
|
||||
this.xgList.push(tObj)
|
||||
|
@ -436,8 +382,8 @@
|
|||
})
|
||||
}
|
||||
this.choosecateEv(this.cateCurrent)
|
||||
}
|
||||
}, error => {})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}, error => {this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
relevant(){
|
||||
this.$requst.post('archives/category', {
|
||||
|
@ -464,15 +410,17 @@
|
|||
content: item.subtitle, //副标题
|
||||
head_img: fabImg || '/static/public/logo.png', //发布者头像
|
||||
name: item.published_by || '恒美植发', //发布者昵称
|
||||
isVideo: item.video.includes(".mp4") //是否是视频
|
||||
isVideo: item.video.includes(".mp4"), //是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
if (item.cover != '' && item.video == '') {
|
||||
this.xgList.push(tObj)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
||||
},
|
||||
choosecateEv(e) {
|
||||
this.page = 1;
|
||||
|
@ -516,7 +464,9 @@
|
|||
content: item.subtitle, //副标题
|
||||
head_img: fabImg || '/static/public/logo.png', //发布者头像
|
||||
name: item.published_by || '恒美植发', //发布者昵称
|
||||
isVideo: isVideo //是否是视频
|
||||
isVideo: isVideo ,//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked // 是否已点赞
|
||||
}
|
||||
if (item.cover != '') {
|
||||
this.allList.push(arrObj);
|
||||
|
@ -524,54 +474,63 @@
|
|||
})
|
||||
}
|
||||
this.cateCurrent = e;
|
||||
}
|
||||
}, error => {})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}, error => {this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
praiseEv(e){ // 点赞事件
|
||||
if(this.allList[e].is_liked==0){
|
||||
this.allList[e].is_liked = 1;
|
||||
this.allList[e].likes++;
|
||||
if(this.allList[e].likes>1000) this.allList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.allList[e].id})
|
||||
}
|
||||
},
|
||||
// 相关列表的点赞事件
|
||||
praisexgEv(e){
|
||||
if(this.xgList[e].is_liked==0){
|
||||
this.xgList[e].is_liked = 1;
|
||||
this.xgList[e].likes++;
|
||||
if(this.xgList[e].likes>1000) this.xgList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.xgList[e].id})
|
||||
}
|
||||
},
|
||||
tapLike() { //喜欢、不喜欢事件
|
||||
if(this.haveImg){
|
||||
this.isDetailLike = !this.isDetailLike
|
||||
if (this.isDetailLike) {
|
||||
this.detailObj.likes++
|
||||
this.likeCon = this.detailObj.likes
|
||||
if (this.likeCon >= 1000) this.likeCon = '999+'
|
||||
} else {
|
||||
this.detailObj.likes--
|
||||
this.likeCon = '喜欢'
|
||||
}
|
||||
let isLikeCon = 'like'
|
||||
//调用点赞事件
|
||||
if (this.isDetailLike) collectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
//调用取消点赞事件
|
||||
else cancleCollectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
this.isDetailLike = !this.isDetailLike
|
||||
if (this.isDetailLike) {
|
||||
this.detailObj.likes++
|
||||
this.likeCon = this.detailObj.likes
|
||||
if (this.likeCon >= 1000) this.likeCon = '999+'
|
||||
} else {
|
||||
// 调起授权弹框
|
||||
this.vision = true;
|
||||
this.detailObj.likes--
|
||||
this.likeCon = '喜欢'
|
||||
}
|
||||
let isLikeCon = 'like'
|
||||
//调用点赞事件
|
||||
if (this.isDetailLike) collectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
//调用取消点赞事件
|
||||
else cancleCollectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
},
|
||||
tapConllection() { //收藏、取消收藏事件
|
||||
let isLikeCon = 'collect'
|
||||
if(this.haveImg){
|
||||
// 调用收藏事件
|
||||
if (!this.isDetailConllection) collectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
// 调用取消收藏事件
|
||||
else cancleCollectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
this.isDetailConllection = !this.isDetailConllection
|
||||
} else {
|
||||
// 调起授权弹框
|
||||
this.vision = true;
|
||||
}
|
||||
// 调用收藏事件
|
||||
if (!this.isDetailConllection) collectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
// 调用取消收藏事件
|
||||
else cancleCollectionEV({
|
||||
action: isLikeCon,
|
||||
archive_id: this.detailObj.id
|
||||
})
|
||||
this.isDetailConllection = !this.isDetailConllection
|
||||
},
|
||||
backTop() { //回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<view v-else class="pad-zy20 mar-s20">
|
||||
<!-- 列表 -->
|
||||
<view v-if="dataList.length!=0">
|
||||
<list-pu :radiu="true" @chooseLike="chooseLike" @comfirmev="comfirmevl" :list="dataList"></list-pu>
|
||||
<list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmevl" :list="dataList"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
|
@ -33,10 +33,8 @@
|
|||
<pu-po :isShowT="isShowT" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -49,7 +47,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
searchVal:'',//输入框的值
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
reSearchList:[//历史记录列表
|
||||
|
@ -85,8 +83,6 @@
|
|||
total:'',//总数
|
||||
isZanw:true,
|
||||
category_id:'',//栏目ID
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
|
@ -104,59 +100,23 @@
|
|||
onUnload() {
|
||||
uni.removeStorageSync('cateList')
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/searchPage/searchPage?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
if(options.keyWorld!=undefined && options.keyWorld!='') {
|
||||
this.searchVal = options.keyWorld
|
||||
this.searchEv()
|
||||
}
|
||||
this.checkSearchHistory()
|
||||
this.checkKey()
|
||||
}
|
||||
if(options.keyWorld!=undefined && options.keyWorld!='') {
|
||||
this.searchVal = options.keyWorld
|
||||
this.searchEv()
|
||||
}
|
||||
this.checkSearchHistory()
|
||||
this.checkKey()
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
if(this.searchVal!=undefined && this.searchVal!='') this.searchEv()
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
if(this.searchVal!=undefined && this.searchVal!='') this.searchEv()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
checkKey(){//查询热搜关键词事件
|
||||
this.$requst.get('index/hot-keywords').then(res=>{
|
||||
// console.log('关键词列表:',res);
|
||||
|
@ -170,8 +130,8 @@
|
|||
this.reSearchList[1].list.push(reObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
|
@ -181,6 +141,16 @@
|
|||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
praiseEv(e){ // 点赞事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_liked==0){
|
||||
this.dataList[e].is_liked = 1;
|
||||
this.dataList[e].likes++;
|
||||
if(this.dataList[e].likes>1000) this.dataList[e].likes = '999+'
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'like',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmevl(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
|
@ -202,8 +172,8 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(ers.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
searchEv(){//搜索事件
|
||||
// console.log('栏目ID:',this.category_id,'关键词:',this.searchVal);
|
||||
|
@ -250,7 +220,9 @@
|
|||
content:item.subtitle,//副标题
|
||||
head_img: fabImg || '/static/public/logo.png',//发布者头像
|
||||
name:item.published_by || '恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
isVideo:item.video.includes(".mp4"),//是否是视频
|
||||
likes:item.likes,//点赞数量
|
||||
is_liked:item.is_liked//是否已点赞
|
||||
}
|
||||
this.dataList.push(tObj);
|
||||
// if(this.newCurrent==0 && item.category_id==32) this.dataList.push(tObj)
|
||||
|
@ -264,8 +236,8 @@
|
|||
}
|
||||
this.reSearchList[0].list.push(obj)
|
||||
this.isList = false
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
delev(){//删除事件
|
||||
this.isShowT = true
|
||||
|
@ -276,8 +248,8 @@
|
|||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('已清空')
|
||||
this.reSearchList[0].list = []//清空搜索历史
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
cancleev(){//取消事件
|
||||
this.isShowT = false
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
<pu-po :isShowT="isShowT" :contentVal="'暂未开放此功能,请耐心等候'" :isCenter="true" :comfrimVal="'好的'" @comfirmev="isShowT=false"></pu-po>
|
||||
<!-- 底部客服 -->
|
||||
<!-- <public-customer :nbottom="100"></public-customer> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='-1'></foot-tab>
|
||||
</view>
|
||||
|
@ -41,7 +39,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isShowT:false,
|
||||
imgSrc:'/static/public/shareh.png',
|
||||
|
@ -51,8 +49,6 @@
|
|||
{num:'0',title:'分享订单'},
|
||||
],
|
||||
imgSrcP:uni.getStorageSync('imgSrcP'),
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
titleList:[],//tab标题
|
||||
imgList:[],//tab图标
|
||||
}
|
||||
|
@ -61,16 +57,13 @@
|
|||
var ya = this;
|
||||
var shareObj = {
|
||||
title: '恒美植发', // 默认是小程序的名称(可以写slogan等)
|
||||
path: '', // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
path: `/pagesB/sharingCenter/sharingCenter?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ya.imgSrc, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
success: function(res){
|
||||
// 转发成功之后的回调
|
||||
if(res.errMsg == 'shareAppMessage:ok'){
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(4);
|
||||
}
|
||||
},
|
||||
fail: function(res){
|
||||
|
@ -85,12 +78,7 @@
|
|||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;} else {this.$toolAll.tools.isLogin()}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
}
|
||||
if(uni.getStorageSync('phone_active')!=0){this.$toolAll.tools.isLogin()}
|
||||
uni.getStorageSync('shareAll')!='' ? this.dataList[1].num = uni.getStorageSync('shareAll').share_users.total : this.dataList[1].num = 0
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
|
@ -134,34 +122,6 @@
|
|||
},error=>{})
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
shareEv(){//分享事件
|
||||
if(this.imgSrcP==''){
|
||||
this.$toolAll.tools.showToast('请先前往个人海报申请海报')
|
||||
|
@ -170,11 +130,8 @@
|
|||
path: this.imgSrcP
|
||||
})
|
||||
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(4);
|
||||
}
|
||||
},
|
||||
goPage(index){
|
||||
|
@ -184,9 +141,6 @@
|
|||
url:newUrl
|
||||
})
|
||||
},
|
||||
// shareEv(){
|
||||
// this.isShowT = true
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<view v-else class="fon24 col9">全部人员可买</view>
|
||||
</view>
|
||||
<view class="disac flexs">
|
||||
<view @tap="shareEv" class="disac fc mar-zy36 posir">
|
||||
<view class="disac fc mar-zy36 posir">
|
||||
<image src="/static/public/weix.png" class="wh42" mode=""></image>
|
||||
<view class="fon24 col9">分享</view>
|
||||
<button class="posia-op" open-type="share">分享</button>
|
||||
|
@ -261,10 +261,8 @@
|
|||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -343,8 +341,6 @@
|
|||
timera:null,
|
||||
pinUserId:0,//发起拼单人ID
|
||||
isAutoPlay:false,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
page:1,
|
||||
size:20,
|
||||
total:0,
|
||||
|
@ -372,12 +368,8 @@
|
|||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record',{type:this.detailObj.is_activity==0 ? 'spu':'activity',action:'share',id:this.detailObj.id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:this.detailObj.is_activity==0 ? 10 : 11,//商品分享(10普通商品,11活动商品)
|
||||
c: this.detailObj.is_activity==0 ? this.detailObj.id*1 : this.detailObj.activity_id,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件
|
||||
this.$toolAll.tools.plantPoint(this.detailObj.is_activity==0 ? 10 : 11,this.detailObj.is_activity==0 ? this.detailObj.id*1 : this.detailObj.activity_id);
|
||||
if(ya.detailObj.share_img==null) ya.detailObj.share_img = ya.detailObj.cover;
|
||||
var shareObj = {
|
||||
title: `${ya.detailObj.name}`, // 默认是小程序的名称(可以写slogan等)
|
||||
|
@ -400,14 +392,9 @@
|
|||
this.isAutoPlay = false;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){
|
||||
this.vision = true;
|
||||
this.loginEv(options);
|
||||
} else {
|
||||
if(uni.getStorageSync('phone_active')!=0){
|
||||
this.checkDetail(options.id,options.is_activity);
|
||||
this.cartNumEv();
|
||||
//查询过期时间和是否有token,并调用登录事件
|
||||
this.$toolAll.tools.overdue();
|
||||
}
|
||||
if(options.category_id!=undefined) {
|
||||
this.category_id = options.category_id
|
||||
|
@ -455,35 +442,7 @@
|
|||
})
|
||||
}
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
})
|
||||
},
|
||||
loginEv(options){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:options.invite_code || '',//用户邀请码
|
||||
source_code:options.source_code || '',
|
||||
channel:options.channel || ''
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false;
|
||||
this.isShowP = true;
|
||||
this.checkDetail(this.orderId,this.isactivity);
|
||||
}
|
||||
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
||||
},
|
||||
cartNumEv(){//购物车数量
|
||||
let ntype = 'spu'
|
||||
|
@ -491,8 +450,8 @@
|
|||
this.$requst.post('order/shopping-cart-count',{type:ntype}).then(res=>{
|
||||
if(res.code==0){
|
||||
this.cartNum = res.data.count;
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
||||
},
|
||||
checkPTList(id){//查询正在拼团的人数
|
||||
uni.request({
|
||||
|
@ -533,6 +492,9 @@
|
|||
this.pingArr = newPArr;
|
||||
}
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},
|
||||
fail:(err)=> {
|
||||
this.$toolAll.tools.showToast(err.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -578,8 +540,8 @@
|
|||
this.$toolAll.tools.showToast('添加购物车成功(*^▽^*)');
|
||||
this.cartNumEv();
|
||||
this.csNum = 0;
|
||||
}
|
||||
})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
||||
}
|
||||
},
|
||||
comeTuan(pinId,index,index2){//去拼单
|
||||
|
@ -624,23 +586,14 @@
|
|||
this.skuDetail = this.allRes.sku[index];
|
||||
},
|
||||
lianK(){//客服
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
} else {
|
||||
this.$requst.post('user/rand-bind-service').then(res=>{})
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:this.detailObj.is_activity==0 ? 13:14,//商品咨询(13普通商品,14活动商品)
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件 商品咨询(13普通商品,14活动商品)
|
||||
this.$toolAll.tools.plantPoint(this.detailObj.is_activity==0 ? 13:14);
|
||||
}
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
chooseLike(e) { //收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
|
@ -669,7 +622,6 @@
|
|||
},
|
||||
shareEv(){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
}
|
||||
},
|
||||
checkDetail(newId,is_activity){
|
||||
|
@ -748,12 +700,8 @@
|
|||
},1000)
|
||||
}
|
||||
}
|
||||
let maiOjb = {
|
||||
e:this.detailObj.is_activity==0 ? 8 : 9,//商品访问(8普通,9活动)
|
||||
c: this.detailObj.is_activity==0 ? this.detailObj.id*1 : this.detailObj.activity_id,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
// 调用tools.js中的种植埋点事件 商品访问(8普通,9活动)
|
||||
this.$toolAll.tools.plantPoint(this.detailObj.is_activity==0 ? 8 : 9,this.detailObj.is_activity==0 ? this.detailObj.id*1 : this.detailObj.activity_id);
|
||||
// 轮播
|
||||
// 图片字符串转数组
|
||||
let arrImg = this.detailObj.images.split(',')
|
||||
|
@ -926,7 +874,7 @@
|
|||
}
|
||||
this.cateCurrent = e;
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
}, error => {})
|
||||
}, error => {this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
tapConllection(){//收藏、取消收藏事件
|
||||
let isLikeCon = 'collect';
|
||||
|
|
|
@ -118,10 +118,8 @@
|
|||
<pu-po :isShowT="isShowT" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -180,7 +178,6 @@
|
|||
timeList:[],
|
||||
zanArr:[],
|
||||
timer:'',
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
|
@ -198,12 +195,6 @@
|
|||
},10000)
|
||||
// }
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/shopSearch/shopSearch?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(options.keyWorld!=undefined && options.keyWorld!='') {
|
||||
this.searchVal = options.keyWorld;
|
||||
|
@ -211,14 +202,12 @@
|
|||
} else {
|
||||
this.search_result = false;
|
||||
}
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('token')!=''){
|
||||
// 调用查询历史搜索的搜索记录
|
||||
this.checkSearchHistory();
|
||||
// 调用查询热搜关键词事件
|
||||
this.checkKey();
|
||||
}
|
||||
this.checkSearchHistory();
|
||||
this.checkKey();
|
||||
// 缓存状态栏+标题栏的高度
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.search-input-box').boundingClientRect((rect) => {
|
||||
|
@ -227,42 +216,16 @@
|
|||
}).exec()
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
if(this.searchVal!=undefined && this.searchVal!='') this.checkShopList();
|
||||
this.cartNumEv();//查询购物车数量
|
||||
this.$toolAll.tools.isLogin();
|
||||
if(uni.getStorageSync('token')!=''){
|
||||
if(this.searchVal!=undefined && this.searchVal!='') this.checkShopList();
|
||||
this.cartNumEv();//查询购物车数量
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
clearInterval(this.timer);
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cartNumEv(){//购物车数量
|
||||
this.$requst.post('order/shopping-cart-count',{type:'spu'}).then(res=>{
|
||||
if(res.code==0){
|
||||
|
@ -270,6 +233,7 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
// 查询商品列表
|
||||
checkShopList(){
|
||||
this.isZanw = true;
|
||||
let params = {
|
||||
|
@ -366,6 +330,9 @@
|
|||
this.search_result = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
this.$toolAll.tools.showToast(err.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -387,8 +354,8 @@
|
|||
this.reSearchList[1].list.push(reObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
checkSearchHistory(){//查询历史搜索的搜索记录
|
||||
this.$requst.post('user/search-history',{page:1,size:100}).then(res=>{
|
||||
|
@ -405,8 +372,8 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
delev(){//删除事件
|
||||
this.isShowT = true
|
||||
|
@ -417,8 +384,8 @@
|
|||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('已清空')
|
||||
this.reSearchList[0].list = []//清空搜索历史
|
||||
}
|
||||
},error=>{})
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
},
|
||||
cancleev(){//取消事件
|
||||
this.isShowT = false
|
||||
|
|
|
@ -32,10 +32,8 @@
|
|||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||||
<!-- 弹框 -->
|
||||
<auth-phone v-if="isShowP"></auth-phone>
|
||||
<!-- 用户信息授权,手机号授权 -->
|
||||
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -43,7 +41,7 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
statusHNH:uni.getStorageSync('electric_nav_height'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[],//数据列表
|
||||
showTop:false,//是否显示返回顶部的箭头
|
||||
|
@ -53,8 +51,6 @@
|
|||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
|
@ -72,50 +68,12 @@
|
|||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onShareAppMessage() {
|
||||
var shareObj = {
|
||||
path: `/pagesB/userFootprint/userFootprint?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onLoad(options) {
|
||||
if(uni.getStorageSync('phone_active')==0){this.vision = true;}
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
this.loginEv(options.invite_code);
|
||||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||||
this.loginEv('',options.source_code,options.channel);
|
||||
if(uni.getStorageSync('token')!='') {
|
||||
this.checkList();
|
||||
}
|
||||
this.checkList()
|
||||
},
|
||||
methods: {
|
||||
loginEv(invite_code='',source='',channel=''){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:invite_code,//用户邀请码
|
||||
source_code:source,
|
||||
channel:channel
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false;
|
||||
this.vision = true;
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
});
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
chooseId(id){
|
||||
this.backTop()
|
||||
this.page = 1
|
||||
|
@ -140,28 +98,26 @@
|
|||
}
|
||||
this.$requst.post('user/footmarks',params).then(res=>{
|
||||
// console.log('足迹列表查询:',res);
|
||||
if(res.code==0){
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.total
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let newCate = ''
|
||||
if(item.content_id > 0) newCate = item.category
|
||||
else newCate = ''
|
||||
let obj = {
|
||||
id:item.account_id,
|
||||
name:item.nickname,
|
||||
action:item.action,
|
||||
title:item.title,
|
||||
time:item.created_at,
|
||||
zwhat:newCate,
|
||||
mobile:item.mobile
|
||||
}
|
||||
this.dataList.push(obj)
|
||||
})
|
||||
}
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.total
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let newCate = ''
|
||||
if(item.content_id > 0) newCate = item.category
|
||||
else newCate = ''
|
||||
let obj = {
|
||||
id:item.account_id,
|
||||
name:item.nickname,
|
||||
action:item.action,
|
||||
title:item.title,
|
||||
time:item.created_at,
|
||||
zwhat:newCate,
|
||||
mobile:item.mobile
|
||||
}
|
||||
this.dataList.push(obj)
|
||||
})
|
||||
}
|
||||
},error=>{})
|
||||
})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
|
|
Before Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 690 B |
Before Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 197 KiB |