Sfoglia il codice sorgente

小版本上测试

喻文俊 3 anni fa
parent
commit
3e1fd69615

+ 11 - 0
src/main/resources/static/js/article/list.js

@@ -14,6 +14,7 @@ var articleList = new Vue({
         },
         listData: [],
         listRecord: 0,
+        productRecord: 0,
         pageInput: '1'
     },
     computed: {
@@ -64,6 +65,15 @@ var articleList = new Vue({
                 this.pageInput = 1;
             }
         },
+        fetchProductList : function(){
+            var _self = this;
+            ProductApi.GetProductSearchList({
+                keyword: this.params.keyword
+            }, function (res) {
+                res = JSON.parse(res.data)
+                _self.productRecord = res.total
+            })
+        },
         getArticleList: function (url, params) {
             var _self = this;
             $.getJSON(url, params, function (r) {
@@ -142,6 +152,7 @@ var articleList = new Vue({
         }
         if (requestUrl) {
             this.getArticleList(requestUrl, requestParams);
+            this.fetchProductList()
         }
         var _self = this;
         if(!isPC){

+ 46 - 25
src/main/resources/static/js/supplier-center/encyclopedia/instrument-edit.js

@@ -71,7 +71,7 @@ const app = new Vue({
                 // 注意事项
                 aroundOperation: '',
                 // 效果展示图片列表
-                displayImageList: '',
+                // displayImageList: '',
                 // 常见问题
                 questionList: '',
                 // 仪器类别
@@ -79,11 +79,9 @@ const app = new Vue({
                 // 仪器状态
                 status: 1,
                 // seo关键词
-                seo: '',
+                seoKeyword: '',
                 // 仪器链接
                 productLink: '',
-                // 空缺数量
-                emptyNum: ''
             },
             rules: {
                 // 仪器名称
@@ -153,6 +151,8 @@ const app = new Vue({
             // 日期选择格式
             marketTimeType: 'year',
             nmpaTimeType: 'year',
+            // 空缺数量
+            emptyNum: ''
         }
     },
     computed: {
@@ -177,7 +177,7 @@ const app = new Vue({
 
     created() {
         this.getTypeList();
-        this.watchArrayStatus(['paramList', 'questionList', 'authImageList', 'displayImageList']);
+        this.watchArrayStatus(['paramList', 'questionList', 'authImageList']);
         this.getProductFormData();
     },
 
@@ -197,14 +197,16 @@ const app = new Vue({
                     this.socrllToErrorInput()
                     return;
                 }
-                this.formData.emptyNum = this.validateEmptyParams(this.formData)
-                if( this.formData.emptyNum> 0){
-                    this.$confirm('您还剩余' + this.formData.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
+                this.emptyNum = this.validateEmptyParams(this.formData)
+                if( this.emptyNum> 0){
+                    this.$confirm('您还剩余' + this.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
                         confirmButtonText: '是',
                         cancelButtonText: '否'
                     }).then(() => {
                         this.saveFormData()
                     })
+                } else{
+                    this.saveFormData()
                 }
             })
         },
@@ -238,6 +240,17 @@ const app = new Vue({
             return count;
         },
 
+        // 裁切时间格式
+        sliceDateStr(time, type) {
+            time = dateFormat(time, 'yyyy-MM-dd')
+            if (type === 'year') {
+                time = time.slice(0, 4)
+            } else if (type === 'month') {
+                time = time.slice(0, 7)
+            }
+            return time
+        },
+
         // 保存表单数据
         saveFormData() {
             const that = this;
@@ -250,32 +263,23 @@ const app = new Vue({
                 // marketTime: dateFormat(this.formData.marketTime, 'yyyy-MM-dd'),
                 // nmpaTime: dateFormat(this.formData.nmpaTime, 'yyyy-MM-dd'),
                 authImageList: this.authImageList.map(image => (image.response ? image.response.data : image.url)),
-                displayImageList: this.displayImageList.map(image => (image.response ? image.response.data : image.url))
+                // displayImageList: this.displayImageList.map(image => (image.response ? image.response.data : image.url))
             };
 
             /* 处理时间 */
             if(this.formData.marketTime){
-                if(this.marketTimeType === 'year'){
-                    params.marketTime = dateFormat(this.formData.marketTime, 'yyyy')
-                }else if(this.marketTimeType === 'month'){
-                    params.marketTime = dateFormat(this.formData.marketTime, 'yyyy-MM')
-                }else{
-                    params.marketTime = dateFormat(this.formData.marketTime, 'yyyy-MM-dd')
-                }
+                params.marketTime = this.sliceDateStr(this.formData.marketTime, this.marketTimeType)
             }
 
             /* 处理时间 */
-            if(this.formData.nmpaTimeType){
-                if(this.nmpaTimeType === 'year'){
-                    params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy')
-                }else if(this.marketTimeType === 'month'){
-                    params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy-MM')
-                }else{
-                    params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy-MM-dd')
-                }
+            if(this.formData.nmpaTime){
+                params.nmpaTime = this.sliceDateStr(this.formData.nmpaTime, this.nmpaTimeType)
             }
 
             if (this.productId) params.productId = this.productId;
+
+            params.emptyNum = this.emptyNum;
+
             console.log(params);
             SupplierApi.ShopBaikeProductSave(params, function (res) {
                 if (res.code === 0) {
@@ -289,6 +293,18 @@ const app = new Vue({
             })
         },
 
+        // 获取时间类型(年月日)
+        getTimeType(time){
+            time = time.split('-')
+            if(time.length === 1){
+                return 'year'
+            }else if(time.length === 2){
+                return 'month'
+            }else {
+                return 'date'
+            }
+        },
+
 		initFormData: function(formData){
 			console.log(formData);
 			// 初始化this.formData
@@ -300,6 +316,11 @@ const app = new Vue({
                 		this.formData[key] = len > 0 ? len : ''
                 	} else if(['marketTime', 'nmpaTime'].includes(key)){
                 		this.formData[key] = new Date(formData[key])
+                        if(key === 'marketTime'){
+                            this.marketTimeType = this.getTimeType(formData[key])
+                        }else{
+                            this.nmpaTimeType = this.getTimeType(formData[key])
+                        }
                 	}
                 	else {
                 		this.formData[key] = formData[key];
@@ -310,7 +331,7 @@ const app = new Vue({
 			this.resetEmptyListData(formData.paramList, formData.questionList);
             // 处理图片
             this.authImageList = formData.authImageList.map(image => ({ url: image, name: 'authImage'}))
-            this.displayImageList = formData.displayImageList.map(image => ({ url: image, name: 'authImage'}))
+            // this.displayImageList = formData.displayImageList.map(image => ({ url: image, name: 'authImage'}))
 		},
 
 

+ 4 - 4
src/main/resources/static/js/supplier-center/encyclopedia/instrument-list.js

@@ -127,18 +127,18 @@ var productList = new Vue({
             if (product.status === 1) {
                 newStatus = 0;
             }
-            if(product.emptyNum > 0){
+            if(product.emptyNum > 0 && newStatus === 1){
                 this.$confirm('您还剩余' + product.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
                     confirmButtonText: '是',
                     cancelButtonText: '否'
                 }).then(() => {
-                    this.ShopBaikeProductStatusUpdate(newStatus)
+                    this.ShopBaikeProductStatusUpdate(newStatus,product)
                 })
             } else{
-                this.ShopBaikeProductStatusUpdate(newStatus)
+                this.ShopBaikeProductStatusUpdate(newStatus,product)
             }
         },
-        ShopBaikeProductStatusUpdate(newStatus){
+        ShopBaikeProductStatusUpdate(newStatus, product){
             SupplierApi.ShopBaikeProductStatusUpdate({
                 productId: product.productId,
                 shopId: this.shopId,

+ 49 - 28
src/main/resources/static/js/supplier-center/encyclopedia/product-edit.js

@@ -69,8 +69,6 @@ const app = new Vue({
                 unAdaptiveMan: '',
                 // 术前术后
                 aroundOperation: '',
-                // 效果展示图片列表
-                displayImageList: '',
                 // 常见问题
                 questionList: '',
                 // 产品类别
@@ -78,11 +76,9 @@ const app = new Vue({
                 // 产品状态
                 status: 1,
                 // seo关键词
-                seo: '',
+                seoKeyword: '',
                 // 产品链接
                 productLink: '',
-                // 空缺数量
-                emptyNum: ''
             },
             rules: {
                 // 产品名称
@@ -149,7 +145,9 @@ const app = new Vue({
             dialogImageUrl: '',
             // 日期选择格式
             marketTimeType: 'year',
-            nmpaTimeType: 'year'
+            nmpaTimeType: 'year',
+            // 空缺数量
+            emptyNum: ''
         }
     },
     computed: {
@@ -174,7 +172,7 @@ const app = new Vue({
 
     created() {
         this.getTypeList();
-        this.watchArrayStatus(['paramList', 'questionList', 'authImageList', 'displayImageList']);
+        this.watchArrayStatus(['paramList', 'questionList', 'authImageList']);
         this.getProductFormData();
 
     },
@@ -195,25 +193,28 @@ const app = new Vue({
                     this.socrllToErrorInput()
                     return
                 }
-                this.formData.emptyNum = this.validateEmptyParams(this.formData)
-                if( this.formData.emptyNum> 0){
-                    this.$confirm('您还剩余' + this.formData.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
+                this.emptyNum = this.validateEmptyParams(this.formData)
+                if( this.emptyNum> 0){
+                    this.$confirm('您还剩余' + this.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
                         confirmButtonText: '是',
                         cancelButtonText: '否'
                     }).then(() => {
                         this.saveFormData()
                     })
+                } else{
+                    this.saveFormData()
                 }
             })
         },
         // 校验空参数个数
         validateEmptyParams(params){
+            let list = []
             const keys = Object.keys(params)
-            console.log(params)
             let count = 0
             keys.forEach(key => {
                 if(typeof params[key] === "string"){
                     if(params[key] === '' || params[key].trim().length <= 0){
+                        list.push(key)
                         count ++
                     }
                 }else if(typeof params[key] === 'number'){
@@ -221,19 +222,34 @@ const app = new Vue({
                 }else if(typeof params[key] === 'object'){
                     if(params[key] instanceof  Array){
                         if(params[key].length <= 0){
+                            list.push(key)
                             count ++
                         }
                     }else {
                         if(params[key] === null){
+                            list.push(key)
                             count ++
                         }
                     }
                 }else if(typeof params[key] === 'undefined'){
+                    list.push(key)
                     count ++
                 }
             })
+            console.log(list)
             return count;
         },
+        // 裁切时间格式
+        sliceDateStr(time, type) {
+            time = dateFormat(time, 'yyyy-MM-dd')
+            if (type === 'year') {
+                time = time.slice(0, 4)
+            } else if (type === 'month') {
+                time = time.slice(0, 7)
+            }
+            return time
+        },
+
         // 保存表单数据
         saveFormData() {
             const that = this;
@@ -250,33 +266,21 @@ const app = new Vue({
                 displayImageList: this.displayImageList.map(image => (image.response ? image.response.data : image.url))
             };
 
-            debugger
-
             console.log(params);
 
             /* 处理时间 */
             if(this.formData.marketTime){
-                if(this.marketTimeType === 'year'){
-                    params.marketTime = dateFormat(this.formData.marketTime, 'yyyy')
-                }else if(this.marketTimeType === 'month'){
-                    params.marketTime = dateFormat(this.formData.marketTime, 'yyyy-MM')
-                }else{
-                    params.marketTime = dateFormat(this.formData.marketTime, 'yyyy-MM-dd')
-                }
+                params.marketTime = this.sliceDateStr(this.formData.marketTime, this.marketTimeType)
             }
 
             /* 处理时间 */
-            if(this.formData.nmpaTimeType){
-                if(this.nmpaTimeType === 'year'){
-                    params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy')
-                }else if(this.marketTimeType === 'month'){
-                    params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy-MM')
-                }else{
-                    params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy-MM-dd')
-                }
+            if(this.formData.nmpaTime){
+                params.nmpaTime = this.sliceDateStr(this.formData.nmpaTime, this.nmpaTimeType)
             }
 
             if (this.productId) params.productId = this.productId;
+            params.emptyNum = this.emptyNum;
+
             console.log(params);
             SupplierApi.ShopBaikeProductSave(params, function (res) {
                 if (res.code === 0) {
@@ -290,6 +294,18 @@ const app = new Vue({
             })
         },
 
+        // 获取时间类型(年月日)
+        getTimeType(time){
+            time = time.split('-')
+            if(time.length === 1){
+                return 'year'
+            }else if(time.length === 2){
+                return 'month'
+            }else {
+                return 'date'
+            }
+        },
+
 		initFormData: function(formData){
 			console.log(formData);
 			// 初始化this.formData
@@ -301,6 +317,11 @@ const app = new Vue({
                 		this.formData[key] = len > 0 ? len : ''
                 	} else if(['marketTime', 'nmpaTime'].includes(key)){
                 		this.formData[key] = new Date(formData[key])
+                        if(key === 'marketTime'){
+                            this.marketTimeType = this.getTimeType(formData[key])
+                        }else{
+                            this.nmpaTimeType = this.getTimeType(formData[key])
+                        }
                 	}
                 	else {
                 		this.formData[key] = formData[key];

+ 4 - 4
src/main/resources/static/js/supplier-center/encyclopedia/product-list.js

@@ -125,18 +125,18 @@ var productList = new Vue({
             if (product.status === 1) {
                 newStatus = 0;
             }
-            if(product.emptyNum){
+            if(product.emptyNum > 0 && newStatus === 1){
                 this.$confirm('您还剩余' + product.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
                     confirmButtonText: '是',
                     cancelButtonText: '否'
                 }).then(() => {
-                    this.ShopBaikeProductStatusUpdate(newStatus )
+                    this.ShopBaikeProductStatusUpdate(newStatus ,product)
                 })
             } else{
-                this.ShopBaikeProductStatusUpdate(newStatus )
+                this.ShopBaikeProductStatusUpdate(newStatus, product )
             }
         },
-        ShopBaikeProductStatusUpdate(newStatus){
+        ShopBaikeProductStatusUpdate(newStatus, product){
             SupplierApi.ShopBaikeProductStatusUpdate({
                 productId: product.productId,
                 shopId: this.shopId,

+ 3 - 1
src/main/resources/templates/article/list.html

@@ -28,7 +28,7 @@
                 </div>
                 <p v-if="isPC" class="result search-tip">
                     <span>为你找到相关文章<b v-text="listRecord"></b>条,</span>
-                    <span>同时为您找到相关产品<b v-text="listRecord"></b>条</span>
+                    <span>同时为您找到相关产品<b v-text="productRecord"></b>条</span>
                     <a target="_blank" :href="'/product/list.html?keyword=' + params.keyword" v-if="listRecord > 0">点击前往</a>
                 </p>
             </div>
@@ -114,6 +114,8 @@
 </div>
 <template th:replace="article/components/article-footer"></template>
 <template th:replace="components/foot-link"></template>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/ajax.service.js}"></script>
+<script charset="utf-8" type="text/javascript" th:src="@{/js/common/serviceapi/product.service.js}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/article/common.js(v=${version})}"></script>
 <script charset="utf-8" type="text/javascript" th:src="@{/js/article/list.js(v=${version})}"></script>
 </body>

+ 2 - 2
src/main/resources/templates/encyclopedia/instrument-detail.html

@@ -214,11 +214,11 @@
             <div class="line"></div>
         </div>
         <div class="group">
-            <a href="/" target="_blank" class="link">
+            <a th:href="*{ '/product-' + '4928.html' }" target="_blank" class="link">
                 <img th:src="*{image}" th:alt="*{name}" class="image"/>
                 <span th:text="*{name}" class="name"></span>
             </a>
-            <a href="/" target="_blank" class="link">
+            <a th:href="*{ '/supplier' + 111 + '.html' }" target="_blank" class="link">
                 <img th:src="*{image}" th:alt="*{name}" class="image"/>
                 <span th:text="*{name}" class="name"></span>
             </a>

+ 1 - 1
src/main/resources/templates/supplier-center/encyclopedia/instrument-edit.html

@@ -130,7 +130,7 @@
 
                             <!-- SEO关键词 -->
                             <el-form-item label="SEO关键字" prop="seo">
-                                <el-input v-model="formData.seo" placeholder="例如:名称,名称"></el-input>
+                                <el-input v-model="formData.seoKeyword" placeholder="例如:名称,名称"></el-input>
                             </el-form-item>
 
                             <!-- 仪器档案 -->

+ 1 - 1
src/main/resources/templates/supplier-center/encyclopedia/product-edit.html

@@ -109,7 +109,7 @@
 
                             <!-- SEO关键词 -->
                             <el-form-item label="SEO关键字" prop="seo">
-                                <el-input v-model="formData.seo" placeholder="例如:名称,名称"></el-input>
+                                <el-input v-model="formData.seoKeyword" placeholder="例如:名称,名称"></el-input>
                             </el-form-item>
 
                             <!-- 产品档案 -->