guide.vue 4.8 KB
Newer Older
S
1  
shenjizhe 已提交
1 2
<template>
	<view style="display: flex;flex-direction: column;justify-content: space-between;">
S
1  
shenjizhe 已提交
3 4
		<view><uni-steps :options="progress" :active="processIndex"></uni-steps></view>
		<scroll-view style="height: 88vh">
S
1  
shenjizhe 已提交
5
			<thirdlucky-data-form v-if="processIndex == 0" :showButton="false" :columns="component.columns" :formData="component.data"></thirdlucky-data-form>
S
1  
shenjizhe 已提交
6
			<thirdlucky-data-view
S
1  
shenjizhe 已提交
7
				v-if="processIndex == 1"
S
1  
shenjizhe 已提交
8 9 10 11 12 13 14
				:buttons="buttons"
				:columns="entity.columns"
				:datas="entity.datas"
				:tableNames="entity.tableNames"
				:showButton="false"
				@selected="onSelected"
			></thirdlucky-data-view>
S
1  
shenjizhe 已提交
15
			<thirdlucky-data-form v-if="processIndex == 2" :showButton="false" :columns="code.columns" :formData="code.data"></thirdlucky-data-form>
S
1  
shenjizhe 已提交
16 17 18 19 20 21 22 23
			<view v-if="processIndex == 3">
				<button @click="onCreateComponent">新建组件</button>
				<button @click="onCreateGit">新建git</button>
				<button @click="onSaveModel">保存模型</button>
				<button @click="onGenerateCode">生成代码</button>
				<button @click="onUpload">上传代码</button>
				<thirdlucky-console-view ref="console" class="console-view"></thirdlucky-console-view>
			</view>
S
1  
shenjizhe 已提交
24
		</scroll-view>
S
1  
shenjizhe 已提交
25
		<view style="display: flex;flex-direction: row;">
S
1  
shenjizhe 已提交
26
			<button style="flex: 1;" :disabled="processIndex == 0" @click="onPrevious">上一步</button>
S
1  
shenjizhe 已提交
27
			<button style="flex: 1;" :disabled="processIndex == 3" @click="onNext">下一步</button>
S
1  
shenjizhe 已提交
28
		</view>
S
1  
shenjizhe 已提交
29 30 31 32 33 34 35 36 37
	</view>
</template>

<script>
export default {
	data() {
		return {
			processIndex: 0,
			column: {},
S
1  
shenjizhe 已提交
38
			progress: [{ title: '1.新建组件' }, { title: '2.创建模型' }, { title: '3.生成代码' }, { title: '4.推送代码' }],
S
1  
shenjizhe 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
			buttons: [{ id: 'edit', name: '编辑', color: 'green' }],
			entity: {
				columns: [
					{
						name: 'name',
						info: '名称',
						type: 'text',
						tips: '名称'
					},
					{
						name: 'title',
						info: '标题',
						type: 'text',
						tips: '标题'
					},
					{
						name: 'comment',
						info: '描述',
						type: 'text',
						tips: '描述'
					},
					{
						name: 'show',
						info: '开关',
						type: 'switch',
						tips: ''
					}
				],
				datas: [],
				tableNames: ['name', 'comment']
S
1  
shenjizhe 已提交
69
			},
S
1  
shenjizhe 已提交
70
			component: {
S
1  
shenjizhe 已提交
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
				columns: [
					{
						name: 'name',
						info: '名称',
						tips: '组件名称',
						type: 'text'
					},
					{
						name: 'comment',
						info: '介绍',
						tips: '组件介绍',
						type: 'textarea'
					},
					{
						name: 'show',
						info: '开关',
						tips: '开关',
						type: 'switch'
					},
					{
						name: 'domain_name',
						info: '域名',
						tips: 'http://localhost',
						type: 'text'
					},
					{
						name: 'project_name',
						info: '工程名称',
						tips: '工程名称',
						type: 'text'
					},
					{
						name: 'project_path',
						info: '工程路径',
						tips: '相对路径',
						type: 'text'
					},
					{
						name: 'file_path',
						info: '文件路径',
						tips: '文件相对路径',
						type: 'text'
					},
					{
						name: 'port',
						info: '端口号',
						tips: '8080',
						type: 'number'
					},
					{
						name: 'root_package',
						info: '包名',
						tips: 'com.bfec',
						type: 'text'
					},
					{
						name: 'deploy_url',
						info: '部署地址',
						tips: '172.17.14.179',
						type: 'text'
					},
					{
						name: 'deploy_path',
						info: '部署路径',
						tips: '/usr/local/services/',
						type: 'text'
					},
					{
						name: 'git_path',
						info: 'GIT地址',
						tips: 'ssh://git@support.licaiedu.com:2222/test-group/code-factory-service.git',
						type: 'text'
					},
					{
						name: 'git_group',
						info: 'GIT分组',
						tips: 'test-group',
						type: 'text'
					}
				],
				data: {}
			},
			code: {
				columns: [
					{
						name: 'template_id',
						info: '模板ID',
						tips: '1',
						type: 'number'
					}
				],
				data: {}
S
1  
shenjizhe 已提交
163 164 165 166 167 168 169
			}
		};
	},
	methods: {
		onSelected(index, action, data) {
			if (action == 'edit') {
			}
S
1  
shenjizhe 已提交
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
		},
		onPrevious() {
			if (this.processIndex > 0) {
				this.processIndex--;
			}
		},
		onNext() {
			if (this.processIndex < 4) {
				switch (this.processIndex) {
					case 0:
						break;
					case 1:
						break;
					case 2:
						break;
					case 3:
						break;
				}
				this.processIndex++;
			}
S
1  
shenjizhe 已提交
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
		},
		onCreateComponent() {
			callApi(this.api.addComponent, this.component.data);
		},
		onCreateGit() {},
		onSaveModel() {},
		onGenerateCode() {},
		onUpload() {},

		callApi(apifunc, data) {
			apifunc(
				data,
				res => {
					uni.showToast({
						title: '提交成功:',
						icon: 'succes',
						duration: 2000
					});
				},
				res => {
					uni.showToast({
						title: '提交失败:' + res.errMsg,
						icon: 'error',
						duration: 2000
					});
				}
			);
S
1  
shenjizhe 已提交
217
		}
S
1  
shenjizhe 已提交
218 219 220 221
	}
};
</script>

S
1  
shenjizhe 已提交
222 223 224 225 226 227 228 229
<style>
.console-view {
	background: white;
	border-style: solid;
	border-width: 100%;
	height: 60vh;
}
</style>