Commit 7bcce1a89b656f262676e69b78d6ef2b0758f02e
1 parent
2b385494
样式优化
Showing
5 changed files
with
181 additions
and
145 deletions
src/components/swiper/swiper.vue
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | </swipe-item> | 10 | </swipe-item> |
| 11 | <template v-if="isPointsMall" #indicator> | 11 | <template v-if="isPointsMall" #indicator> |
| 12 | <div class="custom-indicator"> | 12 | <div class="custom-indicator"> |
| 13 | - {{ current + 1 }}/4 | 13 | + {{ current + 1 }}/{{swipers.length}} |
| 14 | </div> | 14 | </div> |
| 15 | </template> | 15 | </template> |
| 16 | </swipe> | 16 | </swipe> |
src/main.js
| @@ -4,13 +4,25 @@ import router from "./router/"; | @@ -4,13 +4,25 @@ import router from "./router/"; | ||
| 4 | import VueResource from "vue-resource"; | 4 | import VueResource from "vue-resource"; |
| 5 | import VueHead from "vue-head"; | 5 | import VueHead from "vue-head"; |
| 6 | import sha1 from "sha1"; | 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 | import App from "./App"; | 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 | Vue.use(Vuex); | 26 | Vue.use(Vuex); |
| 15 | Vue.use(VueResource); | 27 | Vue.use(VueResource); |
| 16 | Vue.use(VueHead, { separator: " " }); | 28 | Vue.use(VueHead, { separator: " " }); |
| @@ -40,89 +52,89 @@ Vue.use(VueBus); | @@ -40,89 +52,89 @@ Vue.use(VueBus); | ||
| 40 | Vue.use(InfiniteScroll); | 52 | Vue.use(InfiniteScroll); |
| 41 | 53 | ||
| 42 | // 解决低版手机浏览器不支持es6写法,将es6转成es5 | 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 | promise.polyfill(); | 58 | promise.polyfill(); |
| 47 | 59 | ||
| 48 | // 安卓5.1兼容 | 60 | // 安卓5.1兼容 |
| 49 | -import 'url-search-params-polyfill'; | 61 | +import "url-search-params-polyfill"; |
| 50 | 62 | ||
| 51 | Vue.config.productionTip = false; | 63 | Vue.config.productionTip = false; |
| 52 | 64 | ||
| 53 | // 部署模式设置(开发模式:"dev",测试模式:"test",生产模式:"prod") | 65 | // 部署模式设置(开发模式:"dev",测试模式:"test",生产模式:"prod") |
| 54 | -Vue.prototype.mode = "dev"; | 66 | +Vue.prototype.mode = "prod"; |
| 55 | 67 | ||
| 56 | // 微信JS-SDK对象 | 68 | // 微信JS-SDK对象 |
| 57 | Vue.prototype.jweixin = { | 69 | Vue.prototype.jweixin = { |
| 58 | value: null | 70 | value: null |
| 59 | -} | 71 | +}; |
| 60 | 72 | ||
| 61 | // 是否是iPhone平台,默认不是,common.vue进行判断设置 | 73 | // 是否是iPhone平台,默认不是,common.vue进行判断设置 |
| 62 | Vue.prototype.isiPhone = { | 74 | Vue.prototype.isiPhone = { |
| 63 | value: false | 75 | value: false |
| 64 | -} | 76 | +}; |
| 65 | 77 | ||
| 66 | // 是否是iPad平台,默认不是,common.vue进行判断设置 | 78 | // 是否是iPad平台,默认不是,common.vue进行判断设置 |
| 67 | Vue.prototype.isiPad = { | 79 | Vue.prototype.isiPad = { |
| 68 | value: false | 80 | value: false |
| 69 | -} | 81 | +}; |
| 70 | 82 | ||
| 71 | // 是否是Android平台,默认不是,common.vue进行判断设置 | 83 | // 是否是Android平台,默认不是,common.vue进行判断设置 |
| 72 | Vue.prototype.isAndroid = { | 84 | Vue.prototype.isAndroid = { |
| 73 | value: false | 85 | value: false |
| 74 | -} | 86 | +}; |
| 75 | 87 | ||
| 76 | // 是否在App内,默认不在,common.vue进行判断设置 | 88 | // 是否在App内,默认不在,common.vue进行判断设置 |
| 77 | Vue.prototype.isCNLive = { | 89 | Vue.prototype.isCNLive = { |
| 78 | value: false | 90 | value: false |
| 79 | -} | 91 | +}; |
| 80 | 92 | ||
| 81 | // 是否在App内(一组WebView),默认不在,common.vue进行判断设置 | 93 | // 是否在App内(一组WebView),默认不在,common.vue进行判断设置 |
| 82 | Vue.prototype.isPlat = { | 94 | Vue.prototype.isPlat = { |
| 83 | - value: false | ||
| 84 | -} | 95 | + value: false |
| 96 | +}; | ||
| 85 | 97 | ||
| 86 | // 是否在支付宝内,默认不在,common.vue进行判断设置 | 98 | // 是否在支付宝内,默认不在,common.vue进行判断设置 |
| 87 | Vue.prototype.isAliPay = { | 99 | Vue.prototype.isAliPay = { |
| 88 | value: false | 100 | value: false |
| 89 | -} | 101 | +}; |
| 90 | 102 | ||
| 91 | // 是否在微信内,默认不在,common.vue进行判断设置 | 103 | // 是否在微信内,默认不在,common.vue进行判断设置 |
| 92 | Vue.prototype.isWeChat = { | 104 | Vue.prototype.isWeChat = { |
| 93 | value: false, | 105 | value: false, |
| 94 | version: [] | 106 | version: [] |
| 95 | -} | 107 | +}; |
| 96 | 108 | ||
| 97 | // 是否在QQ内,默认不在,common.vue进行判断设置 | 109 | // 是否在QQ内,默认不在,common.vue进行判断设置 |
| 98 | Vue.prototype.isQQ = { | 110 | Vue.prototype.isQQ = { |
| 99 | value: false | 111 | value: false |
| 100 | -} | 112 | +}; |
| 101 | 113 | ||
| 102 | // 是否在小米浏览器内,默认不在,common.vue进行判断设置 | 114 | // 是否在小米浏览器内,默认不在,common.vue进行判断设置 |
| 103 | Vue.prototype.isXiaoMi = { | 115 | Vue.prototype.isXiaoMi = { |
| 104 | - value: false | ||
| 105 | -} | 116 | + value: false |
| 117 | +}; | ||
| 106 | 118 | ||
| 107 | /* 后端API版本控制参数 开始 */ | 119 | /* 后端API版本控制参数 开始 */ |
| 108 | 120 | ||
| 109 | // 参数设置 | 121 | // 参数设置 |
| 110 | Vue.prototype.apiVersion = { | 122 | Vue.prototype.apiVersion = { |
| 111 | LuckDraw: "LuckDraw", // 活动接口 | 123 | LuckDraw: "LuckDraw", // 活动接口 |
| 112 | - index:"Index3",// 主接口 | ||
| 113 | - miniapp:"Miniapp2",// 调用微信相关接口 | 124 | + index: "Index3", // 主接口 |
| 125 | + miniapp: "Miniapp2", // 调用微信相关接口 | ||
| 114 | dynamic: "Dynamic", // 达人动态相关接口 | 126 | dynamic: "Dynamic", // 达人动态相关接口 |
| 115 | LeadGoose: "LeadGoose", // 领头雁项目 | 127 | LeadGoose: "LeadGoose", // 领头雁项目 |
| 116 | // addAddresss:"https://managemall.cnlive.com/",// 生产环境url | 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 | * 获取后端API版本 | 133 | * 获取后端API版本 |
| 122 | */ | 134 | */ |
| 123 | Vue.prototype.getApiVersion = function() { | 135 | Vue.prototype.getApiVersion = function() { |
| 124 | return this.apiVersion; | 136 | return this.apiVersion; |
| 125 | -} | 137 | +}; |
| 126 | /* 后端API版本控制参数 结束 */ | 138 | /* 后端API版本控制参数 结束 */ |
| 127 | 139 | ||
| 128 | /* 设置图片尺寸参数 开始 */ | 140 | /* 设置图片尺寸参数 开始 */ |
| @@ -133,12 +145,11 @@ Vue.prototype.SIGN = { | @@ -133,12 +145,11 @@ Vue.prototype.SIGN = { | ||
| 133 | MIDDLE: "?imageMogr2/thumbnail/400/format/jpg", | 145 | MIDDLE: "?imageMogr2/thumbnail/400/format/jpg", |
| 134 | BIG: "?imageMogr2/thumbnail/750/format/jpg", | 146 | BIG: "?imageMogr2/thumbnail/750/format/jpg", |
| 135 | SOURCE: "" | 147 | SOURCE: "" |
| 136 | -} | 148 | +}; |
| 137 | /* 设置图片尺寸参数 结束 */ | 149 | /* 设置图片尺寸参数 结束 */ |
| 138 | 150 | ||
| 139 | /* 根据模式,获取相关请求参数 开始 */ | 151 | /* 根据模式,获取相关请求参数 开始 */ |
| 140 | Vue.prototype.getParams = function(mode) { | 152 | Vue.prototype.getParams = function(mode) { |
| 141 | - | ||
| 142 | // 返回参数 | 153 | // 返回参数 |
| 143 | let params = {}; | 154 | let params = {}; |
| 144 | 155 | ||
| @@ -149,12 +160,12 @@ Vue.prototype.getParams = function(mode) { | @@ -149,12 +160,12 @@ Vue.prototype.getParams = function(mode) { | ||
| 149 | headers: { | 160 | headers: { |
| 150 | "content-type": "application/x-www-form-urlencoded", | 161 | "content-type": "application/x-www-form-urlencoded", |
| 151 | "Phone-Model": "Wap", | 162 | "Phone-Model": "Wap", |
| 152 | - "Version":"1.0.1" | 163 | + Version: "1.0.1" |
| 153 | }, | 164 | }, |
| 154 | sellerCategory: { | 165 | sellerCategory: { |
| 155 | url: "http://wjjh5test.cnlive.com/hqyw.html" | 166 | url: "http://wjjh5test.cnlive.com/hqyw.html" |
| 156 | } | 167 | } |
| 157 | - } | 168 | + }; |
| 158 | params.cnlive = { | 169 | params.cnlive = { |
| 159 | apiAddress: "https://api.cnlive.com", | 170 | apiAddress: "https://api.cnlive.com", |
| 160 | params: { | 171 | params: { |
| @@ -162,35 +173,42 @@ Vue.prototype.getParams = function(mode) { | @@ -162,35 +173,42 @@ Vue.prototype.getParams = function(mode) { | ||
| 162 | appKey: "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", | 173 | appKey: "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", |
| 163 | secret: "1e6380cb347255e777f72b5aa60f41daa68443a132aaea", | 174 | secret: "1e6380cb347255e777f72b5aa60f41daa68443a132aaea", |
| 164 | ver: "1.0", | 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 | headers: { | 183 | headers: { |
| 169 | "content-type": "application/x-www-form-urlencoded" | 184 | "content-type": "application/x-www-form-urlencoded" |
| 170 | } | 185 | } |
| 171 | - } | 186 | + }; |
| 172 | break; | 187 | break; |
| 173 | case "prod": | 188 | case "prod": |
| 174 | - | ||
| 175 | // 请求头 | 189 | // 请求头 |
| 176 | let app_key = "769_jnjxdh3w53"; | 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 | params.shop = { | 198 | params.shop = { |
| 181 | apiAddress: "https://managemall.cnlive.com", | 199 | apiAddress: "https://managemall.cnlive.com", |
| 182 | headers: { | 200 | headers: { |
| 183 | "App-Key": app_key, | 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 | "content-type": "application/x-www-form-urlencoded", | 204 | "content-type": "application/x-www-form-urlencoded", |
| 187 | "Phone-Model": "Wap", | 205 | "Phone-Model": "Wap", |
| 188 | - "Version":"1.0.1" | 206 | + Version: "1.0.1" |
| 189 | }, | 207 | }, |
| 190 | sellerCategory: { | 208 | sellerCategory: { |
| 191 | url: "http://wjjh5.cnlive.com/hqyw.html" | 209 | url: "http://wjjh5.cnlive.com/hqyw.html" |
| 192 | } | 210 | } |
| 193 | - } | 211 | + }; |
| 194 | params.cnlive = { | 212 | params.cnlive = { |
| 195 | apiAddress: "https://api.cnlive.com", | 213 | apiAddress: "https://api.cnlive.com", |
| 196 | params: { | 214 | params: { |
| @@ -198,13 +216,17 @@ Vue.prototype.getParams = function(mode) { | @@ -198,13 +216,17 @@ Vue.prototype.getParams = function(mode) { | ||
| 198 | appKey: "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d", | 216 | appKey: "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d", |
| 199 | secret: "275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976", | 217 | secret: "275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976", |
| 200 | ver: "1.0", | 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 | headers: { | 226 | headers: { |
| 205 | "content-type": "application/x-www-form-urlencoded" | 227 | "content-type": "application/x-www-form-urlencoded" |
| 206 | } | 228 | } |
| 207 | - } | 229 | + }; |
| 208 | break; | 230 | break; |
| 209 | case "dev": | 231 | case "dev": |
| 210 | default: | 232 | default: |
| @@ -216,7 +238,7 @@ Vue.prototype.getParams = function(mode) { | @@ -216,7 +238,7 @@ Vue.prototype.getParams = function(mode) { | ||
| 216 | sellerCategory: { | 238 | sellerCategory: { |
| 217 | url: "http://wjjh5test.cnlive.com/hqyw.html" | 239 | url: "http://wjjh5test.cnlive.com/hqyw.html" |
| 218 | } | 240 | } |
| 219 | - } | 241 | + }; |
| 220 | params.cnlive = { | 242 | params.cnlive = { |
| 221 | apiAddress: "https://api.cnlive.com", | 243 | apiAddress: "https://api.cnlive.com", |
| 222 | params: { | 244 | params: { |
| @@ -224,22 +246,25 @@ Vue.prototype.getParams = function(mode) { | @@ -224,22 +246,25 @@ Vue.prototype.getParams = function(mode) { | ||
| 224 | appKey: "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", | 246 | appKey: "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f", |
| 225 | secret: "1e6380cb347255e777f72b5aa60f41daa68443a132aaea", | 247 | secret: "1e6380cb347255e777f72b5aa60f41daa68443a132aaea", |
| 226 | ver: "1.0", | 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 | headers: { | 256 | headers: { |
| 231 | "content-type": "application/x-www-form-urlencoded" | 257 | "content-type": "application/x-www-form-urlencoded" |
| 232 | } | 258 | } |
| 233 | - } | 259 | + }; |
| 234 | } | 260 | } |
| 235 | 261 | ||
| 236 | return params; | 262 | return params; |
| 237 | -} | 263 | +}; |
| 238 | /* 根据模式,获取相关请求参数 结束 */ | 264 | /* 根据模式,获取相关请求参数 结束 */ |
| 239 | 265 | ||
| 240 | /* cnlive接口,sign处理 开始 */ | 266 | /* cnlive接口,sign处理 开始 */ |
| 241 | Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | 267 | Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { |
| 242 | - | ||
| 243 | // 返回结果,根据method返回不同值,Object or Array | 268 | // 返回结果,根据method返回不同值,Object or Array |
| 244 | let result = {}; | 269 | let result = {}; |
| 245 | 270 | ||
| @@ -266,7 +291,6 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | @@ -266,7 +291,6 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | ||
| 266 | 291 | ||
| 267 | for (let i in keySortArr) { | 292 | for (let i in keySortArr) { |
| 268 | if (p[keySortArr[i]]) { | 293 | if (p[keySortArr[i]]) { |
| 269 | - | ||
| 270 | // 签名数组 | 294 | // 签名数组 |
| 271 | stringArr.push(keySortArr[i] + "=" + p[keySortArr[i]]); | 295 | stringArr.push(keySortArr[i] + "=" + p[keySortArr[i]]); |
| 272 | 296 | ||
| @@ -286,14 +310,12 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | @@ -286,14 +310,12 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | ||
| 286 | 310 | ||
| 287 | // OPEN方式参数 | 311 | // OPEN方式参数 |
| 288 | if (method.toUpperCase() == "OPEN") { | 312 | if (method.toUpperCase() == "OPEN") { |
| 289 | - | ||
| 290 | // 加入签名 | 313 | // 加入签名 |
| 291 | paramsArr.push("sign=" + sign); | 314 | paramsArr.push("sign=" + sign); |
| 292 | 315 | ||
| 293 | // 设置返回 | 316 | // 设置返回 |
| 294 | result = paramsArr; | 317 | result = paramsArr; |
| 295 | } else { | 318 | } else { |
| 296 | - | ||
| 297 | // 加入签名 | 319 | // 加入签名 |
| 298 | p.sign = sign; | 320 | p.sign = sign; |
| 299 | 321 | ||
| @@ -302,7 +324,7 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | @@ -302,7 +324,7 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | ||
| 302 | } | 324 | } |
| 303 | 325 | ||
| 304 | return result; | 326 | return result; |
| 305 | -} | 327 | +}; |
| 306 | /* cnlive接口,sign处理 结束 */ | 328 | /* cnlive接口,sign处理 结束 */ |
| 307 | 329 | ||
| 308 | /* AJAX请求 开始 */ | 330 | /* AJAX请求 开始 */ |
| @@ -315,7 +337,6 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | @@ -315,7 +337,6 @@ Vue.prototype.getCnliveParams = function(datas, params, method = "GET") { | ||
| 315 | * @param {object} ext [扩展参数] | 337 | * @param {object} ext [扩展参数] |
| 316 | */ | 338 | */ |
| 317 | Vue.prototype.http = function(path, data, callback, ext) { | 339 | Vue.prototype.http = function(path, data, callback, ext) { |
| 318 | - | ||
| 319 | /** | 340 | /** |
| 320 | * get请求处理 | 341 | * get请求处理 |
| 321 | * @param {object} context [Vue对象] | 342 | * @param {object} context [Vue对象] |
| @@ -326,44 +347,41 @@ Vue.prototype.http = function(path, data, callback, ext) { | @@ -326,44 +347,41 @@ Vue.prototype.http = function(path, data, callback, ext) { | ||
| 326 | * @param {object} headers [请求头] | 347 | * @param {object} headers [请求头] |
| 327 | */ | 348 | */ |
| 328 | function get(context, path, data, callback, ext, headers) { | 349 | function get(context, path, data, callback, ext, headers) { |
| 329 | - | ||
| 330 | // 时间戳 | 350 | // 时间戳 |
| 331 | data._timestamp = new Date().getTime(); | 351 | data._timestamp = new Date().getTime(); |
| 332 | 352 | ||
| 333 | let params = { | 353 | let params = { |
| 334 | - emulateJSON: true, // 按照普通表单形式传送 | 354 | + emulateJSON: true, // 按照普通表单形式传送 |
| 335 | // withCredentials: true, | 355 | // withCredentials: true, |
| 336 | params: data, | 356 | params: data, |
| 337 | _timeout: 30000, | 357 | _timeout: 30000, |
| 338 | headers | 358 | headers |
| 339 | - } | 359 | + }; |
| 340 | 360 | ||
| 341 | // HTTP请求 | 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,48 +394,44 @@ Vue.prototype.http = function(path, data, callback, ext) { | ||
| 376 | * @param {object} headers [请求头] | 394 | * @param {object} headers [请求头] |
| 377 | */ | 395 | */ |
| 378 | function post(context, path, data, callback, ext, headers) { | 396 | function post(context, path, data, callback, ext, headers) { |
| 379 | - | ||
| 380 | // 时间戳 | 397 | // 时间戳 |
| 381 | data._timestamp = new Date().getTime(); | 398 | data._timestamp = new Date().getTime(); |
| 382 | 399 | ||
| 383 | // 请求配置 | 400 | // 请求配置 |
| 384 | let requestConfig = { | 401 | let requestConfig = { |
| 385 | - emulateJSON: true, // 按照普通表单形式传送 | 402 | + emulateJSON: true, // 按照普通表单形式传送 |
| 386 | // withCredentials: true, | 403 | // withCredentials: true, |
| 387 | headers, | 404 | headers, |
| 388 | _timeout: 30000 | 405 | _timeout: 30000 |
| 389 | - } | 406 | + }; |
| 390 | 407 | ||
| 391 | // HTTP请求 | 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 | let context = this; | 436 | let context = this; |
| 423 | 437 | ||
| @@ -437,45 +451,55 @@ Vue.prototype.http = function(path, data, callback, ext) { | @@ -437,45 +451,55 @@ Vue.prototype.http = function(path, data, callback, ext) { | ||
| 437 | let api = "shop"; | 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 | method = ext.method.toUpperCase(); | 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 | api = ext.api.toLowerCase(); | 463 | api = ext.api.toLowerCase(); |
| 450 | } | 464 | } |
| 451 | } | 465 | } |
| 452 | 466 | ||
| 453 | // cnlive接口,sign处理 | 467 | // cnlive接口,sign处理 |
| 454 | if (api == "cnlive") { | 468 | if (api == "cnlive") { |
| 455 | - | ||
| 456 | // 获取cnlive接口所需参数(包括sign获取等封装) | 469 | // 获取cnlive接口所需参数(包括sign获取等封装) |
| 457 | data = this.getCnliveParams(data, params[api].params, method); | 470 | data = this.getCnliveParams(data, params[api].params, method); |
| 458 | } | 471 | } |
| 459 | 472 | ||
| 460 | // 判断请求方式 | 473 | // 判断请求方式 |
| 461 | if (method.toUpperCase() === "OPEN") { | 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 | } else { | 478 | } else { |
| 466 | - | ||
| 467 | // 判断请求类型 | 479 | // 判断请求类型 |
| 468 | switch (method) { | 480 | switch (method) { |
| 469 | case "POST": | 481 | case "POST": |
| 470 | - | ||
| 471 | // 调用post方法 | 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 | break; | 491 | break; |
| 474 | case "GET": | 492 | case "GET": |
| 475 | default: | 493 | default: |
| 476 | - | ||
| 477 | // 调用get方法 | 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 | break; | 503 | break; |
| 480 | } | 504 | } |
| 481 | } | 505 | } |
| @@ -484,7 +508,6 @@ Vue.prototype.http = function(path, data, callback, ext) { | @@ -484,7 +508,6 @@ Vue.prototype.http = function(path, data, callback, ext) { | ||
| 484 | 508 | ||
| 485 | /*vue-resource请求超时timeout设置*/ | 509 | /*vue-resource请求超时timeout设置*/ |
| 486 | Vue.http.interceptors.push((request, next) => { | 510 | Vue.http.interceptors.push((request, next) => { |
| 487 | - | ||
| 488 | let timeout; | 511 | let timeout; |
| 489 | 512 | ||
| 490 | // 如果某个请求设置了_timeout,那么超过该时间,会中断该(abort)请求,并执行请求设置的钩子函数onTimeout方法,不会执行then方法。 | 513 | // 如果某个请求设置了_timeout,那么超过该时间,会中断该(abort)请求,并执行请求设置的钩子函数onTimeout方法,不会执行then方法。 |
| @@ -502,7 +525,6 @@ Vue.http.interceptors.push((request, next) => { | @@ -502,7 +525,6 @@ Vue.http.interceptors.push((request, next) => { | ||
| 502 | 525 | ||
| 503 | /* 过滤器 开始 */ | 526 | /* 过滤器 开始 */ |
| 504 | Vue.filter("datetime", function(value, fmt) { | 527 | Vue.filter("datetime", function(value, fmt) { |
| 505 | - | ||
| 506 | // 时间戳转换日期对象 | 528 | // 时间戳转换日期对象 |
| 507 | let datetime = new Date(value); | 529 | let datetime = new Date(value); |
| 508 | // datetime.setTime(value); | 530 | // datetime.setTime(value); |
| @@ -527,14 +549,29 @@ Vue.filter("datetime", function(value, fmt) { | @@ -527,14 +549,29 @@ Vue.filter("datetime", function(value, fmt) { | ||
| 527 | "6": "/u516d" | 549 | "6": "/u516d" |
| 528 | }; | 550 | }; |
| 529 | if (/(y+)/.test(fmt)) { | 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 | if (/(E+)/.test(fmt)) { | 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 | for (var k in o) { | 567 | for (var k in o) { |
| 536 | if (new RegExp("(" + k + ")").test(fmt)) { | 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,13 +614,12 @@ Vue.prototype.$iFrame = { | ||
| 577 | */ | 614 | */ |
| 578 | Vue.prototype.getStore = function(key) { | 615 | Vue.prototype.getStore = function(key) { |
| 579 | return store.state[key]; | 616 | return store.state[key]; |
| 580 | -} | 617 | +}; |
| 581 | /* 获取Vuex参数 结束 */ | 618 | /* 获取Vuex参数 结束 */ |
| 582 | 619 | ||
| 583 | /* 状态管理 开始 */ | 620 | /* 状态管理 开始 */ |
| 584 | const store = new Vuex.Store({ | 621 | const store = new Vuex.Store({ |
| 585 | state: { | 622 | state: { |
| 586 | - | ||
| 587 | // debug模式 | 623 | // debug模式 |
| 588 | debug: true, | 624 | debug: true, |
| 589 | 625 | ||
| @@ -597,7 +633,6 @@ const store = new Vuex.Store({ | @@ -597,7 +633,6 @@ const store = new Vuex.Store({ | ||
| 597 | uid: 0 | 633 | uid: 0 |
| 598 | }, | 634 | }, |
| 599 | mutations: { | 635 | mutations: { |
| 600 | - | ||
| 601 | // 设置设备类型 | 636 | // 设置设备类型 |
| 602 | setDeviceType(state, deviceType) { | 637 | setDeviceType(state, deviceType) { |
| 603 | state.deviceType = deviceType; | 638 | state.deviceType = deviceType; |
src/pages/goodDetails/goodDetails.less
| @@ -65,6 +65,11 @@ | @@ -65,6 +65,11 @@ | ||
| 65 | .right{ | 65 | .right{ |
| 66 | margin-left: 28px; | 66 | margin-left: 28px; |
| 67 | } | 67 | } |
| 68 | + span{ | ||
| 69 | + width: 46px; | ||
| 70 | + height: 1.5px; | ||
| 71 | + background-color: #B4B4B4; | ||
| 72 | + } | ||
| 68 | } | 73 | } |
| 69 | .good-desc{ | 74 | .good-desc{ |
| 70 | margin:40px 40px 10px 40px; | 75 | margin:40px 40px 10px 40px; |
src/pages/goodDetails/goodDetails.vue
| @@ -47,13 +47,13 @@ | @@ -47,13 +47,13 @@ | ||
| 47 | <!-- 商品信息 --> | 47 | <!-- 商品信息 --> |
| 48 | <div class="goods-info"> | 48 | <div class="goods-info"> |
| 49 | <div class="good-title"> | 49 | <div class="good-title"> |
| 50 | - <span class="left">————</span>商品详情<span class="right">————</span> | 50 | + <span class="left"></span>商品详情<span class="right"></span> |
| 51 | </div> | 51 | </div> |
| 52 | <div class="good-desc"> | 52 | <div class="good-desc"> |
| 53 | 商品详情的文字内容的书写的的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置 | 53 | 商品详情的文字内容的书写的的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置 |
| 54 | </div> | 54 | </div> |
| 55 | <div class="good-title"> | 55 | <div class="good-title"> |
| 56 | - <span class="left">————</span>兑换规则<span class="right">————</span> | 56 | + <span class="left"></span>兑换规则<span class="right"></span> |
| 57 | </div> | 57 | </div> |
| 58 | <div class="good-desc"> | 58 | <div class="good-desc"> |
| 59 | <div class="text-left">商品详情的文字内容的书写的的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置</div> | 59 | <div class="text-left">商品详情的文字内容的书写的的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置,商品详情的文字内容的书写的位置</div> |
| @@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
| 67 | </div> | 67 | </div> |
| 68 | </div> | 68 | </div> |
| 69 | <div class="good-title"> | 69 | <div class="good-title"> |
| 70 | - <span class="left">————</span>相似商品<span class="right">————</span> | 70 | + <span class="left"></span>相似商品<span class="right"></span> |
| 71 | </div> | 71 | </div> |
| 72 | <!-- 像是商品推荐 --> | 72 | <!-- 像是商品推荐 --> |
| 73 | <!-- 商品样式 7 列表 --> | 73 | <!-- 商品样式 7 列表 --> |
src/pages/pointsMall/pointsMall.vue
| @@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
| 57 | <!-- 为你推荐商品列表 --> | 57 | <!-- 为你推荐商品列表 --> |
| 58 | <div class="list-box"> | 58 | <div class="list-box"> |
| 59 | <!-- 商品展示样式 2 --> | 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 | :item="item" | 61 | :item="item" |
| 62 | pid="4"> | 62 | pid="4"> |
| 63 | </goods-item-2> | 63 | </goods-item-2> |
| @@ -158,17 +158,13 @@ export default { | @@ -158,17 +158,13 @@ export default { | ||
| 158 | * @param {Object} item [数据对象] | 158 | * @param {Object} item [数据对象] |
| 159 | */ | 159 | */ |
| 160 | toDetail (item) { | 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 | * 分享 |