Prechádzať zdrojové kódy

供应商采美百科

喻文俊 3 rokov pred
rodič
commit
cc574b684c

+ 10 - 10
src/main/resources/config/dev/application-dev.yml

@@ -4,14 +4,14 @@ spring:
   #数据源连接--start
   datasource:
     #本地连接数据库
-    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
-    username: developer
-    password: 05bZ/OxTB:X+yd%1
-    #测试连接数据库
-    #url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    #url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     #username: developer
-    #password: J5p3tgOVazNl4ydf
-    #type: com.zaxxer.hikari.HikariDataSource
+    #password: 05bZ/OxTB:X+yd%1
+    #测试连接数据库
+    url: jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: developer
+    password: J5p3tgOVazNl4ydf
+    type: com.zaxxer.hikari.HikariDataSource
     hikari:
       minimum-idle: 5
       maximum-pool-size: 15
@@ -53,9 +53,9 @@ logging:
 # 服务域名
 caimei:
   siteEnv: 0 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
-  spiServer: http://192.168.2.68:8008
-  #coreServer: https://core-b.caimei365.com
-  coreServer: http://192.168.2.68:18002
+  #spiServer: http://192.168.2.68:8008
+  coreServer: https://core-b.caimei365.com
+  #coreServer: http://192.168.2.68:18002
   #coreServer: http://192.168.2.75:18002
   imageDomain: https://img-b.caimei365.com
   wwwDomain: http:localhost:8009

+ 2 - 2
src/main/resources/static/css/product/alliance-page.css

