| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <view>
- <view class="form">
- <view class="form-item-title">产品标题</view>
- <view class="form-input-box">
- <input placeholder-class="form-input-placeholder" v-model="productTitle" placeholder="请输入产品标题"/>
- </view>
- <view class="form-item-title">产品链接</view>
- <view class="form-input-box ddflex">
- <input class="flex" v-model="productLink" placeholder-class="form-input-placeholder" placeholder="请填写或粘贴产品链接"/>
- <view class="clear-btn">清空</view>
- </view>
- <view class="next-btn" @click="submit">保存</view>
- </view>
- </view>
- </template>
- <script>
- const app = getApp();
- const req = require("../../utils/request.js");
- export default {
- components: {},
- props: {},
- data() {
- return {
- systems: {},
- isTop:0,
- productTitle:'',
- productLink:''
- }
- },
- onLoad(options) {
- let pages = getCurrentPages();
- var prevPage = pages[pages.length - 2];
- if (prevPage) {
- this.productTitle = prevPage.$vm.productTitle
- this.productLink = prevPage.$vm.productLink
- }
- },
- onShow() {
-
- },
- methods: {
- submit(){
- if(!this.productTitle){
- return req.msg('请输入产品标题')
- }
- if(!this.productLink){
- return req.msg('请输入产品链接')
- }
- let pages = getCurrentPages();
- var prevPage = pages[pages.length - 2];
- if (prevPage) {
- prevPage.$vm.setData({
- productTitle:this.productTitle,
- productLink: this.productLink
- });
- }
- uni.navigateBack()
- }
- },
- mounted() {
- const systemInfo = uni.getSystemInfoSync();
- // px转换到rpx的比例
- let pxToRpxScale = 750 / systemInfo.windowWidth;
- let systems = {
- ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
- navigationHeight: 44 * pxToRpxScale // 导航栏的高度
- };
- systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
- this.systems = systems;
- },
- onPageScroll: function(e) {
- if (e.scrollTop > this.systems.barHeight) {
- this.isTop = 1;
- } else {
- this.isTop = 0;
- }
- }
- }
- </script>
- <style>
- @import "./productLink.css";
- </style>
|