Authored by 陈峰

test dev

1 module.exports = { 1 module.exports = {
2 - '/app/product/data': { 2 + '/api/product/data': {
3 api: 'app.product.data', 3 api: 'app.product.data',
4 cache: true, 4 cache: true,
5 params: { 5 params: {
@@ -7,14 +7,14 @@ module.exports = { @@ -7,14 +7,14 @@ module.exports = {
7 uid: {type: Number, require: false} 7 uid: {type: Number, require: false}
8 } 8 }
9 }, 9 },
10 - '/app/product/refundExchange': { 10 + '/api/product/refundExchange': {
11 api: 'app.product.refundExchange', 11 api: 'app.product.refundExchange',
12 cache: true, 12 cache: true,
13 params: { 13 params: {
14 product_skn: {type: Number} 14 product_skn: {type: Number}
15 } 15 }
16 }, 16 },
17 - '/app/favorite/isFavoriteNew': { 17 + '/api/favorite/isFavoriteNew': {
18 api: 'app.favorite.isFavoriteNew', 18 api: 'app.favorite.isFavoriteNew',
19 params: { 19 params: {
20 id: {type: Number}, 20 id: {type: Number},
@@ -124,14 +124,14 @@ if (isProduction) { @@ -124,14 +124,14 @@ if (isProduction) {
124 Object.assign(module.exports, { 124 Object.assign(module.exports, {
125 appName: 'm.yohoblk.com for test', 125 appName: 'm.yohoblk.com for test',
126 domains: { 126 domains: {
127 - api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',  
128 - service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/',  
129 - singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/' 127 + api: process.env.TEST_API || 'http://testapi.yoho.cn:28078/',
  128 + service: process.env.TEST_SERVICE || 'http://testservice.yoho.cn:28077/',
  129 + singleApi: process.env.TEST_SINGLE || 'http://192.168.102.31:8092/brower'
130 }, 130 },
131 memcache: { 131 memcache: {
132 - master: ['127.0.0.1:12111'],  
133 - slave: ['127.0.0.1:12112'],  
134 - session: ['127.0.0.1:12111'], 132 + master: ['192.168.104.15:12111', '192.168.104.29:12111', '192.168.104.32:12111'],
  133 + slave: ['192.168.104.15:12112', '192.168.104.29:12112', '192.168.104.32:12112'],
  134 + session: ['192.168.104.15:12111', '192.168.104.29:12111', '192.168.104.32:12111'],
135 timeout: 100, 135 timeout: 100,
136 retries: 0 136 retries: 0
137 }, 137 },
@@ -6,7 +6,7 @@ Notification.newInstance = properties => { @@ -6,7 +6,7 @@ Notification.newInstance = properties => {
6 6
7 const Instance = new Vue({ 7 const Instance = new Vue({
8 data: _props, 8 data: _props,
9 - render (h) { 9 + render(h) {
10 return h(Notification, { 10 return h(Notification, {
11 props: _props 11 props: _props
12 }); 12 });
@@ -14,18 +14,22 @@ Notification.newInstance = properties => { @@ -14,18 +14,22 @@ Notification.newInstance = properties => {
14 }); 14 });
15 15
16 const component = Instance.$mount(); 16 const component = Instance.$mount();
  17 +
17 document.body.appendChild(component.$el); 18 document.body.appendChild(component.$el);
18 const notification = Instance.$children[0]; 19 const notification = Instance.$children[0];
19 20
20 return { 21 return {
21 - notice (noticeProps) { 22 + notice(noticeProps) {
  23 + setTimeout(() => {
  24 + notification.closeAll();
  25 + }, 0);
22 notification.add(noticeProps); 26 notification.add(noticeProps);
23 }, 27 },
24 - remove (name) { 28 + remove(name) {
25 notification.close(name); 29 notification.close(name);
26 }, 30 },
27 component: notification, 31 component: notification,
28 - destroy (element) { 32 + destroy(element) {
29 notification.closeAll(); 33 notification.closeAll();
30 setTimeout(function() { 34 setTimeout(function() {
31 document.body.removeChild(document.getElementsByClassName(element)[0]); 35 document.body.removeChild(document.getElementsByClassName(element)[0]);
@@ -10,14 +10,14 @@ let messageInstance; @@ -10,14 +10,14 @@ let messageInstance;
10 let name = 1; 10 let name = 1;
11 11
12 const iconTypes = { 12 const iconTypes = {
13 - 'info': 'default-tip',  
14 - 'success': 'success-tip',  
15 - 'warning': 'default-tip',  
16 - 'error': 'error-tip',  
17 - 'loading': 'load-c' 13 + info: 'default-tip',
  14 + success: 'success-tip',
  15 + warning: 'default-tip',
  16 + error: 'error-tip',
  17 + loading: 'load-c'
18 }; 18 };
19 19
20 -function getMessageInstance () { 20 +function getMessageInstance() {
21 messageInstance = messageInstance || Notification.newInstance({ 21 messageInstance = messageInstance || Notification.newInstance({
22 prefixCls: prefixCls, 22 prefixCls: prefixCls,
23 styles: { 23 styles: {
@@ -28,11 +28,11 @@ function getMessageInstance () { @@ -28,11 +28,11 @@ function getMessageInstance () {
28 return messageInstance; 28 return messageInstance;
29 } 29 }
30 30
31 -function notice (content = '', duration = defaultDuration, type, onClose = function () {}, closable = false) {  
32 - const iconType = iconTypes[type]; 31 +function notice(content = '', duration = defaultDuration, type, onClose = function() { }, closable = false) {
  32 + // const iconType = iconTypes[type];
33 33
34 // if loading 34 // if loading
35 - const loadCls = type === 'loading' ? ' blk-load-loop' : ''; 35 + // const loadCls = type === 'loading' ? ' blk-load-loop' : '';
36 36
37 let instance = getMessageInstance(); 37 let instance = getMessageInstance();
38 38
@@ -41,9 +41,15 @@ function notice (content = '', duration = defaultDuration, type, onClose = funct @@ -41,9 +41,15 @@ function notice (content = '', duration = defaultDuration, type, onClose = funct
41 duration: duration, 41 duration: duration,
42 styles: {}, 42 styles: {},
43 transitionName: 'move-up', 43 transitionName: 'move-up',
  44 +
  45 + // content: `
  46 + // <div class="${prefixCls}-custom-content ${prefixCls}-${type}">
  47 + // <i class="${iconPrefixCls} ${iconPrefixCls}-${iconType}${loadCls}"></i>
  48 + // <span>${content}</span>
  49 + // </div>
  50 + // `,
44 content: ` 51 content: `
45 <div class="${prefixCls}-custom-content ${prefixCls}-${type}"> 52 <div class="${prefixCls}-custom-content ${prefixCls}-${type}">
46 - <i class="${iconPrefixCls} ${iconPrefixCls}-${iconType}${loadCls}"></i>  
47 <span>${content}</span> 53 <span>${content}</span>
48 </div> 54 </div>
49 `, 55 `,
@@ -53,19 +59,20 @@ function notice (content = '', duration = defaultDuration, type, onClose = funct @@ -53,19 +59,20 @@ function notice (content = '', duration = defaultDuration, type, onClose = funct
53 }); 59 });
54 60
55 // 用于手动消除 61 // 用于手动消除
56 - return (function () { 62 + return ((function() {
57 let target = name++; 63 let target = name++;
58 64
59 - return function () { 65 + return function() {
60 instance.remove(`${prefixKey}${target}`); 66 instance.remove(`${prefixKey}${target}`);
61 }; 67 };
62 - })(); 68 + })());
63 } 69 }
64 70
65 export default { 71 export default {
66 name: 'Message', 72 name: 'Message',
67 - info (options) { 73 + info(options) {
68 const type = typeof options; 74 const type = typeof options;
  75 +
69 if (type === 'string') { 76 if (type === 'string') {
70 options = { 77 options = {
71 content: options 78 content: options
@@ -73,8 +80,9 @@ export default { @@ -73,8 +80,9 @@ export default {
73 } 80 }
74 return notice(options.content, options.duration, 'info', options.onClose, options.closable); 81 return notice(options.content, options.duration, 'info', options.onClose, options.closable);
75 }, 82 },
76 - success (options) { 83 + success(options) {
77 const type = typeof options; 84 const type = typeof options;
  85 +
78 if (type === 'string') { 86 if (type === 'string') {
79 options = { 87 options = {
80 content: options 88 content: options
@@ -82,8 +90,9 @@ export default { @@ -82,8 +90,9 @@ export default {
82 } 90 }
83 return notice(options.content, options.duration, 'success', options.onClose, options.closable); 91 return notice(options.content, options.duration, 'success', options.onClose, options.closable);
84 }, 92 },
85 - warning (options) { 93 + warning(options) {
86 const type = typeof options; 94 const type = typeof options;
  95 +
87 if (type === 'string') { 96 if (type === 'string') {
88 options = { 97 options = {
89 content: options 98 content: options
@@ -91,8 +100,9 @@ export default { @@ -91,8 +100,9 @@ export default {
91 } 100 }
92 return notice(options.content, options.duration, 'warning', options.onClose, options.closable); 101 return notice(options.content, options.duration, 'warning', options.onClose, options.closable);
93 }, 102 },
94 - error (options) { 103 + error(options) {
95 const type = typeof options; 104 const type = typeof options;
  105 +
96 if (type === 'string') { 106 if (type === 'string') {
97 options = { 107 options = {
98 content: options 108 content: options
@@ -100,8 +110,9 @@ export default { @@ -100,8 +110,9 @@ export default {
100 } 110 }
101 return notice(options.content, options.duration, 'error', options.onClose, options.closable); 111 return notice(options.content, options.duration, 'error', options.onClose, options.closable);
102 }, 112 },
103 - loading (options) { 113 + loading(options) {
104 const type = typeof options; 114 const type = typeof options;
  115 +
105 if (type === 'string') { 116 if (type === 'string') {
106 options = { 117 options = {
107 content: options 118 content: options
@@ -109,7 +120,7 @@ export default { @@ -109,7 +120,7 @@ export default {
109 } 120 }
110 return notice(options.content, options.duration, 'loading', options.onClose, options.closable); 121 return notice(options.content, options.duration, 'loading', options.onClose, options.closable);
111 }, 122 },
112 - config (options) { 123 + config(options) {
113 if (options.top) { 124 if (options.top) {
114 top = options.top; 125 top = options.top;
115 } 126 }
@@ -117,8 +128,9 @@ export default { @@ -117,8 +128,9 @@ export default {
117 defaultDuration = options.duration; 128 defaultDuration = options.duration;
118 } 129 }
119 }, 130 },
120 - destroy () { 131 + destroy() {
121 let instance = getMessageInstance(); 132 let instance = getMessageInstance();
  133 +
122 messageInstance = null; 134 messageInstance = null;
123 instance.destroy('blk-message'); 135 instance.destroy('blk-message');
124 } 136 }
@@ -13,177 +13,179 @@ @@ -13,177 +13,179 @@
13 </transition> 13 </transition>
14 </template> 14 </template>
15 <script> 15 <script>
16 - export default {  
17 - props: {  
18 - prefixCls: {  
19 - type: String,  
20 - default: ''  
21 - },  
22 - duration: {  
23 - type: Number,  
24 - default: 1.5  
25 - },  
26 - type: {  
27 - type: String  
28 - },  
29 - content: {  
30 - type: String,  
31 - default: ''  
32 - },  
33 - styles: {  
34 - type: Object,  
35 - default: function() {  
36 - return {  
37 - right: '50%'  
38 - };  
39 - }  
40 - },  
41 - closable: {  
42 - type: Boolean,  
43 - default: false  
44 - },  
45 - className: {  
46 - type: String  
47 - },  
48 - name: {  
49 - type: String,  
50 - required: true  
51 - },  
52 - onClose: {  
53 - type: Function  
54 - },  
55 - transitionName: {  
56 - type: String  
57 - } 16 +export default {
  17 + props: {
  18 + prefixCls: {
  19 + type: String,
  20 + default: ''
  21 + },
  22 + duration: {
  23 + type: Number,
  24 + default: 1.5
58 }, 25 },
59 - data () {  
60 - return {  
61 - withDesc: false  
62 - }; 26 + type: {
  27 + type: String
63 }, 28 },
64 - computed: {  
65 - baseClass () {  
66 - return `${this.prefixCls}-notice`;  
67 - },  
68 - classes () {  
69 - return [  
70 - this.baseClass,  
71 - {  
72 - [`${this.className}`]: !!this.className,  
73 - [`${this.baseClass}-closable`]: this.closable,  
74 - [`${this.baseClass}-with-desc`]: this.withDesc  
75 - }  
76 - ];  
77 - },  
78 - contentClasses () {  
79 - return `${this.baseClass}-content`; 29 + content: {
  30 + type: String,
  31 + default: ''
  32 + },
  33 + styles: {
  34 + type: Object,
  35 + default: function() {
  36 + return {
  37 + right: '50%'
  38 + };
80 } 39 }
81 }, 40 },
82 - methods: {  
83 - clearCloseTimer () {  
84 - if (this.closeTimer) {  
85 - clearTimeout(this.closeTimer);  
86 - this.closeTimer = null;  
87 - }  
88 - },  
89 - close () {  
90 - this.clearCloseTimer();  
91 - this.onClose();  
92 - this.$parent.close(this.name);  
93 - },  
94 - handleEnter (el) {  
95 - if (this.type === 'message') {  
96 - el.style.height = el.scrollHeight + 'px';  
97 - }  
98 - },  
99 - handleLeave (el) {  
100 - if (this.type === 'message') {  
101 - if (document.getElementsByClassName('blk-message-notice').length !== 1) {  
102 - el.style.height = 0;  
103 - el.style.paddingTop = 0;  
104 - el.style.paddingBottom = 0;  
105 - } 41 + closable: {
  42 + type: Boolean,
  43 + default: false
  44 + },
  45 + className: {
  46 + type: String
  47 + },
  48 + name: {
  49 + type: String,
  50 + required: true
  51 + },
  52 + onClose: {
  53 + type: Function
  54 + },
  55 + transitionName: {
  56 + type: String
  57 + }
  58 + },
  59 + data() {
  60 + return {
  61 + withDesc: false
  62 + };
  63 + },
  64 + computed: {
  65 + baseClass() {
  66 + return `${this.prefixCls}-notice`;
  67 + },
  68 + classes() {
  69 + return [
  70 + this.baseClass,
  71 + {
  72 + [`${this.className}`]: !!this.className,
  73 + [`${this.baseClass}-closable`]: this.closable,
  74 + [`${this.baseClass}-with-desc`]: this.withDesc
106 } 75 }
  76 + ];
  77 + },
  78 + contentClasses() {
  79 + return `${this.baseClass}-content`;
  80 + }
  81 + },
  82 + methods: {
  83 + clearCloseTimer() {
  84 + if (this.closeTimer) {
  85 + clearTimeout(this.closeTimer);
  86 + this.closeTimer = null;
107 } 87 }
108 }, 88 },
109 - mounted () { 89 + close() {
110 this.clearCloseTimer(); 90 this.clearCloseTimer();
111 -  
112 - if (this.duration !== 0) {  
113 - this.closeTimer = setTimeout(() => {  
114 - this.close();  
115 - }, this.duration * 1000);  
116 - }  
117 -  
118 - if (this.prefixCls === 'blk-notice') {  
119 - this.withDesc = this.$refs.content.querySelectorAll(`.${this.prefixCls}-desc`)[0].innerHTML !== ''; 91 + this.onClose();
  92 + this.$parent.close(this.name);
  93 + },
  94 + handleEnter(el) {
  95 + if (this.type === 'message') {
  96 + el.style.height = el.scrollHeight + 'px';
120 } 97 }
121 }, 98 },
122 - beforeDestroy () {  
123 - this.clearCloseTimer(); 99 + handleLeave(el) {
  100 + if (this.type === 'message') {
  101 + if (document.getElementsByClassName('blk-message-notice').length !== 1) {
  102 + el.style.height = 0;
  103 + el.style.paddingTop = 0;
  104 + el.style.paddingBottom = 0;
  105 + }
  106 + }
  107 + }
  108 + },
  109 + mounted() {
  110 + this.clearCloseTimer();
  111 +
  112 + if (this.duration !== 0) {
  113 + this.closeTimer = setTimeout(() => {
  114 + this.close();
  115 + }, this.duration * 1000);
  116 + }
  117 +
  118 + if (this.prefixCls === 'blk-notice') {
  119 + this.withDesc = this.$refs.content.querySelectorAll(`.${this.prefixCls}-desc`)[0].innerHTML !== '';
124 } 120 }
125 - }; 121 + },
  122 + beforeDestroy() {
  123 + this.clearCloseTimer();
  124 + }
  125 +};
126 </script> 126 </script>
127 <style lang="scss"> 127 <style lang="scss">
128 - .blk-message {  
129 - font-size: 24px;  
130 - position: fixed;  
131 - z-index: 1010;  
132 - width: 100%;  
133 - top: 50px;  
134 - left: 0;  
135 - pointer-events: none; 128 +.blk-message {
  129 + font-size: 24px;
  130 + position: fixed;
  131 + z-index: 1010;
  132 + width: 100%;
  133 + top: 50%;
  134 + left: 0;
  135 + pointer-events: none;
136 136
137 - &-notice {  
138 - padding: 8px;  
139 - text-align: center;  
140 - transition: height .3s ease-in-out, padding .3s ease-in-out; 137 + &-notice {
  138 + padding: 8px;
  139 + text-align: center;
  140 + transition: height .3s ease-in-out, padding .3s ease-in-out;
141 141
142 - &:first-child {  
143 - margin-top: -8px;  
144 - } 142 + &:first-child {
  143 + margin-top: -8px;
  144 + }
145 145
146 - .icon-default-tip {  
147 - color: #2db7f5;  
148 - } 146 + .icon-default-tip {
  147 + color: #2db7f5;
  148 + }
149 149
150 - .icon-error-tip {  
151 - color: #ed3f14;  
152 - } 150 + .icon-error-tip {
  151 + color: #ed3f14;
  152 + }
153 153
154 - .icon-success-tip {  
155 - color: #19be6b;  
156 - } 154 + .icon-success-tip {
  155 + color: #19be6b;
157 } 156 }
  157 + }
158 158
159 - &-notice-content { 159 + &-notice-content {
  160 + display: inline-block;
  161 + pointer-events: all;
  162 + padding: 10px 20px;
  163 + border-radius: 8px;
  164 + box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
  165 + background-color: rgba(0, 0, 0, 0.7);
  166 + position: relative;
  167 + color: #fff;
  168 + font-size: 28px;
  169 + &-text {
160 display: inline-block; 170 display: inline-block;
161 - pointer-events: all;  
162 - padding: 8px 16px;  
163 - border-radius: 4px;  
164 - box-shadow: 0 1px 6px rgba(0, 0, 0, .2);  
165 - background: #fff;  
166 - position: relative;  
167 - &-text{  
168 - display: inline-block;  
169 - }  
170 } 171 }
  172 + }
171 173
172 - &-notice-closable{  
173 - .blk-message-notice-content-text{  
174 - padding-right: 32px;  
175 - } 174 + &-notice-closable {
  175 + .blk-message-notice-content-text {
  176 + padding-right: 32px;
176 } 177 }
  178 + }
177 179
178 - .icon {  
179 - margin-right: 8px;  
180 - font-size: 26px;  
181 - top: 1px;  
182 - position: relative; 180 + .icon {
  181 + margin-right: 8px;
  182 + font-size: 26px;
  183 + top: 1px;
  184 + position: relative;
183 185
184 - &.icon-close-tip {  
185 - font-size: 30px;  
186 - } 186 + &.icon-close-tip {
  187 + font-size: 30px;
187 } 188 }
188 } 189 }
  190 +}
189 </style> 191 </style>
@@ -16,82 +16,83 @@ @@ -16,82 +16,83 @@
16 </div> 16 </div>
17 </template> 17 </template>
18 <script> 18 <script>
19 - import Notice from './notice.vue'; 19 +import Notice from './notice.vue';
20 20
21 - const prefixCls = 'blk-notification';  
22 - let seed = 0;  
23 - const now = Date.now(); 21 +const prefixCls = 'blk-notification';
  22 +let seed = 0;
  23 +const now = Date.now();
24 24
25 - function getUuid () {  
26 - return 'blkNotification_' + now + '_' + (seed++);  
27 - } 25 +function getUuid() {
  26 + return 'blkNotification_' + now + '_' + (seed++);
  27 +}
28 28
29 - export default {  
30 - components: { Notice },  
31 - props: {  
32 - prefixCls: {  
33 - type: String,  
34 - default: prefixCls  
35 - },  
36 - styles: {  
37 - type: Object,  
38 - default: function () {  
39 - return {  
40 - top: '65px',  
41 - left: '50%'  
42 - };  
43 - }  
44 - },  
45 - content: {  
46 - type: String  
47 - },  
48 - className: {  
49 - type: String  
50 - } 29 +export default {
  30 + components: { Notice },
  31 + props: {
  32 + prefixCls: {
  33 + type: String,
  34 + default: prefixCls
51 }, 35 },
52 - data () {  
53 - return {  
54 - notices: []  
55 - };  
56 - },  
57 - computed: {  
58 - classes () {  
59 - return [  
60 - `${this.prefixCls}`,  
61 - {  
62 - [`${this.className}`]: !!this.className  
63 - }  
64 - ]; 36 + styles: {
  37 + type: Object,
  38 + default: function() {
  39 + return {
  40 + top: '65px',
  41 + left: '50%'
  42 + };
65 } 43 }
66 }, 44 },
67 - methods: {  
68 - add (notice) {  
69 - const name = notice.name || getUuid(); 45 + content: {
  46 + type: String
  47 + },
  48 + className: {
  49 + type: String
  50 + }
  51 + },
  52 + data() {
  53 + return {
  54 + notices: []
  55 + };
  56 + },
  57 + computed: {
  58 + classes() {
  59 + return [
  60 + `${this.prefixCls}`,
  61 + {
  62 + [`${this.className}`]: !!this.className
  63 + }
  64 + ];
  65 + }
  66 + },
  67 + methods: {
  68 + add(notice) {
  69 + const name = notice.name || getUuid();
  70 +
  71 + let _notice = Object.assign({
  72 + styles: {
  73 + right: '50%'
  74 + },
  75 + content: '',
  76 + duration: 1.5,
  77 + closable: false,
  78 + name: name
  79 + }, notice);
70 80
71 - let _notice = Object.assign({  
72 - styles: {  
73 - right: '50%'  
74 - },  
75 - content: '',  
76 - duration: 1.5,  
77 - closable: false,  
78 - name: name  
79 - }, notice); 81 + this.notices.push(_notice);
  82 + },
  83 + close(name) {
  84 + const notices = this.notices;
80 85
81 - this.notices.push(_notice);  
82 - },  
83 - close (name) {  
84 - const notices = this.notices;  
85 - for (let i = 0; i < notices.length; i++) {  
86 - if (notices[i].name === name) {  
87 - this.notices.splice(i, 1);  
88 - break;  
89 - } 86 + for (let i = 0; i < notices.length; i++) {
  87 + if (notices[i].name === name) {
  88 + this.notices.splice(i, 1);
  89 + break;
90 } 90 }
91 - },  
92 - closeAll () {  
93 - this.notices = [];  
94 } 91 }
  92 + },
  93 + closeAll() {
  94 + this.notices = [];
95 } 95 }
96 - }; 96 + }
  97 +};
97 </script> 98 </script>
@@ -159,10 +159,12 @@ export default { @@ -159,10 +159,12 @@ export default {
159 return; 159 return;
160 } 160 }
161 if (!this.colorId) { 161 if (!this.colorId) {
162 - return alert('请选择颜色'); 162 + this.$message.warning('请选择颜色');
  163 + return;
163 } 164 }
164 if (!this.sizeId) { 165 if (!this.sizeId) {
165 - return alert('请选择尺码'); 166 + this.$message.warning('请选择尺码');
  167 + return;
166 } 168 }
167 let sku = this.skuList.find(s => s.colorId === this.colorId && s.sizeId === this.sizeId); 169 let sku = this.skuList.find(s => s.colorId === this.colorId && s.sizeId === this.sizeId);
168 170
@@ -45,9 +45,9 @@ export default { @@ -45,9 +45,9 @@ export default {
45 is_collect: this.entity.is_collect 45 is_collect: this.entity.is_collect
46 }).then(res => { 46 }).then(res => {
47 if (res.code === 200) { 47 if (res.code === 200) {
48 - alert(this.entity.is_collect === 'Y' ? '取消收藏成功' : '收藏成功'); 48 + this.$message.success(this.entity.is_collect === 'Y' ? '取消收藏成功' : '收藏成功');
49 } else if (res.code === 401) { 49 } else if (res.code === 401) {
50 - alert('请登录') 50 + this.$message.warning('请登录');
51 this.$yoho.goLogin('', () => { 51 this.$yoho.goLogin('', () => {
52 this.toggleFavorite(); 52 this.toggleFavorite();
53 }); 53 });
@@ -43,7 +43,7 @@ export default { @@ -43,7 +43,7 @@ export default {
43 methods: { 43 methods: {
44 addCart(sku) { 44 addCart(sku) {
45 this.$store.dispatch(PRODUCT_ADD_CART, {productSku: sku.sku, buyNumber: 1}).then(() => { 45 this.$store.dispatch(PRODUCT_ADD_CART, {productSku: sku.sku, buyNumber: 1}).then(() => {
46 - alert('添加成功'); 46 + this.$message.success('添加成功');
47 }); 47 });
48 } 48 }
49 }, 49 },
@@ -37,15 +37,15 @@ export default { @@ -37,15 +37,15 @@ export default {
37 // if (cacheItem && Date.now() - cacheItem.__lasttime < 1000 * 60 * 3) { 37 // if (cacheItem && Date.now() - cacheItem.__lasttime < 1000 * 60 * 3) {
38 // return Promise.resolve(); 38 // return Promise.resolve();
39 // } 39 // }
40 - return this.$api.get('/app/product/data', { 40 + return this.$api.get('/api/product/data', {
41 product_id: _.parseInt(product_id) 41 product_id: _.parseInt(product_id)
42 }).then(res => { 42 }).then(res => {
43 if (res.code === 200) { 43 if (res.code === 200) {
44 return Promise.all([ 44 return Promise.all([
45 - this.$api.get('/app/product/refundExchange', { 45 + this.$api.get('/api/product/refundExchange', {
46 product_skn: res.data.product_skn 46 product_skn: res.data.product_skn
47 }), 47 }),
48 - this.$api.get('/app/favorite/isFavoriteNew', { 48 + this.$api.get('/api/favorite/isFavoriteNew', {
49 id: res.data.product_id 49 id: res.data.product_id
50 })]).then(result => { 50 })]).then(result => {
51 if (result[0].code === 200) { 51 if (result[0].code === 200) {