@@ -36,7 +36,7 @@ a{text-decoration:none}
 .zp-main .zp-info .content .zp-click.websit:hover span{margin-left:4px}
 .zp-main .zp-info .zp-auth-info{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;height:114px;padding:24px;margin-top:24px;color:#bc1724;background:url(/img/alliance-page/zp-pc-auth-bg.png) no-repeat;-webkit-box-sizing:border-box;box-sizing:border-box}
 .zp-main .zp-info .zp-auth-info .zp-auth-icon{width:100%;height:28px;background:url(/img/alliance-page/zp-pc-auth-icon.png) no-repeat}
-.zp-main .zp-info .zp-auth-info .zp-auth-text{font-size:16px}
+.zp-main .zp-info .zp-auth-info .zp-auth-text{font-size:16px;color:#bc1724;}
 .zp-main .zp-info .zp-auth-info .zp-auth-text b{font-weight:bold}
 .zp-main .zp-title{font-size:18px;font-weight:bold}
 .zp-main .zp-title .line{position:relative;width:100%;height:1px;margin-top:12px;background:#ececec}
@@ -92,7 +92,7 @@ a{text-decoration:none}
 .zp-main .zp-info .content .zp-click.websit{font-size:3.6vw;color:#bc1724}
 .zp-main .zp-info .zp-auth-info{width:100vw;height:20vw;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:0 4vw;margin:4vw 0;-webkit-box-sizing:border-box;box-sizing:border-box;background:url(/img/alliance-page/zp-h5-auth-bg.png) no-repeat;background-size:100vw auto}
 .zp-main .zp-info .zp-auth-info .zp-auth-icon{width:100%;height:4.7vw;background:url(/img/alliance-page/zp-h5-auth-icon.png) no-repeat;background-size:12vw auto}
-.zp-main .zp-info .zp-auth-info .zp-auth-text{font-size:3.6vw;margin-top:1.2vw;line-height:1.6}
+.zp-main .zp-info .zp-auth-info .zp-auth-text{font-size:3.6vw;margin-top:1.2vw;line-height:1.6;color:#bc1724;}
 .zp-main .zp-title{font-size:4.2vw}
 .zp-main .zp-title .line{width:100%;height:1px;background:#c4c4c4;margin-top:4vw;opacity:0.4}
 .zp-main .zp-params .row{display:table-row}

+ 51 - 47
src/main/resources/static/js/supplier-center/encyclopedia/product-edit.js

@@ -102,21 +102,21 @@ new Vue({
                 type: 'string',
                 required: true,
                 message: '名称不能为空',
-                trigger: ['blur','change']
+                trigger: ['blur', 'change']
             }],
             // 产品别名
             alias: [{
                 type: 'string',
                 required: true,
                 message: '别名不能为空',
-                trigger: ['blur','change']
+                trigger: ['blur', 'change']
             }],
             // 产品概述
             discription: [{
                 type: 'string',
                 required: true,
                 message: '概述不能为空',
-                trigger: ['blur','change']
+                trigger: ['blur', 'change']
             }],
             // 产品图片
             image: [{
@@ -159,35 +159,40 @@ new Vue({
                 type: 'string',
                 required: true,
                 message: '品牌不能为空',
-                trigger: ['change','blur']
+                trigger: ['change', 'blur']
             }],
             // 产地
             producePlace: [{
                 type: 'string',
                 required: true,
                 message: '产地不能为空',
-                trigger: ['change','blur']
+                trigger: ['change', 'blur']
             }],
+
             // 上市时间
             marketTime: [{
                 type: 'string',
                 required: true,
                 message: '上市时间不能为空',
-                trigger: ['change','blur']
+                trigger: ['change', 'blur'],
+                pattern: {
+                    reg: /^\d{4}/g,
+                    regMessage: '时间格式不正确,年月日请以"-"连接'
+                },
             }],
             // 公司/厂商
             company: [{
                 type: 'string',
                 required: true,
                 message: '公司/厂商不能为空',
-                trigger: ['change','blur']
+                trigger: ['change', 'blur']
             }],
             // NMPA认证时间
             nmpaTime: [{
                 type: 'string',
                 required: true,
                 message: 'NMPA认证时间不能为空',
-                trigger: ['change','blur']
+                trigger: ['change', 'blur']
             }],
             // 产品认证
             authImageList: [{
@@ -229,7 +234,7 @@ new Vue({
                 type: 'array',
                 required: true,
                 message: '常见问题不能为空',
-                trigger: ['change','blur'],
+                trigger: ['change', 'blur'],
                 valid: ['question', 'answer']
             }],
             // 产品类别
@@ -241,7 +246,7 @@ new Vue({
             }],
             // 产品状态
             status: [{
-               type: 'number',
+                type: 'number',
                 required: true,
                 message: '状态不能为空',
                 trigger: 'change'
@@ -270,7 +275,7 @@ new Vue({
         },
 
         // 初始化表单数据
-        initFormData(formData){
+        initFormData(formData) {
             console.log(formData);
             // 初始化this.formData
             for (var key in this.formData) {
@@ -284,18 +289,18 @@ new Vue({
             this.formData.nmpaTime = dateFormat(new Date(this.formData.nmpaTime), 'yyyy-MM-dd');
 
             // 初始化图片列表 imageList  authImageList  displayImageList
-            this.imageList = this.initPreviewImageList([formData.image], { name: '授权图片' });
-            this.authImageList = this.initPreviewImageList(formData.authImageList, { name: '授权图片' });
-            this.displayImageList = this.initPreviewImageList(formData.displayImageList, { name: '效果图' });
+            this.imageList = this.initPreviewImageList([formData.image], {name: '授权图片'});
+            this.authImageList = this.initPreviewImageList(formData.authImageList, {name: '授权图片'});
+            this.displayImageList = this.initPreviewImageList(formData.displayImageList, {name: '效果图'});
         },
 
         // 初始化图片
-        initPreviewImageList(imageList, options){
-            if(!options){
+        initPreviewImageList(imageList, options) {
+            if (!options) {
                 options.name = '图片'
             }
 
-            return imageList.map(function(item){
+            return imageList.map(function (item) {
                 return {
                     name: options.name,
                     url: item
@@ -309,13 +314,13 @@ new Vue({
             this.productId = localStorage.getItem('productId');
             localStorage.removeItem('productId');
 
-            if(!this.productId) return;
+            if (!this.productId) return;
 
             const that = this;
-            SupplierApi.GetShopBaikeProductForm({ productId: this.productId }, function(res){
-                if(res.code === 0){
+            SupplierApi.GetShopBaikeProductForm({productId: this.productId}, function (res) {
+                if (res.code === 0) {
                     that.initFormData(res.data);
-                }else{
+                } else {
                     CAIMEI.dialog('获取产品数据失败', false);
                     setTimeout(function () {
                         that.handleBack();
@@ -334,15 +339,15 @@ new Vue({
                 questionList: JSON.stringify(this.formData.questionList)
             };
 
-            if(this.productId) params.productId = this.productId;
+            if (this.productId) params.productId = this.productId;
 
-            SupplierApi.ShopBaikeProductSave(params, function(res){
-                if(res.code === 0) {
+            SupplierApi.ShopBaikeProductSave(params, function (res) {
+                if (res.code === 0) {
                     CAIMEI.dialog('保存成功', false);
                     setTimeout(function () {
                         that.handleBack();
                     }, 2000);
-                }else{
+                } else {
                     CAIMEI.Alert(res.msg, '确认', false)
                 }
             })
@@ -360,72 +365,71 @@ new Vue({
             console.log(this.formData);
             const that = this;
             // that.saveFormData();
-            this.validFormData(this.formData, this.rules).then(res=>{
+            this.validFormData(this.formData, this.rules).then(res => {
                 that.saveFormData()
-            }).catch(()=>{
+            }).catch(() => {
                 CAIMEI.dialog('必填项不能为空', false)
             })
         },
 
         // 上传封面图片
-        handleUploadProductImage(files){
-            this.uploadImage(files[0]).then(res=>{
+        handleUploadProductImage(files) {
+            this.uploadImage(files[0]).then(res => {
                 this.formData.image = res;
-                this.imageList.push({ url: res , name: '封面'})
-            }).catch(err=>{
+                this.imageList.push({url: res, name: '封面'})
+            }).catch(err => {
                 console.log(err)
             })
         },
 
         // 删除上传的封面图片
-        handleRemoveProductImage(){
+        handleRemoveProductImage() {
             this.formData.image = ''
         },
 
         // 上传授权图片
-        handleUploadAuthImage(files){
+        handleUploadAuthImage(files) {
             const that = this;
             files.forEach(function (file) {
-                if(file.type){
+                if (file.type) {
                     // resultFiles 是 input 中选中的文件列表
                     // insertImgFn 是获取图片 url 后,插入到编辑器的方法
                     that.uploadImage(file).then(function (res) {
                         that.formData.authImageList.push(res);
-                        that.authImageList.push({ url: res, name: '图片' })
+                        that.authImageList.push({url: res, name: '图片'})
                     });
                 }
             });
         },
         // 删除上传的授权图片
-        handleRemoveAuthImage(index){
-             this.formData.authImageList.splice(index, 1);
-             this.authImageList.splice(index, 1);
-             console.log(this.formData.authImageList);
-             console.log(this.authImageList);
+        handleRemoveAuthImage(index) {
+            this.formData.authImageList.splice(index, 1);
+            this.authImageList.splice(index, 1);
+            console.log(this.formData.authImageList);
+            console.log(this.authImageList);
         },
 
         // 上传效果展示图片
-        handleUploadDisplayImageList(files){
+        handleUploadDisplayImageList(files) {
             const that = this;
             files.forEach(function (file) {
-                if(file.type){
+                if (file.type) {
                     // resultFiles 是 input 中选中的文件列表
                     // insertImgFn 是获取图片 url 后,插入到编辑器的方法
                     that.uploadImage(file).then(function (res) {
                         that.formData.displayImageList.push(res);
-                        that.displayImageList.push({ url: res, name: '图片' })
+                        that.displayImageList.push({url: res, name: '图片'})
                     });
                 }
             });
         },
         // 删除上传的效果展示图片
-        handleRemoveDisplayImageList(index){
-             this.formData.displayImageList.splice(index, 1);
-             this.displayImageList.splice(index, 1);
+        handleRemoveDisplayImageList(index) {
+            this.formData.displayImageList.splice(index, 1);
+            this.displayImageList.splice(index, 1);
         },
 
 
-
         // 上传图片
         uploadImage: function uploadImage(file) {
             var formData = new FormData();

+ 19 - 0
src/main/resources/static/js/supplier-center/encyclopedia/validFormMixin.js

@@ -52,6 +52,7 @@ const validFormMixin = {
                             return model[key];
                         }, function (nVal, oVal) {
                             _this2.validation(key, model, rules);
+                            console.log('valid change')
                         });
                     } else {
                         _this2.$nextTick(function(){
@@ -61,6 +62,7 @@ const validFormMixin = {
                             validControl.forEach(function (el, index) {
                                 el.addEventListener(item, function () {
                                     _this2.validation(key, model, rules);
+                                    console.log('valid blur')
                                 });
                             });
                         })
@@ -122,6 +124,7 @@ const validFormMixin = {
         validString: function validString(key, rule, validValue) {
             if(!validValue) validValue = '';
 
+
             if (rule.minLength && validValue.length < rule.minLength) {
                 this.$set(this.validMessage, key, {
                     valid: false,
@@ -146,6 +149,22 @@ const validFormMixin = {
                 return;
             }
 
+            // 正则验证
+            // if(rule.pattern){
+            //     console.log('正则表达式, ', rule.pattern.reg);
+            //     console.log('验证字符串, ', validValue,' ', typeof validValue);
+            //     const valide = rule.pattern.reg.test(validValue);
+            //     console.log('验证结果, ', valide);
+            //     if (!valide) {
+            //         this.$set(this.validMessage, key, {
+            //             valid: false,
+            //             message: rule.pattern.regMessage
+            //         });
+            //         return;
+            //     }
+            // }
+
+
             this.$set(this.validMessage, key, {
                 valid: true,
                 message: ''