Commit 7bcce1a89b656f262676e69b78d6ef2b0758f02e
1 parent
2b385494
样式优化
Showing
5 changed files
with
181 additions
and
145 deletions
src/components/swiper/swiper.vue
src/main.js
| ... | ... | @@ -4,13 +4,25 @@ import router from "./router/"; |
| 4 | 4 | import VueResource from "vue-resource"; |
| 5 | 5 | import VueHead from "vue-head"; |
| 6 | 6 | import sha1 from "sha1"; |
| 7 | -import 'mint-ui/lib/style.css'; | |
| 8 | -import { Toast, Indicator,InfiniteScroll } from "mint-ui"; | |
| 9 | -import { Rate, Popup, Lazyload, Search, PullRefresh, Picker, Image, ImagePreview, Tab, Tabs, CountDown} from "vant"; | |
| 7 | +import "mint-ui/lib/style.css"; | |
| 8 | +import { Toast, Indicator, InfiniteScroll } from "mint-ui"; | |
| 9 | +import { | |
| 10 | + Rate, | |
| 11 | + Popup, | |
| 12 | + Lazyload, | |
| 13 | + Search, | |
| 14 | + PullRefresh, | |
| 15 | + Picker, | |
| 16 | + Image, | |
| 17 | + ImagePreview, | |
| 18 | + Tab, | |
| 19 | + Tabs, | |
| 20 | + CountDown | |
| 21 | +} from "vant"; | |
| 10 | 22 | import App from "./App"; |
| 11 | -import IdCard from './common/IdCard'; | |
| 12 | -import VueClipboard from 'vue-clipboard2'; | |
| 13 | -import VueBus from 'vue-bus'; | |
| 23 | +import IdCard from "./common/IdCard"; | |
| 24 | +import VueClipboard from "vue-clipboard2"; | |
| 25 | +import VueBus from "vue-bus"; | |
| 14 | 26 | Vue.use(Vuex); |
| 15 | 27 | Vue.use(VueResource); |
| 16 | 28 | Vue.use(VueHead, { separator: " " }); |
| ... | ... | @@ -40,89 +52,89 @@ Vue.use(VueBus); |
| 40 | 52 | Vue.use(InfiniteScroll); |
| 41 | 53 | |
| 42 | 54 | // 解决低版手机浏览器不支持es6写法,将es6转成es5 |
| 43 | -import 'babel-polyfill'; | |
| 44 | -import promise from 'es6-promise'; | |
| 45 | -require('es6-promise').polyfill(); | |
| 55 | +import "babel-polyfill"; | |
| 56 | +import promise from "es6-promise"; | |
| 57 | +require("es6-promise").polyfill(); | |
| 46 | 58 | promise.polyfill(); |
| 47 | 59 | |
| 48 | 60 | // 安卓5.1兼容 |
| 49 | -import 'url-search-params-polyfill'; | |
| 61 | +import "url-search-params-polyfill"; | |
| 50 | 62 | |
| 51 | 63 | Vue.config.productionTip = false; |
| 52 | 64 | |
| 53 | 65 | // 部署模式设置(开发模式:"dev",测试模式:"test",生产模式:"prod") |
| 54 | -Vue.prototype.mode = "dev"; | |
| 66 | +Vue.prototype.mode = "prod"; | |
| 55 | 67 | |
| 56 | 68 | // 微信JS-SDK对象 |
| 57 | 69 | Vue.prototype.jweixin = { |
| 58 | 70 | value: null |
| 59 | -} | |
| 71 | +}; | |
| 60 | 72 | |
| 61 | 73 | // 是否是iPhone平台,默认不是,common.vue进行判断设置 |
| 62 | 74 | Vue.prototype.isiPhone = { |
| 63 | 75 | value: false |
| 64 | -} | |
| 76 | +}; | |
| 65 | 77 | |
| 66 | 78 | // 是否是iPad平台,默认不是,common.vue进行判断设置 |
| 67 | 79 | Vue.prototype.isiPad = { |
| 68 | 80 | value: false |
| 69 | -} | |
| 81 | +}; | |
| 70 | 82 | |
| 71 | 83 | // 是否是Android平台,默认不是,common.vue进行判断设置 |
| 72 | 84 | Vue.prototype.isAndroid = { |
| 73 | 85 | value: false |
| 74 | -} | |
| 86 | +}; | |
| 75 | 87 | |
| 76 | 88 | // 是否在App内,默认不在,common.vue进行判断设置 |
| 77 | 89 | Vue.prototype.isCNLive = { |
| 78 | 90 | value: false |
| 79 | -} | |
| 91 | +}; | |
| 80 | 92 | |
| 81 | 93 | // 是否在App内(一组WebView),默认不在,common.vue进行判断设置 |
| 82 | 94 | Vue.prototype.isPlat = { |
| 83 | - value: false | |
| 84 | -} | |
| 95 | + value: false | |
| 96 | +}; | |
| 85 | 97 | |
| 86 | 98 | // 是否在支付宝内,默认不在,common.vue进行判断设置 |
| 87 | 99 | Vue.prototype.isAliPay = { |
| 88 | 100 | value: false |
| 89 | -} | |
| 101 | +}; | |
| 90 | 102 | |
| 91 | 103 | // 是否在微信内,默认不在,common.vue进行判断设置 |
| 92 | 104 | Vue.prototype.isWeChat = { |
| 93 | 105 | value: false, |
| 94 | 106 | version: [] |
| 95 | -} | |
| 107 | +}; | |
| 96 | 108 | |
| 97 | 109 | // 是否在QQ内,默认不在,common.vue进行判断设置 |
| 98 | 110 | Vue.prototype.isQQ = { |
| 99 | 111 | value: false |
| 100 | -} | |
| 112 | +}; | |
| 101 | 113 | |
| 102 | 114 | // 是否在小米浏览器内,默认不在,common.vue进行判断设置 |
| 103 | 115 | Vue.prototype.isXiaoMi = { |
| 104 | - value: false | |
| 105 | -} | |
| 116 | + value: false | |
| 117 | +}; | |
| 106 | 118 | |
| 107 | 119 | /* 后端API版本控制参数 开始 */ |
| 108 | 120 | |
| 109 | 121 | // 参数设置 |
| 110 | 122 | Vue.prototype.apiVersion = { |
| 111 | 123 | LuckDraw: "LuckDraw", // 活动接口 |
| 112 | - index:"Index3",// 主接口 | |
| 113 | - miniapp:"Miniapp2",// 调用微信相关接口 | |
| 124 | + index: "Index3", // 主接口 | |
| 125 | + miniapp: "Miniapp2", // 调用微信相关接口 | |
| 114 | 126 | dynamic: "Dynamic", // 达人动态相关接口 |
| 115 | 127 | LeadGoose: "LeadGoose", // 领头雁项目 |
| 116 | 128 | // addAddresss:"https://managemall.cnlive.com/",// 生产环境url |
| 117 | - addAddresss:"https://wjjshop.cnlive.com/"// 测试环境url | |
| 118 | -} | |
| 129 | + addAddresss: "https://wjjshop.cnlive.com/" // 测试环境url | |
| 130 | +}; | |
| 119 | 131 | |
| 120 | 132 | /** |
| 121 | 133 | * 获取后端API版本 |
| 122 | 134 | */ |
| 123 | 135 | Vue.prototype.getApiVersion = function() { |
| 124 | 136 | return this.apiVersion; |
| 125 | -} | |
| 137 | +}; | |
| 126 | 138 | /* 后端API版本控制参数 结束 */ |
| 127 | 139 | |
| 128 | 140 | /* 设置图片尺寸参数 开始 */ |
| ... | ... | @@ -133,12 +145,11 @@ Vue.prototype.SIGN = { |
| 133 | 145 | MIDDLE: "?imageMogr2/thumbnail/400/format/jpg", |
| 134 | 146 | BIG: "?imageMogr2/thumbnail/750/format/jpg", |
| 135 | 147 | SOURCE: "" |
| 136 | -} | |
| 148 | +}; | |
| 137 | 149 | /* 设置图片尺寸参数 结束 */ |
| 138 | 150 | |
| 139 | 151 | /* 根据模式,获取相关请求参数 开始 */ |
| 140 | 152 | Vue.prototype.getParams = function(mode) { |
| 141 | - | |
| 142 | 153 | // 返回参数 |
| 143 | 154 | let params = {}; |
| 144 | 155 | |
| ... | ... | @@ -149,12 +160,12 @@ Vue.prototype.getParams = function(mode) { |
| 149 | 160 | headers: { |
| 150 | 161 | "content-type": "application/x-www-form-urlencoded", |
| 151 | 162 | "Phone-Model": "Wap", |
| 152 | - "Version":"1.0.1" | |
| 163 | + Version: "1.0.1" | |
| 153 | 164 | }, |
| 154 | 165 | sellerCategory: { |
| 155 | 166 | url: "http://wjjh5test.cnlive.com/hqyw.html" |
| 156 | 167 | } |
| 157 | - } | |
| 168 | + }; | |
| 158 | 169 | params.cnlive = { |
| 159 | 170 | apiAddress: "https://api.cnlive.com", |
| 160 | 171 | params: { |
| ... | ... | @@ -162,35 +173,42 @@ Vue.prototype.getParams = function(mode) { |
| 162 | 173 | appKey: "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", |
| 163 | 174 | secret: "1e6380cb347255e777f72b5aa60f41daa68443a132aaea", |
| 164 | 175 | ver: "1.0", |
| 165 | - page_url: "https://wjjshop.cnlive.com/html/votes/1/#/pages/redirect/redirect", | |
| 166 | - timestamp: new Date().getTime().toString().substr(0, 10) | |
| 176 | + page_url: | |
| 177 | + "https://wjjshop.cnlive.com/html/votes/1/#/pages/redirect/redirect", | |
| 178 | + timestamp: new Date() | |
| 179 | + .getTime() | |
| 180 | + .toString() | |
| 181 | + .substr(0, 10) | |
| 167 | 182 | }, |
| 168 | 183 | headers: { |
| 169 | 184 | "content-type": "application/x-www-form-urlencoded" |
| 170 | 185 | } |
| 171 | - } | |
| 186 | + }; | |
| 172 | 187 | break; |
| 173 | 188 | case "prod": |
| 174 | - | |
| 175 | 189 | // 请求头 |
| 176 | 190 | let app_key = "769_jnjxdh3w53"; |
| 177 | - let timestamp = new Date().getTime().toString().substr(0, 10); | |
| 178 | - let nonce = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpeLgK0vk5POU5PQ"; | |
| 191 | + let timestamp = new Date() | |
| 192 | + .getTime() | |
| 193 | + .toString() | |
| 194 | + .substr(0, 10); | |
| 195 | + let nonce = | |
| 196 | + "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpeLgK0vk5POU5PQ"; | |
| 179 | 197 | |
| 180 | 198 | params.shop = { |
| 181 | 199 | apiAddress: "https://managemall.cnlive.com", |
| 182 | 200 | headers: { |
| 183 | 201 | "App-Key": app_key, |
| 184 | - "Timestamp": timestamp, | |
| 185 | - "Signature": sha1(app_key + nonce + timestamp), | |
| 202 | + Timestamp: timestamp, | |
| 203 | + Signature: sha1(app_key + nonce + timestamp), | |
| 186 | 204 | "content-type": "application/x-www-form-urlencoded", |
| 187 | 205 | "Phone-Model": "Wap", |
| 188 | - "Version":"1.0.1" | |
| 206 | + Version: "1.0.1" | |
| 189 | 207 | }, |
| 190 | 208 | sellerCategory: { |
| 191 | 209 | url: "http://wjjh5.cnlive.com/hqyw.html" |
| 192 | 210 | } |
| 193 | - } | |
| 211 | + }; | |
| 194 | 212 | params.cnlive = { |
| 195 | 213 | apiAddress: "https://api.cnlive.com", |
| 196 | 214 | params: { |
| ... | ... | @@ -198,13 +216,17 @@ Vue.prototype.getParams = function(mode) { |
| 198 | 216 | appKey: "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d", |
| 199 | 217 | secret: "275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976", |
| 200 | 218 | ver: "1.0", |
| 201 | - page_url: "https://managemall.cnlive.com/html/votes/1/#/pages/redirect/redirect", | |
| 202 | - timestamp: new Date().getTime().toString().substr(0, 10) | |
| 219 | + page_url: | |
| 220 | + "https://managemall.cnlive.com/html/votes/1/#/pages/redirect/redirect", | |
| 221 | + timestamp: new Date() | |
| 222 | + .getTime() | |
| 223 | + .toString() | |
| 224 | + .substr(0, 10) | |
| 203 | 225 | }, |
| 204 | 226 | headers: { |
| 205 | 227 | "content-type": "application/x-www-form-urlencoded" |
| 206 | 228 | } |
| 207 | - } | |
| 229 | + }; | |
| 208 | 230 | break; |
| 209 | 231 | case "dev": |
| 210 | 232 | default: |
| ... | ... | @@ -216,7 +238,7 @@ Vue.prototype.getParams = function(mode) { |
| 216 | 238 | sellerCategory: { |
| 217 | 239 | url: "http://wjjh5test.cnlive.com/hqyw.html" |
| 218 | 240 | } |
| 219 | - } | |
| 241 | + }; | |
| 220 | 242 | params.cnlive = { |
| 221 | 243 | apiAddress: "https://api.cnlive.com", |
| 222 | 244 | params: { |
| ... | ... | @@ -224,22 +246,25 @@ Vue.prototype.getParams = function(mode) { |
| 224 | 246 | appKey: "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", |
| 225 | 247 | secret: "1e6380cb347255e777f72b5aa60f41daa68443a132aaea", |
| 226 | 248 | ver: "1.0", |
| 227 | - page_url: "http://172.16.2.171:8083/html/votes/1/#/pages/redirect/redirect", | |
| 228 | - timestamp: new Date().getTime().toString().substr(0, 10) | |
| 249 | + page_url: | |
| 250 | + "http://172.16.2.171:8083/html/votes/1/#/pages/redirect/redirect", | |
| 251 | + timestamp: new Date() | |
| 252 | + .getTime() | |
| 253 | + .toString() | |
| 254 | + .substr(0, 10) | |
| 229 | 255 | }, |
| 230 | 256 | headers: { |
| 231 | 257 | "content-type": "application/x-www-form-urlencoded" |
| 232 | 258 | } |
| 233 | - } | |
| 259 | + }; | |
| 234 | 260 | } |
| 235 | 261 | |
| 236 | 262 | return params; |
| 237 | -} | |
| 263 | +}; | |
| 238 | 264 | /* 根据模式,获取相关请求参数 结束 */ |
| 239 | 265 | |
| 240 | 266 | /* cnlive接口,sign处理 开始 */ |
| 241 | 267 | Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { |
| 242 | - | |
| 243 | 268 | // 返回结果,根据method返回不同值,Object or Array |
| 244 | 269 | let result = {}; |
| 245 | 270 | |
| ... | ... | @@ -266,7 +291,6 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { |
| 266 | 291 | |
| 267 | 292 | for (let i in keySortArr) { |
| 268 | 293 | if (p[keySortArr[i]]) { |
| 269 | - | |
| 270 | 294 | // 签名数组 |
| 271 | 295 | stringArr.push(keySortArr[i] + "=" + p[keySortArr[i]]); |
| 272 | 296 | |
| ... | ... | @@ -286,14 +310,12 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { |
| 286 | 310 | |
| 287 | 311 | // OPEN方式参数 |
| 288 | 312 | if (method.toUpperCase() == "OPEN") { |
| 289 | - | |
| 290 | 313 | // 加入签名 |
| 291 | 314 | paramsArr.push("sign=" + sign); |
| 292 | 315 | |
| 293 | 316 | // 设置返回 |
| 294 | 317 | result = paramsArr; |
| 295 | 318 | } else { |
| 296 | - | |
| 297 | 319 | // 加入签名 |
| 298 | 320 | p.sign = sign; |
| 299 | 321 | |
| ... | ... | @@ -302,7 +324,7 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { |
| 302 | 324 | } |
| 303 | 325 | |
| 304 | 326 | return result; |
| 305 | -} | |
| 327 | +}; | |
| 306 | 328 | /* cnlive接口,sign处理 结束 */ |
| 307 | 329 | |
| 308 | 330 | /* AJAX请求 开始 */ |
| ... | ... | @@ -315,7 +337,6 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { |
| 315 | 337 | * @param {object} ext [扩展参数] |
| 316 | 338 | */ |
| 317 | 339 | Vue.prototype.http = function(path, data, callback, ext) { |
| 318 | - | |
| 319 | 340 | /** |
| 320 | 341 | * get请求处理 |
| 321 | 342 | * @param {object} context [Vue对象] |
| ... | ... | @@ -326,44 +347,41 @@ Vue.prototype.http = function(path, data, callback, ext) { |
| 326 | 347 | * @param {object} headers [请求头] |
| 327 | 348 | */ |
| 328 | 349 | function get(context, path, data, callback, ext, headers) { |
| 329 | - | |
| 330 | 350 | // 时间戳 |
| 331 | 351 | data._timestamp = new Date().getTime(); |
| 332 | 352 | |
| 333 | 353 | let params = { |
| 334 | - emulateJSON: true, // 按照普通表单形式传送 | |
| 354 | + emulateJSON: true, // 按照普通表单形式传送 | |
| 335 | 355 | // withCredentials: true, |
| 336 | 356 | params: data, |
| 337 | 357 | _timeout: 30000, |
| 338 | 358 | headers |
| 339 | - } | |
| 359 | + }; | |
| 340 | 360 | |
| 341 | 361 | // HTTP请求 |
| 342 | - context.$http.get(path, params).then(resp => { | |
| 343 | - | |
| 344 | - // 获取返回数据 | |
| 345 | - let respBody = resp.body; | |
| 346 | - | |
| 347 | - // 处理回调 | |
| 348 | - if (typeof callback === "function") { | |
| 349 | - if (ext) { | |
| 350 | - | |
| 351 | - // 回调,同时返回扩展参数 | |
| 352 | - callback(respBody, ext); | |
| 353 | - } else { | |
| 354 | - | |
| 355 | - // 回调 | |
| 356 | - callback(respBody); | |
| 362 | + context.$http.get(path, params).then( | |
| 363 | + resp => { | |
| 364 | + // 获取返回数据 | |
| 365 | + let respBody = resp.body; | |
| 366 | + | |
| 367 | + // 处理回调 | |
| 368 | + if (typeof callback === "function") { | |
| 369 | + if (ext) { | |
| 370 | + // 回调,同时返回扩展参数 | |
| 371 | + callback(respBody, ext); | |
| 372 | + } else { | |
| 373 | + // 回调 | |
| 374 | + callback(respBody); | |
| 375 | + } | |
| 357 | 376 | } |
| 377 | + }, | |
| 378 | + err => { | |
| 379 | + /* 加载错误处理 开始 */ | |
| 380 | + Indicator.close(); | |
| 381 | + Toast("请求出错"); | |
| 382 | + /* 加载错误处理 结束 */ | |
| 358 | 383 | } |
| 359 | - }, err => { | |
| 360 | - | |
| 361 | - /* 加载错误处理 开始 */ | |
| 362 | - Indicator.close(); | |
| 363 | - Toast("请求出错"); | |
| 364 | - /* 加载错误处理 结束 */ | |
| 365 | - | |
| 366 | - }); | |
| 384 | + ); | |
| 367 | 385 | } |
| 368 | 386 | |
| 369 | 387 | /** |
| ... | ... | @@ -376,48 +394,44 @@ Vue.prototype.http = function(path, data, callback, ext) { |
| 376 | 394 | * @param {object} headers [请求头] |
| 377 | 395 | */ |
| 378 | 396 | function post(context, path, data, callback, ext, headers) { |
| 379 | - | |
| 380 | 397 | // 时间戳 |
| 381 | 398 | data._timestamp = new Date().getTime(); |
| 382 | 399 | |
| 383 | 400 | // 请求配置 |
| 384 | 401 | let requestConfig = { |
| 385 | - emulateJSON: true, // 按照普通表单形式传送 | |
| 402 | + emulateJSON: true, // 按照普通表单形式传送 | |
| 386 | 403 | // withCredentials: true, |
| 387 | 404 | headers, |
| 388 | 405 | _timeout: 30000 |
| 389 | - } | |
| 406 | + }; | |
| 390 | 407 | |
| 391 | 408 | // HTTP请求 |
| 392 | - context.$http.post(path, data, requestConfig).then(resp => { | |
| 393 | - | |
| 394 | - // 获取返回数据 | |
| 395 | - let respBody = resp.body; | |
| 396 | - | |
| 397 | - // 处理回调 | |
| 398 | - if (typeof(callback) === "function") { | |
| 399 | - if (ext) { | |
| 400 | - | |
| 401 | - // 回调,同时返回扩展参数 | |
| 402 | - callback(respBody, ext); | |
| 403 | - } else { | |
| 404 | - | |
| 405 | - // 回调 | |
| 406 | - callback(respBody); | |
| 409 | + context.$http.post(path, data, requestConfig).then( | |
| 410 | + resp => { | |
| 411 | + // 获取返回数据 | |
| 412 | + let respBody = resp.body; | |
| 413 | + | |
| 414 | + // 处理回调 | |
| 415 | + if (typeof callback === "function") { | |
| 416 | + if (ext) { | |
| 417 | + // 回调,同时返回扩展参数 | |
| 418 | + callback(respBody, ext); | |
| 419 | + } else { | |
| 420 | + // 回调 | |
| 421 | + callback(respBody); | |
| 422 | + } | |
| 407 | 423 | } |
| 424 | + }, | |
| 425 | + err => { | |
| 426 | + /* 加载错误处理 开始 */ | |
| 427 | + Indicator.close(); | |
| 428 | + Toast("请求出错"); | |
| 429 | + /* 加载错误处理 结束 */ | |
| 408 | 430 | } |
| 409 | - }, err => { | |
| 410 | - | |
| 411 | - /* 加载错误处理 开始 */ | |
| 412 | - Indicator.close(); | |
| 413 | - Toast("请求出错"); | |
| 414 | - /* 加载错误处理 结束 */ | |
| 415 | - | |
| 416 | - }); | |
| 431 | + ); | |
| 417 | 432 | } |
| 418 | 433 | |
| 419 | - if(path) { | |
| 420 | - | |
| 434 | + if (path) { | |
| 421 | 435 | // 上下文 |
| 422 | 436 | let context = this; |
| 423 | 437 | |
| ... | ... | @@ -437,45 +451,55 @@ Vue.prototype.http = function(path, data, callback, ext) { |
| 437 | 451 | let api = "shop"; |
| 438 | 452 | |
| 439 | 453 | // 请求方式 |
| 440 | - if (typeof(ext) === "object" && ext.method) { | |
| 441 | - if(methodsArr.includes(ext.method.toUpperCase())) { | |
| 454 | + if (typeof ext === "object" && ext.method) { | |
| 455 | + if (methodsArr.includes(ext.method.toUpperCase())) { | |
| 442 | 456 | method = ext.method.toUpperCase(); |
| 443 | 457 | } |
| 444 | 458 | } |
| 445 | 459 | |
| 446 | 460 | // 请求地址 |
| 447 | - if (typeof(ext) === "object" && ext.api) { | |
| 448 | - if(apiArr.includes(ext.api.toLowerCase())) { | |
| 461 | + if (typeof ext === "object" && ext.api) { | |
| 462 | + if (apiArr.includes(ext.api.toLowerCase())) { | |
| 449 | 463 | api = ext.api.toLowerCase(); |
| 450 | 464 | } |
| 451 | 465 | } |
| 452 | 466 | |
| 453 | 467 | // cnlive接口,sign处理 |
| 454 | 468 | if (api == "cnlive") { |
| 455 | - | |
| 456 | 469 | // 获取cnlive接口所需参数(包括sign获取等封装) |
| 457 | 470 | data = this.getCnliveParams(data, params[api].params, method); |
| 458 | 471 | } |
| 459 | 472 | |
| 460 | 473 | // 判断请求方式 |
| 461 | 474 | if (method.toUpperCase() === "OPEN") { |
| 462 | - | |
| 463 | 475 | // 打开页面 |
| 464 | - window.location.href = params[api].apiAddress + path + "?" + data.join("&"); | |
| 476 | + window.location.href = | |
| 477 | + params[api].apiAddress + path + "?" + data.join("&"); | |
| 465 | 478 | } else { |
| 466 | - | |
| 467 | 479 | // 判断请求类型 |
| 468 | 480 | switch (method) { |
| 469 | 481 | case "POST": |
| 470 | - | |
| 471 | 482 | // 调用post方法 |
| 472 | - post(context, params[api].apiAddress + path, data, callback, ext, params.shop.headers); | |
| 483 | + post( | |
| 484 | + context, | |
| 485 | + params[api].apiAddress + path, | |
| 486 | + data, | |
| 487 | + callback, | |
| 488 | + ext, | |
| 489 | + params.shop.headers | |
| 490 | + ); | |
| 473 | 491 | break; |
| 474 | 492 | case "GET": |
| 475 | 493 | default: |
| 476 | - | |
| 477 | 494 | // 调用get方法 |
| 478 | - get(context, params[api].apiAddress + path, data, callback, ext, params.shop.headers); | |
| 495 | + get( | |
| 496 | + context, | |
| 497 | + params[api].apiAddress + path, | |
| 498 | + data, | |
| 499 | + callback, | |
| 500 | + ext, | |
| 501 | + params.shop.headers | |
| 502 | + ); | |
| 479 | 503 | break; |
| 480 | 504 | } |
| 481 | 505 | } |
| ... | ... | @@ -484,7 +508,6 @@ Vue.prototype.http = function(path, data, callback, ext) { |
| 484 | 508 | |
| 485 | 509 | /*vue-resource请求超时timeout设置*/ |
| 486 | 510 | Vue.http.interceptors.push((request, next) => { |
| 487 | - | |
| 488 | 511 | let timeout; |
| 489 | 512 | |
| 490 | 513 | // 如果某个请求设置了_timeout,那么超过该时间,会中断该(abort)请求,并执行请求设置的钩子函数onTimeout方法,不会执行then方法。 |
| ... | ... | @@ -502,7 +525,6 @@ Vue.http.interceptors.push((request, next) => { |
| 502 | 525 | |
| 503 | 526 | /* 过滤器 开始 */ |
| 504 | 527 | Vue.filter("datetime", function(value, fmt) { |
| 505 | - | |
| 506 | 528 | // 时间戳转换日期对象 |
| 507 | 529 | let datetime = new Date(value); |
| 508 | 530 | // datetime.setTime(value); |
| ... | ... | @@ -527,14 +549,29 @@ Vue.filter("datetime", function(value, fmt) { |
| 527 | 549 | "6": "/u516d" |
| 528 | 550 | }; |
| 529 | 551 | if (/(y+)/.test(fmt)) { |
| 530 | - fmt = fmt.replace(RegExp.$1, (datetime.getFullYear() + "").substr(4 - RegExp.$1.length)); | |
| 552 | + fmt = fmt.replace( | |
| 553 | + RegExp.$1, | |
| 554 | + (datetime.getFullYear() + "").substr(4 - RegExp.$1.length) | |
| 555 | + ); | |
| 531 | 556 | } |
| 532 | 557 | if (/(E+)/.test(fmt)) { |
| 533 | - fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "/u661f/u671f" : "/u5468" : "") + week[datetime.getDay() + ""]); | |
| 558 | + fmt = fmt.replace( | |
| 559 | + RegExp.$1, | |
| 560 | + (RegExp.$1.length > 1 | |
| 561 | + ? RegExp.$1.length > 2 | |
| 562 | + ? "/u661f/u671f" | |
| 563 | + : "/u5468" | |
| 564 | + : "") + week[datetime.getDay() + ""] | |
| 565 | + ); | |
| 534 | 566 | } |
| 535 | 567 | for (var k in o) { |
| 536 | 568 | if (new RegExp("(" + k + ")").test(fmt)) { |
| 537 | - fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); | |
| 569 | + fmt = fmt.replace( | |
| 570 | + RegExp.$1, | |
| 571 | + RegExp.$1.length == 1 | |
| 572 | + ? o[k] | |
| 573 | + : ("00" + o[k]).substr(("" + o[k]).length) | |
| 574 | + ); | |
| 538 | 575 | } |
| 539 | 576 | } |
| 540 | 577 | |
| ... | ... | @@ -577,13 +614,12 @@ Vue.prototype.$iFrame = { |
| 577 | 614 | */ |
| 578 | 615 | Vue.prototype.getStore = function(key) { |
| 579 | 616 | return store.state[key]; |
| 580 | -} | |
| 617 | +}; | |
| 581 | 618 | /* 获取Vuex参数 结束 */ |
| 582 | 619 | |
| 583 | 620 | /* 状态管理 开始 */ |
| 584 | 621 | const store = new Vuex.Store({ |
| 585 | 622 | state: { |
| 586 | - | |
| 587 | 623 | // debug模式 |
| 588 | 624 | debug: true, |
| 589 | 625 | |
| ... | ... | @@ -597,7 +633,6 @@ const store = new Vuex.Store({ |
| 597 | 633 | uid: 0 |
| 598 | 634 | }, |
| 599 | 635 | mutations: { |
| 600 | - | |
| 601 | 636 | // 设置设备类型 |
| 602 | 637 | setDeviceType(state, deviceType) { |
| 603 | 638 | state.deviceType = deviceType; | ... | ... |
src/pages/goodDetails/goodDetails.less
src/pages/goodDetails/goodDetails.vue
| ... | ... | @@ -47,13 +47,13 @@ |
| 47 | 47 | <!-- 商品信息 --> |
| 48 | 48 | <div class="goods-info"> |
| 49 | 49 | <div class="good-title"> |
| 50 | - <span class="left">————</span>商品详情<span class="right">————</span> | |
| 50 | + <span class="left"></span>商品详情<span class="right"></span> | |
| 51 | 51 | </div> |
| 52 | 52 | <div class="good-desc"> |
| 53 | 53 | 商品详情的文字内容的书写的的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置 |
| 54 | 54 | </div> |
| 55 | 55 | <div class="good-title"> |
| 56 | - <span class="left">————</span>兑换规则<span class="right">————</span> | |
| 56 | + <span class="left"></span>兑换规则<span class="right"></span> | |
| 57 | 57 | </div> |
| 58 | 58 | <div class="good-desc"> |
| 59 | 59 | <div class="text-left">商品详情的文字内容的书写的的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置</div> |
| ... | ... | @@ -67,7 +67,7 @@ |
| 67 | 67 | </div> |
| 68 | 68 | </div> |
| 69 | 69 | <div class="good-title"> |
| 70 | - <span class="left">————</span>相似商品<span class="right">————</span> | |
| 70 | + <span class="left"></span>相似商品<span class="right"></span> | |
| 71 | 71 | </div> |
| 72 | 72 | <!-- 像是商品推荐 --> |
| 73 | 73 | <!-- 商品样式 7 列表 --> | ... | ... |
src/pages/pointsMall/pointsMall.vue
| ... | ... | @@ -57,7 +57,7 @@ |
| 57 | 57 | <!-- 为你推荐商品列表 --> |
| 58 | 58 | <div class="list-box"> |
| 59 | 59 | <!-- 商品展示样式 2 --> |
| 60 | - <goods-item-2 class="item" v-for="(item, index) in goodsLists" :key="index" @jump="toDiscountList(item)" | |
| 60 | + <goods-item-2 class="item" v-for="(item, index) in goodsLists" :key="index" @jump="toDetail(item)" | |
| 61 | 61 | :item="item" |
| 62 | 62 | pid="4"> |
| 63 | 63 | </goods-item-2> |
| ... | ... | @@ -158,17 +158,13 @@ export default { |
| 158 | 158 | * @param {Object} item [数据对象] |
| 159 | 159 | */ |
| 160 | 160 | toDetail (item) { |
| 161 | - | |
| 162 | 161 | // 判断通用跳转函数是否存在 |
| 163 | - if (typeof this.$parent.gotoDetail === 'function') { | |
| 164 | - | |
| 165 | - | |
| 166 | - console.log('toDetail', item); | |
| 167 | - | |
| 168 | - | |
| 169 | - // 通用跳转 | |
| 170 | - this.$parent.gotoDetail(item); | |
| 171 | - } | |
| 162 | + this.$router.push({ | |
| 163 | + path: '/goodDetails', | |
| 164 | + query: { | |
| 165 | + goodsId: item.id, | |
| 166 | + } | |
| 167 | + }) | |
| 172 | 168 | }, |
| 173 | 169 | /** |
| 174 | 170 | * 分享 | ... | ... |