Commit cc2a9e59 by hank

列表编辑,以及增加子项

parent 63069502
NODE_ENV='development'
VUE_APP_BASE_API='http://server.bdideal.com'
\ No newline at end of file
VUE_APP_BASE_API='http://172.16.4.219:8090'
\ No newline at end of file
......@@ -10,6 +10,7 @@
</div>
</template>
<script>
// import { getCookie } from '@/api/cookie'
export default {
data() {
return {
......@@ -32,7 +33,6 @@ export default {
}
},
created () {
// var self = this
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL)
window.addEventListener(
......
import { get } from './index'
export function getCookie() {
return get('/test/get/cookie')
}
......@@ -18,7 +18,7 @@ export default {
},
zIndex: {
type: Number,
default: 1
default: 2
},
className: {
type: String,
......
......@@ -18,7 +18,7 @@
<br />
<van-button class="enter-btn" type="info" @click="addDeviceToPin" size="large">确定</van-button>
</div>
</van-tab> -->
</van-tab>-->
<!-- </van-tabs> -->
</div>
</template>
......@@ -45,24 +45,31 @@ export default {
callback() {},
addDeviceToPin() {
if (!this.pinCode) {
this.$toast('请输入要添加设备的PIN码')
return
this.$toast("请输入要添加设备的PIN码");
return;
}
this.$dialog.confirm({
this.$dialog
.confirm({
title: "添加设备",
message: `是否将设备 ${this.pinCode} 添加至我的设备`
})
.then(() => {
// on confirm
addDeviceFromPin(this.pinCode).then(() => {
this.$toast('添加成功')
this.$router.back()
this.$toast("添加成功");
this.$toast.loading({
duration: 2000,
mask: true,
message: "加载中..."
});
setTimeout(() => {
this.$router.back();
}, 2000);
});
})
.catch(() => {
// on cancel
});
}
}
};
......
......@@ -65,9 +65,14 @@
</template>
<script>
import { getDeviceList, deleteDevice, addDeviceFromToken } from "@/api/device.js";
import {
getDeviceList,
deleteDevice,
addDeviceFromToken
} from "@/api/device.js";
import JSBridge from "@/utils/jssdk";
import { setTimeout } from "timers";
export default {
name: "Films",
data() {
......@@ -166,7 +171,14 @@ export default {
// on confirm
addDeviceFromToken(str).then(() => {
this.$toast("添加成功");
this.onRefresh()
this.$toast.loading({
duration: 2000,
mask: true,
message: "加载中..."
});
setTimeout(() => {
this.onRefresh();
}, 2000);
});
})
.catch(() => {
......
<template>
<Sticky>
<Sticky style="z-index: 10;">
<van-nav-bar
:title="title"
:left-arrow="typeof leftArrow !== 'undefined' ? true : false"
......
......@@ -6,8 +6,8 @@
<div class="name">Vmatrix</div>
<div class="login-content">
<van-cell-group>
<van-field complate v-model.trim="loginForm.phone" left-icon="phone-o" placeholder="请输入手机号" />
<van-field v-model.trim="loginForm.code" left-icon="smile-comment-o" placeholder="请输入验证码">
<van-field type="number" complate v-model.trim="loginForm.phone" left-icon="phone-o" placeholder="请输入手机号" />
<van-field type="number" v-model.trim="loginForm.code" left-icon="smile-comment-o" placeholder="请输入验证码">
<span slot="button" class="code" @click="sendCode">
<span v-if="time === 0">获取验证码</span>
<span v-else>{{time}}s</span>
......@@ -56,7 +56,7 @@ export default {
this.isload = false;
window.localStorage.setItem("login", JSON.stringify(this.loginForm));
this.$router.replace({
path: "/"
path: "/tempaltes"
});
})
.catch(() => {
......
......@@ -32,27 +32,36 @@
:key="index2"
>
<div class="btn-con">
<span>
序号{{index2}}
</span>
<span class="del-btn" @click="deleteItem(index2, schemaData[item.dataKey])">
删除
</span>
<span>序号{{index2}}</span>
<span class="del-btn" @click="deleteItem(index2, schemaData[item.dataKey])">删除</span>
</div>
<div class="list-item-list" v-for="(item3, index3) in item2" :key="index3">
<div v-if="(index3 != 'schemaIndex' && index3 != 'index')">
<input
v-if="index3 != 'index'"
v-if="item.modelSchema[isSchemaIndex(item2)][index3].type === 'text'"
:placeholder="item.modelSchema[isSchemaIndex(item2)][index3].description"
class="edit-input"
type="text"
v-model="item2[index3]"
@keyup="valueChange2()"
/>
</div>
</div>
</div>
<div class="create-btn-container">
<van-button class="create-btn" type="info" @click="addItem(item)">添加</van-button>
</div>
<button v-if="item.type === 'image'">上传</button>
<button v-if="item.type === 'video'">上传</button>
</div>
<van-uploader
result-type="dataUrl"
v-if="item.type == 'image'"
@click.native="uploadItem(item.dataKey)"
:after-read="uploadAfter"
>
<van-button icon="photo" type="info">上传图片</van-button>
</van-uploader>
</div>
</van-collapse-item>
</van-collapse>
......@@ -60,6 +69,8 @@
</template>
<script>
import { upload } from "@/api/api";
export default {
name: "editMenu",
props: {
......@@ -75,7 +86,8 @@ export default {
created() {},
data() {
return {
activeName: ""
activeName: "",
dataKey: ""
};
},
methods: {
......@@ -83,8 +95,46 @@ export default {
console.log(this.schemaData);
this.$emit("setList", this.schemaData);
},
uploadItem(key) {
alert(key);
this.dataKey = key;
},
isSchemaIndex(item) {
return item["schemaIndex"] ? item["schemaIndex"] : 0;
},
toObj(obj) {
console.log(obj)
return JSON.parse(JSON.stringify(obj));
},
addItem(item) {
if (item.modelSchema && item.modelSchema.length === 1) {
var keys = Object.keys(item.modelSchema[0]);
var obj = {};
keys.map(function(item) {
obj[item] = "";
});
this.schemaData[item.dataKey].push(obj);
} else {
alert('选择类型添加,敬请期待!')
}
console.log(item);
},
uploadAfter(file) {
// console.log(file, upload);
upload(file.file)
.then(res => {
console.log(res.data);
console.log(this.dataKey);
this.schemaData[this.dataKey].value = res.data.data;
this.valueChange2();
})
.catch(e => {
console.log(e);
this.$toast("上传失败");
});
},
deleteItem(index, arr) {
arr.splice(index, 1)
arr.splice(index, 1);
this.$emit("setList", this.schemaData);
}
}
......@@ -135,7 +185,7 @@ input {
border: none;
}
.edit-input {
width: 90%;
width: 97%;
border: 1px solid #d0d0d0;
color: #333333;
}
......
......@@ -289,8 +289,7 @@ export default {
vm.isEdited = true;
}
if (typeof e.data === "object" && e.data["type"] == "getList") {
console.log(e.data.pages);
// vm.templateData.listData = e.data.pages;
vm.templateData.listData = e.data.pages;
// console.log("12121321321");
}
// var color = e.data;
......@@ -315,11 +314,8 @@ export default {
this.show = false;
this.pageViews = false;
} else {
var a = confirm("确认退出页面");
if (a) {
next();
}
}
},
mounted() {},
methods: {
......
......@@ -7,6 +7,7 @@
@load="getData"
class="iframe"
v-show="loaded"
scrolling="no"
:src="templateData.frameUrl+'?isPreview=1'"
frameborder="0"
></iframe>
......
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 sign in to comment