Commit ccb579bb by huahua

修改

parent 0fc82f7d
......@@ -24,12 +24,12 @@
<view :style="{width: data.bgWidth +'px',height: data.bgHeight +'px'}" style="position: relative; ">
<!-- <image :src="data.bgImage_old" mode="widthFix"
<!--<image :src="data.bgImage_old" mode="widthFix"
:style="{width: (data.bgWidth - 30) +'px',height: data.bgWidth +'px' ,left: '15px'}"
style="position: absolute; z-index: 0; top: 0; bottom: 0; margin: auto;"></image>
-->
style="position: absolute; z-index: 0; top: 0; bottom: 0; margin: auto;"></image> -->
<!-- 底色 -->
<view :style="{width: data.editorWidth + 'px',height: data.editorHeight +'px',
<view
:style="{width: data.editorWidth + 'px',height: data.editorHeight +'px',
background:background_color ? background_color : '#F5F5F5' ,borderRadius: isShowCircular ? '50%' : defalutFillet + 'px' }"
style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;margin: auto;z-index: 1; ;">
</view>
......@@ -524,6 +524,9 @@
</view>
</view>
<view v-else style="width: 100%; width: 100%; opacity: 1;"></view>
</uni-popup>
<uni-popup ref="showpicture" type="bottom" @change="change" style="position: fixed; z-index: 9999;">
<view class="uni-share"
......@@ -549,7 +552,8 @@
</view>
</uni-popup>
<switchGoods ref="switchGoods" @selectGoodItem="selectGoodSizeItem"></switchGoods>
<switchGoods ref="switchGoods" @selectGoodItem="selectGoodSizeItem" @toCustomSize="toCustomSize">
</switchGoods>
<!--商品弹框 -->
</view>
......@@ -573,7 +577,6 @@
import switchGoods from '../index/switchGoods.vue'; //选择商品
import tuya from './tuya.vue'; //
/* 色彩公园图片 DIY 功能页 */
var app = getApp(); // 当前APP实例
var items = []; // 当前显示的图片列表
......@@ -600,7 +603,6 @@
computed: {},
data() {
return {
collection_currentId: 0, //点赞选中Id
collection_currentIndex: null, //点赞选中坐标
......@@ -747,7 +749,6 @@
transformscale: 0.5, //整体缩小
functionScale: null, //整体缩小
isReady: false, //礼花
//画布
canvasHidden: false, //设置画板的显示与隐藏,画板不隐藏会影响页面正常显示
shareImgPath: '', //用于储存canvas生成的图片
......@@ -762,7 +763,14 @@
diy_upload_menu: 1, //diy_upload_menu为1是显示, diy_upload_menu为0时就不显示
isCustomize: false, //是否自定义
options: {},
defalutFillet:0,//默认圆角
defalutFillet: 0, //默认圆角
pixelScale: 0.55,
customize_size_id: "", //自定义尺寸Id
isUpLoadImage: false, //是否上传图片
design_widthrate: 1, //宽度比率
design_heightrate: 1, //高度比率
design_bgwidthrate: 1, //背景宽度比率
design_bgheightrate: 1, //背景高度比率
};
},
......@@ -770,14 +778,23 @@
let app = uni.getSystemInfoSync(); //设备信息
let menuButtonInfo = uni.getMenuButtonBoundingClientRect(); //胶囊信息
this.textHeight = app.statusBarHeight + menuButtonInfo.height + (menuButtonInfo.top - app.statusBarHeight) * 2
// this.textTop = menuButtonInfo.top;
},
methods: {
//自定义尺寸
toCustomSize() {
uni.navigateTo({
url: '../mall/size?machine_id=' + this.machine_id +
"&isFirstPage=false" +
"&machineDetail=" + JSON.stringify(this.machine_item)
})
},
//切换形状
changeGoodSize() {
this.$refs['switchGoods'].open(this.machine_id);
let isShowCustomizeData = this.machine_item.customize_size == 1 ? true : false
this.$refs['switchGoods'].open(this.machine_id, isShowCustomizeData);
},
//选择型号
......@@ -786,6 +803,9 @@
this.titlename = item.title;
this.goods_size_name = item.title;
this.real_width = item.key;
this.isCustomize = false;
this.options.type = 1;
this.defalutFillet = 0;
this.goodslist();
},
......@@ -837,7 +857,7 @@
width: this.data.editorWidth, // 预设生成图片的宽度
height: this.data.editorHeight, // 预设生成图片的高度
rScale: 1, // 图片原始缩放比例
// 新增加默认属性
//新增加默认属性
activeguide: false, // 开启辅助线
activescale: false, // 开启旋转状态
activehorn: false, // 开启角状态
......@@ -886,16 +906,15 @@
title: '加载中...',
mask: true
})
// 读取主图遮罩
//读取主图遮罩
uni.getImageInfo({
src: result.url,
success: (image) => {
// 清空历史记录
//清空历史记录
items = []; // 当前显示的图片列表
index = 0; // 所点击的图片的索引
snapshot = []; // 操作历史记录清空
snapshotIndex = -1;
uni.hideLoading()
let index = items.length;
let width = 0
......@@ -906,13 +925,8 @@
let ratiowidth = (that.data.editorWidth * that.mix_scale) / image.width
let ratioheight = (that.data.editorHeight * that.mix_scale) / image.height
let resultmix_scale = result.mix_scale || 1
// if (ratio >= 1) { //长方形
width = that.data.editorWidth * that.mix_scale * resultmix_scale
height = image.height * ratiowidth * resultmix_scale
// } else if (ratio < 1) { //长高方形
// height = that.data.editorHeight * that.mix_scale * resultmix_scale
// width = image.width * ratioheight * resultmix_scale
// }
if (result.is_under == 1) { //贴图是否为背景图
let number_index = 0
for (var item of items) {
......@@ -995,9 +1009,9 @@
this.showtwo = true
},
/* 上传图片 */
addItem: async function(e) {
this.isUpLoadImage = true;
this.showone = false
var _this = this
uni.chooseImage({
......@@ -1026,6 +1040,7 @@
/* 上传图片拍照 */
addItemFromCamera: async function(e) {
this.isUpLoadImage = true;
this.showone = false
var _this = this
uni.chooseImage({
......@@ -1055,6 +1070,7 @@
},
/* 上传图片从相册 */
addItemFromAlbum: async function(e) {
this.isUpLoadImage = true;
this.showone = false
var _this = this
uni.chooseImage({
......@@ -1248,6 +1264,7 @@
frame_top: null, // 裁剪窗口y
image_top: null, // 图片y
})
_this.isUpLoadImage = false;
_this.data.itemList = items
_this.saveSnapshot();
}
......@@ -1256,6 +1273,7 @@
// console.log(atter.host + '/' + atter.dir + time + '.jpg')
},
fail: function(err) {
_this.isUpLoadImage = false;
failUp++;
wx.showToast({
title: '上传失败!',
......@@ -1392,8 +1410,25 @@
}, item.angle);
}
let widScale = pixelRate * this.design_widthrate / (this.real_width / 150); //宽度比例
let heiScale = pixelRate * this.design_heightrate / (this.real_width / 150); //高度比例
let widScale = 1;
let heiScale = 1;
//console.log(this.isCustomize)
if (!this.isCustomize) {
widScale = pixelRate * this.design_widthrate / (this.real_width / 150); //宽度比例
heiScale = pixelRate * this.design_heightrate / (this.real_width / 150); //高度比例
} else {
//this.data.editorWidth / this.options.real_width
//this.data.editorHeight / this.options.real_height
widScale = this.data.editorWidth / this.options.real_width //宽度比例
heiScale = this.data.editorHeight / this.options.real_height //高度比例
// console.log("this.data.editorWidth="+this.data.editorWidth+
// "this.options.real_width ="+this.options.real_width +
// "this.data.editorHeight="+this.data.editorHeight+
// "this.data.real_height="+this.options.real_height
// )
}
var comlist = {
support_zoom: item.support_zoom, // 0是不支持缩放,为1时支持缩放
......@@ -1467,7 +1502,36 @@
title: '色彩正在绘制',
mask: true
})
homeservice.cheshi({
var data;
if (this.isCustomize) {
data = {
s: 'Works.save',
components: components,
works_id: this.works_id,
goods_id: this.data.goods_id,
template: this.data.template, //源作品id
template_price: this.data.template_price, //源作品sales_price
template_user_id: this.data.template_user_id, //源作品user_id
user_id: this.data.user_id,
platform: 3,
shape_image: this.shape_image, //形状图片
shape_id: this.shape_id, //形状id
shape_price: this.shape_price, //形状价格
machine_id: this.machine_id, //设备idmachine_id
background_color: this.background_color, //手机壳背景颜色
is_general: "1",
real_width: this.options.real_width,
real_height: this.options.real_height,
customize_size_id: this.options.customize_size_id,
custom_radius: this.options.defalutFillet
}
} else {
data = {
s: 'Works.save',
components: components,
works_id: this.works_id,
......@@ -1485,7 +1549,11 @@
is_general: "1",
real_width: this.real_width,
real_height: this.real_width,
}).then(result => {
}
}
homeservice.cheshi(data).then(result => {
uni.hideLoading();
uni.showToast({
title: '作品绘制成功',
......@@ -2293,12 +2361,14 @@
},
cancel(type) { //关闭弹框
this.e_active = 0
this.isShowGif = false;
try {
this.$refs['show' + type].close()
} catch (e) {
}
this.isUpLoadImage = false;
this.addtext = false
if (wx.pageScrollTo) {
wx.pageScrollTo({
......@@ -3060,7 +3130,7 @@
var diffY = y - centerY;
return Math.sqrt(diffX * diffX + diffY * diffY);
},
// 移除图片
//移除图片
removedeleteItem(item, ix) {
if (!this.active) {
index = items.length - 1
......@@ -3125,7 +3195,7 @@
font_color: '#000000',
under_color: '',
content: e.detail.value, // 文本
top: this.editor_top - 74 / 2, // 初始图片Y坐标,根据画布高/2-图片高/2
top: this.editor_top / 2, // 初始图片Y坐标,根据画布高/2-图片高/2
left: 0, // 初始图片X坐标,因为div是相对定位,所以计算是要多减一次移动的距离
x: this.data.editorWidth / 2, // 初始圆心位置,可再downImg之后又宽高和初始的图片位置得出
y: this.editor_top,
......@@ -3162,10 +3232,8 @@
}
return;
}
var item = items[index];
item.content = e.detail.value;
var that = this;
//赋值
this.data.currentText = e.detail.value
......@@ -3179,7 +3247,6 @@
var width = res[0].width;
var rate = item.width / width;
var tmpSize = item.font_size * rate;
if (tmpSize > maxFontSize) {
item.font_size = maxFontSize;
item.height = maxFontSize * heightRate;
......@@ -3189,7 +3256,7 @@
item.height = item.height * rate;
item.top = item.y - (item.height / 2);
}
// that.setData({itemList:items});
//that.setData({itemList:items});
that.setData({
data: that.data
})
......@@ -3197,7 +3264,6 @@
})
},
async text_await(e) {
// 获取当前选中的部件
var item = items[index];
if (e.detail.value != item.content) {
......@@ -3241,13 +3307,13 @@
lastSnapshot = JSON.stringify(snapshot[snapshotIndex]);
}
if (currentSnapshot != lastSnapshot) {
// 清除当前步骤后面的所有步骤
//清除当前步骤后面的所有步骤
if (snapshot.length > 0 && (snapshot.length - 1 > snapshotIndex)) {
for (var i = snapshotIndex + 1; i < snapshot.length; i++) {
snapshot.pop();
}
}
// 加入快照
//加入快照
snapshot.push(currentSnapshot);
snapshotIndex = snapshotIndex + 1;
}
......@@ -3305,7 +3371,6 @@
});
},
//获取自定义产品数据详情
getCustomDetail() {
this.front_image_long = false
......@@ -3314,82 +3379,91 @@
id: this.data.goods_id
}).then(result => {
this.titlename = result.name + " " + this.titlename //修改头部名称
//console.log("this.titlename=" + result.name)
//读取背景图
uni.getImageInfo({
src: result.front_image_old,
success: (front_image) => {
// this.data.bgHeight = (front_image.height + 600) * (this.data.bgWidth / front_image.width) // 画布高度
this.data.bgHeight = this.data.bgHeight // 画布高度
this.editory = (this.data.bgHeight - (result.design_height * this.data
.pixelRate)) / 2; //辅助线距离
// 设计区放大高度比率
this.front_image_long = true
}
})
// console.log(this.options);
let pixel_scale = 1
if (this.options.WidthIndex > (this.data.windowWidth * this.data.pixelRate)) {
pixel_scale = (this.data.windowWidth * this.data.pixelRate) / this.options.WidthIndex
if (this.options.WidthIndex > (this.data.windowWidth * this.pixelScale)) {
pixel_scale = (this.data.windowWidth * this.pixelScale) / this.options.WidthIndex
} else {
if (this.options.WidthIndex < (this.data.windowWidth * this.data.pixelRate) && this.options.HeightIndex < (this.data.windowHeight * this.data.pixelRate)) {
if (this.options.WidthIndex < (this.data.windowWidth * this.pixelScale) && this.options
.HeightIndex < (this.data.windowHeight * this.pixelScale)) {
pixel_scale = 1
}
}
// console.log("pixel_scale=" + pixel_scale);
if (this.options.HeightIndex > (this.data.windowHeight * this.data.pixelRate)) {
if ((this.data.windowHeight * this.data.pixelRate) / this.options.HeightIndex < pixel_scale) {
pixel_scale = (this.data.windowHeight * this.data.pixelRate) / this.options.HeightIndex
if (this.options.HeightIndex > (this.data.windowHeight * this.pixelScale)) {
if ((this.data.windowHeight * this.pixelScale) / this.options.HeightIndex < this
.pixel_scale) {
pixel_scale = (this.data.windowHeight * this.pixelScale) / this.options.HeightIndex
}
} else {
if (this.options.WidthIndex < (this.data.windowWidth * this.data.pixelRate) && this.options.HeightIndex < (this.data.windowHeight * this.data.pixelRate)) {
if (this.options.WidthIndex < (this.data.windowWidth * this.pixelScale) && this.options
.HeightIndex < (this.data.windowHeight * this.pixelScale)) {
pixel_scale = 1
}
}
// if (this.options.WidthIndex > (this.data.windowWidth * this.data.pixelRate)) {
// pixel_scale = (this.data.windowWidth * this.data.pixelRate) / this.options.WidthIndex
// } else {
// if (this.options.WidthIndex < (this.data.windowWidth * this.data.pixelRate) && this.options
// .HeightIndex < (this.data.windowHeight * this.data.pixelRate)) {
// pixel_scale = 1
// }
// }
// if (this.options.HeightIndex > (this.data.windowHeight * this.data.pixelRate)) {
// if ((this.data.windowHeight * this.data.pixelRate) / this.options.HeightIndex <
// pixel_scale) {
// pixel_scale = (this.data.windowHeight * this.data.pixelRate) / this.options.HeightIndex
// }
// } else {
// if (this.options.WidthIndex < (this.data.windowWidth * this.data.pixelRate) && this.options
// .HeightIndex < (this.data.windowHeight * this.data.pixelRate)) {
// pixel_scale = 1
// }
//}
this.design_width = (this.options.WidthIndex * pixel_scale) / this.data.pixelRate // 设计宽度
this.design_height = (this.options.HeightIndex * pixel_scale) / this.data.pixelRate // 设计高度
//this.design_height = result.design_height // 设计高度
//this.design_width = result.design_width // 设计宽度
uni.getImageInfo({
src: result.front_image_old,
success: (front_image) => {
this.data.bgHeight = this.data.bgHeight // 画布高度
this.front_image_long = true
}
})
this.data.editorWidth = this.design_width * this.data.pixelRate // 设计宽度
this.data.editorHeight = this.design_height * this.data.pixelRate // 设计高度
this.editor_top = this.data.editorHeight * Number(this.location_scale) //辅助线距离
this.design_widthrate = (this.design_width / this.print_width) // 设计区放大宽度比率
this.design_heightrate = (this.design_height / this.print_height)
this.editory = (this.data.windowHeight - this.data.editorHeight) / 2; //辅助线距离
//console.log(this.options)
this.design_widthrate = (this.design_width / result.print_width) // 设计区放大宽度比率
this.design_heightrate = (this.design_height / result.print_height) // 设计区放大高度比率
if (this.options.defalutFillet != "0" && this.options.defalutFillet >= 0) {
let defalutFilletScale = this.data.editorWidth / this.options.real_width;
this.defalutFillet = this.options.defalutFillet * defalutFilletScale
} else {
this.defalutFillet = 0;
}
//this.design_bgwidthrate = this.options.WidthIndex / result.print_width // 设计区放大宽度比率
//this.design_bgheightrate = this.options.HeightIndex / result.print_height // 设计区放大高度比率
//this.design_widthrate = this.design_width / result.print_width // 设计区放大宽度比率
//this.design_heightrate = this.design_height / result.print_height // 设计区放大高度比率
this.data.bgImage = result.front_image // 背景图
this.data.bgImage_old = result.front_image_old // 旧背景图
this.data.bgImage_thumbnail = result.thumbnail // 介绍图片(主图遮罩)
this.design_color = result.design_color // 背景颜色
this.mix_scale = result.mix_scale //上传图片比率
//this.design_height = result.design_height // 设计高度
//this.design_width = result.design_width // 设计宽度
this.print_height = result.print_height // 设计基础宽度
this.print_width = result.print_width // 设计基础高度
this.center_scale = result.center_scale //设计器中心点位置对应底图高度占比(居中=0.5)
this.location_scale = result.location_scale //参考线中心点对应设计器高度占比(居中=0.5)
if (this.options.defalutFillet != "0" && this.options
.defalutFillet >= 0) {
let defalutFilletScale = this.data.editorWidth /
this.options.real_width;
this.defalutFillet = this.options.defalutFillet *
defalutFilletScale
} else {
this.defalutFillet = 0;
}
this.editor_top = this.data.editorHeight * Number(this.location_scale) //辅助线距离
}).catch(err => {
uni.showToast({
......@@ -3419,10 +3493,13 @@
success: (front_image) => {
// this.data.bgHeight = (front_image.height + 600) * (this.data.bgWidth / front_image.width) // 画布高度
this.data.bgHeight = this.data.bgHeight // 画布高度
this.editory = (this.data.bgHeight - (result.design_height * this.data
this.editory = (this.data.bgHeight - (result.design_height * this
.data
.pixelRate)) / 2; //辅助线距离
this.data.editorWidth = result.design_width * this.data.pixelRate // 设计宽度
this.data.editorHeight = result.design_height * this.data.pixelRate // 设计高度
this.data.editorWidth = result.design_width * this.data
.pixelRate // 设计宽度
this.data.editorHeight = result.design_height * this.data
.pixelRate // 设计高度
this.editor_top = this.data.editorHeight * Number(this
.location_scale) //辅助线距离
this.design_widthrate = (result.design_width / result
......@@ -3521,9 +3598,6 @@
this.options = options;
let that = this;
//console.log(options);
if (options.type) {
if (options.type == 2) {
this.isCustomize = true;
......@@ -3691,13 +3765,23 @@
} else {
that.goodslist() // 获取产品详情数据
}
//that.goodslist() // 获取产品详情数据
that.category() // 作品分类 贴图分类
}
})
},
onShow() {
if (this.options && this.options != null) {
if (this.options.type == 2 && this.front_image_long) {
this.isCustomize = true;
if (!this.isUpLoadImage) {
this.queryPage.machine_id = this.options.machine_id
this.data.goods_id = this.options.goods_id // 商品id
this.titlename = this.options.title
this.getCustomDetail();
}
this.isShowCircular = false
}
}
var _this = this
wx.request({
url: _this.$Env.getDevBaseURL() + '/api/system_config/detail',
......
......@@ -3,7 +3,7 @@ const drag = {
* 部件缩放中事件四角缩放
*/
scaleMove(e, item, data, allLineListData, designWidth, designHeight) {
console.log(item)
item.isShowLineV = false; //初始化默认不显示
item.isShowLineH = false; //初始化默认不显示
var minwwidth = 20
......
......@@ -116,6 +116,7 @@
uni.navigateTo({
url: '../mall/size?machine_id=' + this.machine_id +
// + "&title=" + item.title + "&real_width=" + item.key +
"&isFirstPage=true" +
"&machineDetail=" + JSON.stringify(this.list)
// url: '../index/size?machine_id=' + this.machine_id +
// '&key=' + this.key;
......
......@@ -6,20 +6,18 @@
@click="closeView()">
</view>
<view
style=" width: 562upx; border-radius: 20upx; height: 900upx; z-index: 998; position: absolute ;margin:auto; top:0; right: 0; left: 0; bottom: 0;flex-direction: column">
<view style=" width: 562upx; border-radius: 20upx; height: 900upx; z-index: 998; position: absolute ;margin:auto; top:0; right: 0; left: 0; bottom: 0;flex-direction: column">
<image src="../../static/icon_home_good_back.png" style="width: 562upx; border-radius: 20upx;
height: 720upx;
left:50%;
top:50%;
transform: translate(-50%,-50%);
position: absolute; " />
position: absolute; "/>
<view style="position: absolute;
width: 562upx; height:720upx;
top: 0; ">
<view style="
width: 200upx;
height: 120upx;
......@@ -55,7 +53,7 @@
position: relative;
margin: 10upx;">
<view :class="[sizeCurrentIndexTop == index? 'size-item-select':'size-item-no-select' ]">
{{item !=null ? item.title : ''}}
{{item !=null ? item.title : '' }}
</view>
</view>
</view>
......@@ -72,7 +70,7 @@
margin-top:60upx;
text-align: center;">确定</view>
<view @click="toCustomSize()" style="width: 289upx;
<view v-if="isShowCustomize" @click="toCustomSize()" style="width: 289upx;
height: 84upx;
color: #F29F3D;
font-size: 32upx;
......@@ -98,13 +96,14 @@
goodCurrentIndexTop: 0, //上面商品选中
sizeCurrentIndexTop: 0, //下面尺寸选中
selectGoodSize: null, //选中商品尺寸
isShowCustomize: true, //是否自定义选中
isShowCustomize: false, //是否自定义选中
};
},
mounted() {},
mounted() {
methods: {
},
methods: {
//自定义尺寸
toCustomSize() {
......@@ -144,12 +143,14 @@
}
},
//商品点击事件
sizeclick(item, index) {
this.selectGoodSize = item
this.sizeCurrentIndexTop = index;
},
//打开页面
open(machineId, isShowCustomize) {
if (isShowCustomize) {
......@@ -161,6 +162,7 @@
this.getGooods();
},
//获取商品列表
getGooods() {
let that = this;
......@@ -186,7 +188,6 @@
} else {
this.isShow = true;
}
}).catch(err => {
this.isShow = false;
uni.showToast({
......@@ -207,6 +208,13 @@
},
options(options){
},
}
</script>
......@@ -253,4 +261,5 @@
text-align: center;
border: 2upx transparent solid;
}
</style>
......@@ -41,7 +41,7 @@
<view style="text-align: left; font-size: 30upx; color: #333; line-height: 80upx;font-weight: 600; margin-top: 20upx;"> 排队中</view>
</view>
<view style="font-size: 29upx; color: #333333; margin-top: 20upx; font-weight: 600;">
{{designer.goods_name || ''}} {{designer.goods_specs || ''}}
{{ designer.customize_size_id == 0 ? designer.goods_name || '' : ''}} {{designer.goods_specs || ''}}
</view>
</view>
<view style="width: 90%;font-size: 28upx; margin-top: 70upx; font-weight: 550; text-align: right; font-size: 36upx; color: #333; margin-right: 30upx;">
......
......@@ -163,8 +163,8 @@
hValue: 0, //固定宽高比率计算
previewWidth: 0, //基础
previewHeight: 0, //基础
inputWidth: 100, //文本框显示数据
inputHeight: 100, //文本框显示数据
inputWidth: 0, //文本框显示数据
inputHeight: 0, //文本框显示数据
pixel_Width: 0, //实际像素
pixel_Height: 0, //实际像素
pixel_scale: 1, //自动缩放屏幕比率,防止超出屏幕
......@@ -204,10 +204,10 @@
filletScale: 1, //比例
newDefalutFilletData: 0,
headheight: 0, //头部高度
queryPage: {
},
queryPage: {},
good_id: "217", //产品Id
isFirstPage: true,
machineDetail: null //设备对象
}
},
......@@ -220,6 +220,22 @@
if (this.preview) {
this.defalutFillet = 0
this.newDefalutFilletData = 0;
if (!this.Specifications) {
this.dataLoadState = {
pullDownRefresh: false,
reachBottom: false
}
this.LoupanList = []
this.queryPage.page = 1;
this.queryPage.total = 0;
this.Specifications = false
this.queryPage.s = 'CanvasSize.list'
this.loadGoodsList(Enums.DATA_DIRECTION.UP);
}
}
},
......@@ -258,14 +274,6 @@
},
refundNumorder(item) {
// if (this.manyGoodSelectData != null && this.manyGoodSelectData != '' && this.manyGoodSelectData.length >
// 1) {
// this.selectItemData = item
// this.type = 2
// this.showManyGoodPop();
// return
// }
// if (this.nav) {
let real_radius = Number(item.real_radius);
let real_height = Number(item.real_height);
......@@ -284,18 +292,52 @@
real_radius = Math.floor(minWidthAanHeight / 2)
}
uni.navigateTo({
let WidthIndex = item.real_width * this.OldConvert_rate
let HeightIndex = item.real_height * this.OldConvert_rate
let nameStr = item.name
let unit = item.unit;
let customize_size_id = item.id
//console.log(item)
if (this.isFirstPage && this.isFirstPage == "true") {
uni.redirectTo({
url: '../index/index?machine_id=' + this.parameter.machine_id +
'&WidthIndex=' + item.width + '&HeightIndex=' + item.height +
'&OldConvert_rate=' + this.OldConvert_rate + '&unit=' + item.unit +
'&name=' + item.name + '&pixel_scale=' + this.pixel_scale +
'&real_width=' + item.real_width +
'&real_height=' + item.real_height +
'&WidthIndex=' + WidthIndex + '&HeightIndex=' + HeightIndex +
'&OldConvert_rate=' + this.OldConvert_rate + '&unit=' + unit +
'&title=' + nameStr +
'&pixel_scale=' + this.pixel_scale +
'&real_width=' + real_width +
'&real_height=' + real_height +
"&defalutFillet=" + real_radius +
"&good_id=" + this.good_id+
"&type=2"
"&good_id=" + this.good_id +
"&type=2" +
"&customize_size_id=" + customize_size_id
})
// }
} else {
//console.log("defalutFilletData=" + defalutFilletData)
let pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//let machineDetail = encodeURIComponent(JSON.stringify(this.machineDetail));
var data = {
WidthIndex: WidthIndex,
HeightIndex: HeightIndex,
defalutFillet: real_radius,
real_width: real_width,
real_height: real_height,
title: nameStr,
OldConvert_rate: this.OldConvert_rate,
unit: unit,
type: 2,
goods_id: this.good_id,
customize_size_id: customize_size_id
}
prevPage.$vm.options = data;
uni.navigateBack({
delta: 1
});
}
},
onSave() {
......@@ -313,13 +355,6 @@
});
return;
}
// if (this.manyGoodSelectData != null && this.manyGoodSelectData != '' && this.manyGoodSelectData.length >
// 1) {
// this.type = 1;
// this.showManyGoodPop();
// return
// }
//创建或者更新画布信息
let unit = null
let real_width = null
......@@ -357,13 +392,22 @@
defalutFilletData = Math.floor(minWidthAanHeight / 2)
}
// url: '../index/index?machine_id=' + this.machine_id +
// "&good_id=" + item.id +
// "&title=" + item.title +
// "&real_width=" + item.key +
// "&machineDetail=" + JSON.stringify(this.list) +
// "&type = 1"
homeservice.queryList({
s: 'CanvasSize.save',
id: null,
name: nameStr,
real_width: real_width,
real_height: real_height,
unit: unit,
real_radius: defalutFilletData
}).then(result => {
uni.showToast({
icon: "success",
title: '创建成功!',
duration: 2000
});
//console.log(result)
if (this.isFirstPage && this.isFirstPage == "true") {
uni.redirectTo({
url: '../index/index?machine_id=' + this.parameter.machine_id +
'&WidthIndex=' + WidthIndex + '&HeightIndex=' + HeightIndex +
......@@ -374,56 +418,38 @@
'&real_height=' + real_height +
"&defalutFillet=" + defalutFilletData +
"&good_id=" + this.good_id +
"&type=2"
"&type=2" +
"&customize_size_id=" + result.id
})
// homeservice.newqueryList({
// s: 'CanvasSize.save',
// id: null,
// name: nameStr,
// real_width: real_width,
// real_height: real_height,
// unit: unit,
// real_radius: defalutFilletData
// }).then(result => {
// uni.showToast({
// icon: "success",
// title: '创建成功!',
// duration: 2000
// });
// let WidthIndex = real_width * this.OldConvert_rate
// let HeightIndex = real_height * this.OldConvert_rate
// //判断是否超过对应宽高比
// let minWidthAanHeight = 0;
// if (this.inputHeight > this.inputWidth) {
// minWidthAanHeight = this.inputWidth
// } else {
// minWidthAanHeight = this.inputHeight
// }
// if (defalutFilletData > minWidthAanHeight / 2) {
// defalutFilletData = Math.floor(minWidthAanHeight / 2)
// }
// uni.navigateTo({
// url: '../index/index?machine_id=' + this.parameter.machine_id +
// '&WidthIndex=' + WidthIndex + '&HeightIndex=' + HeightIndex +
// '&OldConvert_rate=' + this.OldConvert_rate + '&unit=' + unit +
// '&name=' + nameStr +
// '&pixel_scale=' + this.pixel_scale +
// '&real_width=' + real_width +
// '&real_height=' + real_height +
// "&type = 1" +
// "&defalutFillet=" + defalutFilletData
// })
// }).catch(err => {
// uni.showToast({
// title: err.msg,
// icon: 'none'
// });
// });
} else {
//console.log("defalutFilletData=" + defalutFilletData)
let pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//let machineDetail = encodeURIComponent(JSON.stringify(this.machineDetail));
var data = {
WidthIndex: WidthIndex,
HeightIndex: HeightIndex,
defalutFillet: defalutFilletData,
real_width: real_width,
real_height: real_height,
title: nameStr,
OldConvert_rate: this.OldConvert_rate,
unit: unit,
type: 2,
goods_id: this.good_id,
customize_size_id: result.id
}
prevPage.$vm.options = data;
uni.navigateBack({
delta: 1
});
}
}).catch(err => {
uni.showToast({
title: err.msg,
icon: 'none'
});
});
},
......@@ -645,7 +671,6 @@
this.pixel_Width = this.previewWidth
this.pixel_Height = this.previewHeight
if (this.pixel_Width > (this.data.windowWidth * 0.5)) {
this.pixel_scale = (this.data.windowWidth * 0.5) / this.pixel_Width
} else {
......@@ -665,8 +690,6 @@
this.pixel_scale = 1
}
}
let real_width = Number(this.inputWidth);
let real_height = Number(this.inputHeight);
if (real_width > real_height) {
......@@ -674,15 +697,10 @@
} else {
this.filletScale = real_height / 100;
}
// console.log("this.filletScale=" + this.filletScale + "defalutFillet=" + this.defalutFillet)
let defalutFilletValue = Math.floor(this.newDefalutFilletData * this.filletScale)
this.defalutFillet = Math.floor(defalutFilletValue * (this.pixel_Width * this.pixel_scale / this
.inputWidth));
this.$refs['NumSlider'].initFilletRadius(this.newDefalutFilletData, this.filletScale);
return Height
},
......@@ -725,7 +743,6 @@
return num
},
onChange(e) {
},
......@@ -734,6 +751,13 @@
},
//返回顶部
totop() {
uni.pageScrollTo({
scrollTop: 0,
duration: 300
})
},
loadGoodsList(direction) {
if (this.dataLoadState.pullDownRefresh || this.dataLoadState.reachBottom) return;
......@@ -753,7 +777,7 @@
}, 500);
}
}
homeservice.newqueryList(this.queryPage).then(result => {
homeservice.queryList(this.queryPage).then(result => {
let newList = this.LoupanList.concat(result.data)
this.LoupanList = newList
// 分页对象处理
......@@ -778,25 +802,104 @@
//做滚动加载使用
loadMore() {
this.queryPage.page = this.queryPage.page + 1;
this.loadGoodsList(Enums.DATA_DIRECTION.DOWN);
//this.queryPage.page = this.queryPage.page + 1;
//this.loadGoodsList(Enums.DATA_DIRECTION.DOWN);
},
//获取自定义产品信息
getCustomSizeInfo() {
var data = {
s: 'Product.getCustomize',
machine_id: this.queryPage.machine_id
};
homeservice.queryList(data).then(res => {
let width = this.render_cove_width / this.OldConvert_rate
let height = this.render_cove_height /this.OldConvert_rate
//this.render_cove_width = this.machineDetail.size.width * this.OldConvert_rate //最大宽度
//this.render_cove_height = this.machineDetail.size.height * this.OldConvert_rate //最大高度
this.good_id = res.id
this.good = res
this.wValue = width * this.OldConvert_rate //固定宽高比率计算(像素)
this.hValue = height * this.OldConvert_rate //固定宽高比率计算(像素)
this.previewWidth = width * this.OldConvert_rate //基础(像素)
this.previewHeight = height * this.OldConvert_rate //基础(像素)
this.inputWidth = width //文本(毫米)
this.inputHeight = height //文本(毫米)
this.pixel_Width = width * this.OldConvert_rate //实际(像素)
this.pixel_Height = height * this.OldConvert_rate //实际(像素)
if (this.pixel_Width > (this.data.windowWidth * 0.5)) {
this.pixel_scale = (this.data.windowWidth * 0.5) / this.pixel_Width
} else {
if (this.pixel_Width < (this.data.windowWidth * 0.5) &&
this.pixel_Height < (this.data.windowHeight * 0.5)) {
this.pixel_scale = 1
}
}
if (this.pixel_Height > (this.data.windowHeight * 0.5)) {
if ((this.data.windowHeight * 0.5) / this.pixel_Height < 1) {
this.pixel_scale = (this.data.windowHeight * 0.5) / this.pixel_Height
}
} else {
if (this.pixel_Width < (this.data.windowWidth * 0.5) && this.pixel_Height < (this.data
.windowHeight * this.pixelScale)) {
this.pixel_scale = 1
}
}
let real_width = Number(this.inputWidth);
let real_height = Number(this.inputHeight);
if (real_width > real_height) {
this.filletScale = real_width / 100;
} else {
this.filletScale = real_height / 100;
}
this.$refs['NumSlider'].initFilletRadius(that.newDefalutFilletData, that.filletScale);
homeservice.queryList(data).then(result => {
this.good_id = result.id
}).catch(err => {
});
},
//查设备明细
getDetailMachine() {
this.OldConvert_rate = 10
this.getCustomSizeInfo();
// homeservice.WorksList({
// machine_id: this.queryPage.machine_id,
// s: 'machine.detail'
// }).then(res => {
// //console.log("getDetailMachine")
// this.OldConvert_rate = res.convert_rate
// this.render_cove_width = res.size.width * this.OldConvert_rate //最大宽度
// this.render_cove_height = res.size.height * this.OldConvert_rate //最大高度
// this.getCustomSizeInfo();
// }).catch(err => {
// });
},
},
//上拉加载
onReachBottom() {
//console.log("加载更多")
//console.log("加载更多22this.LoupanList.length"+this.LoupanList.length)
if (this.LoupanList.length < 12) {
return setTimeout(() => {
uni.showToast({
title: '没有更多数据了!',
icon: 'none'
});
}, 500);
}
this.queryPage.page = this.queryPage.page + 1;
this.loadGoodsList(Enums.DATA_DIRECTION.DOWN);
},
......@@ -804,7 +907,15 @@
//获取屏幕宽高
this.sliderdefaultWith = uni.upx2px(280) + 22;
let that = this;
console.log(options)
if (options) {
this.machineDetail = JSON.parse(options.machineDetail);
if (this.machineDetail) {
this.render_cove_width = this.machineDetail.size.width * this.OldConvert_rate //最大宽度
this.render_cove_height = this.machineDetail.size.height * this.OldConvert_rate //最大高度
}
}
wx.getSystemInfo({
success: function(res) {
let pixelRate = res.windowWidth / 750;
......@@ -819,138 +930,13 @@
//画布接口/查询布置画布列表
that.LoupanList = []
that.getDetailMachine()
that.OldConvert_rate = 1
that.inputWidth = 200 //文本(毫米)
that.inputHeight = 450 //文本(毫米)
that.render_cove_width = that.inputWidth * that.convert_rate //最大宽度
that.render_cove_height = that.inputHeight * that.convert_rate //最大高度
that.pixel_Width = that.inputWidth * that
.OldConvert_rate //实际(像素)
that.pixel_Height = that.inputHeight * that
.OldConvert_rate //实际(像素)
if (that.pixel_Width > (that.data.windowWidth * 0.5)) {
that.pixel_scale = (that.data.windowWidth * 0.5) / that
.pixel_Width
} else {
if (that.pixel_Width < (that.data.windowWidth * 0.5) &&
that.pixel_Height < (that.data
.windowHeight * 0.5)) {
that.pixel_scale = 1
if (options.isFirstPage) {
that.isFirstPage = options.isFirstPage
}
}
if (that.pixel_Height > (that.data.windowHeight * 0.5)) {
if ((that.data.windowHeight * 0.5) / that.pixel_Height <
1) {
that.pixel_scale = (that.data.windowHeight * 0.5) /
that.pixel_Height
}
} else {
if (that.pixel_Width < (that.data.windowWidth * 0.5) &&
that.pixel_Height < (that.data.windowHeight * that
.pixelScale)) {
that.pixel_scale = 1
}
}
let real_width = Number(that.inputWidth);
let real_height = Number(that.inputHeight);
if (real_width > real_height) {
that.filletScale = real_width / 100;
} else {
that.filletScale = real_height / 100;
}
that.$refs['NumSlider'].initFilletRadius(that.newDefalutFilletData, that.filletScale);
that.getCustomSizeInfo();
//console.log("machine_id="+that.parameter.machine_id)
// homeservice.WorksList({
// machine_id: that.parameter.machine_id,
// s: 'machine.detail'
// }).then(res => {
// that.OldConvert_rate = res.convert_rate
// //this.OldConvert_rate = 1
// that.render_cove_width = res.size.width * that.OldConvert_rate //最大宽度
// that.render_cove_height = res.size.height * that.OldConvert_rate //最大高度
// //获取通用商品详情
// homeservice.queryList({
// s: 'Product.getCommonGoods',
// machine_id: that.parameter.machine_id
// }).then(result => {
// that.good = result
// that.wValue = res.size.width * that
// .OldConvert_rate //固定宽高比率计算(像素)
// that.hValue = res.size.height * that
// .OldConvert_rate //固定宽高比率计算(像素)
// that.previewWidth = res.size.width * that
// .OldConvert_rate //基础(像素)
// that.previewHeight = res.size.height * that
// .OldConvert_rate //基础(像素)
// that.inputWidth = res.size.width //文本(毫米)
// that.inputHeight = res.size.height //文本(毫米)
// that.pixel_Width = res.size.width * that
// .OldConvert_rate //实际(像素)
// that.pixel_Height = res.size.height * that
// .OldConvert_rate //实际(像素)
// if (that.pixel_Width > (that.data.windowWidth * 0.5)) {
// that.pixel_scale = (that.data.windowWidth * 0.5) / that
// .pixel_Width
// } else {
// if (that.pixel_Width < (that.data.windowWidth * 0.5) &&
// that.pixel_Height < (that.data
// .windowHeight * 0.5)) {
// that.pixel_scale = 1
// }
// }
// if (that.pixel_Height > (that.data.windowHeight * 0.5)) {
// if ((that.data.windowHeight * 0.5) / that.pixel_Height <
// 1) {
// that.pixel_scale = (that.data.windowHeight * 0.5) /
// that.pixel_Height
// }
// } else {
// if (that.pixel_Width < (that.data.windowWidth * 0.5) &&
// that.pixel_Height < (that.data.windowHeight * that
// .pixelScale)) {
// that.pixel_scale = 1
// }
// }
// let real_width = Number(that.inputWidth);
// let real_height = Number(that.inputHeight);
// if (real_width > real_height) {
// that.filletScale = real_width / 100;
// } else {
// that.filletScale = real_height / 100;
// }
// that.$refs['NumSlider'].initFilletRadius(that.newDefalutFilletData, that.filletScale);
// uni.stopPullDownRefresh();
// }).catch(err => {
// uni.stopPullDownRefresh();
// uni.showToast({
// title: err.msg,
// icon: 'none'
// });
// });
// }).catch(err => {
// //console.log(err)
// });
}
}
});
......@@ -960,7 +946,8 @@
//设备信息
let app = uni.getSystemInfoSync();
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
this.headheight = app.statusBarHeight + menuButtonInfo.height + (menuButtonInfo.top - app.statusBarHeight) * 2;
this.headheight = app.statusBarHeight + menuButtonInfo.height + (menuButtonInfo.top - app
.statusBarHeight) * 2;
},
onShow() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment