| | |
| | | </uv-upload> |
| | | </view> |
| | | </view> |
| | | <view class="temp_item" v-if="!isEditMode"> |
| | | <view class="title"> |
| | | 预制动画 |
| | | </view> |
| | | <view class="item"> |
| | | <uv-radio-group v-model="selectedPreset" placement="column" @change="changePreset" labelSize="26rpx"> |
| | | <uv-radio class="spec_radio" v-for="(item, index) in presetList" :key="index" :label="'预制动画:'+item.name" |
| | | :name="item.name"> |
| | | </uv-radio> |
| | | </uv-radio-group> |
| | | </view> |
| | | </view> |
| | | <view class="temp_item"> |
| | | <view class="title"> |
| | | 屏幕规格 |
| | |
| | | import { |
| | | templeteAdd, |
| | | templeteInfo, |
| | | templeteEdit |
| | | templeteEdit, |
| | | templeteList |
| | | } from '@/api/api.js' |
| | | let ctx = null |
| | | export default { |
| | |
| | | scrollLeft: 0, |
| | | textType: 'overwrite', |
| | | tempText: '', |
| | | presetList: [], |
| | | selectedPreset: '', |
| | | isEditMode: false, |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.tId = opt.id |
| | | this.getTempleteInfo() |
| | | this.titleName = '编辑模版' |
| | | this.isEditMode = true |
| | | } |
| | | else{ |
| | | this.titleName = '新增模版' |
| | | this.isEditMode = false |
| | | this.getPresetList() |
| | | } |
| | | }, |
| | | onShow() { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | getPresetList() { |
| | | templeteList({ |
| | | userId: 1, |
| | | pageNum: 1, |
| | | pageSize: 99 |
| | | }).then(res => { |
| | | console.log('预制动画列表-------', res.rows) |
| | | if(res.code == 200){ |
| | | this.presetList = res.rows || [] |
| | | } |
| | | }) |
| | | }, |
| | | changePreset(val) { |
| | | const preset = this.presetList.find(item => item.name === val) |
| | | if (preset) { |
| | | this.specVal = preset.screen |
| | | this.modeVal = preset.mode |
| | | this.total = preset.cycle |
| | | this.speed = preset.speed |
| | | if (preset.fpsList) { |
| | | this.fpsList = JSON.parse(preset.fpsList) |
| | | } |
| | | } |
| | | }, |
| | | handleScroll(e){ |
| | | this.scrollLeft = e.detail.scrollLeft |
| | | }, |
| | |
| | | getCellByTouch(touch, cb) { |
| | | this.getGridRect(rect => { |
| | | if (!rect) return |
| | | const x = touch.clientX - rect.left + this.scrollLeft |
| | | const x = touch.clientX + this.scrollLeft |
| | | const y = touch.clientY - rect.top |
| | | const colCount = this.width * (this.modeVal == 2 ? 10 : 1) |
| | | const cellWidth = rect.width / colCount |
| | | const cellHeight = rect.height / this.height |
| | | const colIndex = Math.floor(x / cellWidth) |
| | | const rowIndex = Math.floor(y / cellHeight) |
| | | console.log('colCount', colCount, 'rowIndex', rowIndex, 'colIndex', colIndex) |
| | | //console.log('colCount', colCount, 'rowIndex', rowIndex, 'colIndex', colIndex, x, cellWidth) |
| | | if ( |
| | | colIndex >= 0 && colIndex < colCount && |
| | | rowIndex >= 0 && rowIndex < this.height |