二手车小程序
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.newcar')"></uni-nav-bar>
|
||||
<view class="content">
|
||||
<view class="cont">{{$t('carinfo.mag')}}</view>
|
||||
<view class="">
|
||||
<!-- <u--textarea v-model="carinfo.condition_desc" :placeholder="$t('carinfo.maginput')" ></u--textarea> -->
|
||||
<textarea auto-height v-model="carinfo.condition_desc" :placeholder="$t('carinfo.maginput')"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<movable-area class="movable-area">
|
||||
<movable-view class="movable-view" :x="x" :y="y" direction="all">
|
||||
<view class="index" @tap="draftadd" >
|
||||
<image v-if="i18locale=='zh'" src="/static/image/cg.png" mode="widthFix">
|
||||
<image v-if="i18locale=='en'" src="/static/image/cge.png" mode="widthFix">
|
||||
<image v-if="i18locale=='ru'" src="/static/image/cgr.png" mode="widthFix">
|
||||
</view>
|
||||
</movable-view>
|
||||
</movable-area>
|
||||
</view>
|
||||
<view class="foot">
|
||||
<view>
|
||||
<button class="btn1" plain="true" @click="leftClick">{{$t('button.previous')}}</button>
|
||||
<button class="btn" @click="addFn">{{$t('button.submit')}}</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request,showToast } from '@/api/apiT.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
x: 310, //x坐标
|
||||
y: 550, //y坐标
|
||||
carinfo:{},
|
||||
i18locale:uni.getStorageSync('i18locale')?uni.getStorageSync('i18locale'):'zh',
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const carinfo = uni.getStorageSync('carinfo');
|
||||
this.carinfo = JSON.parse(carinfo);
|
||||
console.log(this.carinfo)
|
||||
const { windowWidth, windowHeight } = uni.getSystemInfoSync();
|
||||
this.x = windowWidth-70
|
||||
this.y = windowHeight-185
|
||||
},
|
||||
methods: {
|
||||
leftClick(){
|
||||
uni.navigateBack({})
|
||||
},
|
||||
draftadd(){
|
||||
if(uni.getStorageSync('draftid')){
|
||||
request({
|
||||
url:'draft/update/'+uni.getStorageSync('draftid'),
|
||||
method:'post',
|
||||
data:this.carinfo
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
})
|
||||
}else{
|
||||
request({
|
||||
url:'draft/add',
|
||||
method:'post',
|
||||
data:this.carinfo
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
if(res.data.code ==0){
|
||||
uni.setStorageSync('draftid', res.data.data.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
addFn(){
|
||||
request({
|
||||
url:'vehicle/add',
|
||||
method:'post',
|
||||
data:this.carinfo
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
if(res.data.code ==0){
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',// 替换为你要跳转的页面路径
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
textarea {
|
||||
min-height: 640rpx;// 设置默认高度 ,解决设置自适应高度之后高度无效问题
|
||||
width: 100%;
|
||||
}
|
||||
.content{
|
||||
margin: 20px 12px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 10px;
|
||||
.cont{
|
||||
position: relative;
|
||||
font-weight: 500;
|
||||
}
|
||||
.cont::after{
|
||||
content : '';
|
||||
position : absolute;
|
||||
width : 200%;
|
||||
height : 200%;
|
||||
top : 0;
|
||||
left : 0;
|
||||
transform-origin: 0 0;
|
||||
border-width: 0;
|
||||
border-bottom-width:1px;
|
||||
border-style : solid;
|
||||
transform : scale(0.5, 0.5);
|
||||
border-radius : 1px;
|
||||
box-sizing : border-box;
|
||||
pointer-events : none;
|
||||
border-color:#C3C3C3;
|
||||
}
|
||||
}
|
||||
.content view{
|
||||
padding: 20px 10px;
|
||||
}
|
||||
.right{
|
||||
text-align: right;
|
||||
}
|
||||
.select{
|
||||
display: flex;
|
||||
}
|
||||
.caogao{
|
||||
position: fixed;
|
||||
right: 0px;
|
||||
bottom: 280rpx;
|
||||
}
|
||||
.caogao image{
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
.foot{
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
.foot view{
|
||||
display: flex;
|
||||
width: 94%;
|
||||
margin: 15px 3%;
|
||||
}
|
||||
.btn{
|
||||
background-color: #3F435B;
|
||||
color: white;
|
||||
border-radius: 50px;
|
||||
margin-bottom: 40px;
|
||||
margin-left: 2%;
|
||||
flex-grow:1
|
||||
}
|
||||
.btn1{
|
||||
border-color:#9E9E9E !important;
|
||||
border-radius: 50px;
|
||||
color: #414141;
|
||||
margin-bottom: 40px;
|
||||
width: 110px;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user