89 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <section class="AiResult">
 | |
|     <slot v-if="$slots.default"/>
 | |
|     <template v-else>
 | |
|       <image :src="result.image"/>
 | |
|       <span class="tips">{{ result.tips }}</span>
 | |
|       <slot name="extra" class="extra" v-if="$slots.extra"/>
 | |
|       <div v-if="result.btn" class="btn" @tap="handleTap">{{ result.btn }}</div>
 | |
|     </template>
 | |
|   </section>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
| export default {
 | |
|   name: "AiResult",
 | |
|   props: {
 | |
|     tips: {default: "提交成功!"},
 | |
|     image: {default: "https://cdn.cunwuyun.cn/dvcp/h5/result/success.png"},
 | |
|     btn: {default: ""},
 | |
|     status: {default: "success"},
 | |
|     btnTap: Function
 | |
|   },
 | |
|   computed: {
 | |
|     result() {
 | |
|       let obj = {
 | |
|         image: this.image,
 | |
|         tips: this.tips,
 | |
|         btn: this.btn
 | |
|       }
 | |
|       if (this.status == "error") {
 | |
|         obj.image = this.$cdn + "result/fail.png"
 | |
|         obj.tips = this.tips || "提交失败!"
 | |
|       } else if (this.status == "loading") {
 | |
|         obj.image = "https://cdn.cunwuyun.cn/wxAdmin/img/message.png"
 | |
|         obj.tips = this.tips || "数据读取中..."
 | |
|       }
 | |
|       return obj
 | |
|     }
 | |
|   },
 | |
|   methods: {
 | |
|     handleTap() {
 | |
|       this.btnTap && this.btnTap()
 | |
|     }
 | |
|   }
 | |
| }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| .AiResult {
 | |
|   padding-top: 96px;
 | |
|   width: 100%;
 | |
|   display: flex;
 | |
|   flex-direction: column;
 | |
|   align-items: center;
 | |
|   justify-content: center;
 | |
|   font-size: 36px;
 | |
|   font-weight: bold;
 | |
| 
 | |
|   & > image {
 | |
|     width: 192px;
 | |
|     height: 192px;
 | |
|   }
 | |
| 
 | |
|   .tips {
 | |
|     margin: 16px auto 0;
 | |
|     color: #333;
 | |
|   }
 | |
| 
 | |
|   .extra {
 | |
|     margin-top: 48px;
 | |
|   }
 | |
| 
 | |
|   .btn {
 | |
|     cursor: pointer;
 | |
|     margin-top: 80px;
 | |
|     width: calc(100% - 192px);
 | |
|     height: 88px;
 | |
|     background: #197DF0;
 | |
|     box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.02);
 | |
|     border-radius: 8px;
 | |
|     color: #FFF;
 | |
|     display: flex;
 | |
|     justify-content: center;
 | |
|     align-items: center;
 | |
|     font-weight: 500;
 | |
|   }
 | |
| }
 | |
| </style>
 |